From 7b7d9b168eab9d1753d6b72de17f98975df97986 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Fri, 5 Apr 2013 09:15:36 -0400 Subject: [PATCH] Fix for lp:1164442 --- bootstrap.sh | 20 +++++- m4/ax_harden_compiler_flags.m4 | 114 +++++++++++++++++++-------------- 2 files changed, 84 insertions(+), 50 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index a368197a..b9b6a02f 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -808,7 +808,7 @@ function make_for_continuus_integration () make_install_system ;; - *-ubuntu-quantal-*) + *-precise-*) run_configure assert_exec_file 'configure' @@ -1068,6 +1068,14 @@ function parse_command_line_options () ;; h) # help echo "bootstrap.sh [options] optional_target ..." + echo " -a # Just run autoreconf"; + echo " -p # Print ENV"; + echo " -c # Just run configure"; + echo " -m # Just run maintainer-clean"; + echo " -t # Make target"; + echo " -d # Enable debug"; + echo " -h # Show help"; + echo " -v # Be more verbose in output"; exit ;; v) # verbose @@ -1169,6 +1177,7 @@ function autoreconf_setup () if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then echo "Couldn't find user supplied libtoolize, it is required" + return 1 fi else # If we are using OSX, we first check to see glibtoolize is available @@ -1177,12 +1186,14 @@ function autoreconf_setup () if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then echo "Couldn't find glibtoolize, it is required on OSX" + return 1 fi else BOOTSTRAP_LIBTOOLIZE=`type -p libtoolize` if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then echo "Couldn't find libtoolize, it is required" + return 1 fi fi fi @@ -1247,6 +1258,9 @@ function print_setup () echo 'BOOTSTRAP ENV' echo "AUTORECONF=$AUTORECONF" echo "HOST_OS=$HOST_OS" + echo "VENDOR=$VENDOR" + echo "VENDOR_DISTRIBUTION=$VENDOR_DISTRIBUTION" + echo "VENDOR_RELEASE=$VENDOR_RELEASE" echo "getopt()" if $AUTORECONF_OPTION; then @@ -1406,7 +1420,9 @@ function bootstrap () # Set up whatever we need to do to use autoreconf later require_libtoolise - autoreconf_setup + if ! autoreconf_setup; then + return 1 + fi if [ -z "$MAKE_TARGET" ]; then MAKE_TARGET="make_default" diff --git a/m4/ax_harden_compiler_flags.m4 b/m4/ax_harden_compiler_flags.m4 index 2daeb1a1..fc3e4a24 100644 --- a/m4/ax_harden_compiler_flags.m4 +++ b/m4/ax_harden_compiler_flags.m4 @@ -53,7 +53,7 @@ # ? _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) -- Don't turn on for # compatibility issues memcached_stat_st -#serial 8 +#serial 9 AC_DEFUN([_WARNINGS_AS_ERRORS], [AC_CACHE_CHECK([if all warnings into errors],[ac_cv_warnings_as_errors], @@ -92,9 +92,12 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-H]) _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) _APPEND_COMPILE_FLAGS_ERROR([-g]) - _APPEND_COMPILE_FLAGS_ERROR([-O0])], - [_APPEND_COMPILE_FLAGS_ERROR([-g]) - _APPEND_COMPILE_FLAGS_ERROR([-O2])]) + _APPEND_COMPILE_FLAGS_ERROR([-O0]), + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) + ],[ + _APPEND_COMPILE_FLAGS_ERROR([-g]) + _APPEND_COMPILE_FLAGS_ERROR([-O2]) + ]) AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) @@ -155,26 +158,31 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-Wundef]) _APPEND_COMPILE_FLAGS_ERROR([-Wunsafe-loop-optimizations]) _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) + AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]), + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) + AS_IF([test "x$enable_shared" = "xyes"],[ + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) + ]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) + ]) _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result]) @@ -186,6 +194,7 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-fwrapv]) _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt]) _APPEND_COMPILE_FLAGS_ERROR([-pipe]) + _APPEND_COMPILE_FLAGS_ERROR([-Wsizeof-pointer-memaccess]) AS_IF([test "x$ax_enable_debug" = xno], [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], @@ -213,9 +222,12 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-H]) _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) _APPEND_COMPILE_FLAGS_ERROR([-g]) - _APPEND_COMPILE_FLAGS_ERROR([-O0])], - [_APPEND_COMPILE_FLAGS_ERROR([-g]) - _APPEND_COMPILE_FLAGS_ERROR([-O2])]) + _APPEND_COMPILE_FLAGS_ERROR([-O0]), + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) + ],[ + _APPEND_COMPILE_FLAGS_ERROR([-g]) + _APPEND_COMPILE_FLAGS_ERROR([-O2]) + ]) AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) @@ -268,27 +280,32 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) _APPEND_COMPILE_FLAGS_ERROR([-Wc++11-compat]) # _APPEND_COMPILE_FLAGS_ERROR([-Weffc++]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) -# _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-cast]) + AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]), + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) + AS_IF([test "x$enable_shared" = "xyes"],[ + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) + ]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) + ]) +# _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-cast]) _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result]) @@ -301,6 +318,7 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-fwrapv]) _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt]) _APPEND_COMPILE_FLAGS_ERROR([-pipe]) + _APPEND_COMPILE_FLAGS_ERROR([-Wsizeof-pointer-memaccess]) AS_IF([test "x$ax_enable_debug" = xno], [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], -- 2.30.2