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` >= $2 )) = 1 ]; 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}
44 tsdir=`cd "$tmp"; pwd`
45 if test x"$1" = x"--force"; then
50 # Begin list of optional variables sourced from ~/.gnupg-autogen.rc
56 # End list of optional variables sourced from ~/.gnupg-autogen.rc
57 # What follows are variables which are sourced but default to
58 # environment variables or lacking them hardcoded values.
63 if [ -f "$HOME/.gnupg-autogen.rc" ]; then
64 echo "sourcing extra definitions from $HOME/.gnupg-autogen.rc"
65 . "$HOME/.gnupg-autogen.rc"
68 # Convenience option to use certain configure options for some hosts.
83 echo "**Error**: invalid build option $1" >&2
91 # ***** W32 build script *******
92 # Used to cross-compile for Windows.
93 if [ "$myhost" = "w32" ]; then
95 if [ ! -f $tsdir/scripts/config.guess ]; then
96 echo "$tsdir/scripts/config.guess not found" >&2
99 build=`$tsdir/scripts/config.guess`
103 w32root="$w32ce_root"
104 [ -z "$w32root" ] && w32root="$HOME/w32ce_root"
105 toolprefixes="$w32ce_toolprefixes arm-mingw32ce"
106 extraoptions="--enable-dirmngr-auto-start --disable-scdaemon "
107 extraoptions="$extraoptions --disable-zip $w32ce_extraoptions"
110 [ -z "$w32root" ] && w32root="$HOME/w32root"
111 toolprefixes="$w32_toolprefixes i586-mingw32msvc"
112 toolprefixes="$toolprefixes i386-mingw32msvc mingw32"
113 extraoptions="--enable-gpgtar $w32_extraoptions"
116 echo "Using $w32root as standard install directory" >&2
118 # Locate the cross compiler
120 for host in $toolprefixes; do
121 if ${host}-gcc --version >/dev/null 2>&1 ; then
122 crossbindir=/usr/${host}/bin
123 conf_CC="CC=${host}-gcc"
127 if [ -z "$crossbindir" ]; then
128 echo "Cross compiler kit not installed" >&2
129 if [ -z "$sub" ]; then
130 echo "Under Debian GNU/Linux, you may install it using" >&2
131 echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
137 if [ -f "$tsdir/config.log" ]; then
138 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
139 echo "Please run a 'make distclean' first" >&2
144 $tsdir/configure --enable-maintainer-mode --prefix=${w32root} \
145 --host=${host} --build=${build} \
146 --with-gpg-error-prefix=${w32root} \
147 --with-ksba-prefix=${w32root} \
148 --with-libgcrypt-prefix=${w32root} \
149 --with-libassuan-prefix=${w32root} \
150 --with-zlib=${w32root} \
151 --with-regex=${w32root} \
152 --with-pth-prefix=${w32root} \
153 --with-adns=${w32root} \
154 ${extraoptions} --disable-g13 "$@"
158 # ***** end W32 build script *******
160 # ***** AMD64 cross build script *******
161 # Used to cross-compile for AMD64 (for testing)
162 if [ "$myhost" = "amd64" ]; then
164 if [ ! -f $tsdir/scripts/config.guess ]; then
165 echo "$tsdir/scripts/config.guess not found" >&2
168 build=`$tsdir/scripts/config.guess`
170 [ -z "$amd64root" ] && amd64root="$HOME/amd64root"
171 echo "Using $amd64root as standard install directory" >&2
173 toolprefixes="$amd64_toolprefixes x86_64-linux-gnu amd64-linux-gnu"
175 # Locate the cross compiler
177 for host in $toolprefixes ; do
178 if ${host}-gcc --version >/dev/null 2>&1 ; then
179 crossbindir=/usr/${host}/bin
180 conf_CC="CC=${host}-gcc"
184 if [ -z "$crossbindir" ]; then
185 echo "Cross compiler kit not installed" >&2
190 if [ -f "$tsdir/config.log" ]; then
191 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
192 echo "Please run a 'make distclean' first" >&2
197 $tsdir/configure --enable-maintainer-mode --prefix=${amd64root} \
198 --host=${host} --build=${build} \
199 --with-gpg-error-prefix=${amd64root} \
200 --with-ksba-prefix=${amd64root} \
201 --with-libgcrypt-prefix=${amd64root} \
202 --with-libassuan-prefix=${amd64root} \
203 --with-zlib=/usr/x86_64-linux-gnu/usr \
204 --with-pth-prefix=/usr/x86_64-linux-gnu/usr
208 # ***** end AMD64 cross build script *******
211 # Grep the required versions from configure.ac
212 autoconf_vers=`sed -n '/^AC_PREREQ(/ {
216 autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
218 automake_vers=`sed -n '/^min_automake_version=/ {
222 automake_vers_num=`echo "$automake_vers" | cvtver`
224 gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
228 gettext_vers_num=`echo "$gettext_vers" | cvtver`
231 if [ -z "$autoconf_vers" -o -z "$automake_vers" -o -z "$gettext_vers" ]
233 echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
238 if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
239 check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
241 if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
242 check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
244 if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
245 check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
248 if test "$DIE" = "yes"; then
251 Note that you may use alternative versions of the tools by setting
252 the corresponding environment variables; see README.SVN for details.
259 echo "Running aclocal -I m4 -I gl/m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
260 $ACLOCAL -I m4 -I gl/m4 $ACLOCAL_FLAGS
261 echo "Running autoheader..."
263 echo "Running automake --gnu ..."
265 echo "Running autoconf${FORCE} ..."
268 echo "You may now run:
269 ./configure --sysconfdir=/etc --enable-maintainer-mode --enable-symcryptrun --enable-mailto --enable-gpgtar && make