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
31 # Allow to override the default tool names
32 AUTOCONF=${AUTOCONF_PREFIX}${AUTOCONF:-autoconf}${AUTOCONF_SUFFIX}
33 AUTOHEADER=${AUTOCONF_PREFIX}${AUTOHEADER:-autoheader}${AUTOCONF_SUFFIX}
35 AUTOMAKE=${AUTOMAKE_PREFIX}${AUTOMAKE:-automake}${AUTOMAKE_SUFFIX}
36 ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX}
38 GETTEXT=${GETTEXT_PREFIX}${GETTEXT:-gettext}${GETTEXT_SUFFIX}
39 MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX}
43 if [ "$1" = "--build-w32" ]; then
46 if [ ! -f ./config.guess ]; then
47 echo "./config.guess not found" >&2
52 if ! mingw32 --version >/dev/null; then
53 echo "We need at least version 0.3 of MingW32/CPD" >&2
57 if [ -f config.h ]; then
58 if grep HAVE_DOSISH_SYSTEM config.h | grep undef >/dev/null; then
59 echo "Pease run a 'make distclean' first" >&2
64 crossinstalldir=`mingw32 --install-dir`
65 crossbindir=`mingw32 --get-bindir 2>/dev/null` \
66 || crossbindir="$crossinstalldir/bin"
67 crossdatadir=`mingw32 --get-datadir 2>/dev/null` \
68 || crossdatadir="$crossinstalldir/share"
69 crosslibdir=`mingw32 --get-libdir 2>/dev/null` \
70 || crosslibdir="$crossinstalldir/i386--mingw32/lib"
71 crossincdir=`mingw32 --get-includedir 2>/dev/null` \
72 || crossincdir="$crossinstalldir/i386--mingw32/include"
73 CC=`mingw32 --get-path gcc`
74 CPP=`mingw32 --get-path cpp`
75 AR=`mingw32 --get-path ar`
76 RANLIB=`mingw32 --get-path ranlib`
77 export CC CPP AR RANLIB
80 if [ -n "$lib_config_files" ]; then
81 for i in $lib_config_files; do
82 j=`echo $i | tr '[a-z-]' '[A-Z_]'`
83 eval "$j=${crossbindir}/$i"
85 disable_foo_tests="$disable_foo_tests --disable-`echo $i| \
86 sed 's,-config$,,'`-test"
87 if [ ! -f "${crossbindir}/$i" ]; then
88 echo "$i not installed for MingW32" >&2
93 [ $DIE = yes ] && exit 1
95 ./configure --host=${host} --target=${target} ${disable_foo_tests} \
96 --bindir=${crossbindir} --libdir=${crosslibdir} \
97 --datadir=${crossdatadir} --includedir=${crossincdir} \
98 --enable-maintainer-mode $*
104 # Grep the required versions from configure.ac
105 autoconf_vers=`sed -n '/^AC_PREREQ(/ {
109 autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
111 automake_vers=`sed -n '/^min_automake_version=/ {
115 automake_vers_num=`echo "$automake_vers" | cvtver`
117 gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
121 gettext_vers_num=`echo "$gettext_vers" | cvtver`
124 if [ -z "$autoconf_vers" -o -z "$automake_vers" -o -z "$gettext_vers" ]
126 echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
131 if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
132 check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
134 if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
135 check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
137 if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
138 check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
141 if test "$DIE" = "yes"; then
144 Note that you may use alternative versions of the tools by setting
145 the corresponding environment variables; see README.CVS for details.
152 echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
153 $ACLOCAL -I m4 $ACLOCAL_FLAGS
154 echo "Running autoheader..."
156 echo "Running automake --gnu ..."
158 echo "Running autoconf..."
161 echo "You may now run \"./configure --enable-maintainer-mode && make\"."