summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in585
1 files changed, 437 insertions, 148 deletions
diff --git a/configure.in b/configure.in
index f52fcf00b..e236c25fe 100644
--- a/configure.in
+++ b/configure.in
@@ -1,8 +1,8 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
-AC_INIT(rAthena)
-AC_REVISION($Revision$)
+AC_INIT(Hercules)
+AC_REVISION([m4_esyscmd_s([type git >/dev/null 2>&1 && git describe --always 2>/dev/null || echo '(unknown version)'])])
AC_PREREQ([2.59])
AC_CONFIG_SRCDIR([src/common/cbasetypes.h])
AC_CONFIG_FILES([Makefile src/common/Makefile])
@@ -10,8 +10,13 @@ AC_CONFIG_FILES([3rdparty/mt19937ar/Makefile 3rdparty/libconfig/Makefile])
AC_CONFIG_FILES([src/char/Makefile src/login/Makefile])
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
@@ -45,7 +50,7 @@ AC_ARG_ENABLE(
[packetver],
AC_HELP_STRING(
[--enable-packetver=ARG],
- [Sets the PACKETVER define of the map-server. (see src/map/clif.h)]
+ [Sets the PACKETVER define. (see src/common/mmo.h)]
),
[enable_packetver="$enableval"],
[enable_packetver=""]
@@ -53,6 +58,80 @@ AC_ARG_ENABLE(
#
+# packetver-RE
+#
+AC_ARG_ENABLE(
+ [packetver-re],
+ AC_HELP_STRING(
+ [--enable-packetver-re],
+ [Sets or unsets the PACKETVER_RE define - see src/common/mmo.h (currently disabled by default)]
+ ),
+ [
+ enable_packetver_re="$enableval"
+ case $enableval in
+ "no");;
+ "yes");;
+ *) AC_MSG_ERROR([[invalid argument --enable-packetver-re=$enableval... stopping]]);;
+ esac
+ ],
+ [enable_packetver_re="no"]
+)
+
+
+#
+# Obfuscation keys
+#
+AC_ARG_WITH(
+ [key1],
+ AC_HELP_STRING(
+ [--with-key1@<:@=ARG@:>@],
+ [Set the first obfuscation key (ignored unless the other two are also specified)]
+ ),
+ [
+ obfuscationkey1="$( expr "0x$withval" : '0*x*\(0x@<:@A-Fa-f0-9@:>@\{8\}\)' )"
+ if ! expr "x$obfuscationkey1" : 'x0x@<:@A-Fa-f0-9@:>@\{8\}' >/dev/null 2>&1; then
+ obfuscationkey1=""
+ fi
+ ],
+ [
+ obfuscationkey1=""
+ ]
+)
+AC_ARG_WITH(
+ [key2],
+ AC_HELP_STRING(
+ [--with-key2@<:@=ARG@:>@],
+ [Set the second obfuscation key (ignored unless the other two are also specified)]
+ ),
+ [
+ obfuscationkey2="$( expr "0x$withval" : '0*x*\(0x@<:@A-Fa-f0-9@:>@\{8\}\)' )"
+ if ! expr "x$obfuscationkey2" : 'x0x@<:@A-Fa-f0-9@:>@\{8\}' >/dev/null 2>&1; then
+ obfuscationkey2=""
+ fi
+ ],
+ [
+ obfuscationkey2=""
+ ]
+)
+AC_ARG_WITH(
+ [key3],
+ AC_HELP_STRING(
+ [--with-key3@<:@=ARG@:>@],
+ [Set the third obfuscation key (ignored unless the other two are also specified)]
+ ),
+ [
+ obfuscationkey3="$( expr "0x$withval" : '0*x*\(0x@<:@A-Fa-f0-9@:>@\{8\}\)' )"
+ if ! expr "x$obfuscationkey3" : 'x0x@<:@A-Fa-f0-9@:>@\{8\}' >/dev/null 2>&1; then
+ obfuscationkey3=""
+ fi
+ ],
+ [
+ obfuscationkey3=""
+ ]
+)
+
+
+#
# debug
#
AC_ARG_ENABLE(
@@ -111,8 +190,12 @@ AC_ARG_ENABLE(
Note:
Please ensure that you've disabled dynamic CPU-Frequencys, such as power saving options.
- (On the most modern Dedicated Servers cpufreq is preconfigured, see your distribution's manual
- how to disable it)
+ (On most modern Dedicated Servers cpufreq is preconfigured, see your distribution's
+ manual how to disable it).
+ Furthermore, If your CPU has built-in CPU-Frequency scaling features (such as Intel's
+ SpeedStep(R)), do not enable this option. Recent CPUs (Intel Core or newer) guarantee
+ a fixed increment rate for their TSC, so it should be safe to use, but please doublecheck
+ the documentation of both your CPU and OS before enabling this option.
]
),
[
@@ -169,22 +252,45 @@ AC_ARG_ENABLE(
# LTO
#
AC_ARG_ENABLE(
- [lto],
- AC_HELP_STRING(
- [--enable-lto],
- [
+ [lto],
+ AC_HELP_STRING(
+ [--enable-lto],
+ [
Enables or Disables Linktime Code Optimization (LTO is enabled by default)
- ]
- ),
- [
- enable_lto="$enableval"
- case $enableval in
- "no");;
- "yes");;
- *) AC_MSG_ERROR([[invalid argument --enable-lto=$disableval... stopping]]);;
- esac
- ],
- [enable_lto="yes"]
+ ]
+ ),
+ [
+ enable_lto="$enableval"
+ case $enableval in
+ "no");;
+ "yes");;
+ *) AC_MSG_ERROR([[invalid argument --enable-lto=$disableval... stopping]]);;
+ esac
+ ],
+ [enable_lto="yes"]
+)
+
+
+#
+# Renewal
+#
+AC_ARG_ENABLE(
+ [renewal],
+ AC_HELP_STRING(
+ [--disable-renewal],
+ [
+ Disable Ragnarok Renewal support (override settings in src/config/renewal.h)
+ ]
+ ),
+ [
+ enable_renewal="$enableval"
+ case $enableval in
+ "no");;
+ "yes");;
+ *) AC_MSG_ERROR([[invalid argument --enable-renewal=$enableval... stopping]]);;
+ esac
+ ],
+ [enable_renewal="yes"]
)
@@ -200,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"
]
)
@@ -331,7 +437,7 @@ AC_PATH_PROG(AR, ar)
AC_LANG([C])
-CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wno-sign-compare"
+CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wextra -Wno-sign-compare"
CPPFLAGS="$CPPFLAGS -I../common"
@@ -371,16 +477,37 @@ fi
#
AC_MSG_CHECKING([whether $CC produces 32bit code])
AC_RUN_IFELSE(
- [
+ [AC_LANG_SOURCE([
int main(int argc, char **argv){
if(sizeof(void*) == 4) return 0;
else return 1;
}
- ],
+ ])],
[
AC_MSG_RESULT([yes])
+ AC_MSG_CHECKING([whether $CC supports -march=i686 (and we can run it)])
+ OLD_CFLAGS="$CFLAGS"
+ OLD_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS -march=i686"
LDFLAGS="$LDFLAGS -march=i686"
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([
+ int main(int argc, char **argv) { return 0; }
+ ])],
+ [
+ AC_MSG_RESULT([yes])
+ ],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$OLD_CFLAGS"
+ LDFLAGS="$OLD_LDFLAGS"
+ ],
+ [
+ AC_MSG_RESULT([guessing no])
+ CFLAGS="$OLD_CFLAGS"
+ LDFLAGS="$OLD_LDFLAGS"
+ ]
+ )
],
[
AC_MSG_RESULT([no])
@@ -397,17 +524,17 @@ AC_RUN_IFELSE(
#
AC_MSG_CHECKING([whether $CC supports __thread specifier (TLS)])
AC_RUN_IFELSE(
- [
+ [AC_LANG_SOURCE([
__thread int g_Test = -1;
int main(int argc, char **argv){
g_Test = 0;
return g_Test;
}
- ],
+ ])],
[
AC_MSG_RESULT([yes])
- CFLAGS="$CFLAGS -DHAS_TLS"
+ CPPFLAGS="$CPPFLAGS -DHAS_TLS"
],
[
AC_MSG_RESULT([no])
@@ -415,19 +542,6 @@ AC_RUN_IFELSE(
)
-AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
-OLD_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wno-unused-parameter"
-AC_COMPILE_IFELSE(
- [int foo;],
- [AC_MSG_RESULT([yes])],
- [
- AC_MSG_RESULT([no])
- CFLAGS="$OLD_CFLAGS"
- ]
-)
-
-
#
# LTO Support test
#
@@ -441,11 +555,11 @@ if test "$enable_lto" != "no" ; then
AC_MSG_CHECKING([whether $CC supports -flto])
AC_RUN_IFELSE(
- [
+ [AC_LANG_SOURCE([
int main(int argc, char **argv){
- return 0;
- }
- ],
+ return 0;
+ }
+ ])],
[
AC_MSG_RESULT([yes])
],
@@ -461,55 +575,149 @@ if test "$enable_lto" != "no" ; then
fi
-
-AC_MSG_CHECKING([whether $CC supports -Wno-pointer-sign])
-OLD_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wno-pointer-sign"
-AC_COMPILE_IFELSE(
- [int foo;],
+AC_DEFUN(AC_CHECK_COMPILER_WFLAG,
[
- AC_MSG_RESULT([yes])
- AC_MSG_CHECKING([whether $CC can actually use -Wno-pointer-sign])
- # This option causes warnings in C++ mode
- # Note: -Werror must be before -Wno-pointer-sign, otherwise it does not do anything
- CFLAGS="$OLD_CFLAGS -Werror -Wno-pointer-sign"
+ AC_MSG_CHECKING([whether $CC supports -W$1])
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -W$1"
AC_COMPILE_IFELSE(
- [int foo;],
+ [AC_LANG_SOURCE([int foo;])],
[
AC_MSG_RESULT([yes])
- CFLAGS="$OLD_CFLAGS -Wno-pointer-sign"
+ CFLAGS="$OLD_CFLAGS -W$1"
+ # Optionally, run a test
+ if test "x$2" != "x"; then
+ AC_MSG_CHECKING([whether $CC can actually use -W$1])
+ CFLAGS="$OLD_CFLAGS -Werror -W$1"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([$2])],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$OLD_CFLAGS"
+ ]
+ [
+ AC_MSG_RESULT([yes])
+ CFLAGS="$OLD_CFLAGS -W$1"
+ ],
+ )
+ fi
],
[
AC_MSG_RESULT([no])
CFLAGS="$OLD_CFLAGS"
]
)
- ],
- [
- AC_MSG_RESULT([no])
- CFLAGS="$OLD_CFLAGS"
]
)
-
-AC_MSG_CHECKING([whether $CC supports -Wno-switch])
-OLD_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wno-switch"
-AC_COMPILE_IFELSE(
- [int foo;],
- [AC_MSG_RESULT([yes])],
+AC_DEFUN(AC_CHECK_COMPILER_WNOFLAG,
[
- AC_MSG_RESULT([no])
- CFLAGS="$OLD_CFLAGS"
+ AC_MSG_CHECKING([whether $CC supports -Wno-$1])
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wno-$1"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([int foo;])],
+ [
+ # Recent versions of gcc don't fail if -Wno-foo is not recognized
+ # (unless there are also other warnings), so we also check for -Wfoo
+ # which always fails if not supported
+ CFLAGS="$OLD_CFLAGS -Werror -W$1"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([int foo;])],
+ [
+ AC_MSG_RESULT([yes])
+ CFLAGS="$OLD_CFLAGS -Wno-$1"
+ # Optionally, run a test
+ if test "x$2" != "x"; then
+ AC_MSG_CHECKING([whether $CC can actually use -Wno-$1])
+ CFLAGS="$OLD_CFLAGS -Werror -W$1"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([$2])],
+ [
+ AC_MSG_RESULT([not needed but enabled])
+ CFLAGS="$OLD_CFLAGS"
+ ],
+ [
+ CFLAGS="$OLD_CFLAGS -Werror -Wno-$1"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([$2])],
+ [
+ AC_MSG_RESULT([yes])
+ CFLAGS="$OLD_CFLAGS -Wno-$1"
+ ],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$OLD_CFLAGS"
+ ]
+ )
+ ]
+ )
+ fi
+ ],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$OLD_CFLAGS"
+ ]
+ )
+ ],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$OLD_CFLAGS"
+ ]
+ )
]
)
+AC_CHECK_COMPILER_WNOFLAG(unused-parameter, [int foo(int bar) { return 0; }])
+AC_CHECK_COMPILER_WNOFLAG(maybe-uninitialized)
+AC_CHECK_COMPILER_WNOFLAG(clobbered)
+AC_CHECK_COMPILER_WFLAG(empty-body)
+AC_CHECK_COMPILER_WFLAG(newline-eof)
+AC_CHECK_COMPILER_WFLAG(int-conversion)
+AC_CHECK_COMPILER_WFLAG(enum-conversion)
+AC_CHECK_COMPILER_WFLAG(shorten-64-to-32)
+AC_CHECK_COMPILER_WFLAG(constant-conversion)
+AC_CHECK_COMPILER_WFLAG(bool-conversion)
+AC_CHECK_COMPILER_WNOFLAG(switch)
+AC_CHECK_COMPILER_WNOFLAG(missing-field-initializers)
+AC_CHECK_COMPILER_WNOFLAG(format-security)
+AC_CHECK_COMPILER_WNOFLAG(format-nonliteral)
+
+# Certain versions of gcc make -Wshadow completely useless by making it flood
+# you with unnecessary warnings <https://lkml.org/lkml/2006/11/28/239>
+# Let's check if we can really use it
+SAVED_OLD_CFLAGS="$CFLAGS"
+AC_CHECK_COMPILER_WFLAG(shadow)
+if test "x$CFLAGS" != "x$SAVED_OLD_CFLAGS"; then
+ AC_MSG_CHECKING([whether $CC can efficiently use -Wshadow])
+ NEW_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wshadow"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([
+ int foo(void) {
+ return 0;
+ }
+ int bar(void) {
+ int foo = 0;
+ return foo + 1;
+ }
+ ])],
+ [
+ AC_MSG_RESULT([yes])
+ CFLAGS="$NEW_CFLAGS"
+ ],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$SAVED_OLD_CFLAGS"
+ ]
+ )
+fi
AC_MSG_CHECKING([whether $CC supports -fPIC])
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fPIC"
AC_COMPILE_IFELSE(
- [int foo;],
+ [AC_LANG_SOURCE([int foo;])],
[
AC_MSG_RESULT([yes])
compiler_supports_pic="yes"
@@ -527,102 +735,144 @@ CFLAGS="$OLD_CFLAGS"
AC_MSG_CHECKING([how to make shared objects])
OLD_CFLAGS="$CFLAGS"
compiler_shared_objects=""
+compiler_supports_shared_objects="no"
if test "$compiler_supports_pic" = "yes" ; then
my_shared_test_flags="$CFLAGS -fPIC"
fi
# default
CFLAGS="$my_shared_test_flags -shared"
AC_LINK_IFELSE(
- [[
+ [AC_LANG_SOURCE([
int bar = 0;
int foo(void)
{
return bar;
}
- ]],
+ ])],
[
compiler_shared_objects="-shared"
+ compiler_supports_shared_objects="yes"
]
)
# BeOS specific
CFLAGS="$my_shared_test_flags -nostart"
AC_LINK_IFELSE(
- [[
+ [AC_LANG_SOURCE([
int bar = 0;
int foo(void)
{
return bar;
}
- ]],
+ ])],
[
compiler_shared_objects="-nostart"
+ compiler_supports_shared_objects="yes"
]
)
-my_shared_test_flags=""
CFLAGS="$OLD_CFLAGS"
if test "$compiler_supports_shared_objects" = "no" ; then
AC_MSG_RESULT([not supported])
AC_MSG_NOTICE([compiler is unable to generate shared objects, disabled plugins (optional)])
WITH_PLUGINS="no"
else
- AC_MSG_RESULT([$compiler_shared_objects])
+ AC_MSG_RESULT([$compiler_shared_objects $compiler_supports_shared_objects])
SOFLAGS="$SOFLAGS $compiler_shared_objects"
+ AC_SUBST([SOFLAGS])
-#
-# shared objects need position independent code; some platforms emit
-# it always, others need -fPIC
-#
-AC_MSG_CHECKING([whether $CC needs -fPIC for shared objects])
-OLD_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS $SOFLAGS"
-WITH_PLUGINS="yes"
-AC_LINK_IFELSE(
- [[
- int bar = 0;
-
- int foo(void)
- {
- return bar;
- }
- ]],
- [
- AC_MSG_RESULT([no])
- CFLAGS="$OLD_CFLAGS"
- ],
- [
- if test "$compiler_supports_pic" = "yes" ; then
- # Verify if -shared really fails due to lack of -fPIC or something else
- CFLAGS="$CFLAGS -fPIC"
+ #
+ # On certain platforms, undefined references on shared libraries won't be checked
+ # unless explicitly required with the --no-undefined linker option
+ #
+ AC_MSG_CHECKING([whether $CC needs -Wl,--no-undefined to check for undefined references in shared objects])
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$SOFLAGS"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([
+ void foo(void) {
+ foobar();
+ }
+ ])],
+ [
+ CFLAGS="$SOFLAGS -Wl,--no-undefined"
AC_LINK_IFELSE(
- [[
+ [AC_LANG_SOURCE([
int bar = 0;
- int foo(void)
- {
+ int foo(void) {
return bar;
}
- ]],
+ ])],
[
AC_MSG_RESULT([yes])
- CFLAGS="$OLD_CFLAGS -fPIC"
+ SOFLAGS="$SOFLAGS -Wl,--no-undefined"
],
[
- AC_MSG_RESULT([no, but fails for another reason])
- AC_MSG_ERROR([compiler is unable to compile shared objects for an unhandled reason, please report this with attached config.log... stopping])
+ AC_MSG_RESULT([unsupported (undefined references check will be ignored)])
]
)
- else
- # Disable compilation of plugins (optional), so 'make all' does not fail
- AC_MSG_RESULT([yes, but unsupported])
- AC_MSG_NOTICE([compiler is unable to generate position independent code, disabled plugins (optional)])
- WITH_PLUGINS="no"
- fi
- ]
-)
+ ],
+ [
+ AC_MSG_RESULT([no])
+ ]
+ )
+ CFLAGS="$OLD_CFLAGS"
+
+ #
+ # shared objects need position independent code; some platforms emit
+ # it always, others need -fPIC
+ #
+ AC_MSG_CHECKING([whether $CC needs -fPIC for shared objects])
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $SOFLAGS"
+ WITH_PLUGINS="yes"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([
+ int bar = 0;
+
+ int foo(void)
+ {
+ return bar;
+ }
+ ])],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$OLD_CFLAGS"
+ ],
+ [
+ if test "$compiler_supports_pic" = "yes" ; then
+ # Verify if -shared really fails due to lack of -fPIC or something else
+ CFLAGS="$CFLAGS -fPIC"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([
+ int bar = 0;
+
+ int foo(void)
+ {
+ return bar;
+ }
+ ])],
+ [
+ AC_MSG_RESULT([yes])
+ CFLAGS="$OLD_CFLAGS -fPIC"
+ ],
+ [
+ AC_MSG_RESULT([no, but fails for another reason])
+ AC_MSG_ERROR([compiler is unable to compile shared objects for an unhandled reason, please report this with attached config.log... stopping])
+ ]
+ )
+ else
+ # Disable compilation of plugins (optional), so 'make all' does not fail
+ AC_MSG_RESULT([yes, but unsupported])
+ AC_MSG_NOTICE([compiler is unable to generate position independent code, disabled plugins (optional)])
+ WITH_PLUGINS="no"
+ fi
+ ]
+ )
fi
+my_shared_test_flags=""
AC_SUBST([WITH_PLUGINS])
@@ -633,7 +883,7 @@ AC_MSG_CHECKING([whether $CC supports -fno-strict-aliasing])
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-strict-aliasing"
AC_COMPILE_IFELSE(
- [int foo;],
+ [AC_LANG_SOURCE([int foo;])],
[AC_MSG_RESULT([yes])],
[
AC_MSG_RESULT([no])
@@ -650,13 +900,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])
@@ -669,27 +919,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
@@ -698,9 +948,27 @@ esac
# Packetver
#
if test -n "$enable_packetver" ; then
- CFLAGS="$CFLAGS -DPACKETVER=$enable_packetver"
+ CPPFLAGS="$CPPFLAGS -DPACKETVER=$enable_packetver"
fi
+#
+# Packetver-RE
+#
+case $enable_packetver_re in
+ "yes")
+ CPPFLAGS="$CPPFLAGS -DENABLE_PACKETVER_RE"
+ ;;
+ "no")
+ # default value
+ ;;
+esac
+
+#
+# Obfuscation keys
+#
+if test -n "$obfuscationkey1" -a -n "$obfuscationkey2" -a -n "$obfuscationkey3"; then
+ CPPFLAGS="$CPPFLAGS -DOBFUSCATIONKEY1=$obfuscationkey1 -DOBFUSCATIONKEY2=$obfuscationkey2 -DOBFUSCATIONKEY3=$obfuscationkey3"
+fi
#
# Debug
@@ -708,13 +976,15 @@ fi
case $enable_debug in
"no")
# default value
- CFLAGS="$CFLAGS -Wno-unused -Wno-parentheses"
+# 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
@@ -726,7 +996,7 @@ case $enable_buildbot in
# default value
;;
"yes")
- CFLAGS="$CFLAGS -DBUILDBOT"
+ CPPFLAGS="$CPPFLAGS -DBUILDBOT"
;;
esac
@@ -738,7 +1008,7 @@ case $enable_rdtsc in
#default value
;;
1)
- CFLAGS="$CFLAGS -DENABLE_RDTSC"
+ CPPFLAGS="$CPPFLAGS -DENABLE_RDTSC"
;;
esac
@@ -756,6 +1026,17 @@ case $enable_profiler in
;;
esac
+#
+# Renewal
+#
+case $enable_renewal in
+ "no")
+ CPPFLAGS="$CPPFLAGS -DDISABLE_RENEWAL"
+ ;;
+ "yes")
+ # default value
+ ;;
+esac
#
# zlib library (required)
@@ -764,7 +1045,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])])
@@ -791,7 +1072,7 @@ AC_SEARCH_LIBS([clock_gettime], [rt])
if test "$ac_cv_search_clock_gettime" != "no" ; then
AC_MSG_CHECKING([whether CLOCK_MONOTONIC is supported and works])
AC_RUN_IFELSE(
- [
+ [AC_LANG_SOURCE([
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
@@ -801,10 +1082,10 @@ if test "$ac_cv_search_clock_gettime" != "no" ; then
struct timespec tval;
return clock_gettime(CLOCK_MONOTONIC, &tval);
}
- ],
+ ])],
[
AC_MSG_RESULT([yes])
- CFLAGS="$CFLAGS -DHAVE_MONOTONIC_CLOCK"
+ CPPFLAGS="$CPPFLAGS -DHAVE_MONOTONIC_CLOCK"
],
[
# either it failed to compile (CLOCK_MONOTONIC undefined)
@@ -821,15 +1102,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])])
#
@@ -916,6 +1195,13 @@ AC_SUBST([HAVE_PCRE])
AC_SUBST([PCRE_LIBS])
AC_SUBST([PCRE_CFLAGS])
+#
+# Doxygen, perl (for HPMHookGen)
+#
+
+AC_CHECK_PROG([HAVE_DOXYGEN],[doxygen],[yes],[no])
+
+AC_CHECK_PROG([HAVE_PERL],[perl],[yes],[no])
#
# Host specific stuff
@@ -943,11 +1229,14 @@ CYGWIN*)
fd_setsize="done"
DLLEXT=".dll"
;;
+Darwin*)
+ DLLEXT=".dylib"
+ ;;
esac
AC_SUBST([DLLEXT])
AC_MSG_CHECKING([for MinGW])
-if test -n "`$CC --version | grep -i mingw`" ; then
+if test -n "`$CC --version 2>/dev/null | grep -i mingw`" ; then
AC_MSG_RESULT([yes])
CPPFLAGS="$CPPFLAGS -DMINGW"
if test -z "$fd_setsize" ; then