From 042b3e434396095cb4365e8d516a5954af87a14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Wed, 28 May 2014 00:07:08 +0100 Subject: [PATCH] improve android compilation and fix readline 6.3 --- configure | 507 +++++++++++++++++++++++++++------------------------ configure.in | 117 +++++++----- os/pl-rl.c | 9 +- 3 files changed, 350 insertions(+), 283 deletions(-) diff --git a/configure b/configure index 82d3f4808..c7aa52a2c 100755 --- a/configure +++ b/configure @@ -752,6 +752,8 @@ SHLIB_CFLAGS MERGE_DLL_OBJS INSTALL_DLLS EXTRAYAPLIBS +STARTUP_DEFAULT +STARTUP_ANDROID ARCH M4GENHDRS M4 @@ -839,6 +841,7 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking +with_sysroot enable_abi enable_tabling enable_or_parallelism @@ -1550,6 +1553,7 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-sysroot=DIR set sysroot in compiler --with-gmp=DIR use GNU Multiple Precision in DIR --with-R=DIR interface to R language --with-judy=DIR UDI needs judy library @@ -1824,6 +1828,133 @@ fi } # ac_fn_c_try_link +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=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 +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using @@ -1915,79 +2046,6 @@ fi } # ac_fn_c_check_header_mongrel -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly @@ -2294,60 +2352,6 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=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 -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -2703,6 +2707,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu DOC_VERSION=4.2.9 + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; SYSROOT="$withval" + CPPFLAGS="$CPPFLAGS --sysroot=$SYSROOT" + CFLAGS="$CFLAGS --sysroot=$SYSROOT" + CPPFLAGS="$CPPFLAGS --sysroot=$SYSROOT" + LDFLAGS="$LDFLAGS --sysroot=$SYSROOT" +else + yap_cv_gmp=yes +fi + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6445,104 +6462,6 @@ See \`config.log' for more details" "$LINENO" 5; } fi -fi - -if test "$yap_cv_gmp" != "no" -then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lgmp" >&5 -$as_echo_n "checking for main in -lgmp... " >&6; } -if ${ac_cv_lib_gmp_main+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgmp $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -int -main () -{ -return main (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gmp_main=yes -else - ac_cv_lib_gmp_main=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp_main" >&5 -$as_echo "$ac_cv_lib_gmp_main" >&6; } -if test "x$ac_cv_lib_gmp_main" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBGMP 1 -_ACEOF - - LIBS="-lgmp $LIBS" - -fi - -fi - -if test "$yap_cv_judy" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Judy1Set in -lJudy" >&5 -$as_echo_n "checking for Judy1Set in -lJudy... " >&6; } -if ${ac_cv_lib_Judy_Judy1Set+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lJudy $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char Judy1Set (); -int -main () -{ -return Judy1Set (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Judy_Judy1Set=yes -else - ac_cv_lib_Judy_Judy1Set=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Judy_Judy1Set" >&5 -$as_echo "$ac_cv_lib_Judy_Judy1Set" >&6; } -if test "x$ac_cv_lib_Judy_Judy1Set" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBJUDY 1 -_ACEOF - - LIBS="-lJudy $LIBS" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: libJudy not found, UDI will only work with one Index at a time" >&5 -$as_echo "libJudy not found, UDI will only work with one Index at a time" >&6; } -fi - -fi - -if test "$threads" = yes -then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } @@ -6803,7 +6722,115 @@ fi done -for ac_header in pthread.h +ac_fn_c_check_type "$LINENO" "rl_hook_func_t" "ac_cv_type_rl_hook_func_t" "$ac_includes_default" +if test "x$ac_cv_type_rl_hook_func_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_RL_HOOK_FUNC_T 1 +_ACEOF + + +fi + +fi + +if test "$yap_cv_gmp" != "no" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lgmp" >&5 +$as_echo_n "checking for main in -lgmp... " >&6; } +if ${ac_cv_lib_gmp_main+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgmp $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ +return main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gmp_main=yes +else + ac_cv_lib_gmp_main=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp_main" >&5 +$as_echo "$ac_cv_lib_gmp_main" >&6; } +if test "x$ac_cv_lib_gmp_main" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGMP 1 +_ACEOF + + LIBS="-lgmp $LIBS" + +fi + +fi + +if test "$yap_cv_judy" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Judy1Set in -lJudy" >&5 +$as_echo_n "checking for Judy1Set in -lJudy... " >&6; } +if ${ac_cv_lib_Judy_Judy1Set+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lJudy $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char Judy1Set (); +int +main () +{ +return Judy1Set (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_Judy_Judy1Set=yes +else + ac_cv_lib_Judy_Judy1Set=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Judy_Judy1Set" >&5 +$as_echo "$ac_cv_lib_Judy_Judy1Set" >&6; } +if test "x$ac_cv_lib_Judy_Judy1Set" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBJUDY 1 +_ACEOF + + LIBS="-lJudy $LIBS" + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: libJudy not found, UDI will only work with one Index at a time" >&5 +$as_echo "libJudy not found, UDI will only work with one Index at a time" >&6; } +fi + +fi + +if test "$threads" = yes +then + for ac_header in pthread.h do : ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes; then : @@ -8612,6 +8639,19 @@ if test "x$ARCH" = "x"; then fi +case "$host" in + *android*) + STARTUP_ANDROID="" + STARTUP_DEFAULT="x" + ;; + **) + STARTUP_ANDROID="x" + STARTUP_DEFAULT="" + ;; +esac + + + CMDEXT=sh @@ -12432,7 +12472,7 @@ else JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST -/* #line 12435 "configure" */ +/* #line 12475 "configure" */ public class Test { } EOF @@ -12608,7 +12648,7 @@ EOF if uudecode$EXEEXT Test.uue; then ac_cv_prog_uudecode_base64=yes else - echo "configure: 12611: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 + echo "configure: 12651: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 echo "configure: failed file was:" >&5 cat Test.uue >&5 ac_cv_prog_uudecode_base64=no @@ -12739,7 +12779,7 @@ else JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST -/* #line 12742 "configure" */ +/* #line 12782 "configure" */ public class Test { } EOF @@ -12774,7 +12814,7 @@ JAVA_TEST=Test.java CLASS_TEST=Test.class TEST=Test cat << \EOF > $JAVA_TEST -/* [#]line 12777 "configure" */ +/* [#]line 12817 "configure" */ public class Test { public static void main (String args[]) { System.exit (0); @@ -15427,14 +15467,13 @@ if test "$PKG_SWIG" != ""; then mkdir -p packages/swig/python mkdir -p packages/swig/R mkdir -p packages/swig/java -mkdir -p packages/swig/src -mkdir -p packages/swig/jni +mkdir -p packages/swig/fli -ac_config_files="$ac_config_files packages/swig/Makefile packages/swig/jni/Android.mk" +ac_config_files="$ac_config_files packages/swig/Makefile packages/swig/Android.mk" fi @@ -16773,7 +16812,7 @@ do "library/matlab/Makefile") CONFIG_FILES="$CONFIG_FILES library/matlab/Makefile" ;; "packages/python/Makefile") CONFIG_FILES="$CONFIG_FILES packages/python/Makefile" ;; "packages/swig/Makefile") CONFIG_FILES="$CONFIG_FILES packages/swig/Makefile" ;; - "packages/swig/jni/Android.mk") CONFIG_FILES="$CONFIG_FILES packages/swig/jni/Android.mk" ;; + "packages/swig/Android.mk") CONFIG_FILES="$CONFIG_FILES packages/swig/Android.mk" ;; "packages/cuda/Makefile") CONFIG_FILES="$CONFIG_FILES packages/cuda/Makefile" ;; "packages/gecode/Makefile") CONFIG_FILES="$CONFIG_FILES packages/gecode/Makefile" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; diff --git a/configure.in b/configure.in index 05ebc57ee..6005f3f54 100755 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl AC_PREREQ([2.50]) -dnl VARIABLES EXPORTED +dnl VARIABLES EXPORTED dnl dnl ARCH dnl @@ -40,6 +40,15 @@ AC_INIT(YAP, 6.3.4, yap-users@sf.net, yap ) DOC_VERSION=4.2.9 +AC_ARG_WITH(sysroot, + [ --with-sysroot[=DIR] set sysroot in compiler], + [ SYSROOT="$withval" + CPPFLAGS="$CPPFLAGS --sysroot=$SYSROOT" + CFLAGS="$CFLAGS --sysroot=$SYSROOT" + CPPFLAGS="$CPPFLAGS --sysroot=$SYSROOT" + LDFLAGS="$LDFLAGS --sysroot=$SYSROOT" ], + [yap_cv_gmp=yes]) + AC_PROG_CC AC_PROG_CPP AC_PROG_CXX @@ -193,7 +202,7 @@ AC_ARG_WITH(gmp, CFLAGS="$CFLAGS -I${yap_cv_gmp}/include" fi, [yap_cv_gmp=yes]) - + AC_ARG_WITH(R, [ --with-R[=DIR] interface to R language], if test "$withval" = yes; then @@ -204,7 +213,7 @@ AC_ARG_WITH(R, yap_cv_R=$withval fi, [yap_cv_R=no]) - + AC_ARG_WITH(judy, [ --with-judy[=DIR] UDI needs judy library], if test "$withval" = yes; then @@ -317,7 +326,7 @@ AC_ARG_WITH(max-threads, [yap_cv_max_threads="1024"]) AC_DEFINE(MinHeapSpace, (2048*SIZEOF_INT_P), [at least 2M Cells for Heap]) - AC_DEFINE(MinStackSpace,(1024*SIZEOF_INT_P), [at least 1M Cells for Stack]) + AC_DEFINE(MinStackSpace,(1024*SIZEOF_INT_P), [at least 1M Cells for Stack]) AC_DEFINE(MinTrailSpace,(256*SIZEOF_INT_P), [at least 1/2M Cells for Trail]) if test "$orparallelism" = threads then @@ -352,7 +361,7 @@ fi AC_DEFINE_UNQUOTED(MAX_THREADS,$yap_cv_max_threads,[max number of threads, default 1 or 1024]) -if test "$yap_cv_prism" = no +if test "$yap_cv_prism" = no then INSTALL_PRISM="" else @@ -373,7 +382,7 @@ if test "$yap_cv_clpbn_bp"="yes"; then AC_LANG_POP() fi -if test "$yap_cv_clpbn_bp" = no +if test "$yap_cv_clpbn_bp" = no then PKG_CLPBN="packages/CLPBN" else @@ -383,7 +392,7 @@ fi dnl condor universe does not like dynamic linking on Linux, DEC, and HP-UX platforms. -if test "$use_condor" = yes +if test "$use_condor" = yes then static_compilation="yes" use_malloc="yes" @@ -403,7 +412,7 @@ fi dnl Compilation Flags if test "$GCC" = "yes" then - if test "$debugyap" = "yes" + if test "$debugyap" = "yes" then CXXFLAGS="-O -g -Wall $CXXFLAGS" C_INTERF_FLAGS="-O -g -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS" @@ -413,9 +422,9 @@ then C_INTERF_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS" C_PARSER_FLAGS="-O3 -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS" CFLAGS="-O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes $CFLAGS" - case "`$CC --version < /dev/null`" in - *3.4*) - CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS" + case "`$CC --version < /dev/null`" in + *3.4*) + CFLAGS="-fno-gcse -fno-crossjumping $CFLAGS" ;; esac case "$target_cpu" in @@ -425,7 +434,7 @@ then ;; sparc*) case "$target_os" in - *solaris[2-9]*) dnl + *solaris[2-9]*) dnl CFLAGS="-mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1 $CFLAGS" CXXFLAGS="-mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1 $CXXFLAGS" ;; @@ -576,10 +585,10 @@ then esac fi WINDOWS="" - PKG_WINCONSOLE="swi/console" + PKG_WINCONSOLE="swi/console" else WINDOWS="#" - PKG_WINCONSOLE="" + PKG_WINCONSOLE="" LIBS="-lcygwin" EXTRA_LIBS_FOR_DLLS="\$(abs_top_builddir)/yap.dll" EXTRA_INCLUDES_FOR_WIN32="-I\$(srcdir)/packages/PLStream/windows" @@ -636,6 +645,7 @@ then [--with-readline was given, but test for readline failed]) fi ]) + AC_CHECK_TYPES([rl_hook_func_t]) fi if test "$yap_cv_gmp" != "no" @@ -649,7 +659,7 @@ fi if test "$threads" = yes then - AC_CHECK_HEADERS(pthread.h) + AC_CHECK_HEADERS(pthread.h) AC_CHECK_FUNCS(pthread_mutexattr_setkind_np pthread_mutexattr_settype) if test "$pthreadlocking" = yes then @@ -698,7 +708,7 @@ else fi if test "$use_clpqr" = no; then - PKG_CLPQR="" + PKG_CLPQR="" elif test -e "$srcdir"/packages/clpqr/Makefile.in; then PKG_CLPQR="packages/clpqr" else @@ -781,7 +791,7 @@ then AC_MSG_CHECKING([whether ld supports --enable-new-dtags]) AC_LINK_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) + [AC_MSG_RESULT([no]) LDFLAGS="$OLDLDFLAGS"] ) fi @@ -793,7 +803,7 @@ fi else AC_SYS_RESTARTABLE_SYSCALLS fi - + dnl defaults INSTALL_DLLS="no" EXTRA_OBJS="" @@ -803,10 +813,10 @@ fi M4="m4" MERGE_DLL_OBJS="#" IN_UNIX="" - + dnl This has to be before $target_os YAPLIB="libYap.a" - + dnl now this is where things get nasty. dnl trying to get the libraries case "$target_os" in @@ -853,7 +863,7 @@ fi LIBS="$LIBS -lnsl" fi if test "$dynamic_loading" = "yes" - then + then YAPLIB_LD="\$(CC) -shared" EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-rpath=\$(YAPLIBDIR) -Wl,-rpath=\$(LIBDIR)" INSTALL_ENV="LD_LIBRARY_PATH=:\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)" @@ -978,14 +988,14 @@ dnl Linux has both elf and a.out, in this case we found elf have_dl=no) if test ${have_dl} = yes then - LIBS="$LIBS -ldl" + LIBS="$LIBS -ldl" fi fi SO="dylib" SOPATH="DYLD_LIBRARY_PATH" DO_SECOND_LD="" if test "$dynamic_loading" = "yes" - then + then SHLIB_LD="$CC -dynamiclib" SHLIB_CXX_LD="$CXX -dynamiclib" EXTRA_LIBS_FOR_DLLS="-L\$(abs_top_builddir) $LIBS $EXTRA_LIBS_FOR_DLLS -lYap -Wl,-install_name,\$(YAPLIBDIR)/\$@" @@ -1013,7 +1023,7 @@ dnl Linux has both elf and a.out, in this case we found elf *netbsd*|*openbsd*|*freebsd*|*dragonfly*) if echo __ELF__ | ${CC:-cc} -E - | grep -q __ELF__ then - #an a.out system + #an a.out system SHLIB_CFLAGS="$CFLAGS" SHLIB_CXXFLAGS="$CXXFLAGS" SO="o" @@ -1053,7 +1063,7 @@ dnl Linux has both elf and a.out, in this case we found elf DYNYAPLIB=libYap."$SO" SONAMEFLAG="-Wl,--soname=$DYNYAPLIB" if test "$dynamic_loading" = "yes" - then + then YAPLIB_LD="\$(CC)" EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)" PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$LD_LIBRARY_PATH" @@ -1124,7 +1134,7 @@ dnl use the current files, even if older PRE_INSTALL_ENV="$PRE_INSTALL_ENV YAPLIBDIR=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:\$(abs_top_builddir)/packages/clib " if test "$dynamic_loading" = "yes" -then +then YAPLIB_CFLAGS="$SHLIB_CFLAGS" YAPLIB="$DYNYAPLIB" else @@ -1147,29 +1157,29 @@ if test "$eam" = "yes" then YAP_EXTRAS="$YAP_EXTRAS -DBEAM" fi - + if test "$wamprofile" = "yes" then YAP_EXTRAS="$YAP_EXTRAS -DANALYST=1" fi - + if test "$depthlimit" = "yes" then YAP_EXTRAS="$YAP_EXTRAS -DDEPTH_LIMIT=1" fi - + if test "$use_april" = "yes" - then + then YAP_EXTRAS="$YAP_EXTRAS -DDEPTH_LIMIT=1 -DAPRIL" LDFLAGS="$LDFLAGS -L." LIBS="$LIBS -lApril" fi - + if test "$lowleveltracer" = "yes" then YAP_EXTRAS="$YAP_EXTRAS -DLOW_LEVEL_TRACER=1" fi - + if test "$threads" = "yes" then YAP_EXTRAS="$YAP_EXTRAS -DTHREADS=1" @@ -1256,7 +1266,7 @@ AC_TRY_COMPILE( , yap_cv_rl_catch=yes,yap_cv_rl_catch=no ) ] ) AC_MSG_RESULT($yap_cv_rl_catch) -if test "$yap_cv_rl_catch" = yes +if test "$yap_cv_rl_catch" = yes then AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1, [Defined if you can turn off readline's signal handling.]) fi @@ -1306,7 +1316,7 @@ AC_TRY_RUN( , yap_cv_gcc=yes,yap_cv_gcc=no,yap_cv_gcc=yes)]) AC_MSG_RESULT($yap_cv_gcc) -if test "$yap_cv_gcc" = yes +if test "$yap_cv_gcc" = yes then M4GENHDRS=m4/gcc_genhdrs.m4 AC_DEFINE(HAVE_GCC,1,[Old m4 auto-heder generation, not really useful now]) @@ -1335,6 +1345,19 @@ fi changequote([,])dnl AC_SUBST(ARCH) +case "$host" in + *android*) + STARTUP_ANDROID="" + STARTUP_DEFAULT="x" + ;; + **) + STARTUP_ANDROID="x" + STARTUP_DEFAULT="" + ;; +esac +AC_SUBST(STARTUP_ANDROID) +AC_SUBST(STARTUP_DEFAULT) + CMDEXT=sh dnl System stuff for dynamic linking. @@ -1417,7 +1440,7 @@ if test "$yap_cv_threaded_code" = yes && test "$yap_cv_gcc" = yes then AC_DEFINE(USE_THREADED_CODE,1,[threaded emulator]) M4GENABSMI=gen_gcc.m4 -else +else M4GENABSMI=gen_ansi.m4 fi @@ -1437,7 +1460,7 @@ AC_TRY_RUN( , yap_cv_ffieee=yes,yap_cv_ffieee=no,yap_cv_ffieee=yes)]) AC_MSG_RESULT($yap_cv_ffieee) -if test "$yap_cv_ffieee" = yes +if test "$yap_cv_ffieee" = yes then AC_DEFINE(FFIEEE,1,[IEEE floating-point, basically everyone except old VAXEN]) fi @@ -1454,7 +1477,7 @@ AC_TRY_COMPILE( , yap_cv_sigsetjmp=yes,yap_cv_sigsetjmp=no)]) AC_MSG_RESULT($yap_cv_sigsetjmp) -if test "$yap_cv_sigsetjmp" = yes +if test "$yap_cv_sigsetjmp" = yes then AC_DEFINE(HAVE_SIGSETJMP,1,[support for sigsetjmp]) fi @@ -1470,7 +1493,7 @@ AC_TRY_COMPILE( , yap_cv_sigsegv=yes,yap_cv_sigsegv=no)]) AC_MSG_RESULT($yap_cv_sigsegv) -if test "$yap_cv_sigsegv" = yes +if test "$yap_cv_sigsegv" = yes then AC_DEFINE(HAVE_SIGSEGV,1,[UNIX signal SEGV]) fi @@ -1486,7 +1509,7 @@ AC_TRY_COMPILE( , yap_cv_sigprof=yes,yap_cv_sigprof=no)]) AC_MSG_RESULT($yap_cv_sigprof) -if test "$yap_cv_sigsegv" = yes +if test "$yap_cv_sigsegv" = yes then AC_DEFINE(HAVE_SIGPROF,1, [UNIX Signal SIGPROF]) fi @@ -1502,7 +1525,7 @@ AC_TRY_COMPILE( , yap_cv_siginfo=yes,yap_cv_siginfo=no)]) AC_MSG_RESULT($yap_cv_siginfo) -if test "$yap_cv_siginfo" = yes +if test "$yap_cv_siginfo" = yes then AC_DEFINE(HAVE_SIGINFO,1, [Unix SIGINFO]) fi @@ -1518,7 +1541,7 @@ AC_TRY_COMPILE( , yap_cv_sigfpe=yes,yap_cv_sigfpe=no)]) AC_MSG_RESULT($yap_cv_sigfpe) -if test "$yap_cv_sigfpe" = yes +if test "$yap_cv_sigfpe" = yes then AC_DEFINE(HAVE_SIGFPE,1, [Unix SIGFPE]) fi @@ -1558,7 +1581,7 @@ AC_CHECK_MEMBER(struct tm.tm_gmtoff, dnl this is copied from the Tcl code dnl this code checks whether the system defines an union wait AC_MSG_CHECKING([union wait]) -AC_TRY_LINK([#include +AC_TRY_LINK([#include #include ], [ union wait x; wait(&x); /* make sure we can compile wait */ @@ -1627,7 +1650,7 @@ then AC_CHECK_FUNCS(alarm mmap popen shmat sleep system ttyname waitpid) fi -if test "$target_os" != "mingw32" +if test "$target_os" != "mingw32" then AC_CHECK_FUNCS(fetestexcept snprintf) fi @@ -1644,12 +1667,12 @@ AC_TRY_LINK( , yap_cv_mpz_xor=yes,yap_cv_mpz_xor=no)]) AC_MSG_RESULT($yap_cv_mpz_xor) -if test "$yap_cv_mpz_xor" = yes +if test "$yap_cv_mpz_xor" = yes then AC_DEFINE(HAVE_MPZ_XOR,1,[Older versions of MPZ didn't have XOR]) fi -if test "$use_malloc" = "yes" -a "$maxmemory" = "yes" +if test "$use_malloc" = "yes" -a "$maxmemory" = "yes" then maxmemory="no" fi @@ -1824,7 +1847,7 @@ AC_TRY_COMPILE( AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) -if test "$yap_cv_minisat" = no -a "$INSTALL_DLLS" = "no" +if test "$yap_cv_minisat" = no -a "$INSTALL_DLLS" = "no" then PKG_MINISAT="" else @@ -1925,7 +1948,7 @@ dnl if test "$yap_cv_java" = no then - PKG_JPL="" + PKG_JPL="" elif test -e "$srcdir"/packages/jpl/Makefile.in then PKG_JPL="packages/jpl" diff --git a/os/pl-rl.c b/os/pl-rl.c index 8d2cb018a..252e58a27 100755 --- a/os/pl-rl.c +++ b/os/pl-rl.c @@ -454,10 +454,15 @@ Sread_readline(void *handle, char *buf, size_t size) #endif #ifdef HAVE_RL_EVENT_HOOK - if ( PL_dispatch(0, PL_DISPATCH_INSTALLED) ) + if ( PL_dispatch(0, PL_DISPATCH_INSTALLED) ) { +#if HAVE_RL_HOOK_FUNC_T + rl_event_hook = event_hook; +#else rl_event_hook = (Function *)event_hook; - else +#endif + } else { rl_event_hook = NULL; + } #endif prompt = PL_prompt_string(fd);