296
296
# Arguments for configure
297
297
local BUILD_CONFIGURE_ARG=
299
# Set ENV DEBUG in order to enable debugging
299
# If ENV DEBUG is set we enable both debug and asssert, otherwise we see if this is a VCS checkout and if so enable assert
300
# Set ENV ASSERT in order to enable assert
301
BUILD_CONFIGURE_ARG='--enable-debug'
304
# Set ENV ASSERT in order to enable assert
305
if [[ -n "$ASSERT" ]]; then
307
ASSERT_ARG='--enable-assert'
308
BUILD_CONFIGURE_ARG="$ASSERT_ARG $BUILD_CONFIGURE_ARG"
302
BUILD_CONFIGURE_ARG+=' --enable-debug --enable-assert'
303
elif [[ -n "$VCS_CHECKOUT" ]]; then
304
BUILD_CONFIGURE_ARG+=' --enable-assert'
311
307
if [[ -n "$CONFIGURE_ARG" ]]; then
312
BUILD_CONFIGURE_ARG= "$BUILD_CONFIGURE_ARG $CONFIGURE_ARG"
308
BUILD_CONFIGURE_ARG+=" $CONFIGURE_ARG"
311
if [[ -n "$PREFIX_ARG" ]]; then
312
BUILD_CONFIGURE_ARG+=" $PREFIX_ARG"
316
316
# If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV
319
CC=clang CXX=clang++ $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG $PREFIX_ARG"
319
CC=clang CXX=clang++ $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG"
323
323
command_exists 'gcc44' || die "Could not locate gcc44"
324
CC=gcc44 CXX=gcc44 $top_srcdir/configure $BUILD_CONFIGURE_ARG $PREFIX_ARG || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG $PREFIX_ARG"
324
CC=gcc44 CXX=gcc44 $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG"
328
$CONFIGURE $BUILD_CONFIGURE_ARG $PREFIX_ARG
328
$CONFIGURE $BUILD_CONFIGURE_ARG
333
333
if [ $ret -ne 0 ]; then
334
die "Could not execute $CONFIGURE $BUILD_CONFIGURE_ARG $PREFIX_ARG"
334
die "Could not execute $CONFIGURE $BUILD_CONFIGURE_ARG"
337
337
if [ ! -f 'Makefile' ]; then
367
367
die "OLD_CONFIGURE_ARG($OLD_CONFIGURE_ARG) was set on push, programmer error!"
370
if [[ -n "$OLD_PREFIX" ]]; then
371
die "OLD_PREFIX($OLD_PREFIX) was set on push, programmer error!"
370
374
if [[ -n "$OLD_MAKE" ]]; then
371
375
die "OLD_MAKE($OLD_MAKE) was set on push, programmer error!"
414
422
OLD_CONFIGURE_ARG=
416
425
OLD_TESTS_ENVIRONMENT=
421
function push_PREFIX_ARG ()
423
if [[ -n "$OLD_PREFIX_ARG" ]]; then
424
die "OLD_PREFIX_ARG was set on push, programmer error!"
427
if [[ -n "$PREFIX_ARG" ]]; then
428
OLD_PREFIX_ARG=$PREFIX_ARG
432
if [[ -n "$1" ]]; then
433
PREFIX_ARG="--prefix=$1"
437
function pop_PREFIX_ARG ()
439
if [[ -n "$OLD_PREFIX_ARG" ]]; then
440
PREFIX_ARG=$OLD_PREFIX_ARG
447
function push_TESTS_ENVIRONMENT ()
449
if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
450
die "OLD_TESTS_ENVIRONMENT was set on push, programmer error!"
453
if [[ -n "$TESTS_ENVIRONMENT" ]]; then
454
OLD_TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT
459
function pop_TESTS_ENVIRONMENT ()
462
if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
463
TESTS_ENVIRONMENT=$OLD_TESTS_ENVIRONMENT
464
OLD_TESTS_ENVIRONMENT=
468
430
function safe_pushd ()
470
432
pushd $1 &> /dev/null ;
516
480
# If we are required to run configure, do so now
517
481
run_configure_if_required
519
push_TESTS_ENVIRONMENT
521
483
# If we don't have a configure, then most likely we will be missing libtool
522
484
assert_file 'configure'
523
485
if [[ -f 'libtool' ]]; then
529
491
make_target 'check' || return 1
531
pop_TESTS_ENVIRONMENT
534
496
function make_install_system ()
536
498
local INSTALL_LOCATION=$(mktemp -d /tmp/XXXXXXXXXX)
537
push_PREFIX_ARG $INSTALL_LOCATION
501
PREFIX_ARG="--prefix=$INSTALL_LOCATION"
539
503
if [ ! -d $INSTALL_LOCATION ] ; then
540
504
die "ASSERT temp directory not found '$INSTALL_LOCATION'"