diff --git a/C/absmi.c b/C/absmi.c index 538d9ec38..e081a1e09 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -10257,7 +10257,7 @@ Yap_absmi(int inp) if (IsIntTerm(d0) && IsIntTerm(d1)) { Int i2 = IntOfTerm(d1); if (i2 < 0) - d0 = MkIntegerTerm(IntOfTerm(d0) >> -i2); + d0 = MkIntegerTerm(SLR(IntOfTerm(d0), -i2)); else d0 = do_sll(IntOfTerm(d0),i2); } @@ -10343,7 +10343,7 @@ Yap_absmi(int inp) if (IsIntTerm(d0)) { Int i2 = IntOfTerm(d0); if (i2 < 0) - d0 = MkIntegerTerm(d1 >> -i2); + d0 = MkIntegerTerm(SLR(d1, -i2)); else d0 = do_sll(d1,i2); } @@ -10388,7 +10388,7 @@ Yap_absmi(int inp) if (IsIntTerm(d0) && IsIntTerm(d1)) { Int i2 = IntOfTerm(d1); if (i2 < 0) - d0 = MkIntegerTerm(IntOfTerm(d0) >> -i2); + d0 = MkIntegerTerm(SLR(IntOfTerm(d0), -i2)); else d0 = do_sll(IntOfTerm(d0),i2); } @@ -10481,7 +10481,7 @@ Yap_absmi(int inp) if (IsIntTerm(d0)) { Int i2 = IntOfTerm(d0); if (i2 < 0) - d0 = MkIntegerTerm(d1 >> -i2); + d0 = MkIntegerTerm(SLR(d1, -i2)); else d0 = do_sll(d1,i2); } @@ -10531,7 +10531,7 @@ Yap_absmi(int inp) if (i2 < 0) d0 = do_sll(IntOfTerm(d0), -i2); else - d0 = MkIntTerm(IntOfTerm(d0) >> i2); + d0 = MkIntTerm(SLR(IntOfTerm(d0), i2)); } else { saveregs(); @@ -10576,7 +10576,7 @@ Yap_absmi(int inp) { Int d1 = PREG->u.xxn.c; if (IsIntTerm(d0)) { - d0 = MkIntTerm(IntOfTerm(d0) >> d1); + d0 = MkIntTerm(SLR(IntOfTerm(d0), d1)); } else { saveregs(); @@ -10617,7 +10617,7 @@ Yap_absmi(int inp) if (i2 < 0) d0 = do_sll(d1, -i2); else - d0 = MkIntegerTerm(d1 >> i2); + d0 = MkIntegerTerm(SLR(d1, i2)); } else { saveregs(); @@ -10662,7 +10662,7 @@ Yap_absmi(int inp) if (i2 < 0) d0 = do_sll(IntOfTerm(d0), -i2); else - d0 = MkIntTerm(IntOfTerm(d0) >> i2); + d0 = MkIntTerm(SLR(IntOfTerm(d0), i2)); } else { saveregs(); @@ -10710,7 +10710,7 @@ Yap_absmi(int inp) { Int d1 = PREG->u.yxn.c; if (IsIntTerm(d0)) { - d0 = MkIntTerm(IntOfTerm(d0) >> d1); + d0 = MkIntTerm(SLR(IntOfTerm(d0), d1)); } else { saveregs(); @@ -10753,7 +10753,7 @@ Yap_absmi(int inp) if (i2 < 0) d0 = do_sll(d1, -i2); else - d0 = MkIntegerTerm(d1 >> i2); + d0 = MkIntegerTerm(SLR(d1, i2)); } else { saveregs(); diff --git a/C/gmp_support.c b/C/gmp_support.c index 7304b0244..657f34536 100644 --- a/C/gmp_support.c +++ b/C/gmp_support.c @@ -377,16 +377,16 @@ Yap_gmp_sll_big_int(Term t, Int i) MP_INT *b = Yap_BigIntOfTerm(t); if (i > 0) { - mpz_init_set(&new, b); - mpz_mul_2exp(&new, &new, i); + mpz_init(&new); + mpz_mul_2exp(&new, b, i); } else if (i == 0) { return t; } else { - mpz_init_set(&new, b); + mpz_init(&new); if (i == Int_MIN) { return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, MkIntegerTerm(i), "<= 0 ? 0 : -1)); +} + #ifdef __GNUC__ #ifdef __i386__ #define DO_MULTI() { Int tmp1; \ @@ -114,28 +120,56 @@ times_int(Int i1, Int i2) { } -#if USE_GMP -static inline int -sl_overflow(Int i,Int j) +#ifndef __GNUC__X +static int +clrsb(Int i) { - Int x = (8*sizeof(CELL)-2)-j; - CELL t = (1<>= 32; +#endif + if (i < (Int)(0x10000)) {j += 16;} + else i >>= 16; + if (i < (Int)(0x100)) {j += 8;} + else i >>= 8; + if (i < (Int)(0x10)) {j += 4;} + else i >>= 4; + if (i < (Int)(0x4)) {j += 2;} + else i >>= 2; + if (i < (Int)(0x2)) j++; + return j; } #endif + inline static Term -do_sll(Int i, Int j) +do_sll(Int i, Int j) /* j > 0 */ { + Int k; #ifdef USE_GMP - if (sl_overflow(i,j)) { - return Yap_gmp_sll_ints(i, j); - } + if ( +#ifdef __GNUC__X +#if SIZEOF_LONG_INT < SIZEOF_INT_P + __builtin_clrsbll(i) +#else + __builtin_clrsbl(i) #endif +#else + clrsb(i) +#endif + > j) + RINT(i << j); + return Yap_gmp_sll_ints(i, j); +#else RINT(i << j); +#endif } @@ -459,14 +493,16 @@ p_sll(Term t1, Term t2) { switch (ETypeOfTerm(t2)) { case long_int_e: /* two integers */ - if (IntegerOfTerm(t2) < 0) { - Int i2 = IntegerOfTerm(t2); - if (i2 == Int_MIN) { - return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2"); + { Int i2 = IntegerOfTerm(t2); + + if (i2 <= 0) { + if (i2 == Int_MIN) { + return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2"); + } + RINT(SLR(IntegerOfTerm(t1), -i2)); } - RINT(IntegerOfTerm(t1) >> -i2); + return do_sll(IntegerOfTerm(t1),i2); } - return do_sll(IntegerOfTerm(t1),IntegerOfTerm(t2)); case double_e: return Yap_ArithError(TYPE_ERROR_INTEGER, t2, "<>/2"); + { Int i2 = IntegerOfTerm(t2); + + if (i2 < 0) { + if (i2 == Int_MIN) { + return Yap_ArithError(RESOURCE_ERROR_HUGE_INT, t2, ">>/2"); + } + return do_sll(IntegerOfTerm(t1), -i2); } - return do_sll(IntegerOfTerm(t1), -i2); + RINT(SLR(IntegerOfTerm(t1), i2)); } - RINT(IntegerOfTerm(t1) >> IntegerOfTerm(t2)); case double_e: return Yap_ArithError(TYPE_ERROR_INTEGER, t2, ">>/2"); case big_int_e: diff --git a/Makefile.in b/Makefile.in index 21652ff61..e77d99a0c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -129,7 +129,7 @@ INTERFACE_HEADERS = \ IOLIB_HEADERS=$(srcdir)/os/pl-buffer.h \ $(srcdir)/os/pl-ctype.h \ - $(srcdir)/H/pl-codelist.h \ + $(srcdir)/os/pl-codelist.h \ $(srcdir)/os/pl-dtoa.h \ $(srcdir)/os/dtoa.c \ $(srcdir)/H/pl-incl.h \ @@ -138,7 +138,6 @@ IOLIB_HEADERS=$(srcdir)/os/pl-buffer.h \ $(srcdir)/os/pl-option.h \ $(srcdir)/os/pl-os.h \ $(srcdir)/os/pl-privitf.h \ - $(srcdir)/os/pl-stream.h \ $(srcdir)/os/pl-table.h \ $(srcdir)/os/pl-text.h \ $(srcdir)/os/pl-utf8.h \ diff --git a/configure b/configure index e4a23e829..b44db2e59 100755 --- a/configure +++ b/configure @@ -617,6 +617,7 @@ PROLOG_SYSTEM M4GENABSMI MATLAB_INCLUDE INSTALL_MATLAB +EXTRA_LIBS_FOR_R YAPR_INCLUDES ENABLE_YAPR ENABLE_MINISAT @@ -700,6 +701,13 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM LN_S +DefTrailSpace +DefStackSpace +DefHeapSpace +PYTHON +EGREP +GREP +CPP target_os target_vendor target_cpu @@ -712,13 +720,6 @@ build_os build_vendor build_cpu build -DefTrailSpace -DefStackSpace -DefHeapSpace -PYTHON -EGREP -GREP -CPP C_PARSER_FLAGS C_INTERF_FLAGS GCC @@ -2527,7 +2528,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi done @@ -2924,7 +2925,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3039,7 +3040,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3082,7 +3083,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3141,7 +3142,7 @@ $as_echo "$ac_try_echo"; } >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi fi fi @@ -3193,7 +3194,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3722,6 +3723,167 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if ${ac_cv_target+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +cat >>confdefs.h <<_ACEOF +#define HOST_ALIAS "${target}" +_ACEOF + + +case "$target_cpu" in + i*86*) + YAP_TARGET=i386 + ;; + x86*) + YAP_TARGET=amd64 + ;; + sparc*) + YAP_TARGET=sparc + ;; + *) + YAP_TARGET=unknown + ;; + esac + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3851,7 +4013,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c @@ -4230,7 +4392,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "${enable_tabling+set}" = set; then : enableval=$enable_tabling; tabling="$enableval" else - tabling=no + tabling=yes fi # Check whether --enable-or-parallelism was given. @@ -4342,7 +4504,7 @@ fi if test "${enable_use_malloc+set}" = set; then : enableval=$enable_use_malloc; use_malloc="$enableval" else - use_malloc=no + use_malloc=yes fi # Check whether --enable-condor was given. @@ -4429,7 +4591,6 @@ fi # Check whether --with-yapr was given. if test "${with_yapr+set}" = set; then : withval=$with_yapr; if test "$withval" = yes; then - YAPR_INCLUDES="-I/usr/share/R/include" yap_cv_yapr=yes elif test "$withval" = no; then yap_cv_yapr=no @@ -4738,152 +4899,6 @@ _ACEOF -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if ${ac_cv_target+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - -cat >>confdefs.h <<_ACEOF -#define HOST_ALIAS "${target}" -_ACEOF - - if test "$or-parallelism" = no then $as_echo "#define MAX_WORKERS 1" >>confdefs.h @@ -6223,7 +6238,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "--with-readline was given, but test for readline failed -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi fi @@ -6278,12 +6293,44 @@ then then case "$target_os" in *darwin*) - YAPR_INCLUDES="-I/Library/Frameworks/R.framework/Headers" - EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -framework R -L /Library/Frameworks/R.framework/Libraries" + YAPR_INCLUDES="-I/Library/Frameworks/R.framework/Headers" + EXTRA_LIBS_FOR_R="-framework R -L /Library/Frameworks/R.framework/Libraries -lR" ;; **) - YAPR_INCLUDES="-I/usr/include/R -I/usr/share/R/include" + if test -n "$R_HOME" ; then + YAPR_INCLUDES="-I$R_HOME/include" + elif test "$YAP_TARGET" = amd64 -a -d /usr/lib64/R/include ; then + YAPR_INCLUDES="-I/usr/lib64/R/include" + elif test -d /usr/include/R; then + YAPR_INCLUDES="-I/usr/include/R" + elif test -d /usr/share/R/include; then + YAPR_INCLUDES="-I/usr/share/R/include" + fi + echo $YAP_TARGET + if test -n "$R_HOME" ; then + EXTRA_LIBS_FOR_R="-I$R_HOME/lib -lR" + elif test "$YAP_TARGET" = amd64 -a -d /usr/lib64/R/lib; then + EXTRA_LIBS_FOR_R="-L /usr/lib64/R/lib -lR" + elif test -d /usr/lib/R; then + EXTRA_LIBS_FOR_R="-L /usr/lib/R/lib -lR" + fi + ;; esac + else + case "$target_os" in + *cygwin*|*mingw*) + YAPR_INCLUDES="-I\"$yap_cv_yapr/include\"" + if test "$YAP_TARGET" = i386; then + EXTRA_LIBS_FOR_R="\"$yap_cv_yapr/bin/i386/R.dll\"" + else + EXTRA_LIBS_FOR_R="\"$yap_cv_yapr/bin/x64/R.dll\"" + fi + ;; + *) + YAPR_INCLUDES="-I$yap_cv_yapr/include" + EXTRA_LIBS_FOR_R="-L $yap_cv_yapr/lib -lR" + ;; + esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lR" >&5 $as_echo_n "checking for main in -lR... " >&6; } @@ -6625,18 +6672,7 @@ elif test -e "$srcdir"/packages/jpl/Makefile.in; then JAVAINCPATH="-I\"$JAVA_HOME\"/include -I\"$JAVA_HOME\"/include/solaris" ;; esac - case "$target_cpu" in - i*86*) - JAVA_TARGET=i386 - ;; - x86*) - JAVA_TARGET=amd64 - ;; - sparc*) - JAVA_TARGET=sparc - ;; - esac - JAVALIBPATH="-L$JAVA_HOME/jre/lib/$JAVA_TARGET -L$JAVA_HOME/jre/lib/$JAVA_TARGET/client -L$JAVA_HOME/jre/lib/$JAVA_TARGET/server -Wl,-R,$JAVA_HOME/jre/lib/$JAVA_TARGET -ljava -lverify -ljvm " + JAVALIBPATH="-L$JAVA_HOME/jre/lib/$YAP_TARGET -L$JAVA_HOME/jre/lib/$YAP_TARGET/client -L$JAVA_HOME/jre/lib/$YAP_TARGET/server -Wl,-R,$JAVA_HOME/jre/lib/$YAP_TARGET -ljava -lverify -ljvm " ;; esac if test "$yap_cv_java" = ""; then @@ -6954,7 +6990,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c @@ -7018,7 +7054,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7624,19 +7660,19 @@ if test "$threads" = "yes" { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "--or-parallelism=sba incompatible with threads -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } ;; a-cow) { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "--or-parallelism=a-cow incompatible with threads -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } ;; copy) { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "--or-parallelism=copy incompatible with threads -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } ;; yes|threads) YAP_EXTRAS="$YAP_EXTRAS -DYAPOR_THREADS=1" @@ -8372,7 +8408,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int *) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_int_p=0 fi @@ -8405,7 +8441,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short int) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_short_int=0 fi @@ -8438,7 +8474,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_int=0 fi @@ -8471,7 +8507,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long int) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_int=0 fi @@ -8504,7 +8540,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long int) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_long_int=0 fi @@ -8537,7 +8573,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (float) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_float=0 fi @@ -8570,7 +8606,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (double) -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_double=0 fi @@ -8747,6 +8783,7 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc threaded code" >&5 @@ -10929,7 +10966,7 @@ do "packages/prism/src/c/Makefile") CONFIG_FILES="$CONFIG_FILES packages/prism/src/c/Makefile" ;; "packages/prism/src/prolog/Makefile") CONFIG_FILES="$CONFIG_FILES packages/prism/src/prolog/Makefile" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done @@ -11246,7 +11283,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -11274,7 +11311,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -11301,7 +11338,7 @@ $as_echo "$as_me: creating $ac_file" >&6;} case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac diff --git a/configure.in b/configure.in old mode 100644 new mode 100755 index 6566e3f0d..929668adb --- a/configure.in +++ b/configure.in @@ -58,6 +58,25 @@ AC_SUBST(C_INTERF_FLAGS) AC_SUBST(C_PARSER_FLAGS) AC_LANG(C) +AC_CANONICAL_SYSTEM + +AC_DEFINE_UNQUOTED(HOST_ALIAS,"${target}") + +case "$target_cpu" in + i*86*) + YAP_TARGET=i386 + ;; + x86*) + YAP_TARGET=amd64 + ;; + sparc*) + YAP_TARGET=sparc + ;; + *) + YAP_TARGET=unknown + ;; + esac + dnl Gecode support AC_CHECK_HEADER(gecode/support/config.hpp, have_gecode=yes, have_gecode=no) @@ -94,7 +113,7 @@ AC_COMPILE_IFELSE([ AC_ARG_ENABLE(tabling, [ --enable-tabling support tabling ], - tabling="$enableval", tabling=no) + tabling="$enableval", tabling=yes) AC_ARG_ENABLE(or-parallelism, [ --enable-or-parallelism support or-parallelism as: copy,sba,a-cow,threads ], orparallelism="$enableval", orparallelism=no) @@ -142,7 +161,7 @@ AC_ARG_ENABLE(static_compilation, static_compilation="$enableval", static_compilation=no) AC_ARG_ENABLE(use-malloc, [ --enable-use-malloc use malloc to allocate memory ], - use_malloc="$enableval", use_malloc=no) + use_malloc="$enableval", use_malloc=yes) AC_ARG_ENABLE(condor, [ --enable-condor allow YAP to be used from condor ], use_condor="$enableval", use_condor=no) @@ -190,7 +209,6 @@ AC_ARG_WITH(gmp, AC_ARG_WITH(yapr, [ --with-yapr[=DIR] interface to R language, R installed in DIR], if test "$withval" = yes; then - YAPR_INCLUDES="-I/usr/share/R/include" yap_cv_yapr=yes elif test "$withval" = no; then yap_cv_yapr=no @@ -420,10 +438,6 @@ AC_SUBST(DefHeapSpace) AC_SUBST(DefStackSpace) AC_SUBST(DefTrailSpace) -AC_CANONICAL_SYSTEM - -AC_DEFINE_UNQUOTED(HOST_ALIAS,"${target}") - if test "$or-parallelism" = no then AC_DEFINE(MAX_WORKERS,1) @@ -693,13 +707,46 @@ then then case "$target_os" in *darwin*) - YAPR_INCLUDES="-I/Library/Frameworks/R.framework/Headers" - EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -framework R -L /Library/Frameworks/R.framework/Libraries" + YAPR_INCLUDES="-I/Library/Frameworks/R.framework/Headers" + EXTRA_LIBS_FOR_R="-framework R -L /Library/Frameworks/R.framework/Libraries -lR" ;; **) -dnl one of the two may work (Fedora vs Ubuntu) - YAPR_INCLUDES="-I/usr/include/R -I/usr/share/R/include" + dnl R is spread all over the place + dnl one of the two may work (Fedora/Ubuntu) + if test -n "$R_HOME" ; then + YAPR_INCLUDES="-I$R_HOME/include" + elif test "$YAP_TARGET" = amd64 -a -d /usr/lib64/R/include ; then + YAPR_INCLUDES="-I/usr/lib64/R/include" + elif test -d /usr/include/R; then + YAPR_INCLUDES="-I/usr/include/R" + elif test -d /usr/share/R/include; then + YAPR_INCLUDES="-I/usr/share/R/include" + fi + echo $YAP_TARGET + if test -n "$R_HOME" ; then + EXTRA_LIBS_FOR_R="-I$R_HOME/lib -lR" + elif test "$YAP_TARGET" = amd64 -a -d /usr/lib64/R/lib; then + EXTRA_LIBS_FOR_R="-L /usr/lib64/R/lib -lR" + elif test -d /usr/lib/R; then + EXTRA_LIBS_FOR_R="-L /usr/lib/R/lib -lR" + fi + ;; esac + else + case "$target_os" in + *cygwin*|*mingw*) + YAPR_INCLUDES="-I\"$yap_cv_yapr/include\"" + if test "$YAP_TARGET" = i386; then + EXTRA_LIBS_FOR_R="\"$yap_cv_yapr/bin/i386/R.dll\"" + else + EXTRA_LIBS_FOR_R="\"$yap_cv_yapr/bin/x64/R.dll\"" + fi + ;; + *) + YAPR_INCLUDES="-I$yap_cv_yapr/include" + EXTRA_LIBS_FOR_R="-L $yap_cv_yapr/lib -lR" + ;; + esac fi AC_CHECK_LIB(R,main) fi @@ -905,18 +952,7 @@ elif test -e "$srcdir"/packages/jpl/Makefile.in; then JAVAINCPATH="-I\"$JAVA_HOME\"/include -I\"$JAVA_HOME\"/include/solaris" ;; esac - case "$target_cpu" in - i*86*) - JAVA_TARGET=i386 - ;; - x86*) - JAVA_TARGET=amd64 - ;; - sparc*) - JAVA_TARGET=sparc - ;; - esac - JAVALIBPATH="-L$JAVA_HOME/jre/lib/$JAVA_TARGET -L$JAVA_HOME/jre/lib/$JAVA_TARGET/client -L$JAVA_HOME/jre/lib/$JAVA_TARGET/server -Wl,-R,$JAVA_HOME/jre/lib/$JAVA_TARGET -ljava -lverify -ljvm " + JAVALIBPATH="-L$JAVA_HOME/jre/lib/$YAP_TARGET -L$JAVA_HOME/jre/lib/$YAP_TARGET/client -L$JAVA_HOME/jre/lib/$YAP_TARGET/server -Wl,-R,$JAVA_HOME/jre/lib/$YAP_TARGET -ljava -lverify -ljvm " ;; esac if test "$yap_cv_java" = ""; then @@ -1672,6 +1708,7 @@ AC_SUBST(CUDD_CPPFLAGS) AC_SUBST(ENABLE_MINISAT) AC_SUBST(ENABLE_YAPR) AC_SUBST(YAPR_INCLUDES) +AC_SUBST(EXTRA_LIBS_FOR_R) AC_SUBST(INSTALL_MATLAB) AC_SUBST(MATLAB_INCLUDE) diff --git a/include/SWI-Prolog.h b/include/SWI-Prolog.h index d6f4e1749..94c26c3fc 100644 --- a/include/SWI-Prolog.h +++ b/include/SWI-Prolog.h @@ -35,7 +35,7 @@ extern "C" { #include "YapInterface.h" #else -#include +#include #if USE_GMP #include #endif diff --git a/library/varnumbers.yap b/library/varnumbers.yap index a768c9727..08394d821 100644 --- a/library/varnumbers.yap +++ b/library/varnumbers.yap @@ -31,4 +31,4 @@ max_var_numberl(I0,Ar,T,Max0,Max) :- ). varnumbers(GT, VT) :- - unnumber_vars(GT, VT). + unnumbervars(GT, VT). diff --git a/packages/Dialect.defs.in b/packages/Dialect.defs.in index 61b02bb39..ab04aa594 100644 --- a/packages/Dialect.defs.in +++ b/packages/Dialect.defs.in @@ -25,7 +25,6 @@ PLLIBDIR=$(PLBASE)/share/Yap SOLIBDIR=$(PLBASE)/lib/Yap PKGDOCDIR=$(PLBASE)/share/doc/Yap/packages PKGEXDIR=$(PLBASE)/share/doc/Yap//packages/examples -PKGCFLAGS= # # YAP internal stuff diff --git a/packages/YapR b/packages/YapR index a6646d0be..7e577ec26 160000 --- a/packages/YapR +++ b/packages/YapR @@ -1 +1 @@ -Subproject commit a6646d0be1d1d63782e0c1395dd449183fdd8988 +Subproject commit 7e577ec263687279d20e147e3ad4caca88aabcdf diff --git a/packages/clib b/packages/clib index e5f6f249b..f0e208de6 160000 --- a/packages/clib +++ b/packages/clib @@ -1 +1 @@ -Subproject commit e5f6f249be41f7169ab527d0c5a5f40e1c556bde +Subproject commit f0e208de69f5303648fe1d035e2bfa164411d42d