From d37fe74804b94065259703509b4b3dc3f53c30a5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 28 Apr 2016 03:15:10 +0300 Subject: Rename static configure flag, look like clang have issues with this flag enabled. --- configure.ac | 34 ++++++++++++++++++++++++++++------ src/Makefile.am | 4 ++-- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index bec3c79..11d8ca1 100644 --- a/configure.ac +++ b/configure.ac @@ -35,24 +35,24 @@ AC_ARG_ENABLE( AM_CONDITIONAL(ENABLE_SANITIZE, test x$enable_sanitize = xyes) AC_ARG_ENABLE( - [static], + [static-build], AC_HELP_STRING( - [--enable-static], + [--enable-static-build], [ Enables or Disables Statick Linking (STATIC is disabled by default) ] ), [ - enable_static="$enableval" + enable_static_build="$enableval" case $enableval in "no");; "yes");; - *) AC_MSG_ERROR([[invalid argument --enable-static=$disableval... stopping]]);; + *) AC_MSG_ERROR([[invalid argument --enable-static-build=$disableval... stopping]]);; esac ], - [enable_static="no"] + [enable_static_build="no"] ) -AM_CONDITIONAL(ENABLE_STATIC, test x$enable_static = xyes) +AM_CONDITIONAL(ENABLE_STATIC_BUILD, test x$enable_static_build = xyes) AC_ARG_ENABLE( [gprof], @@ -94,6 +94,28 @@ AC_ARG_ENABLE( ) AM_CONDITIONAL(ENABLE_WERROR, test x$enable_werror = xyes) +OLD_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS -rdynamic" +AC_MSG_CHECKING([whether $CC accepts -rdynamic]) +AC_LINK_IFELSE( + [AC_LANG_SOURCE([ + int main(int argc, char **argv) + { + return 0; + } + ])], + [ + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + LDFLAGS="$OLD_LDFLAGS" + ], + [ + AC_MSG_RESULT([guessing no]) + ] +) + AC_DEFUN([AC_CHECK_COMPILER_WFLAG], [ AC_MSG_CHECKING([whether $CC supports -W$1]) diff --git a/src/Makefile.am b/src/Makefile.am index 56c6887..25afa53 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -112,7 +112,7 @@ MAP_SRC = emap/atcommand.c \ # need remove -Wno-unused -SHARED_CFLAGS = ${CFLAGS} -pipe -ffast-math -fvisibility=hidden -rdynamic -std=c99 -Wall -Wextra -Wno-sign-compare -Wno-unused \ +SHARED_CFLAGS = ${CFLAGS} -pipe -ffast-math -fvisibility=hidden -std=c99 -Wall -Wextra -Wno-sign-compare -Wno-unused \ -DPCRE_SUPPORT -I../../.. -I../../../../3rdparty -DPACKETVER=20150000 SHARED_LDFLAGS = -avoid-version -Wl,--no-undefined @@ -134,7 +134,7 @@ SHARED_LDFLAGS += -lasan -lubsan -fsanitize=address \ -fsanitize=enum -fsanitize=vptr endif -if ENABLE_STATIC +if ENABLE_STATIC_BUILD SHARED_CFLAGS += "-static-libgcc" endif -- cgit v1.2.3-60-g2f50