Reid Spencer | 09d0594 | 2007-07-16 08:05:18 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Reid Spencer | 8d1b8f7 | 2007-07-17 07:17:02 +0000 | [diff] [blame] | 3 | # This includes the Bourne shell library from llvm-top. Since this file is |
| 4 | # generally only used when building from llvm-top, it is safe to assume that |
| 5 | # llvm is checked out into llvm-top in which case .. just works. |
| 6 | . ../library.sh |
| 7 | |
| 8 | # Process the options passed in to us by the build script into standard |
| 9 | # variables. |
Reid Spencer | 5cd2aab | 2007-07-21 09:33:41 +0000 | [diff] [blame] | 10 | process_arguments "$@" |
Reid Spencer | 09d0594 | 2007-07-16 08:05:18 +0000 | [diff] [blame] | 11 | |
Duncan Sands | 2603580 | 2009-01-23 08:42:38 +0000 | [diff] [blame] | 12 | # First, see if the build directory is there. If not, create it. |
| 13 | build_dir="$LLVM_TOP/build.llvm" |
| 14 | if test ! -d "$build_dir" ; then |
| 15 | mkdir -p "$build_dir" |
| 16 | fi |
| 17 | |
Reid Spencer | c5a879c | 2007-08-31 19:53:42 +0000 | [diff] [blame] | 18 | # See if we have previously been configured by sensing the presence |
Reid Spencer | 09d0594 | 2007-07-16 08:05:18 +0000 | [diff] [blame] | 19 | # of the config.status scripts |
Duncan Sands | 2603580 | 2009-01-23 08:42:38 +0000 | [diff] [blame] | 20 | config_status="$build_dir/config.status" |
| 21 | if test ! -f "$config_status" -o "$config_status" -ot "$0" ; then |
Reid Spencer | 09d0594 | 2007-07-16 08:05:18 +0000 | [diff] [blame] | 22 | # We must configure so build a list of configure options |
| 23 | config_options="--prefix=$PREFIX --with-llvmgccdir=$PREFIX" |
Reid Spencer | c5a879c | 2007-08-31 19:53:42 +0000 | [diff] [blame] | 24 | if test "$OPTIMIZED" -eq 1 ; then |
| 25 | config_options="$config_options --enable-optimized" |
| 26 | else |
| 27 | config_options="$config_options --disable-optimized" |
| 28 | fi |
| 29 | if test "$DEBUG" -eq 1 ; then |
| 30 | config_options="$config_options --enable-debug" |
| 31 | else |
| 32 | config_options="$config_options --disable-debug" |
| 33 | fi |
| 34 | if test "$ASSERTIONS" -eq 1 ; then |
| 35 | config_options="$config_options --enable-assertions" |
| 36 | else |
| 37 | config_options="$config_options --disable-assertions" |
| 38 | fi |
| 39 | if test "$CHECKING" -eq 1 ; then |
| 40 | config_options="$config_options --enable-expensive-checks" |
| 41 | else |
| 42 | config_options="$config_options --disable-expensive-checks" |
| 43 | fi |
| 44 | if test "$DOXYGEN" -eq 1 ; then |
| 45 | config_options="$config_options --enable-doxygen" |
| 46 | else |
| 47 | config_options="$config_options --disable-doxygen" |
| 48 | fi |
| 49 | if test "$THREADS" -eq 1 ; then |
| 50 | config_options="$config_options --enable-threads" |
| 51 | else |
| 52 | config_options="$config_options --disable-threads" |
| 53 | fi |
Reid Spencer | 8d1b8f7 | 2007-07-17 07:17:02 +0000 | [diff] [blame] | 54 | config_options="$config_options $OPTIONS_DASH $OPTIONS_DASH_DASH" |
Duncan Sands | 2603580 | 2009-01-23 08:42:38 +0000 | [diff] [blame] | 55 | src_dir=`pwd` |
| 56 | cd "$build_dir" |
Reid Spencer | 8d1b8f7 | 2007-07-17 07:17:02 +0000 | [diff] [blame] | 57 | msg 0 Configuring $module with: |
Duncan Sands | 2603580 | 2009-01-23 08:42:38 +0000 | [diff] [blame] | 58 | msg 0 " $src_dir/configure" $config_options |
| 59 | $src_dir/configure $config_options || \ |
| 60 | die $? "Configuring $module module failed" |
Reid Spencer | c5a879c | 2007-08-31 19:53:42 +0000 | [diff] [blame] | 61 | else |
| 62 | msg 0 Module $module already configured, ignoring configure options. |
Duncan Sands | 2603580 | 2009-01-23 08:42:38 +0000 | [diff] [blame] | 63 | cd "$build_dir" |
Reid Spencer | 09d0594 | 2007-07-16 08:05:18 +0000 | [diff] [blame] | 64 | fi |
| 65 | |
Reid Spencer | 8d1b8f7 | 2007-07-17 07:17:02 +0000 | [diff] [blame] | 66 | msg 0 Building $module with: |
| 67 | msg 0 " make" $OPTIONS_ASSIGN tools-only |
| 68 | make $OPTIONS_ASSIGN tools-only |