Let the XPATH command return GPG_ERR_ELEMENT_NOT_FOUND rather than
[pwmd.git] / assuan / autogen.sh
blob1c53b0d1877de0cc4e13db960ba6bfebc58c1d87
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
32 DIE=no
33 FORCE=
34 if test x"$1" = x"--force"; then
35 FORCE=" --force"
36 shift
40 # ***** W32 build script *******
41 # Used to cross-compile for Windows.
42 if test "$1" = "--build-w32"; then
43 tmp=`dirname $0`
44 tsdir=`cd "$tmp"; pwd`
45 shift
46 if [ ! -f $tsdir/config.guess ]; then
47 echo "$tsdir/config.guess not found" >&2
48 exit 1
50 build=`$tsdir/config.guess`
52 [ -z "$w32root" ] && w32root="$HOME/w32root"
53 echo "Using $w32root as standard install directory" >&2
55 crossbindir=
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"
60 break;
62 done
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
67 echo "Stop." >&2
68 exit 1
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
74 exit 1
78 ./configure --enable-maintainer-mode --prefix=${w32root} \
79 --host=${host} --build=${build} \
80 --with-pth-prefix=${w32root} \
81 --disable-shared
83 exit $?
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
91 tmp=`dirname $0`
92 tsdir=`cd "$tmp"; pwd`
93 shift
94 if [ ! -f $tsdir/config.guess ]; then
95 echo "$tsdir/config.guess not found" >&2
96 exit 1
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
104 crossbindir=
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"
109 break;
111 done
112 if [ -z "$crossbindir" ]; then
113 echo "Cross compiler kit not installed" >&2
114 echo "Stop." >&2
115 exit 1
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
121 exit 1
125 $tsdir/configure --enable-maintainer-mode --prefix=${amd64root} \
126 --host=${host} --build=${build}
127 rc=$?
128 exit $rc
130 # ***** end AMD64 cross build script *******
134 # Grep the required versions from configure.ac
135 autoconf_vers=`sed -n '/^AC_PREREQ(/ {
136 s/^.*(\(.*\))/\1/p
138 }' ${configure_ac}`
139 autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
141 automake_vers=`sed -n '/^min_automake_version=/ {
142 s/^.*="\(.*\)"/\1/p
144 }' ${configure_ac}`
145 automake_vers_num=`echo "$automake_vers" | cvtver`
147 #gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
148 #s/^.*(\(.*\))/\1/p
150 #}' ${configure_ac}`
151 #gettext_vers_num=`echo "$gettext_vers" | cvtver`
154 if [ -z "$autoconf_vers" -o -z "$automake_vers" ]
155 then
156 echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
157 exit 1
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
182 cat <<EOF
184 Note that you may use alternative versions of the tools by setting
185 the corresponding environment variables; see README.CVS for details.
188 exit 1
191 echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
192 $ACLOCAL -I m4 $ACLOCAL_FLAGS
193 echo "Running autoheader..."
194 $AUTOHEADER
195 echo "Running automake --gnu ..."
196 $AUTOMAKE --gnu;
197 echo "Running autoconf${FORCE} ..."
198 $AUTOCONF${FORCE}
200 echo "You may now run \"./configure --enable-maintainer-mode && make\"."