support for SWIG.
This commit is contained in:
parent
3efe5df28e
commit
23561d086b
98
configure
vendored
98
configure
vendored
@ -633,12 +633,9 @@ CUDA_CPPFLAGS
|
||||
CUDA_SHLIB_LD
|
||||
PKG_CUDA
|
||||
NVCC
|
||||
SHLIB_SUFFIX
|
||||
CPLINT_SHLIB_LD
|
||||
CPLINT_LDFLAGS
|
||||
CPLINT_CFLAGS
|
||||
CPLINT_LIBS
|
||||
PKG_CPLINT
|
||||
PKG_SWIG
|
||||
SWIG_TARGET
|
||||
SWIG
|
||||
PYTHON_LIBS
|
||||
PYTHON_INCLUDES
|
||||
PKG_PYTHON
|
||||
@ -654,7 +651,7 @@ LTLIBOBJS
|
||||
LIBOBJS
|
||||
RAPTOR_CPPFLAGS
|
||||
RAPTOR_LDFLAGS
|
||||
PKG_RAPTOR
|
||||
ENABLE_RAPTOR
|
||||
LTX_PL
|
||||
_ACJNI_JAVAC
|
||||
JAVADOC
|
||||
@ -883,7 +880,7 @@ with_matlab
|
||||
with_mpi
|
||||
with_mpe
|
||||
with_python
|
||||
enable_cplint
|
||||
with_swig
|
||||
with_cuda
|
||||
enable_gecode
|
||||
'
|
||||
@ -1540,7 +1537,6 @@ Optional Features:
|
||||
--enable-myddas-stats enable the MYDDAS library statistics support
|
||||
--enable-myddas-top-level enable the MYDDAS top-level support to MySQL
|
||||
--enable-bddlib dynamic bdd library
|
||||
--enable-cplint=DIR enable the cplint library using the CUDD library in DIR/lib
|
||||
--enable-gecode install gecode library
|
||||
|
||||
Optional Packages:
|
||||
@ -1566,6 +1562,7 @@ Optional Packages:
|
||||
--with-mpi=DIR use LAM/MPI library in DIR
|
||||
--with-mpe=DIR use MPE library in DIR
|
||||
--with-python=DIR interface to R language
|
||||
--with-swig=DIR swig interface generator
|
||||
--enable-cuda use minisat interface
|
||||
|
||||
Some influential environment variables:
|
||||
@ -12375,7 +12372,7 @@ else
|
||||
JAVA_TEST=Test.java
|
||||
CLASS_TEST=Test.class
|
||||
cat << \EOF > $JAVA_TEST
|
||||
/* #line 12378 "configure" */
|
||||
/* #line 12375 "configure" */
|
||||
public class Test {
|
||||
}
|
||||
EOF
|
||||
@ -12551,7 +12548,7 @@ EOF
|
||||
if uudecode$EXEEXT Test.uue; then
|
||||
ac_cv_prog_uudecode_base64=yes
|
||||
else
|
||||
echo "configure: 12554: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
|
||||
echo "configure: 12551: 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
|
||||
@ -12682,7 +12679,7 @@ else
|
||||
JAVA_TEST=Test.java
|
||||
CLASS_TEST=Test.class
|
||||
cat << \EOF > $JAVA_TEST
|
||||
/* #line 12685 "configure" */
|
||||
/* #line 12682 "configure" */
|
||||
public class Test {
|
||||
}
|
||||
EOF
|
||||
@ -12717,7 +12714,7 @@ JAVA_TEST=Test.java
|
||||
CLASS_TEST=Test.class
|
||||
TEST=Test
|
||||
cat << \EOF > $JAVA_TEST
|
||||
/* [#]line 12720 "configure" */
|
||||
/* [#]line 12717 "configure" */
|
||||
public class Test {
|
||||
public static void main (String args[]) {
|
||||
System.exit (0);
|
||||
@ -13429,9 +13426,9 @@ fi
|
||||
|
||||
if test "$yap_cv_raptor" = no
|
||||
then
|
||||
PKG_RAPTOR=""
|
||||
ENABLE_RAPTOR="@# "
|
||||
else
|
||||
PKG_RAPTOR="packages/raptor"
|
||||
ENABLE_RAPTOR=""
|
||||
fi
|
||||
|
||||
if test "$yap_cv_raptor" != no; then
|
||||
@ -13539,7 +13536,7 @@ RAPTOR_LDFLAGS="$LIBS"
|
||||
|
||||
if test "$raptor_available" = no
|
||||
then
|
||||
PKG_RAPTOR=""
|
||||
ENABLE_RAPTOR="@# "
|
||||
cat << EOF
|
||||
##################################################################
|
||||
# ERROR: Could not find raptor library. Either I don't have the
|
||||
@ -13547,7 +13544,7 @@ then
|
||||
##################################################################
|
||||
EOF
|
||||
else
|
||||
PKG_RAPTOR="packages/raptor"
|
||||
ENABLE_RAPTOR=""
|
||||
fi
|
||||
|
||||
|
||||
@ -15338,56 +15335,42 @@ 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
|
||||
|
||||
|
||||
|
||||
if test ! "$yap_cv_cplint" = "no"
|
||||
then
|
||||
if test ! "$yap_cv_cplint" = "yes"
|
||||
then
|
||||
CPLINT_LDFLAGS+=" -L${yap_cv_cplint}/cudd -L${yap_cv_cplint}/mtr -L${yap_cv_cplint}/st -L${yap_cv_cplint}/util -L${yap_cv_cplint}/epd "
|
||||
CPLINT_CFLAGS+=" -I${yap_cv_cplint}/include"
|
||||
CPLINT_LIBS="-lcudd -lmtr -lst -lepd -lutil -lm "$CPLINT_LIBS
|
||||
fi
|
||||
if test "$target_os" = "cygwin" -o "$target_os" = "mingw32"
|
||||
then
|
||||
CPLINT_SHLIB_LD="gcc -shared ../../yap.dll"
|
||||
SHLIB_SUFFIX="dll"
|
||||
# Check whether --with-swig was given.
|
||||
if test "${with_swig+set}" = set; then :
|
||||
withval=$with_swig; if test "$withval" = yes; then
|
||||
SWIG=swig
|
||||
yap_cv_swig=yes
|
||||
elif test "$withval" = no; then
|
||||
yap_cv_swig=no
|
||||
else
|
||||
CPLINT_SHLIB_LD=$SHLIB_LD
|
||||
SHLIB_SUFFIX="so"
|
||||
SWIG=$withval
|
||||
yap_cv_swig=yes
|
||||
fi
|
||||
PKG_CPLINT="packages/cplint packages/cplint/splipcase packages/cplint/approx/simplecuddLPADs"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
PKG_CPLINT=""
|
||||
yap_cv_swig=no
|
||||
fi
|
||||
|
||||
mkdir -p packages/cplint
|
||||
mkdir -p packages/cplint/approx
|
||||
mkdir -p packages/cplint/approx/simplecuddLPADs
|
||||
|
||||
ac_config_files="$ac_config_files packages/cplint/Makefile"
|
||||
if test "$yap_cv_swig" = "no"; then
|
||||
SWIG_TARGET="dummy"
|
||||
PKG_SWIG=""
|
||||
elif test -e "$srcdir"/packages/swig/Makefile.in ; then
|
||||
SWIG_TARGET="all"
|
||||
PKG_SWIG="swig"
|
||||
fi
|
||||
|
||||
ac_config_files="$ac_config_files packages/cplint/approx/simplecuddLPADs/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files packages/cplint/slipcase/Makefile"
|
||||
if test "$PKG_SWIG" != ""; then
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files packages/swig/Makefile packages/swig/setup.py"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# Check whether --with-cuda was given.
|
||||
if test "${with_cuda+set}" = set; then :
|
||||
@ -16717,9 +16700,8 @@ do
|
||||
"packages/raptor/Makefile") CONFIG_FILES="$CONFIG_FILES packages/raptor/Makefile" ;;
|
||||
"library/matlab/Makefile") CONFIG_FILES="$CONFIG_FILES library/matlab/Makefile" ;;
|
||||
"packages/python/Makefile") CONFIG_FILES="$CONFIG_FILES packages/python/Makefile" ;;
|
||||
"packages/cplint/Makefile") CONFIG_FILES="$CONFIG_FILES packages/cplint/Makefile" ;;
|
||||
"packages/cplint/approx/simplecuddLPADs/Makefile") CONFIG_FILES="$CONFIG_FILES packages/cplint/approx/simplecuddLPADs/Makefile" ;;
|
||||
"packages/cplint/slipcase/Makefile") CONFIG_FILES="$CONFIG_FILES packages/cplint/slipcase/Makefile" ;;
|
||||
"packages/swig/Makefile") CONFIG_FILES="$CONFIG_FILES packages/swig/Makefile" ;;
|
||||
"packages/swig/setup.py") CONFIG_FILES="$CONFIG_FILES packages/swig/setup.py" ;;
|
||||
"packages/cuda/Makefile") CONFIG_FILES="$CONFIG_FILES packages/cuda/Makefile" ;;
|
||||
"packages/gecode/Makefile") CONFIG_FILES="$CONFIG_FILES packages/gecode/Makefile" ;;
|
||||
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||
|
@ -1962,7 +1962,7 @@ m4_include([library/lammpi/configure.in])
|
||||
|
||||
m4_include([packages/python/configure.in])
|
||||
|
||||
m4_include([packages/cplint/configure.in])
|
||||
m4_include([packages/swig/configure.in])
|
||||
|
||||
m4_include([packages/cuda/configure.in])
|
||||
|
||||
|
63
packages/swig/Makefile.in
Normal file
63
packages/swig/Makefile.in
Normal file
@ -0,0 +1,63 @@
|
||||
PACKAGE=swig
|
||||
DOC=swig
|
||||
PKGCFLAGS=
|
||||
SWIG=@SWIG@
|
||||
JAVAC=@JAVAC@
|
||||
JAR=@JAR@
|
||||
include ../Makefile.defs
|
||||
|
||||
PROGRAMS= \
|
||||
|
||||
SWIG_FILES= \
|
||||
$(srcdir)/yap.i \
|
||||
$(srcdir)/yap.c \
|
||||
$(srcdir)/yap.cpp \
|
||||
$(srcdir)/yap.hh
|
||||
|
||||
all: python java R
|
||||
|
||||
python: $(SWIG_FILES) python/_yap.so python/yap.py
|
||||
|
||||
python/_yap.so: python/yap.o python/yap_wrap.o
|
||||
$(LD) $(LDSOFLAGS) -o python/_yap.so python/yap.o python/yap_wrap.o $(LIBS) @PYTHON_LIBS@ -L ../.. -lYap
|
||||
|
||||
python/yap_wrap.c: $(srcdir)/yap.i
|
||||
$(SWIG) -python -outdir python -o python/yap_wrap.c -I$(srcdir)/../../include -I$(srcdir) -Wall $(srcdir)/yap.i
|
||||
|
||||
python/yap_wrap.o: python/yap_wrap.c
|
||||
$(CC) $(CFLAGS) -c python/yap_wrap.c @PYTHON_INCLUDES@ -o python/yap_wrap.o
|
||||
|
||||
python/yap.o: $(srcdir)/yap.c
|
||||
$(CC) $(CFLAGS) -c $< -o python/yap.o
|
||||
|
||||
java: java/libyap.@SO@ java/yap.java
|
||||
cd java ; $(JAVAC) *.java; $(JAR) cvf yap.jar *.class
|
||||
|
||||
java/libyap.@SO@: java/yap.o java/yap_wrap.o
|
||||
$(LD) $(LDSOFLAGS) -L ../.. -lYap -o java/libyap.@SO@ java/yap.o java/yap_wrap.o $(LIBS) @JPLLDFLAGS@ -L ../.. -lYap
|
||||
|
||||
java/yap_wrap.c: $(srcdir)/yap.i
|
||||
$(SWIG) -java -outdir java -o java/yap_wrap.c -I$(srcdir)/../../include -I$(srcdir)/../../include -I$(srcdir) -Wall $(srcdir)/yap.i
|
||||
|
||||
java/yap_wrap.o: java/yap_wrap.c
|
||||
$(CC) $(CFLAGS) -c java/yap_wrap.c @JPLCFLAGS@ -o java/yap_wrap.o
|
||||
|
||||
java/yap.o: $(srcdir)/yap.c
|
||||
$(CC) $(CFLAGS) -c $< -o java/yap.o
|
||||
|
||||
R:
|
||||
|
||||
|
||||
yap.i: $(srcdir)/../../include/YapInterface.h
|
||||
|
||||
install:
|
||||
|
||||
|
||||
clean:
|
||||
rm -f */*
|
||||
|
||||
distclean: clean
|
||||
rm -f *def Makefile
|
||||
|
||||
|
||||
##########
|
35
packages/swig/configure.in
Normal file
35
packages/swig/configure.in
Normal file
@ -0,0 +1,35 @@
|
||||
AC_ARG_WITH(swig,
|
||||
[ --with-swig[=DIR] swig interface generator],
|
||||
if test "$withval" = yes; then
|
||||
SWIG=swig
|
||||
yap_cv_swig=yes
|
||||
elif test "$withval" = no; then
|
||||
yap_cv_swig=no
|
||||
else
|
||||
SWIG=$withval
|
||||
yap_cv_swig=yes
|
||||
fi,
|
||||
[yap_cv_swig=no])
|
||||
|
||||
if test "$yap_cv_swig" = "no"; then
|
||||
SWIG_TARGET="dummy"
|
||||
PKG_SWIG=""
|
||||
elif test -e "$srcdir"/packages/swig/Makefile.in ; then
|
||||
SWIG_TARGET="all"
|
||||
PKG_SWIG="swig"
|
||||
fi
|
||||
|
||||
if test "$PKG_SWIG" != ""; then
|
||||
|
||||
mkdir -p packages/swig/python
|
||||
mkdir -p packages/swig/R
|
||||
mkdir -p packages/swig/java
|
||||
mkdir -p packages/swig/android
|
||||
|
||||
AC_SUBST(SWIG)
|
||||
AC_SUBST(SWIG_TARGET)
|
||||
AC_SUBST(PKG_SWIG)
|
||||
|
||||
AC_CONFIG_FILES([ packages/swig/Makefile ])
|
||||
fi
|
||||
|
29
packages/swig/yap.c
Normal file
29
packages/swig/yap.c
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "YAPInterface.h"
|
||||
|
||||
static void init_yap( void );
|
||||
int yap_prove_string(char *s);
|
||||
|
||||
static int yap_on;
|
||||
|
||||
int
|
||||
prove_string(char *s) {
|
||||
if (!yap_on)
|
||||
init_yap();
|
||||
if (YAP_RunGoal(YAP_MkAtomTerm(YAP_LookupAtom(s)))) {
|
||||
YAP_ShutdownGoal( TRUE );
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
init_yap( void )
|
||||
{
|
||||
if (YAP_FastInit(NULL) == YAP_BOOT_ERROR)
|
||||
exit(1);
|
||||
yap_on = TRUE;
|
||||
}
|
14
packages/swig/yap.i
Normal file
14
packages/swig/yap.i
Normal file
@ -0,0 +1,14 @@
|
||||
/* example.i */
|
||||
%module yap
|
||||
|
||||
%{
|
||||
/* Put header files here or function declarations like below */
|
||||
|
||||
#include "YapInterface.h"
|
||||
|
||||
%}
|
||||
|
||||
extern int prove_string(char *s);
|
||||
|
||||
%include "YapInterface.h"
|
||||
|
Reference in New Issue
Block a user