From 743f46105e1fc10acf08bd5c79cfbf3ca571282a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 7 Mar 2017 00:56:53 +0300 Subject: Enable -rdynamic flag only if it supported by linker. --- configure.ac | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 4df89a250..406fc3688 100755 --- a/configure.ac +++ b/configure.ac @@ -580,6 +580,60 @@ if test "x$naclbuild_enabled" == "xtrue"; then AC_CHECK_SDL() fi +AC_DEFUN([AC_CHECK_CXX_FLAG], + [ + AC_MSG_CHECKING([whether $CC supports $1]) + OLD_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -Werror $1" + test_flag=no + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([int foo;])], + [ + AC_MSG_RESULT([yes]) + test_flag=yes + ], + [ + AC_MSG_RESULT([no]) + test_flag=no + ] + CXXFLAGS="$OLD_CXXFLAGS" + ) + AM_CONDITIONAL($2, test x$test_flag = xtrue) + ] +) + +AC_DEFUN([AC_CHECK_LD_FLAG], + [ + AC_MSG_CHECKING([whether $LD supports $1]) + OLD_CXXFLAGS="$CXXFLAGS" + OLD_LDFLAGS="$LDFLAGS" + CXXFLAGS="" + LDFLAGS="$LDFLAGS $1" + test_flag=no + AC_LINK_IFELSE( + [AC_LANG_SOURCE([ + int main(int argc, char **argv) + { + return 0; + } + ])], + [ + AC_MSG_RESULT([yes]) + test_flag=yes + ], + [ + AC_MSG_RESULT([no]) + test_flag=no + ] + CXXFLAGS="$OLD_CXXFLAGS" + LDFLAGS="$OLD_LDFLAGS" + ) + AM_CONDITIONAL($2, test x$test_flag = xyes) + ] +) + +AC_CHECK_LD_FLAG(-rdynamic, HAVE_RDYNAMIC) + AC_CONFIG_FILES([ manaplus.spec Makefile -- cgit v1.2.3-70-g09d2