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}
40 if test x"$1" = x"--force"; then
45 # ***** W32 build script *******
46 # Used to cross-compile for Windows.
47 if test "$1" = "--build-w32"; then
49 tsdir=`cd "$tmp"; pwd`
51 if [ ! -f $tsdir/config.guess ]; then
52 echo "$tsdir/config.guess not found" >&2
55 build=`$tsdir/config.guess`
57 [ -z "$w32root" ] && w32root="$HOME/w32root"
58 echo "Using $w32root as standard install directory" >&2
60 # Locate the cross compiler
62 for host in i586-mingw32msvc i386-mingw32msvc; do
63 if ${host}-gcc --version >/dev/null 2>&1 ; then
64 crossbindir=/usr/${host}/bin
69 if [ -z "$crossbindir" ]; then
70 echo "Cross compiler kit not installed" >&2
71 echo "Under Debian GNU/Linux, you may install it using" >&2
72 echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
77 if [ -f "$tsdir/config.log" ]; then
78 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
79 echo "Pease run a 'make distclean' first" >&2
84 ./configure --host=${host} --build=${build} --enable-maintainer-mode \
85 --disable-pkg-man_advanced_en "$@"
90 # ***** end W32 build script *******
95 # Grep the required versions from configure.ac
96 autoconf_vers=`sed -n '/^AC_PREREQ(/ {
100 autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
102 automake_vers=`sed -n '/^min_automake_version=/ {
106 automake_vers_num=`echo "$automake_vers" | cvtver`
109 if [ -z "$autoconf_vers" -o -z "$automake_vers" ]
111 echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
116 if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
117 check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
119 if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
120 check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
123 if test "$DIE" = "yes"; then
126 Note that you may use alternative versions of the tools by setting
127 the corresponding environment variables; see README.SVN for details.
134 echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
135 $ACLOCAL -I m4 $ACLOCAL_FLAGS
136 echo "Running autoheader..."
138 echo "Running automake --gnu ..."
140 echo "Running autoconf${FORCE} ..."
143 echo "You may now run \"./configure --host=i586-mingw32msvc && make\"."