diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-03-07 00:56:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-03-07 00:56:53 +0300 |
commit | 743f46105e1fc10acf08bd5c79cfbf3ca571282a (patch) | |
tree | 5c3346f080bf80c0c65b993dda5c9a5405027144 | |
parent | abe7009c7347dd2821bc687d8eb692bac2609bc2 (diff) | |
download | plus-743f46105e1fc10acf08bd5c79cfbf3ca571282a.tar.gz plus-743f46105e1fc10acf08bd5c79cfbf3ca571282a.tar.bz2 plus-743f46105e1fc10acf08bd5c79cfbf3ca571282a.tar.xz plus-743f46105e1fc10acf08bd5c79cfbf3ca571282a.zip |
Enable -rdynamic flag only if it supported by linker.
-rwxr-xr-x | configure.ac | 54 | ||||
-rw-r--r-- | src/Makefile.am | 4 |
2 files changed, 58 insertions, 0 deletions
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 diff --git a/src/Makefile.am b/src/Makefile.am index 3a456a35e..89f09413e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -46,9 +46,11 @@ endif if ENABLE_ASSERTS manaplus_CXXFLAGS += -DENABLE_ASSERTS dyecmd_CXXFLAGS += -DENABLE_ASSERTS +if HAVE_RDYNAMIC manaplus_LDFLAGS = -rdynamic dyecmd_LDFLAGS = -rdynamic endif +endif if ENABLE_PUGIXML manaplus_CXXFLAGS += -DENABLE_PUGIXML @@ -1947,8 +1949,10 @@ manaplustests_CXXFLAGS += -Werror endif if ENABLE_ASSERTS manaplustests_CXXFLAGS += -DENABLE_ASSERTS +if HAVE_RDYNAMIC manaplustests_LDFLAGS = -rdynamic endif +endif if ENABLE_GLIBCDEBUG manaplustests_CXXFLAGS += -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC endif |