From 964b15d1074274622369773fd864d7d764bb5074 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 18 Feb 2014 07:59:47 +0000 Subject: [PATCH] keep on simplifying configure. --- C/amasm.c | 2 -- H/Yap.h | 44 -------------------------- H/pl-incl.h | 7 ----- config.h.in | 29 ++++++++++++++++- configure | 80 +++++++++++++++++++++++++++++++++++++++++++---- configure.in | 51 ++++++++++++++++++++++++++++-- library/mpi/mpe.c | 14 +++++++++ library/mpi/mpi.c | 7 +++++ packages/clib | 2 +- packages/jpl | 2 +- packages/zlib | 2 +- 11 files changed, 174 insertions(+), 66 deletions(-) diff --git a/C/amasm.c b/C/amasm.c index a3bebde43..c6833946f 100755 --- a/C/amasm.c +++ b/C/amasm.c @@ -283,8 +283,6 @@ static void a_fetch_cv(cmp_op_info *, int, struct intermediates *); static void a_fetch_vc(cmp_op_info *, int, struct intermediates *); static yamop *a_f2(cmp_op_info *, yamop *, int, struct intermediates *); -#define CELLSIZE sizeof(CELL) - #define GONEXT(TYPE) code_p = ((yamop *)(&(code_p->u.TYPE.next))) inline static yslot diff --git a/H/Yap.h b/H/Yap.h index 76f0252b2..2fdc930dc 100755 --- a/H/Yap.h +++ b/H/Yap.h @@ -39,52 +39,8 @@ #include "config.h" -#define ALIGN_LONGS 1 -#define LOW_ABSMI 0 - -#define MSHIFTOFFS 1 - -#undef USE_DL_MALLOC -#undef USE_MALLOC -#undef USE_SYSTEM_MALLOC -#define USE_MMAP (HAVE_MMAP & !USE_MALLOC & !USE_SYSTEM_MALLOC) -#define USE_SHM (HAVE_SHMAT & !HAVE_MMAP & !USE_MALLOC & !USE_SYSTEM_MALLOC) -#define USE_SBRK (HAVE_SBRK & !HAVE_MMAP & !HAVE_SHMAT & !USE_MALLOC & !USE_SYSTEM_MALLOC) - -#if __MINGW32__ -#define __WINDOWS__ 1 -#endif - -#if (HAVE_SOCKET || defined(__MINGW32__)) && !defined(SIMICS) -#define USE_SOCKET 1 -#endif - #define FunAdr(X) X -#if HAVE_GMP_H && HAVE_LIBGMP -#define USE_GMP 1 -#endif - -#if HAVE_JUDY_H && HAVE_LIBJUDY -#define USE_JUDY 1 -#endif - -/* Should we use MPI ? */ -#if defined(HAVE_MPI_H) && (defined(HAVE_LIBMPI) || defined(HAVE_LIBMPICH)) - #define HAVE_MPI 1 -#else - #define HAVE_MPI 0 -#endif - -/* Should we use MPE ? */ -#if defined(HAVE_MPI_H) && HAVE_LIBMPE && HAVE_MPI - #define HAVE_MPE 1 -#else - #define HAVE_MPE 0 -#endif - -#define CELLSIZE SIZEOF_VOID_P - #include "inline-only.h" #if defined(YAPOR) || defined(TABLING) #include "opt.config.h" diff --git a/H/pl-incl.h b/H/pl-incl.h index 9f770865e..1eb809639 100755 --- a/H/pl-incl.h +++ b/H/pl-incl.h @@ -59,13 +59,6 @@ typedef struct pred_entry * Procedure; /* predicate */ #undef H #endif -// used by swi -#ifdef SIZEOF_INT_P -#define SIZEOF_VOIDP SIZEOF_INT_P -#else -bad config -#endif - /* swi code called from pl-incl.h */ /* should have messages here */ #ifdef DEBUG diff --git a/config.h.in b/config.h.in index 8957c5904..9bd11fcba 100644 --- a/config.h.in +++ b/config.h.in @@ -3,9 +3,15 @@ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD +/* longs should be in addresses that are multiple of four. */ +#undef ALIGN_LONGS + /* if fflush(NULL) clobbers input pipes1 */ #undef BROKEN_FFLUSH_NULL +/* size of a cell in bytes. */ +#undef CELLSIZE + /* c-compiler used */ #undef C_CC @@ -847,6 +853,9 @@ /* o not use realloc() from HP-UX 10.20 together with MPI */ #undef MPI_AVOID_REALLOC +/* compiler should shift offsets. */ +#undef MSHIFTOFFS + /* myddas release */ #undef MYDDAS_VERSION @@ -937,12 +946,27 @@ /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME +/* use Doug Lea's malloc for all allocation */ +#undef USE_DL_MALLOC + +/* use bignums/rationals in YAP code. */ +#undef USE_GMP + +/* use Judy library for UDI indexing in YAP code. */ +#undef USE_JUDY + /* do not use our own locking routines */ #undef USE_PTHREAD_LOCKING -/* use OS malloc */ +/* use OS malloc for all allocation */ #undef USE_SYSTEM_MALLOC +/* use mmap in or-parallel allocation */ +#undef USE_SYSTEM_MMAP + +/* use shm in or-parallel allocation */ +#undef USE_SYSTEM_SHM + /* threaded emulator */ #undef USE_THREADED_CODE @@ -1003,6 +1027,9 @@ /* HP-UX old socket stuff */ #undef _XOPEN_SOURCE_EXTENDED +/* compiling for Windows */ +#undef __WINDOWS__ + /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus diff --git a/configure b/configure index 65d640719..ba060f3f5 100755 --- a/configure +++ b/configure @@ -4102,6 +4102,14 @@ case "$target_cpu" in esac +$as_echo "#define MSHIFTOFFS 1" >>confdefs.h + + +$as_echo "#define ALIGN_LONGS 1" >>confdefs.h + +# AC_DEFINE(LOW_ABSMI, 1, [absmi located at initial addresses, unused.]) + + # Check whether --enable-tabling was given. if test "${enable_tabling+set}" = set; then : enableval=$enable_tabling; tabling="$enableval" @@ -5492,6 +5500,9 @@ _ACEOF fi fi + +$as_echo "#define __WINDOWS__ 1" >>confdefs.h + EXTRA_LIBS_FOR_DLLS="\$(abs_top_builddir)/yap.dll $EXTRA_LIBS_FOR_DLLS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpsapi" >&5 $as_echo_n "checking for main in -lpsapi... " >&6; } @@ -7627,6 +7638,7 @@ fi done + if test "$yap_cv_gmp" != "no" then for ac_header in gmp.h @@ -7641,7 +7653,14 @@ fi done + if test "x$ac_cv_header_gmp_h" = xyes -a "x$ac_cv_lib_gmp_main" = xyes + then + +$as_echo "#define USE_GMP 1" >>confdefs.h + + fi fi + if test "$yap_cv_judy" != "no"; then for ac_header in Judy.h do : @@ -7655,6 +7674,12 @@ fi done + if test "x$ac_cv_header_Judy_h" = xyes -a "x$ac_cv_lib_Judy_Judy1Set" = xyes + then + +$as_echo "#define USE_JUDY 1" >>confdefs.h + + fi fi if test "$yap_cv_readline" != "no" @@ -8073,6 +8098,13 @@ _ACEOF + +cat >>confdefs.h <<_ACEOF +#define CELLSIZE $ac_cv_sizeof_void_p +_ACEOF + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of malloc" >&5 $as_echo_n "checking for type of malloc... " >&6; } if ${yap_cv_malloct+:} false; then : @@ -9046,15 +9078,51 @@ $as_echo "#define BROKEN_FFLUSH_NULL /**/" >>confdefs.h fi -if test "$use_malloc" = yes -o "$maxmemory" = yes +if test "$threads" = "yes" then + if test "$use_malloc" = "no" + then + +$as_echo "#define USE_DL_MALLOC 1" >>confdefs.h + + else $as_echo "#define USE_SYSTEM_MALLOC 1" >>confdefs.h + fi +else + case "$orparallelism" in + sba|yes|copy) + if test x"$ac_cv_func_mmap" = x"yes" + then + +$as_echo "#define USE_SYSTEM_MMAP 1" >>confdefs.h + + else + +$as_echo "#define USE_SYSTEM_SHM 1" >>confdefs.h + + fi + ;; +# a-cow) + **) + if test "$use_malloc" = "no" + then + +$as_echo "#define USE_DL_MALLOC 1" >>confdefs.h + + else + +$as_echo "#define USE_SYSTEM_MALLOC 1" >>confdefs.h + + fi + ;; + esac +fi $as_echo "#define GC_NO_TAGS 1" >>confdefs.h -fi + PROLOG_SYSTEM=yap @@ -11827,7 +11895,7 @@ else JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST -/* #line 11830 "configure" */ +/* #line 11898 "configure" */ public class Test { } EOF @@ -12003,7 +12071,7 @@ EOF if uudecode$EXEEXT Test.uue; then ac_cv_prog_uudecode_base64=yes else - echo "configure: 12006: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 + echo "configure: 12074: 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 @@ -12134,7 +12202,7 @@ else JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST -/* #line 12137 "configure" */ +/* #line 12205 "configure" */ public class Test { } EOF @@ -12169,7 +12237,7 @@ JAVA_TEST=Test.java CLASS_TEST=Test.class TEST=Test cat << \EOF > $JAVA_TEST -/* [#]line 12172 "configure" */ +/* [#]line 12240 "configure" */ public class Test { public static void main (String args[]) { System.exit (0); diff --git a/configure.in b/configure.in index 9b391de92..9e42d2de3 100755 --- a/configure.in +++ b/configure.in @@ -91,6 +91,11 @@ case "$target_cpu" in ;; esac +dnl hardware/engine +AC_DEFINE(MSHIFTOFFS, 1, [compiler should shift offsets.]) +AC_DEFINE(ALIGN_LONGS, 1, [longs should be in addresses that are multiple of four.]) +# AC_DEFINE(LOW_ABSMI, 1, [absmi located at initial addresses, unused.]) + AC_ARG_ENABLE(tabling, [ --enable-tabling support tabling ], @@ -508,6 +513,7 @@ then AC_CHECK_LIB(comdlg32,main) AC_CHECK_LIB(shell32,main) fi + AC_DEFINE(__WINDOWS__, 1, [compiling for Windows]) EXTRA_LIBS_FOR_DLLS="\$(abs_top_builddir)/yap.dll $EXTRA_LIBS_FOR_DLLS" AC_CHECK_LIB(psapi,main) yap_cv_readline=no @@ -1155,12 +1161,22 @@ AC_CHECK_HEADERS(sys/ucontext.h sys/un.h sys/wait.h) AC_CHECK_HEADERS(time.h unistd.h utime.h wctype.h winsock.h winsock2.h) AC_CHECK_HEADERS(zlib.h zutil.h) AC_CHECK_HEADERS(mach-o/dyld.h LibLoaderAPI.h) + if test "$yap_cv_gmp" != "no" then AC_CHECK_HEADERS(gmp.h) + if test "x$ac_cv_header_gmp_h" = xyes -a "x$ac_cv_lib_gmp_main" = xyes + then + AC_DEFINE(USE_GMP, 1, [use bignums/rationals in YAP code.]) + fi fi + if test "$yap_cv_judy" != "no"; then AC_CHECK_HEADERS(Judy.h) + if test "x$ac_cv_header_Judy_h" = xyes -a "x$ac_cv_lib_Judy_Judy1Set" = xyes + then + AC_DEFINE(USE_JUDY, 1, [use Judy library for UDI indexing in YAP code.]) + fi fi if test "$yap_cv_readline" != "no" @@ -1195,6 +1211,9 @@ AC_CHECK_SIZEOF(float,4) AC_CHECK_SIZEOF(double,8) AC_CHECK_SIZEOF(void *,4) +AC_DEFINE_UNQUOTED(CELLSIZE, $ac_cv_sizeof_void_p, [size of a cell in bytes.]) + + dnl check type of malloc (i.e. char * or void *) AC_MSG_CHECKING(for type of malloc) AC_CACHE_VAL(yap_cv_malloct,[ @@ -1600,11 +1619,37 @@ fi dnl disable smart memory management -if test "$use_malloc" = yes -o "$maxmemory" = yes +if test "$threads" = "yes" then - AC_DEFINE(USE_SYSTEM_MALLOC,1,[use OS malloc]) - AC_DEFINE(GC_NO_TAGS,1,[use Barts idea of allocating extra memory]) + if test "$use_malloc" = "no" + then + AC_DEFINE(USE_DL_MALLOC,1,[use Doug Lea's malloc for all allocation]) + else + AC_DEFINE(USE_SYSTEM_MALLOC,1,[use OS malloc for all allocation]) + fi +else + case "$orparallelism" in + sba|yes|copy) + if test x"$ac_cv_func_mmap" = x"yes" + then + AC_DEFINE(USE_SYSTEM_MMAP,1,[use mmap in or-parallel allocation]) + else + AC_DEFINE(USE_SYSTEM_SHM,1,[use shm in or-parallel allocation]) + fi + ;; +# a-cow) + **) + if test "$use_malloc" = "no" + then + AC_DEFINE(USE_DL_MALLOC,1,[use Doug Lea's malloc for all allocation]) + else + AC_DEFINE(USE_SYSTEM_MALLOC,1,[use OS malloc for all allocation]) + fi + ;; + esac fi +AC_DEFINE(GC_NO_TAGS,1,[use Barts idea of allocating extra memory]) + dnl SWI compatibility support! diff --git a/library/mpi/mpe.c b/library/mpi/mpe.c index 352b4cba0..a2c219d6e 100644 --- a/library/mpi/mpe.c +++ b/library/mpi/mpe.c @@ -21,6 +21,20 @@ static char *rcsid = "$Header: /Users/vitor/Yap/yap-cvsbackup/library/mpi/mpe.c, #include "Yap.h" +/* Should we use MPI ? */ +#if defined(HAVE_MPI_H) && (defined(HAVE_LIBMPI) || defined(HAVE_LIBMPICH)) + #define HAVE_MPI 1 +#else + #define HAVE_MPI 0 +#endif + +/* Should we use MPE ? */ +#if defined(HAVE_MPI_H) && HAVE_LIBMPE && HAVE_MPI + #define HAVE_MPE 1 +#else + #define HAVE_MPE 0 +#endif + #if HAVE_MPE #if 0 diff --git a/library/mpi/mpi.c b/library/mpi/mpi.c index 9e3835872..50c045400 100644 --- a/library/mpi/mpi.c +++ b/library/mpi/mpi.c @@ -21,6 +21,13 @@ static char *rcsid = "$Header: /Users/vitor/Yap/yap-cvsbackup/library/mpi/mpi.c, #include "Yap.h" +/* Should we use MPI ? */ +#if defined(HAVE_MPI_H) && (defined(HAVE_LIBMPI) || defined(HAVE_LIBMPICH)) + #define HAVE_MPI 1 +#else + #define HAVE_MPI 0 +#endif + #if HAVE_MPI #include "Yatom.h" diff --git a/packages/clib b/packages/clib index eb967e056..c6dae3b1c 160000 --- a/packages/clib +++ b/packages/clib @@ -1 +1 @@ -Subproject commit eb967e056bef8c4cff0a9b82ff193da785eba16f +Subproject commit c6dae3b1cb4aa47dd9361099c635e994250c749f diff --git a/packages/jpl b/packages/jpl index 589438f02..77759f849 160000 --- a/packages/jpl +++ b/packages/jpl @@ -1 +1 @@ -Subproject commit 589438f02c532396334ceb7a902969be1979109d +Subproject commit 77759f84962a5f77a970d0cdcc9647fdc8e7bbfb diff --git a/packages/zlib b/packages/zlib index a8a43aa09..abd65ae64 160000 --- a/packages/zlib +++ b/packages/zlib @@ -1 +1 @@ -Subproject commit a8a43aa09892c4b7018dc053d8e7653e2f648107 +Subproject commit abd65ae6486993e04dfa883163efdad3bab789ab