Misha Brukman | a24b4dd | 2009-08-13 20:29:30 +0000 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | die() { |
Misha Brukman | 7dc75a6 | 2009-08-13 20:12:48 +0000 | [diff] [blame] | 4 | echo "$@" 1>&2 |
| 5 | exit 1 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6 | } |
| 7 | |
Misha Brukman | a24b4dd | 2009-08-13 20:29:30 +0000 | [diff] [blame^] | 8 | clean() { |
| 9 | echo $1 | sed -e 's/\\//g' |
| 10 | } |
| 11 | |
| 12 | ### NOTE: ############################################################ |
| 13 | ### These variables specify the tool versions we want to use. |
| 14 | ### Periods should be escaped with backslash for use by grep. |
Scott Michel | da14e00 | 2008-11-20 04:28:08 +0000 | [diff] [blame] | 15 | want_autoconf_version='2\.60' |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 16 | want_autoheader_version=$want_autoconf_version |
Misha Brukman | a24b4dd | 2009-08-13 20:29:30 +0000 | [diff] [blame^] | 17 | want_aclocal_version='1\.9\.6' |
| 18 | want_libtool_version='1\.5\.22' |
| 19 | ### END NOTE ######################################################### |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 20 | |
| 21 | outfile=configure |
| 22 | configfile=configure.ac |
| 23 | |
Misha Brukman | a24b4dd | 2009-08-13 20:29:30 +0000 | [diff] [blame^] | 24 | want_autoconf_version_clean=$(clean $want_autoconf_version) |
| 25 | want_autoheader_version_clean=$(clean $want_autoheader_version) |
| 26 | want_aclocal_version_clean=$(clean $want_aclocal_version) |
| 27 | want_libtool_version_clean=$(clean $want_libtool_version) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 28 | |
| 29 | test -d autoconf && test -f autoconf/$configfile && cd autoconf |
| 30 | test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first" |
| 31 | autoconf --version | grep $want_autoconf_version > /dev/null |
| 32 | test $? -eq 0 || die "Your autoconf was not detected as being $want_autoconf_version_clean" |
Misha Brukman | a24b4dd | 2009-08-13 20:29:30 +0000 | [diff] [blame^] | 33 | aclocal --version | grep '^aclocal.*'$want_aclocal_version > /dev/null |
| 34 | test $? -eq 0 || die "Your aclocal was not detected as being $want_aclocal_version_clean" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 35 | autoheader --version | grep '^autoheader.*'$want_autoheader_version > /dev/null |
| 36 | test $? -eq 0 || die "Your autoheader was not detected as being $want_autoheader_version_clean" |
Misha Brukman | a24b4dd | 2009-08-13 20:29:30 +0000 | [diff] [blame^] | 37 | libtool --version | grep $want_libtool_version > /dev/null |
| 38 | test $? -eq 0 || die "Your libtool was not detected as being $want_libtool_version_clean" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 39 | echo "" |
| 40 | echo "### NOTE: ############################################################" |
| 41 | echo "### If you get *any* warnings from autoconf below you MUST fix the" |
| 42 | echo "### scripts in the m4 directory because there are future forward" |
| 43 | echo "### compatibility or platform support issues at risk. Please do NOT" |
| 44 | echo "### commit any configure script that was generated with warnings" |
| 45 | echo "### present. You should get just three 'Regenerating..' lines." |
| 46 | echo "######################################################################" |
| 47 | echo "" |
Misha Brukman | a24b4dd | 2009-08-13 20:29:30 +0000 | [diff] [blame^] | 48 | echo "Regenerating aclocal.m4 with aclocal $want_aclocal_version_clean" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 49 | cwd=`pwd` |
| 50 | aclocal --force -I $cwd/m4 || die "aclocal failed" |
| 51 | echo "Regenerating configure with autoconf $want_autoconf_version_clean" |
| 52 | autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed" |
| 53 | cd .. |
| 54 | echo "Regenerating config.h.in with autoheader $want_autoheader_version_clean" |
| 55 | autoheader --warnings=all -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed" |
| 56 | exit 0 |