File: AutoRegen.sh

package info (click to toggle)
llvm 2.2-12
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 38,648 kB
  • ctags: 28,258
  • sloc: cpp: 215,479; sh: 12,132; ansic: 10,002; yacc: 5,525; perl: 2,352; ml: 1,580; makefile: 956; pascal: 718; lex: 602; exp: 320; ada: 193; lisp: 160; csh: 116; objc: 59; python: 59; tcl: 20
file content (52 lines) | stat: -rwxr-xr-x 1,561 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
die () {
	echo "$@" 1>&2
	exit 1
}
test -d autoconf && test -f autoconf/configure.ac && cd autoconf
test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first"
autoconf --version | egrep '2\.5[0-9]' > /dev/null
if test $? -ne 0 ; then
  die "Your autoconf was not detected as being 2.5x"
fi
cwd=`pwd`
if test -d ../../../autoconf/m4 ; then
  cd ../../../autoconf/m4
  llvm_m4=`pwd`
  llvm_src_root=../../..
  llvm_obj_root=../../..
  cd $cwd
elif test -d ../../llvm/autoconf/m4 ; then
  cd ../../llvm/autoconf/m4
  llvm_m4=`pwd`
  llvm_src_root=../..
  llvm_obj_root=../..
  cd $cwd
else
  while true ; do
    echo "LLVM source root not found." 
    read -p "Enter full path to LLVM source:"
    if test -d "$REPLY/autoconf/m4" ; then
      llvm_src_root="$REPLY"
      llvm_m4="$REPLY/autoconf/m4"
      read -p "Enter full path to LLVM objects (empty for same as source):"
      if test -d "$REPLY" ; then
        llvm_obj_root="$REPLY"
      else
        llvm_obj_root="$llvm_src_root"
      fi
      break
    fi
  done
fi
# Patch the LLVM_ROOT in configure.ac, if it needs it
cp configure.ac configure.bak
sed -e "s#^LLVM_SRC_ROOT=.*#LLVM_SRC_ROOT=\"$llvm_src_root\"#" \
    -e "s#^LLVM_OBJ_ROOT=.*#LLVM_OBJ_ROOT=\"$llvm_obj_root\"#" configure.bak > configure.ac
echo "Regenerating aclocal.m4 with aclocal"
rm -f aclocal.m4
aclocal -I $llvm_m4 -I "$llvm_m4/.." || die "aclocal failed"
echo "Regenerating configure with autoconf 2.5x"
autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed"
cd ..
exit 0