diff --git a/configure b/configure index 071b5abca6..db0df2a27e 100755 --- a/configure +++ b/configure @@ -633,6 +633,8 @@ MYSQL_CFLAGS MYSQL_VERSION HAVE_MYSQL MYSQL_CONFIG_HOME +WITH_PLUGINS +SOFLAGS AR SET_MAKE OMAP @@ -1327,8 +1329,7 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-manager=ARG memory managers: no, builtin, memwatch, dmalloc, gcollect, bcheck (defaults to builtin) - --enable-packetver=ARG Sets the PACKETVER define of the map-server. (see - src/map/clif.h) + --enable-packetver=ARG Sets the PACKETVER define. (see src/common/mmo.h) --enable-debug[=ARG] Compiles extra debug code. (disabled by default) (available options: yes, no, gdb) --enable-prere[=ARG] Compiles serv in prere mode. (disabled by default) @@ -3628,19 +3629,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 @@ -4849,8 +4850,44 @@ if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -march=i686 (and we can run it)" >&5 +$as_echo_n "checking whether $CC supports -march=i686 (and we can run it)... " >&6; } + OLD_CFLAGS="$CFLAGS" + OLD_LDFLAGS="$LDFLAGS" CFLAGS="$CFLAGS -march=i686" LDFLAGS="$LDFLAGS -march=i686" + if test "$cross_compiling" = yes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: guessing no" >&5 +$as_echo "guessing no" >&6; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + + +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; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + else @@ -4891,7 +4928,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 @@ -4905,30 +4942,6 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-unused-parameter" >&5 -$as_echo_n "checking whether $CC supports -Wno-unused-parameter... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-unused-parameter" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - PROD_WARN="$PROD_WARN -Wno-unused-parameter" - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$OLD_CFLAGS" - - # # LTO Support test # @@ -4953,8 +4966,8 @@ else /* end confdefs.h. */ int main(int argc, char **argv){ - return 0; - } + return 0; + } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -4978,23 +4991,278 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-pointer-sign" >&5 -$as_echo_n "checking whether $CC supports -Wno-pointer-sign... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-pointer-sign" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-unused-parameter" >&5 +$as_echo_n "checking whether $CC supports -Wno-unused-parameter... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-unused-parameter" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + # 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 -Wunused-parameter" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-pointer-sign" >&5 -$as_echo_n "checking whether $CC can actually use -Wno-pointer-sign... " >&6; } - # 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" + CFLAGS="$OLD_CFLAGS -Wno-unused-parameter" + # Optionally, run a test + if test "xint foo(int bar) { return 0; }" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-unused-parameter" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-unused-parameter... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wunused-parameter" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo(int bar) { return 0; } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +$as_echo "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" + +else + + CFLAGS="$OLD_CFLAGS -Werror -Wno-unused-parameter" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo(int bar) { return 0; } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-unused-parameter" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-maybe-uninitialized" >&5 +$as_echo_n "checking whether $CC supports -Wno-maybe-uninitialized... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-maybe-uninitialized" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # 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 -Wmaybe-uninitialized" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-maybe-uninitialized" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-maybe-uninitialized" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-maybe-uninitialized... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wmaybe-uninitialized" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +$as_echo "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" + +else + + CFLAGS="$OLD_CFLAGS -Werror -Wno-maybe-uninitialized" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-maybe-uninitialized" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-clobbered" >&5 +$as_echo_n "checking whether $CC supports -Wno-clobbered... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-clobbered" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # 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 -Wclobbered" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-clobbered" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-clobbered" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-clobbered... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wclobbered" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +$as_echo "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" + +else + + CFLAGS="$OLD_CFLAGS -Werror -Wno-clobbered" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-clobbered" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wempty-body" >&5 +$as_echo_n "checking whether $CC supports -Wempty-body... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wempty-body" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; @@ -5003,51 +5271,600 @@ if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - PROD_WARN="$PROD_WARN -Wno-pointer-sign" + CFLAGS="$OLD_CFLAGS -Wempty-body" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wempty-body" >&5 +$as_echo_n "checking whether $CC can actually use -Wempty-body... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wempty-body" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wempty-body" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$OLD_CFLAGS" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-switch" >&5 -$as_echo_n "checking whether $CC supports -Wno-switch... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-switch" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wnewline-eof" >&5 +$as_echo_n "checking whether $CC supports -Wnewline-eof... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wnewline-eof" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wnewline-eof" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wnewline-eof" >&5 +$as_echo_n "checking whether $CC can actually use -Wnewline-eof... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wnewline-eof" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wnewline-eof" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" + CFLAGS="$OLD_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wint-conversion" >&5 +$as_echo_n "checking whether $CC supports -Wint-conversion... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wint-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wint-conversion" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wint-conversion" >&5 +$as_echo_n "checking whether $CC can actually use -Wint-conversion... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wint-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wint-conversion" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wenum-conversion" >&5 +$as_echo_n "checking whether $CC supports -Wenum-conversion... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wenum-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wenum-conversion" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wenum-conversion" >&5 +$as_echo_n "checking whether $CC can actually use -Wenum-conversion... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wenum-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wenum-conversion" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wshorten-64-to-32" >&5 +$as_echo_n "checking whether $CC supports -Wshorten-64-to-32... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wshorten-64-to-32" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wshorten-64-to-32" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wshorten-64-to-32" >&5 +$as_echo_n "checking whether $CC can actually use -Wshorten-64-to-32... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wshorten-64-to-32" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wshorten-64-to-32" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wconstant-conversion" >&5 +$as_echo_n "checking whether $CC supports -Wconstant-conversion... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wconstant-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wconstant-conversion" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wconstant-conversion" >&5 +$as_echo_n "checking whether $CC can actually use -Wconstant-conversion... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wconstant-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wconstant-conversion" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wbool-conversion" >&5 +$as_echo_n "checking whether $CC supports -Wbool-conversion... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wbool-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wbool-conversion" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wbool-conversion" >&5 +$as_echo_n "checking whether $CC can actually use -Wbool-conversion... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wbool-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wbool-conversion" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-switch" >&5 +$as_echo_n "checking whether $CC supports -Wno-switch... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # 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 -Wswitch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-switch" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-switch" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-switch... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wswitch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +$as_echo "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" + +else + + CFLAGS="$OLD_CFLAGS -Werror -Wno-switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-switch" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-missing-field-initializers" >&5 +$as_echo_n "checking whether $CC supports -Wno-missing-field-initializers... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-missing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # 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 -Wmissing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-missing-field-initializers" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-missing-field-initializers" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-missing-field-initializers... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wmissing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +$as_echo "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" + +else + + CFLAGS="$OLD_CFLAGS -Werror -Wno-missing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-missing-field-initializers" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + +# Certain versions of gcc make -Wshadow completely useless by making it flood +# you with unnecessary warnings +# Let's check if we can really use it +SAVED_OLD_CFLAGS="$CFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wshadow" >&5 +$as_echo_n "checking whether $CC supports -Wshadow... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wshadow" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wshadow" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wshadow" >&5 +$as_echo_n "checking whether $CC can actually use -Wshadow... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wshadow" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wshadow" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +if test "x$CFLAGS" != "x$SAVED_OLD_CFLAGS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can efficiently use -Wshadow" >&5 +$as_echo_n "checking whether $CC can efficiently use -Wshadow... " >&6; } + NEW_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wshadow" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int foo(void) { + return 0; + } + int bar(void) { + int foo = 0; + return foo + 1; + } + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$NEW_CFLAGS" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$SAVED_OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fPIC" >&5 $as_echo_n "checking whether $CC supports -fPIC... " >&6; } OLD_CFLAGS="$CFLAGS" @@ -5073,6 +5890,206 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$OLD_CFLAGS" +# +# option for shared objects +# +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to make shared objects" >&5 +$as_echo_n "checking how to make shared objects... " >&6; } +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" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int bar = 0; + + int foo(void) + { + return bar; + } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + compiler_shared_objects="-shared" + compiler_supports_shared_objects="yes" + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +# BeOS specific +CFLAGS="$my_shared_test_flags -nostart" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int bar = 0; + + int foo(void) + { + return bar; + } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + compiler_shared_objects="-nostart" + compiler_supports_shared_objects="yes" + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +CFLAGS="$OLD_CFLAGS" +if test "$compiler_supports_shared_objects" = "no" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5 +$as_echo "not supported" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: compiler is unable to generate shared objects, disabled plugins (optional)" >&5 +$as_echo "$as_me: compiler is unable to generate shared objects, disabled plugins (optional)" >&6;} + WITH_PLUGINS="no" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $compiler_shared_objects $compiler_supports_shared_objects" >&5 +$as_echo "$compiler_shared_objects $compiler_supports_shared_objects" >&6; } + SOFLAGS="$SOFLAGS $compiler_shared_objects" + + + # + # On certain platforms, undefined references on shared libraries won't be checked + # unless explicitly required with the --no-undefined linker option + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -Wl,--no-undefined to check for undefined references in shared objects" >&5 +$as_echo_n "checking whether $CC needs -Wl,--no-undefined to check for undefined references in shared objects... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$SOFLAGS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + void foo(void) { + foobar(); + } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + CFLAGS="$SOFLAGS -Wl,--no-undefined" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int bar = 0; + + int foo(void) { + return bar; + } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SOFLAGS="$SOFLAGS -Wl,--no-undefined" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported (undefined references check will be ignored)" >&5 +$as_echo "unsupported (undefined references check will be ignored)" >&6; } + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$OLD_CFLAGS" + + # + # shared objects need position independent code; some platforms emit + # it always, others need -fPIC + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -fPIC for shared objects" >&5 +$as_echo_n "checking whether $CC needs -fPIC for shared objects... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $SOFLAGS" + WITH_PLUGINS="yes" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int bar = 0; + + int foo(void) + { + return bar; + } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + +else + + if test "$compiler_supports_pic" = "yes" ; then + # Verify if -shared really fails due to lack of -fPIC or something else + CFLAGS="$CFLAGS -fPIC" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int bar = 0; + + int foo(void) + { + return bar; + } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -fPIC" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, but fails for another reason" >&5 +$as_echo "no, but fails for another reason" >&6; } + as_fn_error $? "compiler is unable to compile shared objects for an unhandled reason, please report this with attached config.log... stopping" "$LINENO" 5 + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + else + # Disable compilation of plugins (optional), so 'make all' does not fail + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, but unsupported" >&5 +$as_echo "yes, but unsupported" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: compiler is unable to generate position independent code, disabled plugins (optional)" >&5 +$as_echo "$as_me: compiler is unable to generate position independent code, disabled plugins (optional)" >&6;} + WITH_PLUGINS="no" + fi + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +my_shared_test_flags="" + + # # -O2 implies -fstrict-aliasing, but the code is not safe for that @@ -5098,31 +6115,6 @@ $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# -# check if support conversion check -# -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wconversion" >&5 -$as_echo_n "checking whether $CC supports -Wconversion... " >&6; } -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wconversion" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - EXTRA_WARN="-Wconversion" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$OLD_CFLAGS" - ############################################################################### # Check for libraries and header files. @@ -5134,7 +6126,7 @@ CFLAGS="$OLD_CFLAGS" # 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 @@ -5144,7 +6136,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 @@ -5184,7 +6176,12 @@ done for ac_header in xlocale.h do : - ac_fn_c_check_header_mongrel "$LINENO" "xlocale.h" "ac_cv_header_xlocale_h" "$ac_includes_default" + ac_fn_c_check_header_compile "$LINENO" "xlocale.h" "ac_cv_header_xlocale_h" " +#ifdef HAVE_XLOCALE_H + # include + #endif + +" if test "x$ac_cv_header_xlocale_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_XLOCALE_H 1 @@ -5200,13 +6197,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 : @@ -5217,7 +6214,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 : @@ -5229,7 +6226,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 : @@ -5241,7 +6238,7 @@ fi ;; "bcheck") - CFLAGS="$CFLAGS -DBCHECK" + CPPFLAGS="$CPPFLAGS -DBCHECK" ;; esac @@ -5250,7 +6247,7 @@ esac # Packetver # if test -n "$enable_packetver" ; then - CFLAGS="$CFLAGS -DPACKETVER=$enable_packetver" + CPPFLAGS="$CPPFLAGS -DPACKETVER=$enable_packetver" fi @@ -5260,14 +6257,14 @@ fi case $enable_debug in "no") # default value - CFLAGS="$CFLAGS" + CPPFLAGS="$CPPFLAGS" ;; "yes") - CFLAGS="$CFLAGS -g -DDEBUG" + CPPFLAGS="$CPPFLAGS -g -DDEBUG" LDFLAGS="$LDFLAGS -g" ;; "gdb") - CFLAGS="$CFLAGS -ggdb -DDEBUG" + CPPFLAGS="$CPPFLAGS -ggdb -DDEBUG" LDFLAGS="$LDFLAGS -g" ;; esac @@ -5278,10 +6275,10 @@ esac case $enable_prere in "no") # default value - CFLAGS="$CFLAGS" + CPPFLAGS="$CPPFLAGS" ;; "yes") - CFLAGS="$CFLAGS -DPRERE" + CPPFLAGS="$CPPFLAGS -DPRERE" ;; esac @@ -5290,13 +6287,13 @@ esac # case $enable_warn in "no") #default - CFLAGS="$CFLAGS $PROD_WARN" + CPPFLAGS="$CPPFLAGS $PROD_WARN" ;; "yes") - CFLAGS="$CFLAGS" + CPPFLAGS="$CPPFLAGS" ;; "extra") - CFLAGS="$CFLAGS $EXTRA_WARN" + CPPFLAGS="$CPPFLAGS $EXTRA_WARN" ;; esac @@ -5308,7 +6305,7 @@ case $enable_buildbot in # default value ;; "yes") - CFLAGS="$CFLAGS -DBUILDBOT" + CPPFLAGS="$CPPFLAGS -DBUILDBOT" ;; esac @@ -5320,7 +6317,7 @@ case $enable_rdtsc in #default value ;; 1) - CFLAGS="$CFLAGS -DENABLE_RDTSC" + CPPFLAGS="$CPPFLAGS -DENABLE_RDTSC" ;; esac @@ -5346,13 +6343,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. */ @@ -5371,29 +6367,45 @@ 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 fi -ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" +ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "#ifdef HAVE_ZLIB_H + # include + #endif + +" if test "x$ac_cv_header_zlib_h" = xyes; then : else @@ -5563,7 +6575,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 @@ -5583,13 +6595,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. */ @@ -5608,35 +6619,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. */ @@ -5655,35 +6677,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. */ @@ -5702,35 +6735,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. */ @@ -5749,35 +6793,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. */ @@ -5796,35 +6851,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. */ @@ -5843,35 +6909,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. */ @@ -5890,31 +6967,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 @@ -6240,8 +7327,8 @@ else $as_echo "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: Configure finish, CFLAGS= $CFLAGS" >&5 -$as_echo "$as_me: Configure finish, CFLAGS= $CFLAGS" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: Configure finish, CPPFLAGS= $CPPFLAGS" >&5 +$as_echo "$as_me: Configure finish, CPPFLAGS= $CPPFLAGS" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: LDFLAGS=$LDFLAGS" >&5 $as_echo "$as_me: LDFLAGS=$LDFLAGS" >&6;} #AC_MSG_NOTICE([PROD_WARN= $PROD_WARN]) diff --git a/configure.in b/configure.in index a8fad86237..8394dd3c09 100644 --- a/configure.in +++ b/configure.in @@ -45,7 +45,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=""] @@ -247,18 +247,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" ] ) @@ -455,16 +455,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]) @@ -481,38 +502,23 @@ 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]) ] ) - -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([no])], - [ - AC_MSG_RESULT([yes]) - PROD_WARN="$PROD_WARN -Wno-unused-parameter" - ] -) -CFLAGS="$OLD_CFLAGS" - - # # LTO Support test # @@ -526,11 +532,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]) ], @@ -546,55 +552,147 @@ 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]) - PROD_WARN="$PROD_WARN -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_MSG_RESULT([no]) - CFLAGS="$OLD_CFLAGS" ] ) +AC_DEFUN(AC_CHECK_COMPILER_WNOFLAG, + [ + 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) + +# Certain versions of gcc make -Wshadow completely useless by making it flood +# you with unnecessary warnings +# 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" @@ -606,6 +704,152 @@ AC_COMPILE_IFELSE( ) CFLAGS="$OLD_CFLAGS" +# +# option for shared objects +# +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" + ] +) +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 $compiler_supports_shared_objects]) + SOFLAGS="$SOFLAGS $compiler_shared_objects" + AC_SUBST([SOFLAGS]) + + # + # 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) { + return bar; + } + ])], + [ + AC_MSG_RESULT([yes]) + SOFLAGS="$SOFLAGS -Wl,--no-undefined" + ], + [ + AC_MSG_RESULT([unsupported (undefined references check will be ignored)]) + ] + ) + ], + [ + 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]) + # # -O2 implies -fstrict-aliasing, but the code is not safe for that @@ -614,7 +858,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]) @@ -622,22 +866,6 @@ AC_COMPILE_IFELSE( ] ) -# -# check if support conversion check -# -AC_MSG_CHECKING([whether $CC supports -Wconversion]) -OLD_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wconversion" -AC_COMPILE_IFELSE( - [int foo;], - [ - AC_MSG_RESULT([yes]) - EXTRA_WARN="-Wconversion" - ], - [AC_MSG_RESULT([no])] -) -CFLAGS="$OLD_CFLAGS" - ############################################################################### # Check for libraries and header files. @@ -647,46 +875,50 @@ CFLAGS="$OLD_CFLAGS" # # 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]) AC_CHECK_FUNCS([newlocale]) AC_CHECK_FUNCS([freelocale]) -AC_CHECK_HEADERS([xlocale.h]) +AC_CHECK_HEADERS([xlocale.h], [], [], [ +AC_LANG_SOURCE([#ifdef HAVE_XLOCALE_H + # include + #endif + ])]) # # Memory manager # 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 @@ -695,7 +927,7 @@ esac # Packetver # if test -n "$enable_packetver" ; then - CFLAGS="$CFLAGS -DPACKETVER=$enable_packetver" + CPPFLAGS="$CPPFLAGS -DPACKETVER=$enable_packetver" fi @@ -705,14 +937,14 @@ fi case $enable_debug in "no") # default value - CFLAGS="$CFLAGS" + CPPFLAGS="$CPPFLAGS" ;; "yes") - CFLAGS="$CFLAGS -g -DDEBUG" + CPPFLAGS="$CPPFLAGS -g -DDEBUG" LDFLAGS="$LDFLAGS -g" ;; "gdb") - CFLAGS="$CFLAGS -ggdb -DDEBUG" + CPPFLAGS="$CPPFLAGS -ggdb -DDEBUG" LDFLAGS="$LDFLAGS -g" ;; esac @@ -723,10 +955,10 @@ esac case $enable_prere in "no") # default value - CFLAGS="$CFLAGS" + CPPFLAGS="$CPPFLAGS" ;; "yes") - CFLAGS="$CFLAGS -DPRERE" + CPPFLAGS="$CPPFLAGS -DPRERE" ;; esac @@ -735,13 +967,13 @@ esac # case $enable_warn in "no") #default - CFLAGS="$CFLAGS $PROD_WARN" + CPPFLAGS="$CPPFLAGS $PROD_WARN" ;; "yes") - CFLAGS="$CFLAGS" + CPPFLAGS="$CPPFLAGS" ;; "extra") - CFLAGS="$CFLAGS $EXTRA_WARN" + CPPFLAGS="$CPPFLAGS $EXTRA_WARN" ;; esac @@ -753,7 +985,7 @@ case $enable_buildbot in # default value ;; "yes") - CFLAGS="$CFLAGS -DBUILDBOT" + CPPFLAGS="$CPPFLAGS -DBUILDBOT" ;; esac @@ -765,7 +997,7 @@ case $enable_rdtsc in #default value ;; 1) - CFLAGS="$CFLAGS -DENABLE_RDTSC" + CPPFLAGS="$CPPFLAGS -DENABLE_RDTSC" ;; esac @@ -791,8 +1023,12 @@ 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_CHECK_HEADER([zlib.h], [], [AC_MSG_ERROR([zlib header not found, 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])], +[AC_LANG_SOURCE([#ifdef HAVE_ZLIB_H + # include + #endif + ])]) # @@ -818,20 +1054,20 @@ 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 #include #include - + int main(int argc, char** argv) { 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) @@ -848,15 +1084,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])]) # @@ -990,7 +1224,7 @@ else AC_MSG_RESULT([no]) fi -AC_MSG_NOTICE([Configure finish, CFLAGS= $CFLAGS]) +AC_MSG_NOTICE([Configure finish, CPPFLAGS= $CPPFLAGS]) AC_MSG_NOTICE([LDFLAGS=$LDFLAGS]) #AC_MSG_NOTICE([PROD_WARN= $PROD_WARN]) #AC_MSG_NOTICE([EXTRA_WARN= $EXTRA_WARN]) diff --git a/src/common/atomic.h b/src/common/atomic.h index 32b7ad267d..a90ecc1d6b 100644 --- a/src/common/atomic.h +++ b/src/common/atomic.h @@ -87,10 +87,16 @@ forceinline volatile int64 InterlockedExchange64(volatile int64 *target, int64 v #elif defined(__GNUC__) -#if !defined(__x86_64__) && !defined(__i386__) +// The __sync functions are available on x86 or ARMv6+ +//need to proper dig into arm macro, +//see http://sourceforge.net/p/predef/wiki/Architectures/ +#if !defined(__x86_64__) && !defined(__i386__) \ + && ( !defined(__ARM_ARCH_VERSION__) || __ARM_ARCH_VERSION__ < 6 ) \ + && ( !defined(__ARM_ARCH) && __ARM_ARCH < 6 ) #error Your Target Platfrom is not supported #endif + static forceinline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){ return __sync_fetch_and_add(addend, increment); }//end: InterlockedExchangeAdd64() diff --git a/src/common/nullpo.c b/src/common/nullpo.c index 4383109a7f..0069540f9f 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.c @@ -6,13 +6,12 @@ #include #include "nullpo.h" #include "../common/showmsg.h" -// #include "logs.h" // 布石してみる static void nullpo_info_core(const char *file, int line, const char *func, const char *fmt, va_list ap); /*====================================== - * Nullチェック 及び 情報出力 + * Null Information output and check *--------------------------------------*/ int nullpo_chk_f(const char *file, int line, const char *func, const void *target, const char *fmt, ...) @@ -30,16 +29,17 @@ int nullpo_chk_f(const char *file, int line, const char *func, const void *targe int nullpo_chk(const char *file, int line, const char *func, const void *target) { + va_list ap; if (target != NULL) return 0; - nullpo_info_core(file, line, func, NULL, NULL); + nullpo_info_core(file, line, func, NULL, ap); return 1; } /*====================================== - * nullpo情報出力(外部呼出し向けラッパ) + * nullpo Information output (external call) *--------------------------------------*/ void nullpo_info_f(const char *file, int line, const char *func, const char *fmt, ...) @@ -53,12 +53,13 @@ void nullpo_info_f(const char *file, int line, const char *func, void nullpo_info(const char *file, int line, const char *func) { - nullpo_info_core(file, line, func, NULL, NULL); + va_list ap; + nullpo_info_core(file, line, func, NULL, ap); } /*====================================== - * nullpo情報出力(Main) + * nullpo intelligence Output (Main) *--------------------------------------*/ static void nullpo_info_core(const char *file, int line, const char *func, const char *fmt, va_list ap) @@ -79,13 +80,10 @@ static void nullpo_info_core(const char *file, int line, const char *func, { vprintf(fmt, ap); - // 最後に改行したか確認 + // Check whether the new line at the end if (fmt[strlen(fmt)-1] != '\n') ShowMessage("\n"); } } ShowMessage("--- end nullpo info ----------------------------------------\n"); - - // ここらでnullpoログをファイルに書き出せたら - // まとめて提出できるなと思っていたり。 } diff --git a/src/common/utils.c b/src/common/utils.c index ecb4c68ba7..f9ab8f1b5f 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -259,6 +259,59 @@ uint32 MakeDWord(uint16 word0, uint16 word1) ( (uint32)(word1 << 0x10) ); } +/************************************* +* Big-endian compatibility functions * +*************************************/ + +// Converts an int16 from current machine order to little-endian +int16 MakeShortLE(int16 val) +{ + unsigned char buf[2]; + buf[0] = (unsigned char)( (val & 0x00FF) ); + buf[1] = (unsigned char)( (val & 0xFF00) >> 0x08 ); + return *((int16*)buf); +} + +// Converts an int32 from current machine order to little-endian +int32 MakeLongLE(int32 val) +{ + unsigned char buf[4]; + buf[0] = (unsigned char)( (val & 0x000000FF) ); + buf[1] = (unsigned char)( (val & 0x0000FF00) >> 0x08 ); + buf[2] = (unsigned char)( (val & 0x00FF0000) >> 0x10 ); + buf[3] = (unsigned char)( (val & 0xFF000000) >> 0x18 ); + return *((int32*)buf); +} + +// Reads an uint16 in little-endian from the buffer +uint16 GetUShort(const unsigned char* buf) +{ + return ( ((uint16)(buf[0])) ) + |( ((uint16)(buf[1])) << 0x08 ); +} + +// Reads an uint32 in little-endian from the buffer +uint32 GetULong(const unsigned char* buf) +{ + return ( ((uint32)(buf[0])) ) + |( ((uint32)(buf[1])) << 0x08 ) + |( ((uint32)(buf[2])) << 0x10 ) + |( ((uint32)(buf[3])) << 0x18 ); +} + +// Reads an int32 in little-endian from the buffer +int32 GetLong(const unsigned char* buf) +{ + return (int32)GetULong(buf); +} + +// Reads a float (32 bits) from the buffer +float GetFloat(const unsigned char* buf) +{ + uint32 val = GetULong(buf); + return *((float*)(void*)&val); +} + uint32 date2version(int date) { if(date < 20040906) return 5; else if(date < 20040920) return 10; diff --git a/src/common/utils.h b/src/common/utils.h index 07f927440c..329c9f67b7 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -29,6 +29,16 @@ extern uint16 GetWord(uint32 val, int idx); extern uint16 MakeWord(uint8 byte0, uint8 byte1); extern uint32 MakeDWord(uint16 word0, uint16 word1); +////////////////////////////////////////////////////////////////////////// +// Big-endian compatibility functions +////////////////////////////////////////////////////////////////////////// +extern int16 MakeShortLE(int16 val); +extern int32 MakeLongLE(int32 val); +extern uint16 GetUShort(const unsigned char* buf); +extern uint32 GetULong(const unsigned char* buf); +extern int32 GetLong(const unsigned char* buf); +extern float GetFloat(const unsigned char* buf); + uint32 date2version(int date); int levenshtein(const char *s1, const char *s2); diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c index 49f948709f..2ac07c2c7c 100644 --- a/src/tool/mapcache.c +++ b/src/tool/mapcache.c @@ -1,14 +1,6 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder -#include "../common/cbasetypes.h" -#include "../common/grfio.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" - -#include "../config/renewal.h" - #include #include #include @@ -17,6 +9,14 @@ #include #endif +#include "../common/cbasetypes.h" +#include "../common/grfio.h" +#include "../common/malloc.h" +#include "../common/mmo.h" +#include "../common/showmsg.h" + +#include "../config/renewal.h" + #define NO_WATER 1000000 char grf_list_file[256] = "conf/grf-files.txt"; @@ -50,60 +50,6 @@ struct map_info { }; -/************************************* -* Big-endian compatibility functions * -*************************************/ - -// Converts an int16 from current machine order to little-endian -int16 MakeShortLE(int16 val) -{ - unsigned char buf[2]; - buf[0] = (unsigned char)( (val & 0x00FF) ); - buf[1] = (unsigned char)( (val & 0xFF00) >> 0x08 ); - return *((int16*)buf); -} - -// Converts an int32 from current machine order to little-endian -int32 MakeLongLE(int32 val) -{ - unsigned char buf[4]; - buf[0] = (unsigned char)( (val & 0x000000FF) ); - buf[1] = (unsigned char)( (val & 0x0000FF00) >> 0x08 ); - buf[2] = (unsigned char)( (val & 0x00FF0000) >> 0x10 ); - buf[3] = (unsigned char)( (val & 0xFF000000) >> 0x18 ); - return *((int32*)buf); -} - -// Reads an uint16 in little-endian from the buffer -uint16 GetUShort(const unsigned char* buf) -{ - return ( ((uint16)(buf[0])) ) - |( ((uint16)(buf[1])) << 0x08 ); -} - -// Reads an uint32 in little-endian from the buffer -uint32 GetULong(const unsigned char* buf) -{ - return ( ((uint32)(buf[0])) ) - |( ((uint32)(buf[1])) << 0x08 ) - |( ((uint32)(buf[2])) << 0x10 ) - |( ((uint32)(buf[3])) << 0x18 ); -} - -// Reads an int32 in little-endian from the buffer -int32 GetLong(const unsigned char* buf) -{ - return (int32)GetULong(buf); -} - -// Reads a float (32 bits) from the buffer -float GetFloat(const unsigned char* buf) -{ - uint32 val = GetULong(buf); - return *((float*)(void*)&val); -} - - // Reads a map from GRF's GAT and RSW files int read_map(char *name, struct map_data *m) {