From 9174f32eb5ebc974f2acc03f5285e9f6194a6d02 Mon Sep 17 00:00:00 2001 From: rzf Date: Wed, 7 Nov 2007 13:02:37 +0000 Subject: [PATCH] added support for the compilation of cplint with the option --enable-cplint[=DIR] where DIR is the optional directory prefix where glu was installed git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1978 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- Makefile.in | 13 +- configure | 325 ++++++++++++++++++++++++++++++++++++++++++++- configure.in | 41 +++++- cplint/Makefile.in | 116 ++++++++++++++++ cplint/test.yap | 17 ++- 5 files changed, 495 insertions(+), 17 deletions(-) create mode 100644 cplint/Makefile.in diff --git a/Makefile.in b/Makefile.in index a413daaca..e071e4f90 100644 --- a/Makefile.in +++ b/Makefile.in @@ -559,6 +559,7 @@ all: startup @INSTALL_DLLS@ (cd library/matrix; make) @INSTALL_MATLAB@ (cd library/matlab; make) @ENABLE_JPL@ @INSTALL_DLLS@ (cd LGPL/JPL/src; make) + @ENABLE_CPLINT@ (cd cplint; make) startup: yap@EXEC_SUFFIX@ $(PL_SOURCES) -rm -f startup @@ -573,7 +574,7 @@ libYap.a: $(LIB_OBJECTS) $(RANLIB) libYap.a @DYNYAPLIB@: $(LIB_OBJECTS) - @DYNLIB_LD@ -o @YAPLIB@ $(LIB_OBJECTS) $(LIBS) + @DYNLIB_LD@ -o @YAPLIB@ $(LIB_OBJECTS) $(LIBS) $(LDFLGS) install: install_bin install_data @@ -598,6 +599,8 @@ install_unix: startup libYap.a @ENABLE_JPL@ @INSTALL_DLLS@ (cd LGPL/JPL/src; make install) mkdir -p $(DESTDIR)$(INCLUDEDIR) for h in $(INTERFACE_HEADERS); do $(INSTALL) $$h $(DESTDIR)$(INCLUDEDIR); done + @ENABLE_CPLINT@ (cd cplint; make install) + install_win32: startup mkdir -p $(DESTDIR)$(BINDIR) @@ -620,6 +623,7 @@ install_win32: startup (cd library/system; make install) @INSTALL_MATLAB@ (cd library/matlab; make install) (cd library/tries; make install) + @ENABLE_CPLINT@ (cd cplint; make install) install_library: @YAPLIB@ mkdir -p $(DESTDIR)$(INCLUDEDIR) @@ -661,6 +665,8 @@ clean: clean_docs @INSTALL_DLLS@ (cd library/lammpi; make clean) @INSTALL_MATLAB@ (cd library/matlab; make clean) @ENABLE_JPL@ @INSTALL_DLLS@ (cd LGPL/JPL/src; make clean) + @ENABLE_CPLINT@ (cd cplint; make clean) + realclean: clean realclean_docs @@ -682,7 +688,7 @@ yap.dll: libYap.a -Wl,--export-all-symbols \ -Wl,--enable-auto-import \ -Wl,--whole-archive libYap.a \ - -Wl,--no-whole-archive $(LIBS) + -Wl,--no-whole-archive $(LIBS) $(LDFLAGS) install_info: make info; \ @@ -737,7 +743,8 @@ clean_docs: realclean_docs: clean_docs rm -f yap.ps yap.html yap_toc.html yap.pdf yap.info* - +installcheck: + @ENABLE_CPLINT@ (cd cplint; make installcheck) # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/configure b/configure index 4e6741732..76728f805 100755 --- a/configure +++ b/configure @@ -684,6 +684,11 @@ INSTALL_INFO CPP GREP EGREP +CPLINT_LIBS +CPLINT_CFLAGS +CPLINT_LDFLAGS +CPLINT_SHLIB_LD +ENABLE_CPLINT M4 M4GENHDRS INSTALL_DLLS @@ -1323,6 +1328,7 @@ Optional Features: --enable-condor allow Yap to be used from condor --enable-april compile Yap to support April ILP system --enable-dlcompat use dlcompat library for dynamic loading on Mac OS X + --enable-cplint=DIR enable the cplint library using the glu library in DIR/lib --enable-myddas[=DIR] enable the MYDDAS library --enable-myddas-stats enable the MYDDAS library statistics support --enable-myddas-top-level enable the MYDDAS top-level support to MySQL @@ -2845,6 +2851,14 @@ else fi +# Check whether --enable-cplint was given. +if test "${enable_cplint+set}" = set; then + enableval=$enable_cplint; yap_cv_cplint=$enableval +else + yap_cv_cplint=no +fi + + # Check whether --with-gmp was given. if test "${with_gmp+set}" = set; then @@ -7184,6 +7198,296 @@ if test "$tabling" = "yes" then YAP_EXTRAS="$YAP_EXTRAS -DTABLING=1" fi +if test ! "$yap_cv_cplint" = "no" + then + GLIBS=`glib-config --libs glib` + GFLAGS=`glib-config --cflags glib` + CPLINT_LIBS+=$GLIBS + CPLINT_CFLAGS=" $GFLAGS " + CPLINT_LDFLAGS=" `echo $GLIBS | awk '{print $1}'` -L/usrl/local/lib/" + LDFLAGS+=" `echo $GLIBS | awk '{print $1}'` -L/usrl/local/lib/" + if test ! "$yap_cv_cplint" = "yes" + then + LDFLAGS+=" -L${yap_cv_cplint}/lib" + CPLINT_LDFLAGS+=" -L${yap_cv_cplint}/lib" + CPLINT_CFLAGS+=" -I${yap_cv_cplint}/include" + fi + { echo "$as_me:$LINENO: checking for library containing g_hash_table_new" >&5 +echo $ECHO_N "checking for library containing g_hash_table_new... $ECHO_C" >&6; } +if test "${ac_cv_search_g_hash_table_new+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 g_hash_table_new (); +int +main () +{ +return g_hash_table_new (); + ; + return 0; +} +_ACEOF +for ac_lib in '' glib; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_g_hash_table_new=$ac_res +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_g_hash_table_new+set}" = set; then + break +fi +done +if test "${ac_cv_search_g_hash_table_new+set}" = set; then + : +else + ac_cv_search_g_hash_table_new=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_g_hash_table_new" >&5 +echo "${ECHO_T}$ac_cv_search_g_hash_table_new" >&6; } +ac_res=$ac_cv_search_g_hash_table_new +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + CPLINT_LIBS="-lglib " +else + { { echo "$as_me:$LINENO: error: This package needs glib." >&5 +echo "$as_me: error: This package needs glib." >&2;} + { (exit 1); exit 1; }; } +fi + + { echo "$as_me:$LINENO: checking for library containing array_do_alloc" >&5 +echo $ECHO_N "checking for library containing array_do_alloc... $ECHO_C" >&6; } +if test "${ac_cv_search_array_do_alloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 array_do_alloc (); +int +main () +{ +return array_do_alloc (); + ; + return 0; +} +_ACEOF +for ac_lib in '' glu; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_array_do_alloc=$ac_res +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_array_do_alloc+set}" = set; then + break +fi +done +if test "${ac_cv_search_array_do_alloc+set}" = set; then + : +else + ac_cv_search_array_do_alloc=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_array_do_alloc" >&5 +echo "${ECHO_T}$ac_cv_search_array_do_alloc" >&6; } +ac_res=$ac_cv_search_array_do_alloc +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + CPLINT_LIBS="-lglu "$CPLINT_LIBS +else + { { echo "$as_me:$LINENO: error: This package needs glu." >&5 +echo "$as_me: error: This package needs glu." >&2;} + { (exit 1); exit 1; }; } +fi + + { echo "$as_me:$LINENO: checking for library containing Cudd_Init" >&5 +echo $ECHO_N "checking for library containing Cudd_Init... $ECHO_C" >&6; } +if test "${ac_cv_search_Cudd_Init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 Cudd_Init (); +int +main () +{ +return Cudd_Init (); + ; + return 0; +} +_ACEOF +for ac_lib in '' cu; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib -lglu -lm $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_Cudd_Init=$ac_res +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_Cudd_Init+set}" = set; then + break +fi +done +if test "${ac_cv_search_Cudd_Init+set}" = set; then + : +else + ac_cv_search_Cudd_Init=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_Cudd_Init" >&5 +echo "${ECHO_T}$ac_cv_search_Cudd_Init" >&6; } +ac_res=$ac_cv_search_Cudd_Init +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + CPLINT_LIBS="-lcu "$CPLINT_LIBS +else + { { echo "$as_me:$LINENO: error: This package needs glu." >&5 +echo "$as_me: error: This package needs glu." >&2;} + { (exit 1); exit 1; }; } +fi + + ENABLE_CPLINT="" + if test "$target_os" = "cygwin" -o "$target_os" = "mingw32" + then + CPLINT_SHLIB_LD="gcc -shared ../yap.dll" + else + CPLINT_SHLIB_LD=$SHLIB_LD + fi + + + + +else + ENABLE_CPLINT="#" +fi + # LAM OLD_CC=${CC} @@ -15835,8 +16139,9 @@ mkdir -p LGPL/JPL/src mkdir -p LGPL/clp mkdir -p LGPL/clpr mkdir -p LGPL/chr +mkdir -p cplint -ac_config_files="$ac_config_files Makefile library/matrix/Makefile library/matlab/Makefile library/regex/Makefile library/system/Makefile library/random/Makefile library/yap2swi/Makefile library/mpi/Makefile .depend library/Makefile LGPL/chr/Makefile LGPL/chr/chr_swi_bootstrap.yap CLPBN/Makefile LGPL/clp/Makefile LGPL/clpr/Makefile library/lammpi/Makefile library/tries/Makefile LGPL/JPL/Makefile LGPL/JPL/src/Makefile LGPL/JPL/java/Makefile LGPL/JPL/jpl_paths.yap" +ac_config_files="$ac_config_files Makefile library/matrix/Makefile library/matlab/Makefile library/regex/Makefile library/system/Makefile library/random/Makefile library/yap2swi/Makefile library/mpi/Makefile .depend library/Makefile LGPL/chr/Makefile LGPL/chr/chr_swi_bootstrap.yap CLPBN/Makefile LGPL/clp/Makefile LGPL/clpr/Makefile library/lammpi/Makefile library/tries/Makefile LGPL/JPL/Makefile LGPL/JPL/src/Makefile LGPL/JPL/java/Makefile LGPL/JPL/jpl_paths.yap cplint/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -16413,6 +16718,7 @@ do "LGPL/JPL/src/Makefile") CONFIG_FILES="$CONFIG_FILES LGPL/JPL/src/Makefile" ;; "LGPL/JPL/java/Makefile") CONFIG_FILES="$CONFIG_FILES LGPL/JPL/java/Makefile" ;; "LGPL/JPL/jpl_paths.yap") CONFIG_FILES="$CONFIG_FILES LGPL/JPL/jpl_paths.yap" ;; + "cplint/Makefile") CONFIG_FILES="$CONFIG_FILES cplint/Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -16545,6 +16851,11 @@ INSTALL_INFO!$INSTALL_INFO$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim +CPLINT_LIBS!$CPLINT_LIBS$ac_delim +CPLINT_CFLAGS!$CPLINT_CFLAGS$ac_delim +CPLINT_LDFLAGS!$CPLINT_LDFLAGS$ac_delim +CPLINT_SHLIB_LD!$CPLINT_SHLIB_LD$ac_delim +ENABLE_CPLINT!$ENABLE_CPLINT$ac_delim M4!$M4$ac_delim M4GENHDRS!$M4GENHDRS$ac_delim INSTALL_DLLS!$INSTALL_DLLS$ac_delim @@ -16566,11 +16877,6 @@ JAR!$JAR$ac_delim IN_UNIX!$IN_UNIX$ac_delim YAPMPILIB!$YAPMPILIB$ac_delim LAM_MPI_CC!$LAM_MPI_CC$ac_delim -MPI_OBJS!$MPI_OBJS$ac_delim -MPI_LIBS!$MPI_LIBS$ac_delim -INSTALL_COMMAND!$INSTALL_COMMAND$ac_delim -CROSS_SIMULATOR!$CROSS_SIMULATOR$ac_delim -INSTALLCLP!$INSTALLCLP$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -16612,6 +16918,11 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +MPI_OBJS!$MPI_OBJS$ac_delim +MPI_LIBS!$MPI_LIBS$ac_delim +INSTALL_COMMAND!$INSTALL_COMMAND$ac_delim +CROSS_SIMULATOR!$CROSS_SIMULATOR$ac_delim +INSTALLCLP!$INSTALLCLP$ac_delim JAVALIBPATH!$JAVALIBPATH$ac_delim JAVAINCPATH!$JAVAINCPATH$ac_delim LAMOBJS!$LAMOBJS$ac_delim @@ -16624,7 +16935,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 10; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 15; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.in b/configure.in index 359fb970c..0ab37d7ca 100644 --- a/configure.in +++ b/configure.in @@ -77,7 +77,11 @@ AC_ARG_ENABLE(april, AC_ARG_ENABLE(dlcompat, [ --enable-dlcompat use dlcompat library for dynamic loading on Mac OS X], use_dlcompat="$enableval", use_dlcompat=no) - + +AC_ARG_ENABLE(cplint, + [ --enable-cplint[=DIR] enable the cplint library using the glu library in DIR/lib], + yap_cv_cplint=$enableval, yap_cv_cplint=no) + AC_ARG_WITH(gmp, [ --with-gmp[=DIR] use GNU Multiple Precision in DIR], if test "$withval" = yes; then @@ -936,6 +940,38 @@ if test "$tabling" = "yes" then YAP_EXTRAS="$YAP_EXTRAS -DTABLING=1" fi +if test ! "$yap_cv_cplint" = "no" + then + GLIBS=`glib-config --libs glib` + GFLAGS=`glib-config --cflags glib` + CPLINT_LIBS+=$GLIBS + CPLINT_CFLAGS=" $GFLAGS " + CPLINT_LDFLAGS=" `echo $GLIBS | awk '{print $1}'` -L/usrl/local/lib/" + LDFLAGS+=" `echo $GLIBS | awk '{print $1}'` -L/usrl/local/lib/" + if test ! "$yap_cv_cplint" = "yes" + then + LDFLAGS+=" -L${yap_cv_cplint}/lib" + CPLINT_LDFLAGS+=" -L${yap_cv_cplint}/lib" + CPLINT_CFLAGS+=" -I${yap_cv_cplint}/include" + fi + AC_SEARCH_LIBS([g_hash_table_new], [glib], [CPLINT_LIBS="-lglib "], [AC_MSG_ERROR([This package needs glib.], [1])], []) + AC_SEARCH_LIBS([array_do_alloc], [glu], [CPLINT_LIBS="-lglu "$CPLINT_LIBS], [AC_MSG_ERROR([This package needs glu.], [1])], []) + AC_SEARCH_LIBS([Cudd_Init], [cu], [CPLINT_LIBS="-lcu "$CPLINT_LIBS], [AC_MSG_ERROR([This package needs glu.], [1])], [-lglu -lm]) + ENABLE_CPLINT="" + if test "$target_os" = "cygwin" -o "$target_os" = "mingw32" + then + CPLINT_SHLIB_LD="gcc -shared ../yap.dll" + else + CPLINT_SHLIB_LD=$SHLIB_LD + fi + AC_SUBST(CPLINT_LIBS) + AC_SUBST(CPLINT_CFLAGS) + AC_SUBST(CPLINT_LDFLAGS) + AC_SUBST(CPLINT_SHLIB_LD) +else + ENABLE_CPLINT="#" +fi +AC_SUBST(ENABLE_CPLINT) # LAM OLD_CC=${CC} @@ -1366,8 +1402,9 @@ mkdir -p LGPL/JPL/src mkdir -p LGPL/clp mkdir -p LGPL/clpr mkdir -p LGPL/chr +mkdir -p cplint -AC_OUTPUT(Makefile library/matrix/Makefile library/matlab/Makefile library/regex/Makefile library/system/Makefile library/random/Makefile library/yap2swi/Makefile library/mpi/Makefile .depend library/Makefile LGPL/chr/Makefile LGPL/chr/chr_swi_bootstrap.yap CLPBN/Makefile LGPL/clp/Makefile LGPL/clpr/Makefile library/lammpi/Makefile library/tries/Makefile LGPL/JPL/Makefile LGPL/JPL/src/Makefile LGPL/JPL/java/Makefile LGPL/JPL/jpl_paths.yap) +AC_OUTPUT(Makefile library/matrix/Makefile library/matlab/Makefile library/regex/Makefile library/system/Makefile library/random/Makefile library/yap2swi/Makefile library/mpi/Makefile .depend library/Makefile LGPL/chr/Makefile LGPL/chr/chr_swi_bootstrap.yap CLPBN/Makefile LGPL/clp/Makefile LGPL/clpr/Makefile library/lammpi/Makefile library/tries/Makefile LGPL/JPL/Makefile LGPL/JPL/src/Makefile LGPL/JPL/java/Makefile LGPL/JPL/jpl_paths.yap cplint/Makefile) make depend diff --git a/cplint/Makefile.in b/cplint/Makefile.in new file mode 100644 index 000000000..6295cc5c5 --- /dev/null +++ b/cplint/Makefile.in @@ -0,0 +1,116 @@ +# +# default base directory for YAP installation +# (EROOT for architecture-dependent files) +# +prefix = @prefix@ +ROOTDIR = $(prefix) +EROOTDIR = @exec_prefix@ +# +# where the binary should be +# +BINDIR = $(ROOTDIR)/bin +# +# where YAP should look for libraries +# +LIBDIR=$(ROOTDIR)/lib/Yap +# +# where YAP should look for architecture-independent Prolog libraries +# +SHAREDIR=$(ROOTDIR)/share/Yap +# +# +CC=@CC@ +CFLAGS= @CFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../.. -I$(srcdir)/../../include +# +# +# You shouldn't need to change what follows. +# +INSTALL=@INSTALL@ +INSTALL_DATA=@INSTALL_DATA@ +INSTALL_PROGRAM=@INSTALL_PROGRAM@ +SHELL=/bin/sh +RANLIB=@RANLIB@ +srcdir=@srcdir@ +SHLIB_CFLAGS=@SHLIB_CFLAGS@ +SHLIB_SUFFIX=@SHLIB_SUFFIX@ +CPLINT_CFLAGS=@CPLINT_CFLAGS@ +CPLINT_LDFLAGS=@CPLINT_LDFLAGS@ +CPLINT_LIBS=@CPLINT_LIBS@ +#4.1VPATH=@srcdir@:@srcdir@/OPTYap +CWD=$(PWD) +# +OBS=cplint_yap.o cplint_Prob.o +SOBJS=cplint@SHLIB_SUFFIX@ + + + + +CPLINT_SRCDIR = $(srcdir) + +CPLINT_EXDIR = $(srcdir)/examples + +CPLINT_DOCDIR = $(srcdir)/doc + + +CPLINT_PROGRAMS= \ + $(CPLINT_SRCDIR)/cplint.yap + +CPLINT_HELPER_PROGRAMS= \ + $(CPLINT_SRCDIR)/test.yap \ + $(CPLINT_SRCDIR)/semantics.yap +CPLINT_EXAMPLES= \ + $(CPLINT_EXDIR)/dice.cpl \ + $(CPLINT_EXDIR)/dice.uni \ + $(CPLINT_EXDIR)/mendel.cpl \ + $(CPLINT_EXDIR)/alarm.cpl \ + $(CPLINT_EXDIR)/coin.cpl \ + $(CPLINT_EXDIR)/coin.uni \ + $(CPLINT_EXDIR)/coin2.cpl \ + $(CPLINT_EXDIR)/coin2.uni \ + $(CPLINT_EXDIR)/student.cpl \ + $(CPLINT_EXDIR)/student.uni \ + $(CPLINT_EXDIR)/esapprox.cpl \ + $(CPLINT_EXDIR)/esrange.cpl \ + $(CPLINT_EXDIR)/es.cpl \ + $(CPLINT_EXDIR)/school_simple.cpl \ + $(CPLINT_EXDIR)/school_simple.uni \ + $(CPLINT_EXDIR)/school.cpl \ + $(CPLINT_EXDIR)/paper_ref.cpl \ + $(CPLINT_EXDIR)/paper_ref_not.cpl \ + $(CPLINT_EXDIR)/paper_ref_simple.cpl \ + $(CPLINT_EXDIR)/threesideddice.cpl \ + $(CPLINT_EXDIR)/threesideddice.uni \ + $(CPLINT_EXDIR)/twosideddice.cpl \ + $(CPLINT_EXDIR)/female.cpl + +CPLINT_DOCS=\ + $(CPLINT_DOCDIR)/bib.bib \ + $(CPLINT_DOCDIR)/manual.tex + + +all: $(SOBJS) + +cplint_yap.o: $(srcdir)/cplint_yap.c $(srcdir)/cplint.h + $(CC) -c $(CFLAGS) $(SHLIB_CFLAGS) $(CPLINT_CFLAGS) $(srcdir)/cplint_yap.c -o cplint_yap.o + +cplint_Prob.o: $(srcdir)/cplint_Prob.c $(srcdir)/cplint.h + $(CC) -c $(CFLAGS) $(SHLIB_CFLAGS) $(CPLINT_CFLAGS) $(srcdir)/cplint_Prob.c -o cplint_Prob.o + + + +@DO_SECOND_LD@cplint@SHLIB_SUFFIX@: cplint_yap.o cplint_Prob.o +@DO_SECOND_LD@ @CPLINT_SHLIB_LD@ -o cplint@SHLIB_SUFFIX@ $(CPLINT_LDFLAGS) cplint_yap.o cplint_Prob.o $(CPLINT_LIBS) + + +install: all + mkdir -p $(DESTDIR)$(SHAREDIR)/cplint + mkdir -p $(DESTDIR)$(SHAREDIR)/cplint/examples + for h in $(CPLINT_PROGRAMS); do $(INSTALL_DATA) $$h $(DESTDIR)$(SHAREDIR); done + for h in $(CPLINT_EXAMPLES); do $(INSTALL_DATA) $$h $(DESTDIR)$(SHAREDIR)/cplint/examples; done + for h in $(CPLINT_DOCS); do $(INSTALL_DATA) $$h $(DESTDIR)$(SHAREDIR)/cplint/doc; done + for h in $(CPLINT_HELPER_PROGRAMS); do $(INSTALL_DATA) $$h $(DESTDIR)$(SHAREDIR)/cplint; done + $(INSTALL_PROGRAM) $(SOBJS) $(DESTDIR)$(LIBDIR) + +installcheck: + yap -l $(DESTDIR)$(SHAREDIR)/cplint/test.yap + diff --git a/cplint/test.yap b/cplint/test.yap index 6b94da935..487d06a77 100644 --- a/cplint/test.yap +++ b/cplint/test.yap @@ -8,9 +8,8 @@ use to execute the test */ -%:-use_module(library(cplint)). +:-use_module(library(cplint)). -:-compile(cplint). epsilon(0.000001). @@ -34,8 +33,10 @@ test_files([]). test_files([H|T]):- format("~a~n",[H]), - atom_concat('examples/',H,HN), - p(HN), + library_directory(LD), + atom_concat(LD,'/cplint/examples/',ExDir), + atom_concat(ExDir,H,NH), + p(NH), findall(A,test(A,H),L), test_all(H,L), test_files(T). @@ -43,7 +44,9 @@ test_files([H|T]):- test_all(_F,[]). test_all(F,[H|T]):- - format("~a ~p.~n",[F,H]), + copy_term(H,NH), + NH=(Query,close_to('P',Prob)), + format("~a ~p.~n",[F,NH]), call(H), test_all(F,T). @@ -175,3 +178,7 @@ test((s([course_difficulty(c0,m)],P),close_to(P,0.5)),school). test((s([student_ranking(s0,h)],P),close_to(P,0.6646250000000005)),school_simple). test((s([student_ranking(s0,l)],P),close_to(P,0.33537499999999987)),school_simple). + +:-t. + +:-halt.