blob: c9cc905cd09e7997e28b79b03e052d40061a5c12 [file] [log] [blame]
Reid Spencer38fd88a2005-01-05 06:41:10 +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"
8autoconf --version | egrep '2\.5[0-9]' > /dev/null
9if test $? -ne 0 ; then
Reid Spencer30ea4782006-04-18 06:27:47 +000010 die "Your autoconf was not detected as being 2.5x"
Reid Spencer38fd88a2005-01-05 06:41:10 +000011fi
12cwd=`pwd`
13if test -d ../../../autoconf/m4 ; then
14 cd ../../../autoconf/m4
15 llvm_m4=`pwd`
Reid Spencer30ea4782006-04-18 06:27:47 +000016 llvm_src_root=../../..
17 llvm_obj_root=../../..
Reid Spencer38fd88a2005-01-05 06:41:10 +000018 cd $cwd
19elif test -d ../../llvm/autoconf/m4 ; then
20 cd ../../llvm/autoconf/m4
21 llvm_m4=`pwd`
Reid Spencer30ea4782006-04-18 06:27:47 +000022 llvm_src_root=../..
23 llvm_obj_root=../..
Reid Spencer38fd88a2005-01-05 06:41:10 +000024 cd $cwd
25else
Reid Spencer30ea4782006-04-18 06:27:47 +000026 while true ; do
27 echo "LLVM source root not found."
28 read -p "Enter full path to LLVM source:"
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):"
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
Reid Spencer38fd88a2005-01-05 06:41:10 +000041fi
Reid Spencer30ea4782006-04-18 06:27:47 +000042# 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
Reid Spencer38fd88a2005-01-05 06:41:10 +000046echo "Regenerating aclocal.m4 with aclocal"
47rm -f aclocal.m4
Reid Spencerf20856d2005-02-24 18:42:34 +000048aclocal -I $llvm_m4 -I "$llvm_m4/.." || die "aclocal failed"
Reid Spencer38fd88a2005-01-05 06:41:10 +000049echo "Regenerating configure with autoconf 2.5x"
Reid Spencerf20856d2005-02-24 18:42:34 +000050autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed"
Reid Spencer38fd88a2005-01-05 06:41:10 +000051cd ..
52exit 0