summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-05-24 00:38:25 +0200
committerHaru <haru@dotalux.com>2014-05-25 17:13:24 +0200
commitb7373b6de5b41a4b420741da9ebf0570e36c11c7 (patch)
tree0058b108f2df1745b86cbadfb48fea9fa0aad4bf
parent9089ea1e9998663f0573abca89ed542f19418b11 (diff)
downloadhercules-b7373b6de5b41a4b420741da9ebf0570e36c11c7.tar.gz
hercules-b7373b6de5b41a4b420741da9ebf0570e36c11c7.tar.bz2
hercules-b7373b6de5b41a4b420741da9ebf0570e36c11c7.tar.xz
hercules-b7373b6de5b41a4b420741da9ebf0570e36c11c7.zip
Improved CFLAGS/CPPFLAGS handling
- Language extensions, such as _GNU_SOURCE are now enabled through CPPFLAGS by the configure script, rather than within the source code. - Moved some configure-time CFLAGS to CPPFLAGS, where appropriate. - Fixes bugreport:8211, thanks to Neoth http://hercules.ws/board/tracker/issue-8211-compiling-warning-in-linux Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--3rdparty/libconfig/Makefile.in2
-rw-r--r--3rdparty/mt19937ar/Makefile.in2
-rw-r--r--Makefile.in4
-rwxr-xr-xconfigure423
-rw-r--r--configure.in66
-rw-r--r--src/char/Makefile.in4
-rw-r--r--src/common/Makefile.in8
-rw-r--r--src/common/strlib.h9
-rw-r--r--src/login/Makefile.in4
-rw-r--r--src/map/Makefile.in4
-rw-r--r--src/plugins/Makefile.in2
-rw-r--r--src/test/Makefile.in4
-rw-r--r--src/tool/Makefile.in4
-rw-r--r--tools/HPMHookGen/Makefile.in2
14 files changed, 322 insertions, 216 deletions
diff --git a/3rdparty/libconfig/Makefile.in b/3rdparty/libconfig/Makefile.in
index e27aab30a..4eb1acc16 100644
--- a/3rdparty/libconfig/Makefile.in
+++ b/3rdparty/libconfig/Makefile.in
@@ -1,6 +1,8 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
+# @configure_input@
+
LIBCONFIG_OBJ = libconfig.o grammar.o scanctx.o scanner.o strbuf.o
LIBCONFIG_H = libconfig.h grammar.h parsectx.h scanctx.h scanner.h strbuf.h wincompat.h
diff --git a/3rdparty/mt19937ar/Makefile.in b/3rdparty/mt19937ar/Makefile.in
index 61f0556be..9f49f3a81 100644
--- a/3rdparty/mt19937ar/Makefile.in
+++ b/3rdparty/mt19937ar/Makefile.in
@@ -1,6 +1,8 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
+# @configure_input@
+
MT19937AR_OBJ = mt19937ar.o
MT19937AR_H = mt19937ar.h
diff --git a/Makefile.in b/Makefile.in
index e987c713f..4a1ac2a72 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,8 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
+# @configure_input@
+
@SET_MAKE@
HAVE_MYSQL=@HAVE_MYSQL@
@@ -145,7 +147,7 @@ distclean: clean
@-rm -f $(MF_TARGETS) config.status config.log
sysinfo:
- @./sysinfogen.sh src/common/sysinfo_new.inc @CFLAGS@
+ @./sysinfogen.sh src/common/sysinfo_new.inc @CFLAGS@ @CPPFLAGS@
@if cmp -s src/common/sysinfo.inc src/common/sysinfo_new.inc; then \
rm src/common/sysinfo_new.inc ; \
else \
diff --git a/configure b/configure
index 16bb8a738..c521b9375 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in 8801585.
+# From configure.in 7ed8f70.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -3433,7 +3433,6 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
-
#
# Memory managers
#
@@ -3686,19 +3685,19 @@ fi
if test "${with_maxconn+set}" = set; then :
withval=$with_maxconn;
if test "$withval" == "no"; then
- CFLAGS="$CFLAGS -DMAXCONN=16384"
+ CPPFLAGS="$CPPFLAGS -DMAXCONN=16384"
else
if ! test "$withval" -ge 0 -o "$withval" -lt 0 2>&- ; then
as_fn_error $? "Invalid argument --with-maxconn=$withval ... stopping" "$LINENO" 5
else
- CFLAGS="$CFLAGS -DMAXCONN=$withval"
+ CPPFLAGS="$CPPFLAGS -DMAXCONN=$withval"
fi
fi
else
- CFLAGS="$CFLAGS -DMAXCONN=16384"
+ CPPFLAGS="$CPPFLAGS -DMAXCONN=16384"
fi
@@ -4945,7 +4944,7 @@ if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- CFLAGS="$CFLAGS -DHAS_TLS"
+ CPPFLAGS="$CPPFLAGS -DHAS_TLS"
else
@@ -6144,7 +6143,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
#
ac_fn_c_check_func "$LINENO" "setrlimit" "ac_cv_func_setrlimit"
if test "x$ac_cv_func_setrlimit" = xyes; then :
- CFLAGS="$CFLAGS -DHAVE_SETRLIMIT"
+ CPPFLAGS="$CPPFLAGS -DHAVE_SETRLIMIT"
fi
@@ -6154,7 +6153,7 @@ fi
#
ac_fn_c_check_func "$LINENO" "strnlen" "ac_cv_func_strnlen"
if test "x$ac_cv_func_strnlen" = xyes; then :
- CFLAGS="$CFLAGS -DHAVE_STRNLEN"
+ CPPFLAGS="$CPPFLAGS -DHAVE_STRNLEN"
fi
@@ -6210,13 +6209,13 @@ done
#
case $enable_manager in
"no")
- CFLAGS="$CFLAGS -DNO_MEMMGR"
+ CPPFLAGS="$CPPFLAGS -DNO_MEMMGR"
;;
"builtin")
# enabled by default
;;
"memwatch")
- CFLAGS="$CFLAGS -DMEMWATCH"
+ CPPFLAGS="$CPPFLAGS -DMEMWATCH"
ac_fn_c_check_header_mongrel "$LINENO" "memwatch.h" "ac_cv_header_memwatch_h" "$ac_includes_default"
if test "x$ac_cv_header_memwatch_h" = xyes; then :
@@ -6227,7 +6226,7 @@ fi
;;
"dmalloc")
- CFLAGS="$CFLAGS -DDMALLOC -DDMALLOC_FUNC_CHECK"
+ CPPFLAGS="$CPPFLAGS -DDMALLOC -DDMALLOC_FUNC_CHECK"
LIBS="$LIBS -ldmalloc"
ac_fn_c_check_header_mongrel "$LINENO" "dmalloc.h" "ac_cv_header_dmalloc_h" "$ac_includes_default"
if test "x$ac_cv_header_dmalloc_h" = xyes; then :
@@ -6239,7 +6238,7 @@ fi
;;
"gcollect")
- CFLAGS="$CFLAGS -DGCOLLECT"
+ CPPFLAGS="$CPPFLAGS -DGCOLLECT"
LIBS="$LIBS -lgc"
ac_fn_c_check_header_mongrel "$LINENO" "gc.h" "ac_cv_header_gc_h" "$ac_includes_default"
if test "x$ac_cv_header_gc_h" = xyes; then :
@@ -6251,7 +6250,7 @@ fi
;;
"bcheck")
- CFLAGS="$CFLAGS -DBCHECK"
+ CPPFLAGS="$CPPFLAGS -DBCHECK"
;;
esac
@@ -6260,7 +6259,7 @@ esac
# Packetver
#
if test -n "$enable_packetver" ; then
- CFLAGS="$CFLAGS -DPACKETVER=$enable_packetver"
+ CPPFLAGS="$CPPFLAGS -DPACKETVER=$enable_packetver"
fi
#
@@ -6268,7 +6267,7 @@ fi
#
case $enable_packetver_re in
"yes")
- CFLAGS="$CFLAGS -DENABLE_PACKETVER_RE"
+ CPPFLAGS="$CPPFLAGS -DENABLE_PACKETVER_RE"
;;
"no")
# default value
@@ -6279,7 +6278,7 @@ esac
# Obfuscation keys
#
if test -n "$obfuscationkey1" -a -n "$obfuscationkey2" -a -n "$obfuscationkey3"; then
- CFLAGS="$CFLAGS -DOBFUSCATIONKEY1=$obfuscationkey1 -DOBFUSCATIONKEY2=$obfuscationkey2 -DOBFUSCATIONKEY3=$obfuscationkey3"
+ CPPFLAGS="$CPPFLAGS -DOBFUSCATIONKEY1=$obfuscationkey1 -DOBFUSCATIONKEY2=$obfuscationkey2 -DOBFUSCATIONKEY3=$obfuscationkey3"
fi
#
@@ -6291,10 +6290,12 @@ case $enable_debug in
# CFLAGS="$CFLAGS -Wno-unused -Wno-parentheses"
;;
"yes")
- CFLAGS="$CFLAGS -g -DDEBUG"
+ CFLAGS="$CFLAGS -g"
+ CPPFLAGS="$CPPFLAGS -DDEBUG"
;;
"gdb")
- CFLAGS="$CFLAGS -ggdb -DDEBUG"
+ CFLAGS="$CFLAGS -ggdb"
+ CPPFLAGS="$CPPFLAGS -DDEBUG"
;;
esac
@@ -6306,7 +6307,7 @@ case $enable_buildbot in
# default value
;;
"yes")
- CFLAGS="$CFLAGS -DBUILDBOT"
+ CPPFLAGS="$CPPFLAGS -DBUILDBOT"
;;
esac
@@ -6318,7 +6319,7 @@ case $enable_rdtsc in
#default value
;;
1)
- CFLAGS="$CFLAGS -DENABLE_RDTSC"
+ CPPFLAGS="$CPPFLAGS -DENABLE_RDTSC"
;;
esac
@@ -6341,7 +6342,7 @@ esac
#
case $enable_renewal in
"no")
- CFLAGS="$CFLAGS -DDISABLE_RENEWAL"
+ CPPFLAGS="$CPPFLAGS -DDISABLE_RENEWAL"
;;
"yes")
# default value
@@ -6355,13 +6356,12 @@ if test -n "${ZLIB_HOME}" ; then
LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateEnd in -lz" >&5
-$as_echo_n "checking for inflateEnd in -lz... " >&6; }
-if ${ac_cv_lib_z_inflateEnd+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inflateEnd" >&5
+$as_echo_n "checking for library containing inflateEnd... " >&6; }
+if ${ac_cv_search_inflateEnd+:} false; then :
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz $LIBS"
+ ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6380,23 +6380,35 @@ return inflateEnd ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_z_inflateEnd=yes
-else
- ac_cv_lib_z_inflateEnd=no
+for ac_lib in '' z; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_inflateEnd=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ conftest$ac_exeext
+ if ${ac_cv_search_inflateEnd+:} false; then :
+ break
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateEnd" >&5
-$as_echo "$ac_cv_lib_z_inflateEnd" >&6; }
-if test "x$ac_cv_lib_z_inflateEnd" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBZ 1
-_ACEOF
+done
+if ${ac_cv_search_inflateEnd+:} false; then :
- LIBS="-lz $LIBS"
+else
+ ac_cv_search_inflateEnd=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inflateEnd" >&5
+$as_echo "$ac_cv_search_inflateEnd" >&6; }
+ac_res=$ac_cv_search_inflateEnd
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
as_fn_error $? "zlib library not found or incompatible, please specify the correct path with --with-zlib=DIR... stopping" "$LINENO" 5
@@ -6572,7 +6584,7 @@ if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- CFLAGS="$CFLAGS -DHAVE_MONOTONIC_CLOCK"
+ CPPFLAGS="$CPPFLAGS -DHAVE_MONOTONIC_CLOCK"
else
@@ -6592,13 +6604,12 @@ fi
#
# pthread
#
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
-$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_create+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5
+$as_echo_n "checking for library containing pthread_create... " >&6; }
+if ${ac_cv_search_pthread_create+:} false; then :
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+ ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6617,35 +6628,46 @@ return pthread_create ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_pthread_create=yes
-else
- ac_cv_lib_pthread_pthread_create=no
+for ac_lib in '' pthread; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_pthread_create=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ conftest$ac_exeext
+ if ${ac_cv_search_pthread_create+:} false; then :
+ break
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
+done
+if ${ac_cv_search_pthread_create+:} false; then :
- LIBS="-lpthread $LIBS"
+else
+ ac_cv_search_pthread_create=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_create" >&5
+$as_echo "$ac_cv_search_pthread_create" >&6; }
+ac_res=$ac_cv_search_pthread_create
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
as_fn_error $? "pthread library not found or incompatible" "$LINENO" 5
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_sigmask in -lpthread" >&5
-$as_echo_n "checking for pthread_sigmask in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_sigmask+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_sigmask" >&5
+$as_echo_n "checking for library containing pthread_sigmask... " >&6; }
+if ${ac_cv_search_pthread_sigmask+:} false; then :
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+ ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6664,35 +6686,46 @@ return pthread_sigmask ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_pthread_sigmask=yes
-else
- ac_cv_lib_pthread_pthread_sigmask=no
+for ac_lib in '' pthread; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_pthread_sigmask=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ conftest$ac_exeext
+ if ${ac_cv_search_pthread_sigmask+:} false; then :
+ break
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_sigmask" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_sigmask" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_sigmask" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
+done
+if ${ac_cv_search_pthread_sigmask+:} false; then :
- LIBS="-lpthread $LIBS"
+else
+ ac_cv_search_pthread_sigmask=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_sigmask" >&5
+$as_echo "$ac_cv_search_pthread_sigmask" >&6; }
+ac_res=$ac_cv_search_pthread_sigmask
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
as_fn_error $? "pthread library not found or incompatible" "$LINENO" 5
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_init in -lpthread" >&5
-$as_echo_n "checking for pthread_attr_init in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_attr_init+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_attr_init" >&5
+$as_echo_n "checking for library containing pthread_attr_init... " >&6; }
+if ${ac_cv_search_pthread_attr_init+:} false; then :
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+ ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6711,35 +6744,46 @@ return pthread_attr_init ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_pthread_attr_init=yes
-else
- ac_cv_lib_pthread_pthread_attr_init=no
+for ac_lib in '' pthread; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_pthread_attr_init=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ conftest$ac_exeext
+ if ${ac_cv_search_pthread_attr_init+:} false; then :
+ break
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_attr_init" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_attr_init" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_attr_init" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
+done
+if ${ac_cv_search_pthread_attr_init+:} false; then :
- LIBS="-lpthread $LIBS"
+else
+ ac_cv_search_pthread_attr_init=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_attr_init" >&5
+$as_echo "$ac_cv_search_pthread_attr_init" >&6; }
+ac_res=$ac_cv_search_pthread_attr_init
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
as_fn_error $? "pthread library not found or incompatible" "$LINENO" 5
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_setstacksize in -lpthread" >&5
-$as_echo_n "checking for pthread_attr_setstacksize in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_attr_setstacksize+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_attr_setstacksize" >&5
+$as_echo_n "checking for library containing pthread_attr_setstacksize... " >&6; }
+if ${ac_cv_search_pthread_attr_setstacksize+:} false; then :
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+ ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6758,35 +6802,46 @@ return pthread_attr_setstacksize ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_pthread_attr_setstacksize=yes
-else
- ac_cv_lib_pthread_pthread_attr_setstacksize=no
+for ac_lib in '' pthread; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_pthread_attr_setstacksize=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ conftest$ac_exeext
+ if ${ac_cv_search_pthread_attr_setstacksize+:} false; then :
+ break
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_attr_setstacksize" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_attr_setstacksize" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_attr_setstacksize" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
+done
+if ${ac_cv_search_pthread_attr_setstacksize+:} false; then :
- LIBS="-lpthread $LIBS"
+else
+ ac_cv_search_pthread_attr_setstacksize=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_attr_setstacksize" >&5
+$as_echo "$ac_cv_search_pthread_attr_setstacksize" >&6; }
+ac_res=$ac_cv_search_pthread_attr_setstacksize
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
as_fn_error $? "pthread library not found or incompatible" "$LINENO" 5
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_destroy in -lpthread" >&5
-$as_echo_n "checking for pthread_attr_destroy in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_attr_destroy+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_attr_destroy" >&5
+$as_echo_n "checking for library containing pthread_attr_destroy... " >&6; }
+if ${ac_cv_search_pthread_attr_destroy+:} false; then :
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+ ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6805,35 +6860,46 @@ return pthread_attr_destroy ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_pthread_attr_destroy=yes
-else
- ac_cv_lib_pthread_pthread_attr_destroy=no
+for ac_lib in '' pthread; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_pthread_attr_destroy=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ conftest$ac_exeext
+ if ${ac_cv_search_pthread_attr_destroy+:} false; then :
+ break
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_attr_destroy" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_attr_destroy" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_attr_destroy" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
+done
+if ${ac_cv_search_pthread_attr_destroy+:} false; then :
- LIBS="-lpthread $LIBS"
+else
+ ac_cv_search_pthread_attr_destroy=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_attr_destroy" >&5
+$as_echo "$ac_cv_search_pthread_attr_destroy" >&6; }
+ac_res=$ac_cv_search_pthread_attr_destroy
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
as_fn_error $? "pthread library not found or incompatible" "$LINENO" 5
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_cancel in -lpthread" >&5
-$as_echo_n "checking for pthread_cancel in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_cancel+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_cancel" >&5
+$as_echo_n "checking for library containing pthread_cancel... " >&6; }
+if ${ac_cv_search_pthread_cancel+:} false; then :
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+ ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6852,35 +6918,46 @@ return pthread_cancel ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_pthread_cancel=yes
-else
- ac_cv_lib_pthread_pthread_cancel=no
+for ac_lib in '' pthread; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_pthread_cancel=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ conftest$ac_exeext
+ if ${ac_cv_search_pthread_cancel+:} false; then :
+ break
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_cancel" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_cancel" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_cancel" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
+done
+if ${ac_cv_search_pthread_cancel+:} false; then :
- LIBS="-lpthread $LIBS"
+else
+ ac_cv_search_pthread_cancel=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_cancel" >&5
+$as_echo "$ac_cv_search_pthread_cancel" >&6; }
+ac_res=$ac_cv_search_pthread_cancel
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
as_fn_error $? "pthread library not found or incompatible" "$LINENO" 5
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in -lpthread" >&5
-$as_echo_n "checking for pthread_join in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_join+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_join" >&5
+$as_echo_n "checking for library containing pthread_join... " >&6; }
+if ${ac_cv_search_pthread_join+:} false; then :
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+ ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6899,31 +6976,41 @@ return pthread_join ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_pthread_join=yes
-else
- ac_cv_lib_pthread_pthread_join=no
+for ac_lib in '' pthread; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_pthread_join=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ conftest$ac_exeext
+ if ${ac_cv_search_pthread_join+:} false; then :
+ break
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_join" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_join" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_join" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPTHREAD 1
-_ACEOF
+done
+if ${ac_cv_search_pthread_join+:} false; then :
- LIBS="-lpthread $LIBS"
+else
+ ac_cv_search_pthread_join=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_join" >&5
+$as_echo "$ac_cv_search_pthread_join" >&6; }
+ac_res=$ac_cv_search_pthread_join
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
as_fn_error $? "pthread library not found or incompatible" "$LINENO" 5
fi
-LDFLAGS="$LDFLAGS -lpthread"
-
#
# MySQL library
diff --git a/configure.in b/configure.in
index 6755e3ca5..63d571194 100644
--- a/configure.in
+++ b/configure.in
@@ -12,7 +12,11 @@ AC_CONFIG_FILES([src/map/Makefile src/plugins/Makefile src/tool/Makefile])
AC_CONFIG_FILES([src/test/Makefile])
AC_CONFIG_FILES([tools/HPMHookGen/Makefile])
-AC_GNU_SOURCE
+dnl AC_USE_SYSTEM_EXTENSIONS requires autoconf 2.60 or newer. Fall back to AC_GNU_SOURCE otherwise.
+m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
+ [AC_USE_SYSTEM_EXTENSIONS],
+ [AC_GNU_SOURCE]
+)
#
# Memory managers
@@ -302,18 +306,18 @@ AC_ARG_WITH(
),
[
if test "$withval" == "no"; then
- CFLAGS="$CFLAGS -DMAXCONN=16384"
+ CPPFLAGS="$CPPFLAGS -DMAXCONN=16384"
else
if ! test "$withval" -ge 0 -o "$withval" -lt 0 2>&- ; then
AC_MSG_ERROR([Invalid argument --with-maxconn=$withval ... stopping])
else
- CFLAGS="$CFLAGS -DMAXCONN=$withval"
+ CPPFLAGS="$CPPFLAGS -DMAXCONN=$withval"
fi
fi
],
[
- CFLAGS="$CFLAGS -DMAXCONN=16384"
+ CPPFLAGS="$CPPFLAGS -DMAXCONN=16384"
]
)
@@ -530,7 +534,7 @@ AC_RUN_IFELSE(
])],
[
AC_MSG_RESULT([yes])
- CFLAGS="$CFLAGS -DHAS_TLS"
+ CPPFLAGS="$CPPFLAGS -DHAS_TLS"
],
[
AC_MSG_RESULT([no])
@@ -894,13 +898,13 @@ AC_COMPILE_IFELSE(
#
# setrlimit - used to set the socket limit
#
-AC_CHECK_FUNC([setrlimit],[CFLAGS="$CFLAGS -DHAVE_SETRLIMIT"])
+AC_CHECK_FUNC([setrlimit],[CPPFLAGS="$CPPFLAGS -DHAVE_SETRLIMIT"])
#
# strnlen - string length with upper scan bound
#
-AC_CHECK_FUNC([strnlen],[CFLAGS="$CFLAGS -DHAVE_STRNLEN"])
+AC_CHECK_FUNC([strnlen],[CPPFLAGS="$CPPFLAGS -DHAVE_STRNLEN"])
# libconfig
AC_CHECK_FUNCS([uselocale])
@@ -913,27 +917,27 @@ AC_CHECK_HEADERS([xlocale.h])
#
case $enable_manager in
"no")
- CFLAGS="$CFLAGS -DNO_MEMMGR"
+ CPPFLAGS="$CPPFLAGS -DNO_MEMMGR"
;;
"builtin")
# enabled by default
;;
"memwatch")
- CFLAGS="$CFLAGS -DMEMWATCH"
+ CPPFLAGS="$CPPFLAGS -DMEMWATCH"
AC_CHECK_HEADER([memwatch.h], , [AC_MSG_ERROR([memwatch header not found... stopping])])
;;
"dmalloc")
- CFLAGS="$CFLAGS -DDMALLOC -DDMALLOC_FUNC_CHECK"
+ CPPFLAGS="$CPPFLAGS -DDMALLOC -DDMALLOC_FUNC_CHECK"
LIBS="$LIBS -ldmalloc"
AC_CHECK_HEADER([dmalloc.h], , [AC_MSG_ERROR([dmalloc header not found... stopping])])
;;
"gcollect")
- CFLAGS="$CFLAGS -DGCOLLECT"
+ CPPFLAGS="$CPPFLAGS -DGCOLLECT"
LIBS="$LIBS -lgc"
AC_CHECK_HEADER([gc.h], , [AC_MSG_ERROR([gcollect header not found... stopping])])
;;
"bcheck")
- CFLAGS="$CFLAGS -DBCHECK"
+ CPPFLAGS="$CPPFLAGS -DBCHECK"
;;
esac
@@ -942,7 +946,7 @@ esac
# Packetver
#
if test -n "$enable_packetver" ; then
- CFLAGS="$CFLAGS -DPACKETVER=$enable_packetver"
+ CPPFLAGS="$CPPFLAGS -DPACKETVER=$enable_packetver"
fi
#
@@ -950,7 +954,7 @@ fi
#
case $enable_packetver_re in
"yes")
- CFLAGS="$CFLAGS -DENABLE_PACKETVER_RE"
+ CPPFLAGS="$CPPFLAGS -DENABLE_PACKETVER_RE"
;;
"no")
# default value
@@ -961,7 +965,7 @@ esac
# Obfuscation keys
#
if test -n "$obfuscationkey1" -a -n "$obfuscationkey2" -a -n "$obfuscationkey3"; then
- CFLAGS="$CFLAGS -DOBFUSCATIONKEY1=$obfuscationkey1 -DOBFUSCATIONKEY2=$obfuscationkey2 -DOBFUSCATIONKEY3=$obfuscationkey3"
+ CPPFLAGS="$CPPFLAGS -DOBFUSCATIONKEY1=$obfuscationkey1 -DOBFUSCATIONKEY2=$obfuscationkey2 -DOBFUSCATIONKEY3=$obfuscationkey3"
fi
#
@@ -973,10 +977,12 @@ case $enable_debug in
# CFLAGS="$CFLAGS -Wno-unused -Wno-parentheses"
;;
"yes")
- CFLAGS="$CFLAGS -g -DDEBUG"
+ CFLAGS="$CFLAGS -g"
+ CPPFLAGS="$CPPFLAGS -DDEBUG"
;;
"gdb")
- CFLAGS="$CFLAGS -ggdb -DDEBUG"
+ CFLAGS="$CFLAGS -ggdb"
+ CPPFLAGS="$CPPFLAGS -DDEBUG"
;;
esac
@@ -988,7 +994,7 @@ case $enable_buildbot in
# default value
;;
"yes")
- CFLAGS="$CFLAGS -DBUILDBOT"
+ CPPFLAGS="$CPPFLAGS -DBUILDBOT"
;;
esac
@@ -1000,7 +1006,7 @@ case $enable_rdtsc in
#default value
;;
1)
- CFLAGS="$CFLAGS -DENABLE_RDTSC"
+ CPPFLAGS="$CPPFLAGS -DENABLE_RDTSC"
;;
esac
@@ -1023,7 +1029,7 @@ esac
#
case $enable_renewal in
"no")
- CFLAGS="$CFLAGS -DDISABLE_RENEWAL"
+ CPPFLAGS="$CPPFLAGS -DDISABLE_RENEWAL"
;;
"yes")
# default value
@@ -1037,7 +1043,7 @@ if test -n "${ZLIB_HOME}" ; then
LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
fi
-AC_CHECK_LIB([z], [inflateEnd], [],[AC_MSG_ERROR([zlib library not found or incompatible, please specify the correct path with --with-zlib=DIR... stopping])])
+AC_SEARCH_LIBS([inflateEnd], [z], [],[AC_MSG_ERROR([zlib library not found or incompatible, please specify the correct path with --with-zlib=DIR... stopping])])
AC_CHECK_HEADER([zlib.h], [], [AC_MSG_ERROR([zlib header not found, please specify the correct path with --with-zlib=DIR... stopping])])
@@ -1077,7 +1083,7 @@ if test "$ac_cv_search_clock_gettime" != "no" ; then
])],
[
AC_MSG_RESULT([yes])
- CFLAGS="$CFLAGS -DHAVE_MONOTONIC_CLOCK"
+ CPPFLAGS="$CPPFLAGS -DHAVE_MONOTONIC_CLOCK"
],
[
# either it failed to compile (CLOCK_MONOTONIC undefined)
@@ -1094,15 +1100,13 @@ fi
#
# pthread
#
-AC_CHECK_LIB([pthread], [pthread_create], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
-AC_CHECK_LIB([pthread], [pthread_sigmask], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
-AC_CHECK_LIB([pthread], [pthread_attr_init], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
-AC_CHECK_LIB([pthread], [pthread_attr_setstacksize], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
-AC_CHECK_LIB([pthread], [pthread_attr_destroy], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
-AC_CHECK_LIB([pthread], [pthread_cancel], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
-AC_CHECK_LIB([pthread], [pthread_join], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
-
-LDFLAGS="$LDFLAGS -lpthread"
+AC_SEARCH_LIBS([pthread_create], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
+AC_SEARCH_LIBS([pthread_sigmask], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
+AC_SEARCH_LIBS([pthread_attr_init], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
+AC_SEARCH_LIBS([pthread_attr_setstacksize], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
+AC_SEARCH_LIBS([pthread_attr_destroy], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
+AC_SEARCH_LIBS([pthread_cancel], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
+AC_SEARCH_LIBS([pthread_join], [pthread], [], [AC_MSG_ERROR([pthread library not found or incompatible])])
#
diff --git a/src/char/Makefile.in b/src/char/Makefile.in
index ecaad3602..59dc56076 100644
--- a/src/char/Makefile.in
+++ b/src/char/Makefile.in
@@ -1,6 +1,8 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
+# @configure_input@
+
CONFIG_D = ../config
CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h)
@@ -96,7 +98,7 @@ char-server: ../../char-server@EXEEXT@
obj_sql/%.o: %.c $(CHAR_H) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj_sql
@echo " CC $<"
- @$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
+ @$(CC) @CFLAGS@ @DEFS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
$(COMMON_D)/obj_all/common.a:
diff --git a/src/common/Makefile.in b/src/common/Makefile.in
index 623c59c2e..5dfdd35bd 100644
--- a/src/common/Makefile.in
+++ b/src/common/Makefile.in
@@ -1,6 +1,8 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
+# @configure_input@
+
CONFIG_D = ../config
CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h)
@@ -114,15 +116,15 @@ obj_all/sysinfo.o: sysinfo.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_
obj_all/%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | $(SYSINFO_INC) obj_all
@echo " CC $<"
- @$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
+ @$(CC) @CFLAGS@ @DEFS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
obj_all/mini%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | $(SYSINFO_INC) obj_all
@echo " CC $<"
- @$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) -DMINICORE @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
+ @$(CC) @CFLAGS@ @DEFS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) -DMINICORE @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
obj_sql/%.o: %.c $(COMMON_H) $(COMMON_SQL_H) $(CONFIG_H) $(LIBCONFIG_H) | $(SYSINFO_INC) obj_sql
@echo " CC $<"
- @$(CC) @CFLAGS@ $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
+ @$(CC) @CFLAGS@ @DEFS@ $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
$(MT19937AR_OBJ):
diff --git a/src/common/strlib.h b/src/common/strlib.h
index decf661a6..f93d8ad67 100644
--- a/src/common/strlib.h
+++ b/src/common/strlib.h
@@ -6,17 +6,10 @@
#define _COMMON_STRLIB_H_
#include <stdarg.h>
+#include <string.h>
#include "../common/cbasetypes.h"
-#ifndef __USE_GNU
-# define __USE_GNU // required to enable strnlen on some platforms
-# include <string.h>
-# undef __USE_GNU
-#else
-# include <string.h>
-#endif
-
#ifdef WIN32
#define HAVE_STRTOK_R
#define strtok_r(s,delim,save_ptr) _strtok_r((s),(delim),(save_ptr))
diff --git a/src/login/Makefile.in b/src/login/Makefile.in
index 033dad25b..7551eed5f 100644
--- a/src/login/Makefile.in
+++ b/src/login/Makefile.in
@@ -1,6 +1,8 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
+# @configure_input@
+
CONFIG_D = ../config
CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h)
@@ -92,7 +94,7 @@ login-server: ../../login-server@EXEEXT@
obj_sql/%.o: %.c $(LOGIN_H) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj_sql
@echo " CC $<"
- @$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
+ @$(CC) @CFLAGS@ @DEFS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
$(COMMON_D)/obj_all/common.a:
diff --git a/src/map/Makefile.in b/src/map/Makefile.in
index e4f2d9953..fc58c9d70 100644
--- a/src/map/Makefile.in
+++ b/src/map/Makefile.in
@@ -1,6 +1,8 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
+# @configure_input@
+
CONFIG_D = ../config
CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h)
@@ -109,7 +111,7 @@ map-server: ../../map-server@EXEEXT@
obj_sql/%.o: %.c $(MAP_H) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj_sql
@echo " CC $<"
- @$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) $(PCRE_CFLAGS) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
+ @$(CC) @CFLAGS@ @DEFS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) $(PCRE_CFLAGS) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
$(COMMON_D)/obj_all/common.a:
diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in
index 11e93973d..77040d567 100644
--- a/src/plugins/Makefile.in
+++ b/src/plugins/Makefile.in
@@ -1,6 +1,8 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
+# @configure_input@
+
################ PLUGIN CONFIGURATION ##############################
# #
# When you add a plugin, add its name here: #
diff --git a/src/test/Makefile.in b/src/test/Makefile.in
index 2ee4e29b7..dea126e46 100644
--- a/src/test/Makefile.in
+++ b/src/test/Makefile.in
@@ -1,6 +1,8 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
+# @configure_input@
+
CONFIG_D = ../config
CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h)
@@ -68,7 +70,7 @@ test_spinlock: $(TEST_SPINLOCK_DEPENDS) Makefile
obj/%.o: %.c $(TEST_SPINLOCK_H) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj
@echo " CC $<"
- @$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) -DWITH_SQL @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
+ @$(CC) @CFLAGS@ @DEFS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) -DWITH_SQL @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
$(COMMON_D)/obj_all/common.a:
diff --git a/src/tool/Makefile.in b/src/tool/Makefile.in
index 07b03e334..127d3841b 100644
--- a/src/tool/Makefile.in
+++ b/src/tool/Makefile.in
@@ -1,6 +1,8 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
+# @configure_input@
+
CONFIG_D = ../config
CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h)
@@ -68,7 +70,7 @@ obj_all:
obj_all/%.o: %.c $(MAPCACHE_H) $(COMMON_H) $(CONFIG_H) $(LIBCONFIG_H) | obj_all
@echo " CC $<"
- @$(CC) @CFLAGS@ $(LIBCONFIG_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
+ @$(CC) @CFLAGS@ @DEFS@ $(LIBCONFIG_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing common object files
$(COMMON_D)/obj_all/common_mini.a:
diff --git a/tools/HPMHookGen/Makefile.in b/tools/HPMHookGen/Makefile.in
index ce07b37d4..fefe0eef4 100644
--- a/tools/HPMHookGen/Makefile.in
+++ b/tools/HPMHookGen/Makefile.in
@@ -1,6 +1,8 @@
# Copyright (c) Hercules Dev Team, licensed under GNU GPL.
# See the LICENSE file
+# @configure_input@
+
@SET_MAKE@
COMMON_D = ../../src/common