* gpg.texi (GPG Configuration Options): Make http_proxy option
[gnupg.git] / autogen.sh
blob8a20b1a388abdbebc483b7ce28ddbdc1690ed8dc
1 #! /bin/sh
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"
16 cvtver () {
17 awk 'NR==1 {split($NF,A,".");X=1000000*A[1]+1000*A[2]+A[3];print X;exit 0}'
20 check_version () {
21 if [ `("$1" --version || echo "0") | cvtver` -ge "$2" ]; then
22 return 0
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
27 DIE="yes"
28 return 1
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}
41 DIE=no
43 # ***** W32 build script *******
44 # Used to cross-compile for Windows.
45 if test "$1" = "--build-w32"; then
46 tmp=`dirname $0`
47 tsdir=`cd "$tmp"; pwd`
48 shift
49 if [ ! -f $tsdir/scripts/config.guess ]; then
50 echo "$tsdir/scripts/config.guess not found" >&2
51 exit 1
53 build=`$tsdir/scripts/config.guess`
55 [ -z "$w32root" ] && w32root="$HOME/w32root"
56 echo "Using $w32root as standard install directory" >&2
58 # Locate the cross compiler
59 crossbindir=
60 for host in i586-mingw32msvc i386-mingw32msvc mingw32; do
61 if ${host}-gcc --version >/dev/null 2>&1 ; then
62 crossbindir=/usr/${host}/bin
63 conf_CC="CC=${host}-gcc"
64 break;
66 done
67 if [ -z "$crossbindir" ]; then
68 echo "Cross compiler kit not installed" >&2
69 echo "Under Debian GNU/Linux, you may install it using" >&2
70 echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
71 echo "Stop." >&2
72 exit 1
75 if [ -f "$tsdir/config.log" ]; then
76 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
77 echo "Please run a 'make distclean' first" >&2
78 exit 1
82 ./configure --enable-maintainer-mode --prefix=${w32root} \
83 --host=${host} --build=${build} \
84 --with-gpg-error-prefix=${w32root} \
85 --with-ksba-prefix=${w32root} \
86 --with-libgcrypt-prefix=${w32root} \
87 --with-libassuan-prefix=${w32root} \
88 --with-zlib=${w32root} \
89 --with-pth-prefix=${w32root} \
90 --disable-gpg
91 rc=$?
92 exit $rc
94 # ***** end W32 build script *******
96 # ***** AMD64 cross build script *******
97 # Used to cross-compile for AMD64 (for testing)
98 if test "$1" = "--build-amd64"; then
99 tmp=`dirname $0`
100 tsdir=`cd "$tmp"; pwd`
101 shift
102 if [ ! -f $tsdir/scripts/config.guess ]; then
103 echo "$tsdir/scripts/config.guess not found" >&2
104 exit 1
106 build=`$tsdir/scripts/config.guess`
108 [ -z "$amd64root" ] && amd64root="$HOME/amd64root"
109 echo "Using $amd64root as standard install directory" >&2
111 # Locate the cross compiler
112 crossbindir=
113 for host in x86_64-linux-gnu amd64-linux-gnu; do
114 if ${host}-gcc --version >/dev/null 2>&1 ; then
115 crossbindir=/usr/${host}/bin
116 conf_CC="CC=${host}-gcc"
117 break;
119 done
120 if [ -z "$crossbindir" ]; then
121 echo "Cross compiler kit not installed" >&2
122 echo "Stop." >&2
123 exit 1
126 if [ -f "$tsdir/config.log" ]; then
127 if ! head $tsdir/config.log | grep "$host" >/dev/null; then
128 echo "Please run a 'make distclean' first" >&2
129 exit 1
133 $tsdir/configure --enable-maintainer-mode --prefix=${amd64root} \
134 --host=${host} --build=${build} \
135 --with-gpg-error-prefix=${amd64root} \
136 --with-ksba-prefix=${amd64root} \
137 --with-libgcrypt-prefix=${amd64root} \
138 --with-libassuan-prefix=${amd64root} \
139 --with-zlib=/usr/x86_64-linux-gnu/usr \
140 --with-pth-prefix=/usr/x86_64-linux-gnu/usr
141 rc=$?
142 exit $rc
144 # ***** end AMD64 cross build script *******
147 # Grep the required versions from configure.ac
148 autoconf_vers=`sed -n '/^AC_PREREQ(/ {
149 s/^.*(\(.*\))/\1/p
151 }' ${configure_ac}`
152 autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
154 automake_vers=`sed -n '/^min_automake_version=/ {
155 s/^.*="\(.*\)"/\1/p
157 }' ${configure_ac}`
158 automake_vers_num=`echo "$automake_vers" | cvtver`
160 gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
161 s/^.*(\(.*\))/\1/p
163 }' ${configure_ac}`
164 gettext_vers_num=`echo "$gettext_vers" | cvtver`
167 if [ -z "$autoconf_vers" -o -z "$automake_vers" -o -z "$gettext_vers" ]
168 then
169 echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
170 exit 1
174 if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
175 check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
177 if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
178 check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
180 if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
181 check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
184 if test "$DIE" = "yes"; then
185 cat <<EOF
187 Note that you may use alternative versions of the tools by setting
188 the corresponding environment variables; see README.CVS for details.
191 exit 1
195 echo "Running aclocal -I m4 -I gl/m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
196 $ACLOCAL -I m4 -I gl/m4 $ACLOCAL_FLAGS
197 echo "Running autoheader..."
198 $AUTOHEADER
199 echo "Running automake --gnu ..."
200 $AUTOMAKE --gnu;
201 echo "Running autoconf..."
202 $AUTOCONF
204 echo "You may now run \"./configure --sysconfdir=/etc --enable-maintainer-mode && make\"."