OSDN Git Service

projects/sample: Import adapted form of current LLVM autoconf/Makefile setup so that...
[android-x86/external-llvm.git] / projects / sample / autoconf / AutoRegen.sh
1 #!/bin/sh
2 die () {
3         echo "$@" 1>&2
4         exit 1
5 }
6 test -d autoconf && test -f autoconf/configure.ac && cd autoconf
7 test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first"
8 autoconf --version | egrep '2\.[56][0-9]' > /dev/null
9 if test $? -ne 0 ; then
10   die "Your autoconf was not detected as being 2.5x or 2.6x"
11 fi
12 cwd=`pwd`
13 if test -d ../../../autoconf/m4 ; then
14   cd ../../../autoconf/m4
15   llvm_src_root=../..
16   llvm_obj_root=../..
17   cd $cwd
18 elif test -d ../../llvm/autoconf/m4 ; then
19   cd ../../llvm/autoconf/m4
20   llvm_src_root=../..
21   llvm_obj_root=../..
22   cd $cwd
23 else
24   while true ; do
25     echo "LLVM source root not found." 
26     read -p "Enter full path to LLVM source:" REPLY
27     if test -d "$REPLY/autoconf/m4" ; then
28       llvm_src_root="$REPLY"
29       read -p "Enter full path to LLVM objects (empty for same as source):" REPLY
30       if test -d "$REPLY" ; then
31         llvm_obj_root="$REPLY"
32       else
33         llvm_obj_root="$llvm_src_root"
34       fi
35       break
36     fi
37   done
38 fi
39 echo "Regenerating aclocal.m4 with aclocal"
40 rm -f aclocal.m4
41 aclocal -I $cwd/m4 || die "aclocal failed"
42 echo "Regenerating configure with autoconf"
43 autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed"
44 cd ..
45 exit 0