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
39 # Begin list of optional variables sourced from ~/.gnupg-autogen.rc
45 # End list of optional variables sourced from ~/.gnupg-autogen.rc
46 # What follows are variables which are sourced but default to
47 # environment variables or lacking them hardcoded values.
52 if [ -f "$HOME/.gnupg-autogen.rc" ]; then
53 echo "sourcing extra definitions from $HOME/.gnupg-autogen.rc"
54 . "$HOME/.gnupg-autogen.rc"
57 # Convenience option to use certain configure options for some hosts.
72 echo "**Error**: invalid build option $1" >&2
80 # ***** W32 build script *******
81 # Used to cross-compile for Windows.
82 if [ "$myhost" = "w32" ]; then
84 tsdir=`cd "$tmp"; pwd`
86 if [ ! -f $tsdir/config.guess ]; then
87 echo "$tsdir/config.guess not found" >&2
90 build=`$tsdir/config.guess`
95 [ -z "$w32root" ] && w32root="$HOME/w32ce_root"
96 toolprefixes="arm-mingw32ce"
99 [ -z "$w32root" ] && w32root="$HOME/w32root"
100 toolprefixes="i586-mingw32msvc i386-mingw32msvc"
103 echo "Using $w32root as standard install directory" >&2
106 for host in $toolprefixes; do
107 if ${host}-gcc --version >/dev/null 2>&1 ; then
108 crossbindir=/usr/${host}/bin
109 conf_CC="CC=${host}-gcc"
113 if [ -z "$crossbindir" ]; then
114 echo "Cross compiler kit not installed" >&2
115 if [ -z "$sub" ]; then
116 echo "Under Debian GNU/Linux, you may install it using" >&2
117 echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
123 if [ -f "$tsdir/config.log" ]; then
124 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
125 echo "Pease run a 'make distclean' first" >&2
130 $tsdir/configure --enable-maintainer-mode --prefix=${w32root} \
131 --host=${host} --build=${build} \
132 --with-gpg-error-prefix=${w32root} \
133 --with-libassuan-prefix=${w32root} "$@"
137 # ***** end W32 build script *******
140 # ***** AMD64 cross build script *******
141 # Used to cross-compile for AMD64 (for testing)
142 if [ "$myhost" = "amd64" ]; then
144 tsdir=`cd "$tmp"; pwd`
146 if [ ! -f $tsdir/config.guess ]; then
147 echo "$tsdir/config.guess not found" >&2
150 build=`$tsdir/config.guess`
152 [ -z "$amd64root" ] && amd64root="$HOME/amd64root"
153 echo "Using $amd64root as standard install directory" >&2
155 # Locate the cross compiler
157 for host in x86_64-linux-gnu amd64-linux-gnu; do
158 if ${host}-gcc --version >/dev/null 2>&1 ; then
159 crossbindir=/usr/${host}/bin
160 conf_CC="CC=${host}-gcc"
164 if [ -z "$crossbindir" ]; then
165 echo "Cross compiler kit not installed" >&2
170 if [ -f "$tsdir/config.log" ]; then
171 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
172 echo "Please run a 'make distclean' first" >&2
177 $tsdir/configure --enable-maintainer-mode --prefix=${amd64root} \
178 --host=${host} --build=${build}
182 # ***** end AMD64 cross build script *******
186 # Grep the required versions from configure.ac
187 autoconf_vers=`sed -n '/^AC_PREREQ(/ {
191 autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
193 automake_vers=`sed -n '/^min_automake_version=/ {
197 automake_vers_num=`echo "$automake_vers" | cvtver`
199 #gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
203 #gettext_vers_num=`echo "$gettext_vers" | cvtver`
206 if [ -z "$autoconf_vers" -o -z "$automake_vers" ]
208 echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
212 # Allow to override the default tool names
213 AUTOCONF=${AUTOCONF_PREFIX}${AUTOCONF:-autoconf}${AUTOCONF_SUFFIX}
214 AUTOHEADER=${AUTOCONF_PREFIX}${AUTOHEADER:-autoheader}${AUTOCONF_SUFFIX}
216 AUTOMAKE=${AUTOMAKE_PREFIX}${AUTOMAKE:-automake}${AUTOMAKE_SUFFIX}
217 ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX}
219 #GETTEXT=${GETTEXT_PREFIX}${GETTEXT:-gettext}${GETTEXT_SUFFIX}
220 #MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX}
223 if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
224 check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
226 if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
227 check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
229 #if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
230 # check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
233 if test "$DIE" = "yes"; then
236 Note that you may use alternative versions of the tools by setting
237 the corresponding environment variables; see README.CVS for details.
243 echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
244 $ACLOCAL -I m4 $ACLOCAL_FLAGS
245 echo "Running autoheader..."
247 echo "Running automake --gnu ..."
249 echo "Running autoconf${FORCE} ..."
252 echo "You may now run
253 ./configure --enable-maintainer-mode && make