Fix r10617 to work with autoconf versions before 2.65 as well

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@10171 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2010-03-06 17:10:11 +00:00 committed by Git SVN Gateway
parent 24cd201a00
commit 9cfa838355
1 changed files with 20 additions and 30 deletions

View File

@ -29,35 +29,6 @@ m4_define([stack_protector_c_test_program],
])
AC_DEFUN([AX_STACK_PROTECT_CC],[
dnl Function to compile as C, but link as C++. This should catch errors
dnl where the C compiler and C++ compiler that are used are from
dnl different versions or vendors.
AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_try_link_as_cxx],
[AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_try_link_as_cxx], [LINENO],
[Try to link conftest.$ac_ext as C++, and return whether this succeeded.])],
[
AS_LINENO_PUSH([$[]1])
rm -f conftest.$ac_objext conftest$ac_exeext
AS_IF([_AC_DO_STDERR($ac_compile) &&
_AC_DO_STDERR($CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD) && {
test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
AS_TEST_X([conftest$ac_exeext])
}],
[ac_retval=0],
[_AC_MSG_LOG_CONFTEST
ac_retval=1])
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
AS_LINENO_POP
AS_SET_STATUS([$ac_retval])
])
AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
AC_LANG_PUSH([C])
@ -74,7 +45,26 @@ AC_DEFUN([AX_STACK_PROTECT_CC],[
AC_LINK_IFELSE([stack_protector_c_test_program], [
dnl Try to compile as C and link as C++
AC_LANG_CONFTEST([stack_protector_c_test_program])
AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_try_link_as_cxx "$LINENO"], AC_MSG_RESULT(yes), [
AS_IF([{
rm -f conftest.$ac_objext conftest$ac_exeext
AS_IF([_AC_DO_STDERR($ac_compile) &&
_AC_DO_STDERR($CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD) && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
AS_TEST_X([conftest$ac_exeext])
}],
[ac_retval=0],
[_AC_MSG_LOG_CONFTEST
ac_retval=1])
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
test "$ac_retval" = 0
}], AC_MSG_RESULT(yes), [
CFLAGS="$OLD_CFLAGS"
AC_MSG_RESULT(no)
])