X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=m4%2Fax_harden_compiler_flags.m4;h=b31518aaa624e197e6e09c43951af422f473d294;hb=c2c9d14f605d54ec6e7d24551fdfa2ceee7d7258;hp=66de89d358a7ae3939c5a795d7d4aaa7133d7dc3;hpb=17690735658d7b44f91579df91e31da9ae185158;p=awesomized%2Flibmemcached diff --git a/m4/ax_harden_compiler_flags.m4 b/m4/ax_harden_compiler_flags.m4 index 66de89d3..b31518aa 100644 --- a/m4/ax_harden_compiler_flags.m4 +++ b/m4/ax_harden_compiler_flags.m4 @@ -61,9 +61,10 @@ AC_DEFUN([_WARNINGS_AS_ERRORS], ]) ]) +# Note: Should this be LIBS or LDFLAGS? AC_DEFUN([_APPEND_LINK_FLAGS_ERROR], [AC_REQUIRE([AX_APPEND_LINK_FLAGS]) - AX_APPEND_LINK_FLAGS([$1],[LIB],[-Werror]) + AX_APPEND_LINK_FLAGS([$1],[LDFLAGS],[-Werror]) ]) AC_DEFUN([_APPEND_COMPILE_FLAGS_ERROR], @@ -75,7 +76,7 @@ AC_DEFUN([_APPEND_COMPILE_FLAGS_ERROR], AC_DEFUN([_HARDEN_LINKER_FLAGS], [_APPEND_LINK_FLAGS_ERROR([-z relro -z now]) - _APPEND_LINK_FLAGS_ERROR([-pie]) + #_APPEND_LINK_FLAGS_ERROR([-pie]) AS_IF([test "x$ac_cv_warnings_as_errors" = xyes], [AX_APPEND_LINK_FLAGS([-Werror])]) ]) @@ -91,7 +92,10 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], [_APPEND_COMPILE_FLAGS_ERROR([-g]) _APPEND_COMPILE_FLAGS_ERROR([-O2])]) - _APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas]) + AS_IF([test "x$ac_cv_vcs_checkout" = xyes], + [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])], + [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) + _APPEND_COMPILE_FLAGS_ERROR([-Wall]) _APPEND_COMPILE_FLAGS_ERROR([-Wextra]) _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas]) @@ -148,17 +152,13 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], AS_IF([test "x$ax_enable_debug" = xno], [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], - [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) - AS_IF([test "x$ac_c_gcc_recent" = xyes], - [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2]) -# _APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) - _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector]) -# _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) - ])])]) - - AS_IF([test "x$ac_cv_vcs_checkout" = xyes], - [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])], - [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) + [AS_IF([test "x${target_os}" != "xmingw"], + [AS_IF([test "x$ac_c_gcc_recent" = xyes], + [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2]) + #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) + #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector]) + _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) + ])])])]) AS_IF([test "x$ac_cv_warnings_as_errors" = xyes], [AX_APPEND_FLAG([-Werror])]) @@ -231,13 +231,13 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], AS_IF([test "x$ax_enable_debug" = xno], [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], - [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) - AS_IF([test "x$ac_c_gcc_recent" = xyes], - [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2]) -# _APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) - _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector]) -# _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) - ])])]) + [AS_IF([test "x${target_os}" != "xmingw"], + [AS_IF([test "x$ac_c_gcc_recent" = xyes], + [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2]) + #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) + #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector]) + _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) + ])])])]) AS_IF([test "x$ac_cv_warnings_as_errors" = xyes], [AX_APPEND_FLAG([-Werror])])