Fix for some platforms that didn't want to insert the harden LIB in some cases.

This commit is contained in:
Brian Aker 2012-10-20 20:07:30 -04:00
parent 1be873533e
commit db8bd91488
2 changed files with 18 additions and 5 deletions

View File

@ -707,6 +707,7 @@ echo " * C Flags: $CFLAGS"
echo " * C++ Compiler: $CXX_VERSION"
echo " * C++ Flags: $CXXFLAGS"
echo " * CPP Flags: $CPPFLAGS"
echo " * LIB Flags: $LIB"
echo " * Assertions enabled: $ac_cv_assert"
echo " * Debug enabled: $with_debug"
echo " * Warnings as failure: $ac_cv_warnings_as_errors"

View File

@ -68,16 +68,28 @@
AC_REQUIRE([AX_DEBUG])
AC_REQUIRE([AX_CXX_COMPILER_VERSION])
dnl If we are inside of VCS we append -Werror, otherwise we just use it to test other flags
AX_HARDEN_LIB=
ax_append_compile_link_flags_extra=
AS_IF([test "$ac_cv_vcs_checkout" = "yes"], [
AX_CHECK_LINK_FLAG([-Werror])
AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"],[
AX_CHECK_LINK_FLAG([-Werror],[
AX_HARDEN_LIB="-Werror $AX_HARDEN_LIB"
])
],[
AX_CHECK_LINK_FLAG([-Werror],[
ax_append_compile_link_flags_extra=$ax_cv_check_ldflags___Werror
ax_append_compile_link_flags_extra='-Werror'
])
])
AX_CHECK_LINK_FLAG([-z relro -z now],,[$ax_append_compile_link_flags_extra])
AX_CHECK_LINK_FLAG([-pie],,[$ax_append_compile_link_flags_extra])
AX_CHECK_LINK_FLAG([-z relro -z now],[
AX_HARDEN_LIB="-z relro -z now $AX_HARDEN_LIB"
],,[$ax_append_compile_link_flags_extra])
AX_CHECK_LINK_FLAG([-pie],[
AX_HARDEN_LIB="-pie $AX_HARDEN_LIB"
],,[$ax_append_compile_link_flags_extra])
LIB="$LIB $AX_HARDEN_LIB"
])
AC_DEFUN([AX_HARDEN_CC_COMPILER_FLAGS], [