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 # ***** W32 build script *******
44 # Used to cross-compile for Windows.
45 if test "$1" = "--build-w32"; then
47 tsdir
=`cd "$tmp"; pwd`
49 if [ ! -f $tsdir/scripts
/config.guess
]; then
50 echo "$tsdir/scripts/config.guess not found" >&2
53 build
=`$tsdir/scripts/config.guess`
55 [ -z "$w32root" ] && w32root
="$HOME/w32root"
56 echo "Using $w32root as standard install directory" >&2
58 # See whether we have the Debian cross compiler package or the
59 # old mingw32/cpd system
60 if i586-mingw32msvc-gcc
--version >/dev
/null
2>&1 ; then
62 crossbindir
=/usr
/$host/bin
65 if ! mingw32
--version >/dev
/null
; then
66 echo "We need at least version 0.3 of MingW32/CPD" >&2
69 crossbindir
=`mingw32 --install-dir`/bin
70 # Old autoconf version required us to setup the environment
71 # with the proper tool names.
72 CC
=`mingw32 --get-path gcc`
73 CPP
=`mingw32 --get-path cpp`
74 AR
=`mingw32 --get-path ar`
75 RANLIB
=`mingw32 --get-path ranlib`
76 export CC CPP AR RANLIB
79 if [ -f "$tsdir/config.log" ]; then
80 if ! head $tsdir/config.log |
grep "$host" >/dev
/null
; then
81 echo "Pease run a 'make distclean' first" >&2
86 .
/configure
--enable-maintainer-mode --prefix=${w32root} \
87 --host=i586-mingw32msvc
--build=${build} \
88 --with-gpg-error-prefix=${w32root} \
89 --with-ksba-prefix=${w32root} \
90 --with-libgcrypt-prefix=${w32root} \
91 --with-libassuan-prefix=${w32root} \
92 --with-zlib=${w32root} \
93 --with-pth-prefix=${w32root} \
96 # Ugly hack to overcome a gettext problem. Someone should look into
97 # gettext to figure out why the po directory is not ignored as it used
99 [ $rc = 0 ] && touch $tsdir/po
/all
102 # ***** end W32 build script *******
107 # Grep the required versions from configure.ac
108 autoconf_vers
=`sed -n '/^AC_PREREQ(/ {
112 autoconf_vers_num
=`echo "$autoconf_vers" | cvtver`
114 automake_vers
=`sed -n '/^min_automake_version=/ {
118 automake_vers_num
=`echo "$automake_vers" | cvtver`
120 gettext_vers
=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
124 gettext_vers_num
=`echo "$gettext_vers" | cvtver`
127 if [ -z "$autoconf_vers" -o -z "$automake_vers" -o -z "$gettext_vers" ]
129 echo "**Error**: version information not found in "\
`${configure_ac}\'"." >&2
134 if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
135 check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
137 if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
138 check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
140 if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
141 check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
144 if test "$DIE" = "yes"; then
147 Note that you may use alternative versions of the tools by setting
148 the corresponding environment variables; see README.CVS for details.
155 echo "Running aclocal -I m4 -I gl/m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
156 $ACLOCAL -I m4 -I gl/m4 $ACLOCAL_FLAGS
157 echo "Running autoheader..."
159 echo "Running automake --gnu ..."
161 echo "Running autoconf..."
164 echo "You may now run \"./configure --enable-maintainer-mode && make\"."