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 x
"$1" = x
"--force"; then
40 # ***** W32 build script *******
41 # Used to cross-compile for Windows.
42 if test "$1" = "--build-w32"; then
44 tsdir
=`cd "$tmp"; pwd`
46 if [ ! -f $tsdir/config.guess
]; then
47 echo "$tsdir/config.guess not found" >&2
50 build
=`$tsdir/config.guess`
52 [ -z "$w32root" ] && w32root
="$HOME/w32root"
53 echo "Using $w32root as standard install directory" >&2
56 for host in i586-mingw32msvc i386-mingw32msvc mingw32
; do
57 if ${host}-gcc --version >/dev
/null
2>&1 ; then
58 crossbindir
=/usr
/${host}/bin
59 conf_CC
="CC=${host}-gcc"
63 if [ -z "$crossbindir" ]; then
64 echo "Cross compiler kit not installed" >&2
65 echo "Under Debian GNU/Linux, you may install it using" >&2
66 echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
71 if [ -f "$tsdir/config.log" ]; then
72 if ! head $tsdir/config.log |
grep "$host" >/dev
/null
; then
73 echo "Pease run a 'make distclean' first" >&2
78 .
/configure
--enable-maintainer-mode --prefix=${w32root} \
79 --host=${host} --build=${build} \
80 --with-pth-prefix=${w32root} \
85 # ***** end W32 build script *******
88 # ***** AMD64 cross build script *******
89 # Used to cross-compile for AMD64 (for testing)
90 if test "$1" = "--build-amd64"; then
92 tsdir
=`cd "$tmp"; pwd`
94 if [ ! -f $tsdir/config.guess
]; then
95 echo "$tsdir/config.guess not found" >&2
98 build
=`$tsdir/config.guess`
100 [ -z "$amd64root" ] && amd64root
="$HOME/amd64root"
101 echo "Using $amd64root as standard install directory" >&2
103 # Locate the cross compiler
105 for host in x86_64-linux-gnu amd64-linux-gnu
; do
106 if ${host}-gcc --version >/dev
/null
2>&1 ; then
107 crossbindir
=/usr
/${host}/bin
108 conf_CC
="CC=${host}-gcc"
112 if [ -z "$crossbindir" ]; then
113 echo "Cross compiler kit not installed" >&2
118 if [ -f "$tsdir/config.log" ]; then
119 if ! head $tsdir/config.log |
grep "$host" >/dev
/null
; then
120 echo "Please run a 'make distclean' first" >&2
125 $tsdir/configure
--enable-maintainer-mode --prefix=${amd64root} \
126 --host=${host} --build=${build}
130 # ***** end AMD64 cross build script *******
134 # Grep the required versions from configure.ac
135 autoconf_vers
=`sed -n '/^AC_PREREQ(/ {
139 autoconf_vers_num
=`echo "$autoconf_vers" | cvtver`
141 automake_vers
=`sed -n '/^min_automake_version=/ {
145 automake_vers_num
=`echo "$automake_vers" | cvtver`
147 #gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
151 #gettext_vers_num=`echo "$gettext_vers" | cvtver`
154 if [ -z "$autoconf_vers" -o -z "$automake_vers" ]
156 echo "**Error**: version information not found in "\
`${configure_ac}\'"." >&2
160 # Allow to override the default tool names
161 AUTOCONF=${AUTOCONF_PREFIX}${AUTOCONF:-autoconf}${AUTOCONF_SUFFIX}
162 AUTOHEADER=${AUTOCONF_PREFIX}${AUTOHEADER:-autoheader}${AUTOCONF_SUFFIX}
164 AUTOMAKE=${AUTOMAKE_PREFIX}${AUTOMAKE:-automake}${AUTOMAKE_SUFFIX}
165 ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX}
167 #GETTEXT=${GETTEXT_PREFIX}${GETTEXT:-gettext}${GETTEXT_SUFFIX}
168 #MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX}
171 if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
172 check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
174 if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
175 check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
177 #if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
178 # check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
181 if test "$DIE" = "yes"; then
184 Note that you may use alternative versions of the tools by setting
185 the corresponding environment variables; see README.CVS for details.
191 echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
192 $ACLOCAL -I m4 $ACLOCAL_FLAGS
193 echo "Running autoheader..."
195 echo "Running automake --gnu ..."
197 echo "Running autoconf${FORCE} ..."
200 echo "You may now run \"./configure --enable-maintainer-mode && make\"."