Add the --with-automake option to AutoRegen.sh and provide the automake
[oota-llvm.git] / autoconf / AutoRegen.sh
1 #!/bin/sh
2 die () {
3         echo "$@" 1>&2
4         exit 1
5 }
6 if test "$1" = --with-automake ; then
7   outfile=configure_am
8   configfile=configure.am
9   with_automake=1
10 else
11   outfile=configure
12   configfile=configure.ac
13   with_automake=0
14 fi
15 test -d autoconf && test -f autoconf/$configfile && cd autoconf
16 test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first"
17 autoconf --version | egrep '2\.59' > /dev/null
18 if test $? -ne 0 ; then
19   die "Your autoconf was not detected as being 2.59"
20 fi
21 aclocal --version | egrep '1\.9\.2' > /dev/null
22 if test $? -ne 0 ; then
23   die "Your aclocal was not detected as being 1.9.1"
24 fi
25 autoheader --version | egrep '2\.59' > /dev/null
26 if test $? -ne 0 ; then
27   die "Your autoheader was not detected as being 2.59"
28 fi
29 libtool --version | grep '1.5.10' > /dev/null
30 if test $? -ne 0 ; then
31   die "Your libtool was not detected as being 1.5.10"
32 fi
33 if test $with_automake -eq 1 ; then
34   automake --version | grep 'automake.*1.9.2' > /dev/null
35   if test $? -ne 0 ; then
36     die "Your automake was not detected as being 1.9.2"
37   fi
38 fi
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 ""
48 echo "Regenerating aclocal.m4 with aclocal"
49 cwd=`pwd`
50 if test $with_automake -eq 1 ; then
51   cp configure.ac .configure.ac.save
52   cp configure.am configure.ac
53   cp configure.am ../configure.ac
54 fi
55 aclocal --force -I $cwd/m4 || die "aclocal failed"
56 echo "Regenerating configure with autoconf 2.59"
57 autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed"
58 cd ..
59 echo "Regenerating config.h.in with autoheader 2.59"
60 autoheader -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed"
61 if test $with_automake -eq 1 ; then
62   echo "Regenerating makefiles with automake 1.9.2"
63   cp autoconf/aclocal.m4 .
64   automake --foreign --add-missing --copy
65   rm configure.ac
66   cd $cwd
67   cp .configure.ac.save configure.ac
68 fi
69 exit 0