diff options
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/configure.in b/configure.in index 6b0604e07..ef0dea87c 100644 --- a/configure.in +++ b/configure.in @@ -272,6 +272,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 # AC_ARG_ENABLE( @@ -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) # |