summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2014-10-23 21:24:50 +0200
committerHaruna <haru@dotalux.com>2014-10-23 21:24:50 +0200
commit32d658cc23e4f935a388876a8525ac0e7159154a (patch)
tree2a2cea46c0fa8076be0c9f94c13f9f07edb0cbcf /configure.in
parent3579235602638631f5d6e10e18567291d5de1350 (diff)
parent1f5a9d02c6aa41ded7dfbc0e1b1d22504f0e83fb (diff)
downloadhercules-32d658cc23e4f935a388876a8525ac0e7159154a.tar.gz
hercules-32d658cc23e4f935a388876a8525ac0e7159154a.tar.bz2
hercules-32d658cc23e4f935a388876a8525ac0e7159154a.tar.xz
hercules-32d658cc23e4f935a388876a8525ac0e7159154a.zip
Merge pull request #347 from 4144/static
In configure add option --enable-static
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in92
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)
#