Home | History | Annotate | Download | only in autoconf
      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_m4=`pwd`
     16   llvm_src_root=../..
     17   llvm_obj_root=../..
     18   cd $cwd
     19 elif test -d ../../llvm/autoconf/m4 ; then
     20   cd ../../llvm/autoconf/m4
     21   llvm_m4=`pwd`
     22   llvm_src_root=..
     23   llvm_obj_root=..
     24   cd $cwd
     25 else
     26   while true ; do
     27     echo "LLVM source root not found." 
     28     read -p "Enter full path to LLVM source:" REPLY
     29     if test -d "$REPLY/autoconf/m4" ; then
     30       llvm_src_root="$REPLY"
     31       llvm_m4="$REPLY/autoconf/m4"
     32       read -p "Enter full path to LLVM objects (empty for same as source):" REPLY
     33       if test -d "$REPLY" ; then
     34         llvm_obj_root="$REPLY"
     35       else
     36         llvm_obj_root="$llvm_src_root"
     37       fi
     38       break
     39     fi
     40   done
     41 fi
     42 # Patch the LLVM_ROOT in configure.ac, if it needs it
     43 cp configure.ac configure.bak
     44 sed -e "s#^LLVM_SRC_ROOT=.*#LLVM_SRC_ROOT=\"$llvm_src_root\"#" \
     45     -e "s#^LLVM_OBJ_ROOT=.*#LLVM_OBJ_ROOT=\"$llvm_obj_root\"#" configure.bak > configure.ac
     46 echo "Regenerating aclocal.m4 with aclocal"
     47 rm -f aclocal.m4
     48 aclocal -I $llvm_m4 -I "$llvm_m4/.." || die "aclocal failed"
     49 echo "Regenerating configure with autoconf"
     50 autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed"
     51 cd ..
     52 exit 0
     53