blob: 78e3ed87f092fdb4f2fce49cd9c3e45f72a0dfa9 [file] [log] [blame]
Reid Spencer09d05942007-07-16 08:05:18 +00001#!/bin/sh
2
Reid Spencer8d1b8f72007-07-17 07:17:02 +00003# 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 Spencer5cd2aab2007-07-21 09:33:41 +000010process_arguments "$@"
Reid Spencer09d05942007-07-16 08:05:18 +000011
Duncan Sands26035802009-01-23 08:42:38 +000012# First, see if the build directory is there. If not, create it.
13build_dir="$LLVM_TOP/build.llvm"
14if test ! -d "$build_dir" ; then
15 mkdir -p "$build_dir"
16fi
17
Reid Spencerc5a879c2007-08-31 19:53:42 +000018# See if we have previously been configured by sensing the presence
Reid Spencer09d05942007-07-16 08:05:18 +000019# of the config.status scripts
Duncan Sands26035802009-01-23 08:42:38 +000020config_status="$build_dir/config.status"
21if test ! -f "$config_status" -o "$config_status" -ot "$0" ; then
Reid Spencer09d05942007-07-16 08:05:18 +000022 # We must configure so build a list of configure options
23 config_options="--prefix=$PREFIX --with-llvmgccdir=$PREFIX"
Reid Spencerc5a879c2007-08-31 19:53:42 +000024 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 Spencer8d1b8f72007-07-17 07:17:02 +000054 config_options="$config_options $OPTIONS_DASH $OPTIONS_DASH_DASH"
Duncan Sands26035802009-01-23 08:42:38 +000055 src_dir=`pwd`
56 cd "$build_dir"
Reid Spencer8d1b8f72007-07-17 07:17:02 +000057 msg 0 Configuring $module with:
Duncan Sands26035802009-01-23 08:42:38 +000058 msg 0 " $src_dir/configure" $config_options
59 $src_dir/configure $config_options || \
60 die $? "Configuring $module module failed"
Reid Spencerc5a879c2007-08-31 19:53:42 +000061else
62 msg 0 Module $module already configured, ignoring configure options.
Duncan Sands26035802009-01-23 08:42:38 +000063 cd "$build_dir"
Reid Spencer09d05942007-07-16 08:05:18 +000064fi
65
Reid Spencer8d1b8f72007-07-17 07:17:02 +000066msg 0 Building $module with:
67msg 0 " make" $OPTIONS_ASSIGN tools-only
68make $OPTIONS_ASSIGN tools-only