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
33 if test "$1" = "--force"; then
38 # ***** W32 build script *******
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 # Locate the cross compiler
55 for host in i586-mingw32msvc i386-mingw32msvc; do
56 if ${host}-gcc --version >/dev/null 2>&1 ; then
57 crossbindir=/usr/${host}/bin
58 conf_CC="CC=${host}-gcc"
62 if [ -z "$crossbindir" ]; then
63 echo "Cross compiler kit not installed" >&2
64 echo "Under Debian GNU/Linux, you may install it using" >&2
65 echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
70 if [ -f "$tsdir/config.log" ]; then
71 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
72 echo "Pease run a 'make distclean' first" >&2
77 ./configure --enable-maintainer-mode --prefix=${w32root} \
78 --host=${host} --build=${build}
82 # ***** end W32 build script *******
85 # ***** AMD64 cross build script *******
86 # Used to cross-compile for AMD64 (for testing)
87 if test "$1" = "--build-amd64"; then
89 tsdir=`cd "$tmp"; pwd`
91 if [ ! -f $tsdir/config.guess ]; then
92 echo "$tsdir/config.guess not found" >&2
95 build=`$tsdir/config.guess`
97 [ -z "$amd64root" ] && amd64root="$HOME/amd64root"
98 echo "Using $amd64root as standard install directory" >&2
100 # Locate the cross compiler
102 for host in x86_64-linux-gnu amd64-linux-gnu; do
103 if ${host}-gcc --version >/dev/null 2>&1 ; then
104 crossbindir=/usr/${host}/bin
105 conf_CC="CC=${host}-gcc"
109 if [ -z "$crossbindir" ]; then
110 echo "Cross compiler kit not installed" >&2
115 if [ -f "$tsdir/config.log" ]; then
116 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
117 echo "Please run a 'make distclean' first" >&2
122 $tsdir/configure --enable-maintainer-mode --prefix=${amd64root} \
123 --host=${host} --build=${build}
127 # ***** end AMD64 cross build script *******
131 # Grep the required versions from configure.ac
132 autoconf_vers=`sed -n '/^AC_PREREQ(/ {
136 autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
138 automake_vers=`sed -n '/^min_automake_version=/ {
142 automake_vers_num=`echo "$automake_vers" | cvtver`
144 gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
148 gettext_vers_num=`echo "$gettext_vers" | cvtver`
151 if [ -z "$autoconf_vers" -o -z "$automake_vers" -o -z "$gettext_vers" ]
153 echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
157 # Allow to override the default tool names
158 AUTOCONF=${AUTOCONF_PREFIX}${AUTOCONF:-autoconf}${AUTOCONF_SUFFIX}
159 AUTOHEADER=${AUTOCONF_PREFIX}${AUTOHEADER:-autoheader}${AUTOCONF_SUFFIX}
161 AUTOMAKE=${AUTOMAKE_PREFIX}${AUTOMAKE:-automake}${AUTOMAKE_SUFFIX}
162 ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX}
164 GETTEXT=${GETTEXT_PREFIX}${GETTEXT:-gettext}${GETTEXT_SUFFIX}
165 MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX}
168 if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
169 check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
171 if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
172 check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
174 if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
175 check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
178 if test "$DIE" = "yes"; then
181 Note that you may use alternative versions of the tools by setting
182 the corresponding environment variables; see README.CVS for details.
188 echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
189 $ACLOCAL -I m4 $ACLOCAL_FLAGS
190 echo "Running autoheader..."
192 echo "Running automake --gnu ..."
194 echo "Running autoconf${FORCE} ..."
197 echo "You may now run \"./configure --enable-maintainer-mode && make\"."