2 # Run this to generate all the initial makefiles, etc.
4 # Copyright (C) 2003 g10 Code GmbH
6 # This file is free software; as a special exception the author gives
7 # unlimited permission to copy and/or distribute it, with or without
8 # modifications, as long as this notice is preserved.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
12 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 configure_ac="configure.ac"
17 awk 'NR==1 {split($NF,A,".");X=1000000*A[1]+1000*A[2]+A[3];print X;exit 0}'
21 if [ `("$1" --version || echo "0") | cvtver` -ge "$2" ]; then
24 echo "**Error**: "\`$1\'" not installed or too old." >&2
25 echo ' Version '$3' or newer is required.' >&2
26 [ -n "$4" ] && echo ' Note that this is part of '\`$4\''.' >&2
34 if test "$1" = "--force"; then
39 # Used to cross-compile for Windows.
40 if test "$1" = "--build-w32"; then
42 tsdir=`cd "$tmp"; pwd`
44 if [ ! -f $tsdir/config.guess ]; then
45 echo "$tsdir/config.guess not found" >&2
48 build=`$tsdir/config.guess`
50 [ -z "$w32root" ] && w32root="$HOME/w32root"
51 echo "Using $w32root as standard install directory" >&2
53 # See whether we have the Debian cross compiler package or the
54 # old mingw32/cpd system
55 if i586-mingw32msvc-gcc --version >/dev/null 2>&1 ; then
57 crossbindir=/usr/$host/bin
60 if ! mingw32 --version >/dev/null; then
61 echo "We need at least version 0.3 of MingW32/CPD" >&2
64 crossbindir=`mingw32 --install-dir`/bin
65 # Old autoconf version required us to setup the environment
66 # with the proper tool names.
67 CC=`mingw32 --get-path gcc`
68 CPP=`mingw32 --get-path cpp`
69 AR=`mingw32 --get-path ar`
70 RANLIB=`mingw32 --get-path ranlib`
71 export CC CPP AR RANLIB
74 if [ -f "$tsdir/config.log" ]; then
75 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
76 echo "Pease run a 'make distclean' first" >&2
81 ./configure --enable-maintainer-mode --prefix=${w32root} \
82 --host=i586-mingw32msvc --build=${build} \
83 --with-gpg-error-prefix=${w32root} \
84 --enable-shared --enable-static --enable-w32-glib \
85 PKG_CONFIG_LIBDIR="$w32root/lib/pkgconfig"
94 # Grep the required versions from configure.ac
95 autoconf_vers=`sed -n '/^AC_PREREQ(/ {
99 autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
101 automake_vers=`sed -n '/^min_automake_version=/ {
105 automake_vers_num=`echo "$automake_vers" | cvtver`
107 #gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
111 #gettext_vers_num=`echo "$gettext_vers" | cvtver`
114 if [ -z "$autoconf_vers" -o -z "$automake_vers" ]
116 echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
120 # Allow to override the default tool names
121 AUTOCONF=${AUTOCONF_PREFIX}${AUTOCONF:-autoconf}${AUTOCONF_SUFFIX}
122 AUTOHEADER=${AUTOCONF_PREFIX}${AUTOHEADER:-autoheader}${AUTOCONF_SUFFIX}
124 AUTOMAKE=${AUTOMAKE_PREFIX}${AUTOMAKE:-automake}${AUTOMAKE_SUFFIX}
125 ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX}
127 #GETTEXT=${GETTEXT_PREFIX}${GETTEXT:-gettext}${GETTEXT_SUFFIX}
128 #MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX}
133 if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
134 check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
136 if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
137 check_version $ACLOCAL $automake_vers_num $automake_vers automake
139 #if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
140 # check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
143 if test "$DIE" = "yes"; then
146 Note that you may use alternative versions of the tools by setting
147 the corresponding environment variables; see README.CVS for details.
153 echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
154 $ACLOCAL -I m4 $ACLOCAL_FLAGS
155 echo "Running autoheader..."
157 echo "Running automake --gnu ..."
159 echo "Running autoconf${FORCE} ..."
162 echo "You may now run:
163 ./configure --enable-maintainer-mode && make