blob: 126703ba5aaf10667a0b66cd7d671ed1aee0f99e [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001#!/bin/sh
2die () {
3 echo "$@" 1>&2
4 exit 1
5}
6test -d autoconf && test -f autoconf/configure.ac && cd autoconf
7test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first"
Dan Gohman0f1d6a32009-03-24 23:45:13 +00008autoconf --version | egrep '2\.[56][0-9]' > /dev/null
Dan Gohmanf17a25c2007-07-18 16:29:46 +00009if test $? -ne 0 ; then
Dan Gohman0f1d6a32009-03-24 23:45:13 +000010 die "Your autoconf was not detected as being 2.5x or 2.6x"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000011fi
12cwd=`pwd`
13if test -d ../../../autoconf/m4 ; then
14 cd ../../../autoconf/m4
15 llvm_m4=`pwd`
Dan Gohman6edd4ef2009-03-25 00:52:11 +000016 llvm_src_root=../../..
17 llvm_obj_root=../../..
Dan Gohmanf17a25c2007-07-18 16:29:46 +000018 cd $cwd
19elif test -d ../../llvm/autoconf/m4 ; then
20 cd ../../llvm/autoconf/m4
21 llvm_m4=`pwd`
Dan Gohman6edd4ef2009-03-25 00:52:11 +000022 llvm_src_root=../..
23 llvm_obj_root=../..
Dan Gohmanf17a25c2007-07-18 16:29:46 +000024 cd $cwd
25else
26 while true ; do
27 echo "LLVM source root not found."
Dan Gohmanc8f73642009-03-24 20:21:37 +000028 read -p "Enter full path to LLVM source:" REPLY
Dan Gohmanf17a25c2007-07-18 16:29:46 +000029 if test -d "$REPLY/autoconf/m4" ; then
30 llvm_src_root="$REPLY"
31 llvm_m4="$REPLY/autoconf/m4"
Dan Gohmanc8f73642009-03-24 20:21:37 +000032 read -p "Enter full path to LLVM objects (empty for same as source):" REPLY
Dan Gohmanf17a25c2007-07-18 16:29:46 +000033 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
41fi
42# Patch the LLVM_ROOT in configure.ac, if it needs it
43cp configure.ac configure.bak
44sed -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
46echo "Regenerating aclocal.m4 with aclocal"
47rm -f aclocal.m4
48aclocal -I $llvm_m4 -I "$llvm_m4/.." || die "aclocal failed"
Dan Gohman0f1d6a32009-03-24 23:45:13 +000049echo "Regenerating configure with autoconf"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000050autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed"
51cd ..
52exit 0