From e92b2d8da64e6b461fa093fd99a2a7dc946d2506 Mon Sep 17 00:00:00 2001 From: alexhudson Date: Sat, 6 Sep 2008 11:35:28 +0000 Subject: [PATCH] Turn off stack protection on older glibcs; in theory it should work, in practice the linker complains bitterly. :( --- m4/gcc_stack_protect.m4 | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/m4/gcc_stack_protect.m4 b/m4/gcc_stack_protect.m4 index 13c5e0a..70db1a5 100644 --- a/m4/gcc_stack_protect.m4 +++ b/m4/gcc_stack_protect.m4 @@ -85,15 +85,30 @@ AC_DEFUN([GCC_STACK_PROTECT_CXX],[ fi ]) +dnl By default, we don't enable unless we're on glibc 2.5 or better. +dnl For some reason, linking on Debian etch (glibc=2.3, gcc=4.1) completely +dnl fails unless -shared is in CCLD/CXXLD, but setting that flag causes +dnl other configure tests to fail :( For now, I'm giving up on those +dnl old versions since time will fix this bug for us (I hope!) + AC_DEFUN([GCC_STACK_PROTECTOR],[ - GCC_STACK_PROTECT_LIB + dnl -lssp shouldn't even be needed on recent glibc/gcc + dnl GCC_STACK_PROTECT_LIB - AC_LANG_PUSH([C]) - GCC_STACK_PROTECT_CC - AC_LANG_POP([C]) + AC_MSG_CHECKING([for GNU libc 2.4 or better]) + AC_EGREP_CPP(yes, [ + #include + #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 4 + yes + #endif], [glibc_24=yes; AC_MSG_RESULT(yes)], AC_MSG_RESULT(no)) + if test "x$glibc_24" == "xyes"; then + AC_LANG_PUSH([C]) + GCC_STACK_PROTECT_CC + AC_LANG_POP([C]) - AC_LANG_PUSH([C++]) - GCC_STACK_PROTECT_CXX - AC_LANG_POP([C++]) + AC_LANG_PUSH([C++]) + GCC_STACK_PROTECT_CXX + AC_LANG_POP([C++]) + fi ])