From 3abdd4484cca514988ff190f0547811d48f41031 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 10 Dec 2016 11:36:55 +0100 Subject: Added check for -Wl,--no-undefined or -Wl,-undefined,error in the CXX to be able to support no-undefined during linking with clang. --- configure.ac | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 8f2c71a..120944c 100644 --- a/configure.ac +++ b/configure.ac @@ -70,9 +70,37 @@ HUGIN_PARM="-DDISABLE_HUGIN" AC_ARG_WITH([debug], AS_HELP_STRING([--with-debug], [Build with debug support])) +dnl =========================== +dnl Check for -Wl,--no-undefined or -Wl,-undefined,error support +dnl =========================== +TMP_CXXFLAGS="$CXXFLAGS" +AC_MSG_CHECKING([whether CXX supports '-Wl,--no-undefined']) +CXXFLAGS=-Wl,--no-undefined +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [ AC_MSG_RESULT([yes]) + NO_UNDEFINED_PARAM=-Wl,--no-undefined + ], + [ AC_MSG_RESULT([no]) + AC_MSG_CHECKING([whether CXX supports '-Wl,-undefined,error']) + CXXFLAGS=-Wl,-undefined,error + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes]) + NO_UNDEFINED_PARAM=-Wl,-undefined,error + ], + [AC_MSG_RESULT([no]) + NO_UNDEFINED_PARAM="" + ] + ) + ] +) +CXXFLAGS="$TMP_CXXFLAGS" + +dnl =========================== +dnl Set up debug compile args if the user requested it +dnl =========================== AS_IF([test "x$with_debug" == "xyes"], [AC_MSG_WARN([*** Building with debug support!]) - CXXFLAGS="$CXXFLAGS -Wall -Werror -g -Wl,--no-undefined" + CXXFLAGS="$CXXFLAGS -Wall -Werror -g $NO_UNDEFINED_PARAM" HUGIN_PARM=""] ) -- cgit v1.2.3