From 260c37acecc99aacd0ebcbd74537d0008f6888ef Mon Sep 17 00:00:00 2001 From: John Safranek Date: Fri, 14 Feb 2014 15:59:59 -0800 Subject: [PATCH] Update autoconf scripts 1. Since AX_HARDEN is called always, moved the few items set in configure for gcc-hardening to AX_HARDEN. 2. Dropped the macros that AX_DEBUG was setting that we haven't been using and aren't using now. --- configure.ac | 12 +----------- m4/ax_debug.m4 | 4 +--- m4/ax_harden_compiler_flags.m4 | 1 + 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index eded5ddef..e1ed459fb 100644 --- a/configure.ac +++ b/configure.ac @@ -95,6 +95,7 @@ AC_TYPE_UINT8_T AM_PROG_AS AM_PROG_CC_C_O LT_LIB_M +AX_HARDEN_CC_COMPILER_FLAGS OPTIMIZE_CFLAGS="-Os -fomit-frame-pointer" OPTIMIZE_FAST_CFLAGS="-O2 -fomit-frame-pointer" @@ -1554,17 +1555,6 @@ fi LIB_SOCKET_NSL -AC_ARG_ENABLE([gcc-hardening], -AS_HELP_STRING(--enable-gcc-hardening, Enable compiler security checks (default: disabled)), -[if test x$enableval = xyes; then - AM_CFLAGS="$AM_CFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector-all" - AM_CFLAGS="$AM_CFLAGS -fwrapv -fPIE -Wstack-protector" - AM_CFLAGS="$AM_CFLAGS --param ssp-buffer-size=1" - LDFLAGS="$LDFLAGS -pie" -fi]) - -AX_HARDEN_CC_COMPILER_FLAGS - # link to ws2_32 if on mingw case $host_os in *mingw32) diff --git a/m4/ax_debug.m4 b/m4/ax_debug.m4 index 7696a1147..63c883c34 100644 --- a/m4/ax_debug.m4 +++ b/m4/ax_debug.m4 @@ -51,9 +51,7 @@ AC_DEFUN([AX_DEBUG], [AS_HELP_STRING([--enable-debug], [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])], [ax_enable_debug=yes - AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.]) - AX_ADD_AM_MACRO([AM_YFLAGS += --debug]) - AX_ADD_AM_MACRO([AM_CPPFLAGS += -D_GLIBCXX_DEBUG])], + AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.])], [ax_enable_debug=no AC_SUBST([MCHECK]) AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])]) diff --git a/m4/ax_harden_compiler_flags.m4 b/m4/ax_harden_compiler_flags.m4 index 6f01c1aca..c02af319d 100644 --- a/m4/ax_harden_compiler_flags.m4 +++ b/m4/ax_harden_compiler_flags.m4 @@ -156,6 +156,7 @@ AX_APPEND_COMPILE_FLAGS([-Wunused-variable],,[$ax_append_compile_cflags_extra]) AX_APPEND_COMPILE_FLAGS([-Wwrite-strings],,[$ax_append_compile_cflags_extra]) AX_APPEND_COMPILE_FLAGS([-fwrapv],,[$ax_append_compile_cflags_extra]) + AX_APPEND_COMPILE_FLAGS([-fPIE],,[$ax_append_compile_cflags_extra]) AC_LANG_POP ])