[PPL-devel] [GIT] ppl/ppl(master): Improved and generalized the detection of YAP.

Roberto Bagnara bagnara at cs.unipr.it
Fri Jul 31 13:16:14 CEST 2009


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

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Fri Jul 31 13:15:39 2009 +0200

Improved and generalized the detection of YAP.

---

 configure.ac                      |   10 +-----
 interfaces/Prolog/YAP/Makefile.am |   11 ++++---
 m4/ac_check_yap.m4                |   54 +++++++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7a1877b..d1fb09e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1125,17 +1125,11 @@ AM_CONDITIONAL(BUILD_XSB_PROLOG_INTERFACE,
 # Checks for YAP.
 if test x${yap_prolog_interface_enabled} = xyes
 then
-  AC_CHECK_PROG(YAP_PROLOG, yap, yap)
-  if test x"$YAP_PROLOG" = xyap
-  then
-    AC_CHECK_HEADER(Yap/c_interface.h,
-                    [],
-                    YAP_PROLOG="")
-  fi
+  AC_CHECK_YAP_PROLOG
 fi
 
 if test x${yap_prolog_interface_enabled} = xyes \
-&& test x$YAP_PROLOG = xyap
+&& test x$have_yap_prolog = xyes
 then
   build_yap_prolog_interface=yes
 fi
diff --git a/interfaces/Prolog/YAP/Makefile.am b/interfaces/Prolog/YAP/Makefile.am
index 7af35c8..b7aaee4 100644
--- a/interfaces/Prolog/YAP/Makefile.am
+++ b/interfaces/Prolog/YAP/Makefile.am
@@ -63,6 +63,7 @@ AM_CPPFLAGS = \
 -I$(top_buildir)/interfaces/Prolog \
 -I$(top_builddir)/src \
 $(WATCHDOG_INCLUDE_OPTIONS) \
+$(YAP_PROLOG_INCLUDE_OPTIONS) \
 @extra_includes@
 
 if NO_UNDEFINED
@@ -160,7 +161,7 @@ nodist_EXTRA_ppl_yap_la_SOURCES = \
 
 ppl_yap_la_LIBADD = \
 @required_instantiations_prolog_cxx_objects@ \
--lYap \
+$(YAP_PROLOG_LD_OPTIONS) \
 $(top_builddir)/src/libppl.la \
 $(WATCHDOG_LIBRARY) \
 @extra_libraries@
@@ -213,7 +214,7 @@ pl_check_test: yap_pl_check.pl ppl_yap.pl ../tests/pl_check.pl $(EXPECTED_PCHK)
 		-dlopen ../../../src/libppl.la \
 		$(WATCHDOG_DLOPEN) \
 		-dlopen ppl_yap.la \
-		yap -l $(srcdir)/yap_pl_check.pl \
+		$(YAP_PROLOG) -l $(srcdir)/yap_pl_check.pl \
 			<script_pchk >obtained_pchk
 	diff -u --ignore-all-space $(EXPECTED_PCHK) obtained_pchk
 
@@ -227,7 +228,7 @@ clpq_test: yap_clpq.pl ppl_yap.pl ../tests/clpq.pl ../tests/script_clpq $(EXPECT
 		-dlopen ../../../src/libppl.la \
 		$(WATCHDOG_DLOPEN) \
 		-dlopen ppl_yap.la \
-		yap -l $(srcdir)/yap_clpq.pl \
+		$(YAP_PROLOG) -l $(srcdir)/yap_clpq.pl \
 			<script_clpq >obtained_clpq
 	diff -u --ignore-all-space $(EXPECTED_CLPQ) obtained_clpq
 
@@ -238,7 +239,7 @@ clpq2_test: yap_clpq2.pl ppl_yap.pl ../tests/clpq2.pl ../tests/script_clpq2 $(EX
 		-dlopen ../../../src/libppl.la \
 		$(WATCHDOG_DLOPEN) \
 		-dlopen ppl_yap.la \
-		yap -l $(srcdir)/yap_clpq2.pl \
+		$(YAP_PROLOG) -l $(srcdir)/yap_clpq2.pl \
 			<script_clpq2 >obtained_clpq2
 	diff -u --ignore-all-space $(EXPECTED_CLPQ2) obtained_clpq2
 
@@ -254,7 +255,7 @@ ppl_prolog_generated_test: yap_prolog_generated_test.pl ppl_yap.pl  ../tests/exp
 		-dlopen ../../../src/libppl.la \
 		$(WATCHDOG_DLOPEN) \
 		-dlopen ppl_yap.la \
-		yap -l yap_prolog_generated_test.pl \
+		$(YAP_PROLOG) -l yap_prolog_generated_test.pl \
 			<script_pgt >obtained_pgt
 	if [ $(srcdir) != `pwd` ]; then \
 	  rm -f ppl_prolog_generated_test_common.pl; \
diff --git a/m4/ac_check_yap.m4 b/m4/ac_check_yap.m4
new file mode 100644
index 0000000..5235050
--- /dev/null
+++ b/m4/ac_check_yap.m4
@@ -0,0 +1,54 @@
+dnl A function to check for the existence and usability of YAP Prolog.
+dnl Copyright (C) 2001-2009 Roberto Bagnara <bagnara at cs.unipr.it>
+dnl
+dnl This file is part of the Parma Polyhedra Library (PPL).
+dnl
+dnl The PPL is free software; you can redistribute it and/or modify it
+dnl under the terms of the GNU General Public License as published by the
+dnl Free Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl The PPL is distributed in the hope that it will be useful, but WITHOUT
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software Foundation,
+dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
+dnl
+dnl For the most up-to-date information see the Parma Polyhedra Library
+dnl site: http://www.cs.unipr.it/ppl/ .
+
+AC_DEFUN([AC_CHECK_YAP_PROLOG],
+[
+dnl By default, YAP-Prolog is installed as `yap'.
+AC_PATH_PROG(yap_prolog, yap)
+if test x$yap_prolog != x
+then
+  dnl Additional version checks could be inserted here, if necessary.
+
+  YAP_PROLOG_INCLUDE_OPTIONS=""
+  YAP_PROLOG_LD_OPTIONS="-lYap"
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="$CPPFLAGS $YAP_PROLOG_INCLUDE_OPTIONS"
+  AC_LANG_PUSH(C++)
+  # Check for YAP's foreign language interface header file.
+  AC_CHECK_HEADER(Yap/c_interface.h,
+                  [],
+                  yap_prolog="")
+  AC_LANG_POP(C++)
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  YAP_PROLOG="$yap_prolog"
+  AC_SUBST(YAP_PROLOG)
+  AC_SUBST(YAP_PROLOG_INCLUDE_OPTIONS)
+  AC_SUBST(YAP_PROLOG_LD_OPTIONS)
+fi
+
+if test x$yap_prolog != x
+then
+  have_yap_prolog=yes
+else
+  have_yap_prolog=no
+fi
+])




More information about the PPL-devel mailing list