From e9edd2a8df5f35670b4532f8fd82cab7f076a8ff Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 25 Apr 2013 01:32:16 +0700 Subject: [PATCH] windows build fixes --- tcejdb/configure | 1103 ++++++++++++++++++++++++----------------------- tcejdb/configure.ac | 15 +- tcejdb/mxe/mxe-build.sh | 2 +- 3 files changed, 561 insertions(+), 559 deletions(-) diff --git a/tcejdb/configure b/tcejdb/configure index cb281e3..13d1a68 100755 --- a/tcejdb/configure +++ b/tcejdb/configure @@ -2208,415 +2208,144 @@ MYMAN3FILES="libtcejdb.3" MYDOCUMENTFILES="COPYING Changelog" MYPCFILES="tcejdb.pc" -case $host_os in - mingw*) - #durty hack fixes weird behaviour of gcc -O[123] optimizations with ejdb test cases on win32 - #CCOPT=`gcc -O2 -Q --help=optimizers | grep enabled | sed 's/\[[enabled\]]//' | tr '\n' ' ' | sed 's/[[[:blank:]]]\+/ /g'` - CCOPT="-O2" - ;; - *) - CCOPT="-O3" - ;; -esac - -# Building flags -MYCFLAGS="$MYCFLAGS -std=gnu99 -Wall -fsigned-char $CCOPT -Wfatal-errors" -MYCPPFLAGS="-I. -I$HOME/include -I\$(INCLUDEDIR) -I/usr/local/include" -MYCPPFLAGS="$MYCPPFLAGS -D_UNICODE -DNDEBUG -D_GNU_SOURCE=1 -D_REENTRANT -D__EXTENSIONS__" -MYLDFLAGS="-L. -L\$(LIBDIR) -L$HOME/lib -L/usr/local/lib -L/usr/lib" -MYCMDLDFLAGS="" -MYRUNPATH="\$(LIBDIR)" -MYLDLIBPATHENV="LD_LIBRARY_PATH" -MYPOSTCMD="true" - -# Building paths -PATH="$PATH:$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin" -PATH="$PATH:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/xpg4/bin:/usr/xpg6/bin:/usr/ucb" -CPATH="$HOME/include:/usr/local/include:$CPATH" -LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LIBRARY_PATH" -LD_LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH" -PKG_CONFIG_PATH="$HOME/lib/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" -export PATH CPATH LIBRARY_PATH LD_LIBRARY_PATH PKG_CONFIG_PATH - - -#================================================================ -# Options -#================================================================ - - -# Internal variables -enables="" - -# Debug mode -# Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then : - enableval=$enable_debug; -fi - -if test "$enable_debug" = "yes" -then - MYCFLAGS="-std=gnu99 -Wall -pedantic -fsigned-char -g -O0 -Wfatal-errors" - MYCPPFLAGS="$MYCPPFLAGS -D_DEBUG -UNDEBUG -DEJDB_STATIC" - MYCMDLDFLAGS="$MYCMDLDFLAGS -static" - enables="$enables (debug)" +#C compiler +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else - MYLDFLAGS="$MYLDFLAGS -s" -fi - -# Developping mode -# Check whether --enable-devel was given. -if test "${enable_devel+set}" = set; then : - enableval=$enable_devel; -fi - -if test "$enable_devel" = "yes" -then - MYCFLAGS="-std=gnu99 -Wall -pedantic -fsigned-char -g $CCOPT -pipe" - MYCPPFLAGS="$MYCPPFLAGS -D_DEBUG -UNDEBUG" - enables="$enables (devel)" -fi - -# Profiling mode -# Check whether --enable-profile was given. -if test "${enable_profile+set}" = set; then : - enableval=$enable_profile; -fi + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -if test "$enable_profile" = "yes" -then - MYCFLAGS="-std=gnu99 -Wall -pedantic -fsigned-char -g -pg $CCOPT -pipe -Wfatal-errors" - enables="$enables (profile)" fi - -# Static mode -# Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; fi - -if test "$enable_static" = "yes" -then - MYCMDLDFLAGS="$MYCMDLDFLAGS -static" - enables="$enables (static)" +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -# Fastest mode -# Check whether --enable-fastest was given. -if test "${enable_fastest+set}" = set; then : - enableval=$enable_fastest; -fi -if test "$enable_fastest" = "yes" -then - MYLIBOBJFILES="tokyocabinet_all.o" - MYCFLAGS="-std=gnu99 -Wall -pedantic -fsigned-char -O3" - MYCFLAGS="$MYCFLAGS -fomit-frame-pointer -fforce-addr -minline-all-stringops" - MYCPPFLAGS="$MYCPPFLAGS -D_MYFASTEST" - enables="$enables (fastest)" fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -# 64-bit offset mode -# Check whether --enable-off64 was given. -if test "${enable_off64+set}" = set; then : - enableval=$enable_off64; fi - -if test "$enable_off64" = "yes" -then - MYCPPFLAGS="$MYCPPFLAGS -D_FILE_OFFSET_BITS=64" - enables="$enables (off64)" fi - -# Swapping byte-orders mode -# Check whether --enable-swab was given. -if test "${enable_swab+set}" = set; then : - enableval=$enable_swab; +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -if test "$enable_swab" = "yes" -then - MYCPPFLAGS="$MYCPPFLAGS -D_MYSWAB" - enables="$enables (swab)" + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" fi -# Micro yield mode -# Check whether --enable-uyield was given. -if test "${enable_uyield+set}" = set; then : - enableval=$enable_uyield; -fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -if test "$enable_uyield" = "yes" -then - MYCPPFLAGS="$MYCPPFLAGS -D_MYMICROYIELD" - enables="$enables (uyield)" fi - -# Enable test cases -# Check whether --enable-tests was given. -if test "${enable_tests+set}" = set; then : - enableval=$enable_tests; fi - -if test "$enable_tests" = "yes" -then - MYCPPFLAGS="$MYCPPFLAGS -D_MYTESTS" - enables="$enables (tests)" +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -# Enable BZIP2 compression -# Check whether --enable-bzip was given. -if test "${enable_bzip+set}" = set; then : - enableval=$enable_bzip; -fi -if test "$enable_bzip" = "yes" -then - MYCPPFLAGS="$MYCPPFLAGS -D_MYBZIP" - enables="$enables (bzip)" -fi - -# Disable the unified buffer cache assumption -# Check whether --enable-ubc was given. -if test "${enable_ubc+set}" = set; then : - enableval=$enable_ubc; -fi - -if test "$enable_ubc" = "no" -then - MYCPPFLAGS="$MYCPPFLAGS -D_MYNOUBC" - enables="$enables (no-ubc)" -fi - -# Disable ZLIB compression -# Check whether --enable-zlib was given. -if test "${enable_zlib+set}" = set; then : - enableval=$enable_zlib; -fi - -if test "$enable_zlib" = "no" -then - MYCPPFLAGS="$MYCPPFLAGS -D_MYNOZLIB" - enables="$enables (no-zlib)" -fi - -# Disable shared object -# Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; -fi - -if test "$enable_shared" = "no" -then - enables="$enables (no-shared)" -fi - -# Enable custom codec functions of LZMA -# Check whether --enable-exlzma was given. -if test "${enable_exlzma+set}" = set; then : - enableval=$enable_exlzma; -fi - -if test "$enable_exlzma" = "yes" -then - MYCPPFLAGS="$MYCPPFLAGS -D_MYEXLZMA" - enables="$enables (exlzma)" -fi - -# Enable custom codec functions of LZO -# Check whether --enable-exlzo was given. -if test "${enable_exlzo+set}" = set; then : - enableval=$enable_exlzo; -fi - -if test "$enable_exlzo" = "yes" -then - MYCPPFLAGS="$MYCPPFLAGS -D_MYEXLZO" - enables="$enables (exlzo)" -fi - -# Specify the installation path of ZLIB - -# Check whether --with-zlib was given. -if test "${with_zlib+set}" = set; then : - withval=$with_zlib; -fi - -if test -n "$with_zlib" -then - MYCPPFLAGS="$MYCPPFLAGS -I$with_zlib/include" - MYLDFLAGS="$MYLDFLAGS -L$with_zlib/lib" - MYRUNPATH="$MYRUNPATH:$with_zlib/lib" - CPATH="$CPATH:$with_zlib/include" - LIBRARY_PATH="$LIBRARY_PATH:$with_zlib/lib" - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$with_zlib/lib" -fi - -# Specify the installation path of BZIP2 - -# Check whether --with-bzip was given. -if test "${with_bzip+set}" = set; then : - withval=$with_bzip; -fi - -if test -n "$with_bzip" -then - MYCPPFLAGS="$MYCPPFLAGS -I$with_bzip/include" - MYLDFLAGS="$MYLDFLAGS -L$with_bzip/lib" - MYRUNPATH="$MYRUNPATH:$with_bzip/lib" - CPATH="$CPATH:$with_bzip/include" - LIBRARY_PATH="$LIBRARY_PATH:$with_bzip/lib" - LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$with_bzip/lib" -fi - -# Messages -printf '#================================================================\n' -printf '# Configuring EJDB version %s%s.\n' "$PACKAGE_VERSION" "$enables" -printf '#================================================================\n' - - - -#================================================================ -# Checking Commands and Libraries -#================================================================ - -# C compiler -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi + fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. @@ -3082,194 +2811,466 @@ if ac_fn_c_try_compile "$LINENO"; then : else ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +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 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +case $host_os in + mingw*) + #durty hack fixes weird behaviour of gcc -O[123] optimizations with ejdb test cases on win32 + CCOPT=`$CC -O2 -Q --help=optimizers | grep enabled | sed 's/\[enabled\]//' | tr '\n' ' ' | sed 's/[[:blank:]]\+/ /g'` + #CCOPT="-O2" + ;; + *) + CCOPT="-O3" + ;; +esac + +# Building flags +MYCFLAGS="$MYCFLAGS -std=gnu99 -Wall -fsigned-char $CCOPT -Wfatal-errors" +MYCPPFLAGS="-I. -I\$(INCLUDEDIR)" +MYCPPFLAGS="$MYCPPFLAGS -D_UNICODE -DNDEBUG -D_GNU_SOURCE=1 -D_REENTRANT -D__EXTENSIONS__" +MYLDFLAGS="-L. -L\$(LIBDIR)" +MYCMDLDFLAGS="" +MYRUNPATH="\$(LIBDIR)" +MYLDLIBPATHENV="LD_LIBRARY_PATH" +MYPOSTCMD="true" + +# Building paths +PATH="$PATH:$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin" +PATH="$PATH:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/xpg4/bin:/usr/xpg6/bin:/usr/ucb" +CPATH="$HOME/include:/usr/local/include:$CPATH" +LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LIBRARY_PATH" +LD_LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH" +PKG_CONFIG_PATH="$HOME/lib/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" +export PATH CPATH LIBRARY_PATH LD_LIBRARY_PATH PKG_CONFIG_PATH + + +#================================================================ +# Options +#================================================================ + + +# Internal variables +enables="" + +# Debug mode +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; +fi + +if test "$enable_debug" = "yes" +then + MYCFLAGS="-std=gnu99 -Wall -pedantic -fsigned-char -g -O0 -Wfatal-errors" + MYCPPFLAGS="$MYCPPFLAGS -D_DEBUG -UNDEBUG -DEJDB_STATIC" + MYCMDLDFLAGS="$MYCMDLDFLAGS -static" + enables="$enables (debug)" +else + MYLDFLAGS="$MYLDFLAGS -s" +fi + +# Developping mode +# Check whether --enable-devel was given. +if test "${enable_devel+set}" = set; then : + enableval=$enable_devel; +fi + +if test "$enable_devel" = "yes" +then + MYCFLAGS="-std=gnu99 -Wall -pedantic -fsigned-char -g $CCOPT -pipe" + MYCPPFLAGS="$MYCPPFLAGS -D_DEBUG -UNDEBUG" + enables="$enables (devel)" +fi + +# Profiling mode +# Check whether --enable-profile was given. +if test "${enable_profile+set}" = set; then : + enableval=$enable_profile; +fi + +if test "$enable_profile" = "yes" +then + MYCFLAGS="-std=gnu99 -Wall -pedantic -fsigned-char -g -pg $CCOPT -pipe -Wfatal-errors" + enables="$enables (profile)" +fi + +# Static mode +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; +fi + +if test "$enable_static" = "yes" +then + MYCMDLDFLAGS="$MYCMDLDFLAGS -static" + enables="$enables (static)" +fi + +# Fastest mode +# Check whether --enable-fastest was given. +if test "${enable_fastest+set}" = set; then : + enableval=$enable_fastest; +fi + +if test "$enable_fastest" = "yes" +then + MYLIBOBJFILES="tokyocabinet_all.o" + MYCFLAGS="-std=gnu99 -Wall -pedantic -fsigned-char -O3" + MYCFLAGS="$MYCFLAGS -fomit-frame-pointer -fforce-addr -minline-all-stringops" + MYCPPFLAGS="$MYCPPFLAGS -D_MYFASTEST" + enables="$enables (fastest)" +fi + +# 64-bit offset mode +# Check whether --enable-off64 was given. +if test "${enable_off64+set}" = set; then : + enableval=$enable_off64; +fi + +if test "$enable_off64" = "yes" +then + MYCPPFLAGS="$MYCPPFLAGS -D_FILE_OFFSET_BITS=64" + enables="$enables (off64)" +fi + +# Swapping byte-orders mode +# Check whether --enable-swab was given. +if test "${enable_swab+set}" = set; then : + enableval=$enable_swab; +fi + +if test "$enable_swab" = "yes" +then + MYCPPFLAGS="$MYCPPFLAGS -D_MYSWAB" + enables="$enables (swab)" +fi + +# Micro yield mode +# Check whether --enable-uyield was given. +if test "${enable_uyield+set}" = set; then : + enableval=$enable_uyield; +fi + +if test "$enable_uyield" = "yes" +then + MYCPPFLAGS="$MYCPPFLAGS -D_MYMICROYIELD" + enables="$enables (uyield)" +fi + +# Enable test cases +# Check whether --enable-tests was given. +if test "${enable_tests+set}" = set; then : + enableval=$enable_tests; +fi + +if test "$enable_tests" = "yes" +then + MYCPPFLAGS="$MYCPPFLAGS -D_MYTESTS" + enables="$enables (tests)" +fi +# Enable BZIP2 compression +# Check whether --enable-bzip was given. +if test "${enable_bzip+set}" = set; then : + enableval=$enable_bzip; fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main () -{ +if test "$enable_bzip" = "yes" +then + MYCPPFLAGS="$MYCPPFLAGS -D_MYBZIP" + enables="$enables (bzip)" +fi - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +# Disable the unified buffer cache assumption +# Check whether --enable-ubc was given. +if test "${enable_ubc+set}" = set; then : + enableval=$enable_ubc; +fi -int -main () -{ +if test "$enable_ubc" = "no" +then + MYCPPFLAGS="$MYCPPFLAGS -D_MYNOUBC" + enables="$enables (no-ubc)" +fi - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +# Disable ZLIB compression +# Check whether --enable-zlib was given. +if test "${enable_zlib+set}" = set; then : + enableval=$enable_zlib; +fi -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +if test "$enable_zlib" = "no" +then + MYCPPFLAGS="$MYCPPFLAGS -D_MYNOZLIB" + enables="$enables (no-zlib)" +fi -int -main () -{ +# Disable shared object +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; +fi - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes +if test "$enable_shared" = "no" +then + enables="$enables (no-shared)" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +# Enable custom codec functions of LZMA +# Check whether --enable-exlzma was given. +if test "${enable_exlzma+set}" = set; then : + enableval=$enable_exlzma; fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test "$enable_exlzma" = "yes" +then + MYCPPFLAGS="$MYCPPFLAGS -D_MYEXLZMA" + enables="$enables (exlzma)" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag + +# Enable custom codec functions of LZO +# Check whether --enable-exlzo was given. +if test "${enable_exlzo+set}" = set; then : + enableval=$enable_exlzo; fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi + +if test "$enable_exlzo" = "yes" +then + MYCPPFLAGS="$MYCPPFLAGS -D_MYEXLZO" + enables="$enables (exlzo)" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +# Specify the installation path of ZLIB -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +# Check whether --with-zlib was given. +if test "${with_zlib+set}" = set; then : + withval=$with_zlib; +fi -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg +if test -n "$with_zlib" +then + MYCPPFLAGS="$MYCPPFLAGS -I$with_zlib/include" + MYLDFLAGS="$MYLDFLAGS -L$with_zlib/lib" + MYRUNPATH="$MYRUNPATH:$with_zlib/lib" + CPATH="$CPATH:$with_zlib/include" + LIBRARY_PATH="$LIBRARY_PATH:$with_zlib/lib" + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$with_zlib/lib" fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC +# Specify the installation path of BZIP2 + +# Check whether --with-bzip was given. +if test "${with_bzip+set}" = set; then : + withval=$with_bzip; fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test -n "$with_bzip" +then + MYCPPFLAGS="$MYCPPFLAGS -I$with_bzip/include" + MYLDFLAGS="$MYLDFLAGS -L$with_bzip/lib" + MYRUNPATH="$MYRUNPATH:$with_bzip/lib" + CPATH="$CPATH:$with_bzip/include" + LIBRARY_PATH="$LIBRARY_PATH:$with_bzip/lib" + LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$with_bzip/lib" fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +# Messages +printf '#================================================================\n' +printf '# Configuring EJDB version %s%s.\n' "$PACKAGE_VERSION" "$enables" +printf '#================================================================\n' + +#================================================================ +# Checking Commands and Libraries +#================================================================ + # BSD install # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or diff --git a/tcejdb/configure.ac b/tcejdb/configure.ac index c958867..73f7e20 100644 --- a/tcejdb/configure.ac +++ b/tcejdb/configure.ac @@ -35,11 +35,15 @@ MYMAN3FILES="libtcejdb.3" MYDOCUMENTFILES="COPYING Changelog" MYPCFILES="tcejdb.pc" +#C compiler +AC_PROG_CC + + case $host_os in mingw*) #durty hack fixes weird behaviour of gcc -O[123] optimizations with ejdb test cases on win32 - #CCOPT=`gcc -O2 -Q --help=optimizers | grep enabled | sed 's/\[[enabled\]]//' | tr '\n' ' ' | sed 's/[[[:blank:]]]\+/ /g'` - CCOPT="-O2" + CCOPT=`$CC -O2 -Q --help=optimizers | grep enabled | sed 's/\[[enabled\]]//' | tr '\n' ' ' | sed 's/[[[:blank:]]]\+/ /g'` + #CCOPT="-O2" ;; *) CCOPT="-O3" @@ -48,9 +52,9 @@ esac # Building flags MYCFLAGS="$MYCFLAGS -std=gnu99 -Wall -fsigned-char $CCOPT -Wfatal-errors" -MYCPPFLAGS="-I. -I$HOME/include -I\$(INCLUDEDIR) -I/usr/local/include" +MYCPPFLAGS="-I. -I\$(INCLUDEDIR)" MYCPPFLAGS="$MYCPPFLAGS -D_UNICODE -DNDEBUG -D_GNU_SOURCE=1 -D_REENTRANT -D__EXTENSIONS__" -MYLDFLAGS="-L. -L\$(LIBDIR) -L$HOME/lib -L/usr/local/lib -L/usr/lib" +MYLDFLAGS="-L. -L\$(LIBDIR)" MYCMDLDFLAGS="" MYRUNPATH="\$(LIBDIR)" MYLDLIBPATHENV="LD_LIBRARY_PATH" @@ -253,9 +257,6 @@ printf '#================================================================\n' # Checking Commands and Libraries #================================================================ -# C compiler -AC_PROG_CC - # BSD install AC_PROG_INSTALL diff --git a/tcejdb/mxe/mxe-build.sh b/tcejdb/mxe/mxe-build.sh index f478074..9cf5e4d 100755 --- a/tcejdb/mxe/mxe-build.sh +++ b/tcejdb/mxe/mxe-build.sh @@ -45,5 +45,5 @@ autoconf make clean make make win-archive - +make -C testejdb/ all -- 2.7.4