[PPL-devel] [GIT] ppl/ppl(termination): Support newer versions of SWI-Prolog.

Roberto Bagnara bagnara at cs.unipr.it
Mon Mar 8 15:42:26 CET 2010


Module: ppl/ppl
Branch: termination
Commit: b81ffc77370c6734881e1b600a5d7c9688c9ca3e
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=b81ffc77370c6734881e1b600a5d7c9688c9ca3e

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Mon Mar  8 18:39:23 2010 +0400

Support newer versions of SWI-Prolog.

---

 interfaces/Prolog/SWI/Makefile.am |   12 ++++++------
 m4/ac_check_swi_prolog.m4         |   23 +++++++++++++++++------
 2 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/interfaces/Prolog/SWI/Makefile.am b/interfaces/Prolog/SWI/Makefile.am
index 9c48447..98dffed 100644
--- a/interfaces/Prolog/SWI/Makefile.am
+++ b/interfaces/Prolog/SWI/Makefile.am
@@ -206,9 +206,9 @@ pl_clpq2_SOURCES = pl_clpq.cc
 
 if HOST_OS_CYGWIN
 
-# Under Cygwin, plld gets the link options wrong: -lpl (PLLIB)
-# comes before -lppl_swiprolog, with the result that all the
-# symbols of the SWI-Prolog foreign interface are undefined.
+# Under Cygwin, $(SWI_PROLOG_LD) gets the link options wrong:
+# -lpl (PLLIB) comes before -lppl_swiprolog, with the result that all
+# the symbols of the SWI-Prolog foreign interface are undefined.
 # Repeating the link options works around this problem.
 EXTRA_LINK_OPTIONS = $(SWI_PROLOG_LD_OPTIONS)
 
@@ -229,14 +229,14 @@ LIBPPL_SWIPROLOG_LINK_OPTIONS = -L.libs -lppl_swiprolog
 endif !ENABLE_STATIC
 
 ppl_pl$(EXEEXT): libppl_swiprolog.la ppl_pl.o
-	plld -pl $(SWI_PROLOG) -cc $(CC) -c++ $(CXX) -ld $(CXX) \
+	$(SWI_PROLOG_LD) -pl $(SWI_PROLOG) -cc $(CC) -c++ $(CXX) -ld $(CXX) \
 		-ld-options`echo '' $(AM_CXXFLAGS) $(CXXFLAGS) | tr " " "/"` \
 		-o $@ $(LIBPPL_SWIPROLOG_LINK_OPTIONS) ppl_pl.o \
 		-L$(top_builddir)/src/.libs \
 		-lppl $(WATCHDOG_LINK_OPTIONS) @extra_libraries@ $(EXTRA_LINK_OPTIONS)
 
 pl_clpq$(EXEEXT): libppl_swiprolog.la pl_clpq.o pl_clpq.pl ../tests/clpq.pl
-	plld -pl $(SWI_PROLOG) -cc $(CC) -c++ $(CXX) -ld $(CXX) \
+	$(SWI_PROLOG_LD) -pl $(SWI_PROLOG) -cc $(CC) -c++ $(CXX) -ld $(CXX) \
 		-ld-options`echo '' $(AM_CXXFLAGS) $(CXXFLAGS) | tr " " "/"` \
 		-o $@ $(LIBPPL_SWIPROLOG_LINK_OPTIONS) pl_clpq.o \
                 $(srcdir)/pl_clpq.pl $(srcdir)/../tests/clpq.pl \
@@ -245,7 +245,7 @@ pl_clpq$(EXEEXT): libppl_swiprolog.la pl_clpq.o pl_clpq.pl ../tests/clpq.pl
 
 
 pl_clpq2$(EXEEXT): libppl_swiprolog.la pl_clpq.o pl_clpq.pl ../tests/clpq2.pl
-	plld -pl $(SWI_PROLOG) -cc $(CC) -c++ $(CXX) -ld $(CXX) \
+	$(SWI_PROLOG_LD) -pl $(SWI_PROLOG) -cc $(CC) -c++ $(CXX) -ld $(CXX) \
 		-ld-options`echo '' $(AM_CXXFLAGS) $(CXXFLAGS) | tr " " "/"` \
 		-o $@ $(LIBPPL_SWIPROLOG_LINK_OPTIONS) pl_clpq.o \
                 $(srcdir)/pl_clpq.pl $(srcdir)/../tests/clpq2.pl \
diff --git a/m4/ac_check_swi_prolog.m4 b/m4/ac_check_swi_prolog.m4
index b4680e3..daed0a7 100644
--- a/m4/ac_check_swi_prolog.m4
+++ b/m4/ac_check_swi_prolog.m4
@@ -22,14 +22,17 @@ dnl site: http://www.cs.unipr.it/ppl/ .
 
 AC_DEFUN([AC_CHECK_SWI_PROLOG],
 [
-dnl By default, SWI-Prolog is installed as `pl', though some administrators
-dnl call it `swipl' or `swi-prolog'.  In particular, on Mac OS X `pl' is
-dnl the name of another program.  On Windows, the console version of
-dnl SWI-Prolog is called `plcon'.
-AC_PATH_PROG(swi_prolog, swi-prolog)
+dnl By default, old versions of SWI-Prolog were installed as `pl',
+dnl though some administrators called it `swipl' or `swi-prolog'.
+dnl In particular, on Mac OS X `pl' is the name of another program.
+dnl On Windows, the console version of SWI-Prolog was called `plcon'.
+dnl Since SWI-Prolog 5.9.9, by default and on all systems, the
+dnl interpreter is called `swipl' and `plld' is called `swipl-ld'
+
+AC_PATH_PROG(swi_prolog, swipl)
 if test -z $swi_prolog
 then
-  AC_PATH_PROG(swi_prolog, swipl)
+  AC_PATH_PROG(swi_prolog, swi-prolog)
   if test -z $swi_prolog
   then
     AC_PATH_PROG(swi_prolog, pl)
@@ -49,6 +52,12 @@ then
 
   dnl Additional version checks could be inserted here, if necessary.
 
+  AC_PATH_PROG(swi_prolog_ld, swipl-ld)
+  if test -z $swi_prolog_ld
+  then
+    AC_PATH_PROG(swi_prolog_ld, plld)
+  fi
+
   # In Fedora, SWI-Prolog.h is installed only in /usr/include/pl, which,
   # IMHO, is a bug (https://bugzilla.redhat.com/show_bug.cgi?id=471071).
   SWI_PROLOG_INCLUDE_OPTIONS="-I${swi_prolog_base}/include -I/usr/include/pl"
@@ -79,7 +88,9 @@ main() {
   AC_LANG_POP(C++)
   CPPFLAGS="$ac_save_CPPFLAGS"
   SWI_PROLOG="$swi_prolog"
+  SWI_PROLOG_LD="$swi_prolog_ld"
   AC_SUBST(SWI_PROLOG)
+  AC_SUBST(SWI_PROLOG_LD)
   AC_SUBST(SWI_PROLOG_INCLUDE_OPTIONS)
   AC_SUBST(SWI_PROLOG_LD_OPTIONS)
 fi




More information about the PPL-devel mailing list