summaryrefslogtreecommitdiff
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
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
-rwxr-xr-xconfigure128
-rw-r--r--configure.in92
-rw-r--r--src/char/Makefile.in2
-rw-r--r--src/login/Makefile.in2
-rw-r--r--src/map/Makefile.in2
-rw-r--r--src/plugins/Makefile.in2
-rw-r--r--src/tool/Makefile.in2
7 files changed, 224 insertions, 6 deletions
diff --git a/configure b/configure
index 815b7d21a..33184288b 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in 3a79f91.
+# From configure.in 9c48781.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -626,6 +626,8 @@ LIBOBJS
DLLEXT
HAVE_PERL
HAVE_DOXYGEN
+PLUGINSTATIC
+STATIC
PCRE_CFLAGS
PCRE_LIBS
HAVE_PCRE
@@ -701,6 +703,7 @@ enable_rdtsc
enable_profiler
enable_64bit
enable_lto
+enable_static
enable_sanitize
enable_renewal
with_maxconn
@@ -1352,6 +1355,8 @@ Optional Features:
--disable-64bit Enforce 32bit output on x86_64 systems.
--enable-lto Enables or Disables Linktime Code Optimization (LTO
is enabled by default)
+ --enable-static Enables or Disables Statick Linking (STATIC is
+ disabled by default)
--enable-sanitize Enables or Disables Sanitize Address Checking
(SANITIZE is disabled by default)
--disable-renewal Disable Ragnarok Renewal support (override settings
@@ -3660,6 +3665,26 @@ fi
#
+# static linking
+#
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+ enableval=$enable_static;
+ enable_static="$enableval"
+ case $enableval in
+ "no");;
+ "yes");;
+ *) as_fn_error $? "invalid argument --enable-static=$disableval... stopping" "$LINENO" 5;;
+ esac
+
+else
+ enable_static="no"
+
+fi
+
+
+
+#
# adress sanitize
#
# Check whether --enable-sanitize was given.
@@ -7515,6 +7540,107 @@ fi
+
+#
+# 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"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -static" >&5
+$as_echo_n "checking whether $CC supports -static... " >&6; }
+ if test "$cross_compiling" = yes; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: guessing no" >&5
+$as_echo "guessing no" >&6; }
+ STATIC=""
+
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ int main(int argc, char **argv){
+ return 0;
+ }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ STATIC=""
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ CFLAGS="$OLD_CFLAGS -static-libgcc"
+ LDFLAGS="$OLD_LDFLAGS -static-libgcc"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -static-libgcc" >&5
+$as_echo_n "checking whether $CC supports -static-libgcc... " >&6; }
+ if test "$cross_compiling" = yes; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: guessing no" >&5
+$as_echo "guessing no" >&6; }
+ PLUGINSTATIC=""
+
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ int main(int argc, char **argv){
+ return 0;
+ }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PLUGINSTATIC=""
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+ CFLAGS="$OLD_CFLAGS"
+ LDFLAGS="$OLD_LDFLAGS"
+ LIBS="$OLD_LIBS"
+fi
+
+STATIC=${STATIC}
+
+PLUGINSTATIC=${PLUGINSTATIC}
+
+
+
+
#
# Doxygen, perl (for HPMHookGen)
#
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)
#
diff --git a/src/char/Makefile.in b/src/char/Makefile.in
index 59dc56076..ecb2f8741 100644
--- a/src/char/Makefile.in
+++ b/src/char/Makefile.in
@@ -91,7 +91,7 @@ char-server: ../../char-server@EXEEXT@
../../char-server@EXEEXT@: $(CHAR_SERVER_SQL_DEPENDS) Makefile
@echo " LD $(notdir $@)"
- @$(CC) @LDFLAGS@ -o ../../char-server@EXEEXT@ $(CHAR_OBJ) $(COMMON_D)/obj_sql/common_sql.a \
+ @$(CC) @STATIC@ @LDFLAGS@ -o ../../char-server@EXEEXT@ $(CHAR_OBJ) $(COMMON_D)/obj_sql/common_sql.a \
$(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
# char object files
diff --git a/src/login/Makefile.in b/src/login/Makefile.in
index 7551eed5f..a4aec59cf 100644
--- a/src/login/Makefile.in
+++ b/src/login/Makefile.in
@@ -87,7 +87,7 @@ login-server: ../../login-server@EXEEXT@
../../login-server@EXEEXT@: $(LOGIN_SERVER_SQL_DEPENDS) Makefile
@echo " LD $(notdir $@)"
- @$(CC) @LDFLAGS@ -o ../../login-server@EXEEXT@ $(LOGIN_OBJ) $(COMMON_D)/obj_sql/common_sql.a \
+ @$(CC) @STATIC@ @LDFLAGS@ -o ../../login-server@EXEEXT@ $(LOGIN_OBJ) $(COMMON_D)/obj_sql/common_sql.a \
$(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
# login object files
diff --git a/src/map/Makefile.in b/src/map/Makefile.in
index fc58c9d70..ee8b7ac56 100644
--- a/src/map/Makefile.in
+++ b/src/map/Makefile.in
@@ -104,7 +104,7 @@ map-server: ../../map-server@EXEEXT@
../../map-server@EXEEXT@: $(MAP_SERVER_SQL_DEPENDS) Makefile
@echo " LD $(notdir $@)"
- @$(CC) @LDFLAGS@ -o ../../map-server@EXEEXT@ $(MAP_OBJ) $(COMMON_D)/obj_sql/common_sql.a \
+ @$(CC) @STATIC@ @LDFLAGS@ -o ../../map-server@EXEEXT@ $(MAP_OBJ) $(COMMON_D)/obj_sql/common_sql.a \
$(COMMON_D)/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @PCRE_LIBS@ @MYSQL_LIBS@
# map object files
diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in
index 77040d567..39f445319 100644
--- a/src/plugins/Makefile.in
+++ b/src/plugins/Makefile.in
@@ -80,4 +80,4 @@ Makefile: Makefile.in
../../plugins/%@DLLEXT@: %.c $(ALL_H) $$(shell ls %/* 2>/dev/null)
@echo " CC $<"
- @$(CC) @DEFS@ @CFLAGS@ @CPPFLAGS@ @LDFLAGS@ @SOFLAGS@ -o $@ $<
+ @$(CC) @PLUGINSTATIC@ @DEFS@ @CFLAGS@ @CPPFLAGS@ @LDFLAGS@ @SOFLAGS@ -o $@ $<
diff --git a/src/tool/Makefile.in b/src/tool/Makefile.in
index 127d3841b..2d7699db0 100644
--- a/src/tool/Makefile.in
+++ b/src/tool/Makefile.in
@@ -36,7 +36,7 @@ mapcache: ../../mapcache@EXEEXT@
../../mapcache@EXEEXT@: $(MAPCACHE_DEPENDS) Makefile
@echo " LD $(notdir $@)"
- @$(CC) @LDFLAGS@ -o ../../mapcache@EXEEXT@ $(MAPCACHE_DEPENDS) @LIBS@
+ @$(CC) @STATIC@ @LDFLAGS@ -o ../../mapcache@EXEEXT@ $(MAPCACHE_DEPENDS) @LIBS@
buildclean:
@echo " CLEAN tool (build temp files)"