From 4d03dcc18c3e23685d6ce103c68a631bb8e36f6b Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Fri, 26 Apr 2013 19:51:54 -0700 Subject: [PATCH] Update ddm4 --- bootstrap.sh | 70 +++++++++++++++++++++++++++++++++++++-------------- configure.ac | 3 +++ m4/ax_uuid.m4 | 32 ++++++++++++++++++++--- 3 files changed, 83 insertions(+), 22 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 1c2beff2..65cbbc2a 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -188,9 +188,15 @@ function set_VENDOR_DISTRIBUTION () function set_VENDOR_RELEASE () { local release=`echo "$1" | tr '[A-Z]' '[a-z]'` - case "$VENDOR_DISTRIBUTION" in + + if $DEBUG; then + echo "VENDOR_DISTRIBUTION:$VENDOR_DISTRIBUTION" + echo "VENDOR_RELEASE:$release" + fi + + case $VENDOR_DISTRIBUTION in darwin) - case "$VENDOR_DISTRIBUTION" in + case $release in 10.6*) VENDOR_RELEASE='snow_leopard' ;; @@ -200,10 +206,12 @@ function set_VENDOR_RELEASE () mountain) VENDOR_RELEASE='mountain' ;; - 10.8*) + 10.8.*) + echo "mountain_lion" VENDOR_RELEASE='mountain_lion' ;; *) + echo $VENDOR_RELEASE VENDOR_RELEASE='unknown' ;; esac @@ -375,11 +383,17 @@ function run_configure () local BUILD_CONFIGURE_ARG= # 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 - # Set ENV ASSERT in order to enable assert - if $DEBUG; then - BUILD_CONFIGURE_ARG+=' --enable-debug --enable-assert' - elif [[ -n "$VCS_CHECKOUT" ]]; then - BUILD_CONFIGURE_ARG+=' --enable-assert' + # Set ENV ASSERT in order to enable assert. + # If we are doing a valgrind run, we always compile with assert disabled + if $valgrind_run; then + BUILD_CONFIGURE_ARG+= " CXXFLAGS=-DNDEBUG " + BUILD_CONFIGURE_ARG+= " CFLAGS=-DNDEBUG " + else + if $DEBUG; then + BUILD_CONFIGURE_ARG+=' --enable-debug --enable-assert' + elif [[ -n "$VCS_CHECKOUT" ]]; then + BUILD_CONFIGURE_ARG+=' --enable-assert' + fi fi if [[ -n "$CONFIGURE_ARG" ]]; then @@ -431,7 +445,7 @@ function setup_gdb_command () { function setup_valgrind_command () { VALGRIND_PROGRAM=`type -p valgrind` if [[ -n "$VALGRIND_PROGRAM" ]]; then - VALGRIND_COMMAND="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE" + VALGRIND_COMMAND="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --show-reachable=yes --malloc-fill=A5 --free-fill=DE --xml=yes --xml-file=\"valgrind-%p.xml\"" fi } @@ -531,11 +545,6 @@ function safe_popd () function make_valgrind () { - if [[ "$VENDOR_DISTRIBUTION" == 'darwin' ]]; then - make_darwin_malloc - return - fi - # If the env VALGRIND_COMMAND is set then we assume it is valid local valgrind_was_set=false if [[ -z "$VALGRIND_COMMAND" ]]; then @@ -555,8 +564,10 @@ function make_valgrind () save_BUILD + valgrind_run=true + # If we are required to run configure, do so now - run_configure_if_required + run_configure # If we don't have a configure, then most likely we will be missing libtool assert_file 'configure' @@ -566,9 +577,21 @@ function make_valgrind () TESTS_ENVIRONMENT="$VALGRIND_COMMAND" fi - make_target 'check' || return 1 + make_target 'check' + ret=$? + + # If we aren't going to error, we will clean up our environment + if [ "$ret" -eq 0 ]; then + make 'distclean' + fi + + valgrind_run=false restore_BUILD + + if [ "$ret" -ne 0 ]; then + return 1 + fi } function make_install_system () @@ -1102,7 +1125,7 @@ function run_autoreconf () run $BOOTSTRAP_LIBTOOLIZE '--copy' '--install' '--force' || die "Cannot execute $BOOTSTRAP_LIBTOOLIZE" fi - run $AUTORECONF || die "Cannot execute $AUTORECONF" + run $AUTORECONF $AUTORECONF_ARGS || die "Cannot execute $AUTORECONF" eval 'bash -n configure' || die "autoreconf generated a malformed configure" } @@ -1283,12 +1306,16 @@ function autoreconf_setup () fi fi fi + if $VERBOSE; then LIBTOOLIZE_OPTIONS="--verbose $BOOTSTRAP_LIBTOOLIZE_OPTIONS" fi + if $DEBUG; then LIBTOOLIZE_OPTIONS="--debug $BOOTSTRAP_LIBTOOLIZE_OPTIONS" fi + + # Here we set LIBTOOLIZE to true since we are going to invoke it via BOOTSTRAP_LIBTOOLIZE LIBTOOLIZE=true fi @@ -1326,7 +1353,7 @@ function autoreconf_setup () fi if [[ -n "$GNU_BUILD_FLAGS" ]]; then - AUTORECONF="$AUTORECONF $GNU_BUILD_FLAGS" + AUTORECONF_ARGS="$GNU_BUILD_FLAGS" fi fi @@ -1553,6 +1580,7 @@ function bootstrap () fi local snapshot_run=false + local valgrind_run=false case $target in 'self') @@ -1616,7 +1644,11 @@ function bootstrap () 'rpm') make_rpm ;; + 'darwin_malloc') + make_darwin_malloc + ;; 'valgrind') + make_maintainer_clean make_valgrind ;; 'universe') @@ -1713,7 +1745,7 @@ function main () fi if [ -z "$MAKE_TARGET" ]; then - MAKE_TARGET='jenkins' + MAKE_TARGET='check' fi fi fi diff --git a/configure.ac b/configure.ac index a70143ab..97565c46 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,9 @@ LT_INIT LT_LANG([C++]) LT_LIB_M +AC_PROG_CC_C99 +AS_IF([test "x${ac_cv_prog_cc_c99}" == "xno"],[AC_MSG_ERROR([No c99 compatible compiler found])]) + AX_ASSERT AX_PLATFORM diff --git a/m4/ax_uuid.m4 b/m4/ax_uuid.m4 index 93c5f89f..293fdfc5 100644 --- a/m4/ax_uuid.m4 +++ b/m4/ax_uuid.m4 @@ -6,22 +6,23 @@ # SYNOPSIS # # AX_UUID() +# AX_UUID_GENERATE_TIME() # AX_UUID_GENERATE_TIME_SAFE() # # DESCRIPTION # -# Check for uuid, and uuid_generate_time_safe support. +# Check for uuid, uuid_generate_time, and uuid_generate_time_safe support. # # LICENSE # -# Copyright (c) 2012 Brian Aker +# Copyright (c) 2012-2013 Brian Aker # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 6 +#serial 7 AC_DEFUN([AX_UUID], [AC_PREREQ([2.63])dnl @@ -72,6 +73,31 @@ AC_DEFUN([AX_UUID], AM_CONDITIONAL([HAVE_LIBUUID],[test "x$ax_libuuid" = xyes]) ]) + AC_DEFUN([AX_UUID_GENERATE_TIME], + [AC_PREREQ([2.63])dnl + AC_REQUIRE([AX_UUID])dnl + AC_CACHE_CHECK([for uuid_generate_time], + [ax_cv_uuid_generate_time], + [AX_SAVE_FLAGS + LIBS="$LIBUUID_LIB $LIBS" + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([#include ],[ + uuid_t out; + uuid_generate_time(out); + ])], + [ax_cv_uuid_generate_time=yes], + [ax_cv_uuid_generate_time=no], + [AC_MSG_WARN([test program execution failed])]) + AC_LANG_POP + AX_RESTORE_FLAGS + ]) + + AS_IF([test "$ax_cv_uuid_generate_time" = yes], + [AC_DEFINE([HAVE_UUID_GENERATE_TIME],[1],[Define if uuid_generate_time is present in uuid/uuid.h.])], + [AC_DEFINE([HAVE_UUID_GENERATE_TIME],[0],[Define if uuid_generate_time is present in uuid/uuid.h.])]) + ]) + AC_DEFUN([AX_UUID_GENERATE_TIME_SAFE], [AC_PREREQ([2.63])dnl AC_REQUIRE([AX_UUID])dnl -- 2.30.2