From 1f5a9d02c6aa41ded7dfbc0e1b1d22504f0e83fb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Sep 2014 16:33:27 +0300 Subject: In configure add option --enable-static This option enable static build for server binaries and map cache. For plugins this option enable static linking with gcc. --- configure.in | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'configure.in') diff --git a/configure.in b/configure.in index 6b0604e07..ef0dea87c 100644 --- a/configure.in +++ b/configure.in @@ -271,6 +271,29 @@ AC_ARG_ENABLE( ) +# +# static linking +# +AC_ARG_ENABLE( + [static], + AC_HELP_STRING( + [--enable-static], + [ + Enables or Disables Statick Linking (STATIC is disabled by default) + ] + ), + [ + enable_static="$enableval" + case $enableval in + "no");; + "yes");; + *) AC_MSG_ERROR([[invalid argument --enable-static=$disableval... stopping]]);; + esac + ], + [enable_static="no"] +) + + # # adress sanitize # @@ -1251,6 +1274,75 @@ AC_SUBST([HAVE_PCRE]) AC_SUBST([PCRE_LIBS]) AC_SUBST([PCRE_CFLAGS]) + +# +# static Support test +# +if test "$enable_static" != "no" ; then + + STATIC="-static" + PLUGINSTATIC="-static-libgcc" + + OLD_CFLAGS="$CFLAGS" + OLD_LDFLAGS="$LDFLAGS" + OLD_LIBS="$LIBS" + + CFLAGS="$OLD_CFLAGS $MYSQL_CFLAGS $PCRE_CFLAGS -static" + LDFLAGS="$OLD_LDFLAGS -static" + LIBS="$OLD_LIBS $MYSQL_LIBS $PCRE_LIBS" + + AC_MSG_CHECKING([whether $CC supports -static]) + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + int main(int argc, char **argv){ + return 0; + } + ])], + [ + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + STATIC="" + ], + [ + AC_MSG_RESULT([guessing no]) + STATIC="" + ] + ) + CFLAGS="$OLD_CFLAGS -static-libgcc" + LDFLAGS="$OLD_LDFLAGS -static-libgcc" + + AC_MSG_CHECKING([whether $CC supports -static-libgcc]) + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + int main(int argc, char **argv){ + return 0; + } + ])], + [ + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + PLUGINSTATIC="" + ], + [ + AC_MSG_RESULT([guessing no]) + PLUGINSTATIC="" + ] + ) + + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + LIBS="$OLD_LIBS" +fi + +AC_SUBST(STATIC, ${STATIC}) +AC_SUBST(PLUGINSTATIC, ${PLUGINSTATIC}) + + + # # Doxygen, perl (for HPMHookGen) # -- cgit v1.2.3-60-g2f50