summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-13 16:33:27 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-23 21:52:03 +0300
commit1f5a9d02c6aa41ded7dfbc0e1b1d22504f0e83fb (patch)
tree2a2cea46c0fa8076be0c9f94c13f9f07edb0cbcf /configure.in
parent3579235602638631f5d6e10e18567291d5de1350 (diff)
downloadhercules-1f5a9d02c6aa41ded7dfbc0e1b1d22504f0e83fb.tar.gz
hercules-1f5a9d02c6aa41ded7dfbc0e1b1d22504f0e83fb.tar.bz2
hercules-1f5a9d02c6aa41ded7dfbc0e1b1d22504f0e83fb.tar.xz
hercules-1f5a9d02c6aa41ded7dfbc0e1b1d22504f0e83fb.zip
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.
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)
#