c3210bf1876c206b0f5c7225b25e234bc79e1647
[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 elif test -z "$1" ; then
11   outfile=configure
12   configfile=configure.ac
13   with_automake=0
14 else
15   die "Invalid option: $1"
16 fi
17 test -d autoconf && test -f autoconf/$configfile && cd autoconf
18 test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first"
19 autoconf --version | egrep '2\.59' > /dev/null
20 if test $? -ne 0 ; then
21   die "Your autoconf was not detected as being 2.59"
22 fi
23 aclocal --version | egrep '1\.9\.2' > /dev/null
24 if test $? -ne 0 ; then
25   die "Your aclocal was not detected as being 1.9.2"
26 fi
27 autoheader --version | egrep '2\.59' > /dev/null
28 if test $? -ne 0 ; then
29   die "Your autoheader was not detected as being 2.59"
30 fi
31 libtool --version | grep '1\.5\.10' > /dev/null
32 if test $? -ne 0 ; then
33   die "Your libtool was not detected as being 1.5.10"
34 fi
35 echo ""
36 echo "### NOTE: ############################################################"
37 echo "### If you get *any* warnings from autoconf below you MUST fix the"
38 echo "### scripts in the m4 directory because there are future forward"
39 echo "### compatibility or platform support issues at risk. Please do NOT"
40 echo "### commit any configure script that was generated with warnings"
41 echo "### present. You should get just three 'Regenerating..' lines."
42 echo "######################################################################"
43 echo ""
44 echo "Regenerating aclocal.m4 with aclocal 1.9.2"
45 cwd=`pwd`
46 aclocal --force -I $cwd/m4 || die "aclocal failed"
47 echo "Regenerating configure with autoconf 2.59"
48 autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed"
49 cd ..
50 echo "Regenerating config.h.in with autoheader 2.59"
51 autoheader -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed"
52 exit 0