Re-introducing the old "indef..endif" logic, but using "?=", as ifndef is only
[mirror-ossqm-expat.git] / buildconf.sh
blob2fc5932a3a86fb9e4198f73e70cc04b758d3fa22
1 #! /bin/sh
3 #--------------------------------------------------------------------------
4 # autoconf 2.52 or newer
6 ac_version="`${AUTOCONF:-autoconf} --version 2> /dev/null | head -1 | sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`"
7 if test -z "$ac_version"; then
8 echo "ERROR: autoconf not found."
9 echo " You need autoconf version 2.52 or newer installed."
10 exit 1
12 IFS=.; set $ac_version; IFS=' '
13 if test "$1" = "2" -a "$2" -lt "52" || test "$1" -lt "2"; then
14 echo "ERROR: autoconf version $ac_version found."
15 echo " You need autoconf version 2.52 or newer installed."
16 exit 1
19 echo "found: autoconf version $ac_version (ok)"
21 #--------------------------------------------------------------------------
22 # libtool 1.4 or newer
26 # find libtoolize, or glibtoolize on MacOS X
28 libtoolize=`conftools/PrintPath glibtoolize libtoolize`
29 if [ "x$libtoolize" = "x" ]; then
30 echo "ERROR: libtoolize not found."
31 echo " You need libtool version 1.4 or newer installed"
32 exit 1
35 lt_pversion="`$libtoolize --version 2> /dev/null | sed -e 's/^[^0-9]*//'`"
37 # convert something like 1.4p1 to 1.4.p1
38 lt_version="`echo $lt_pversion | sed -e 's/\([a-z]*\)$/.\1/'`"
40 IFS=.; set $lt_version; IFS=' '
41 if test "$1" = "1" -a "$2" -lt "4"; then
42 echo "ERROR: libtool version $lt_pversion found."
43 echo " You need libtool version 1.4 or newer installed"
44 exit 1
47 echo "found: libtool version $lt_pversion (ok)"
49 #--------------------------------------------------------------------------
51 # Remove any libtool files so one can switch between libtool 1.3
52 # and libtool 1.4 by simply rerunning the buildconf script.
53 (cd conftools/; rm -f ltmain.sh ltconfig)
56 # Create the libtool helper files
58 echo "Copying libtool helper files ..."
61 # Note: we don't use --force (any more) since we have a special
62 # config.guess/config.sub that we want to ensure is used.
64 # --copy to avoid symlinks; we want originals for the distro
65 # --automake to make it shut up about "things to do"
67 $libtoolize --copy --automake
70 # Find the libtool.m4 file. The developer/packager can set the LIBTOOL_M4
71 # environment variable to specify its location. If that variable is not
72 # set, then we'll assume a "standard" libtool installation and try to
73 # derive its location.
75 ltpath=`dirname $libtoolize`
76 ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/libtool.m4}
77 cp $ltfile conftools/libtool.m4
79 echo "Using libtool.m4 from ${ltfile}."
81 #--------------------------------------------------------------------------
83 ### for a little while... remove stray aclocal.m4 files from
84 ### developers' working copies. we no longer use it. (nothing else
85 ### will remove it, and leaving it creates big problems)
86 rm -f aclocal.m4
89 # Generate the autoconf header template (expat_config.h.in) and ./configure
91 echo "Creating expat_config.h.in ..."
92 ${AUTOHEADER:-autoheader}
94 echo "Creating configure ..."
95 ### do some work to toss config.cache?
96 ${AUTOCONF:-autoconf}
98 # toss this; it gets created by autoconf on some systems
99 rm -rf autom4te*.cache
101 # exit with the right value, so any calling script can continue
102 exit 0