compile myddas interface to sqlite

This commit is contained in:
Vítor Santos Costa 2015-03-23 07:27:10 +00:00
parent c9aa53350a
commit 4eeacd8b7b
11 changed files with 233 additions and 104 deletions

View File

@ -77,7 +77,7 @@ CPP=@CPP@
RC=@RC@ RC=@RC@
RCFLAGS=@RCFLAGS@ RCFLAGS=@RCFLAGS@
DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1 -DDESTDIR=\"$(DESTDIR)\" DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1 -DDESTDIR=\"$(DESTDIR)\"
LIBS=@LIBS@ LIBS=@LIBS@ @MYDDAS_LIBS@
DLL_LIBS=@LIBS@ @EXTRA_LIBS_FOR_DLLS@ DLL_LIBS=@LIBS@ @EXTRA_LIBS_FOR_DLLS@
LDFLAGS=@LDFLAGS@ LDFLAGS=@LDFLAGS@
EXTRAYAPLIBS=@EXTRAYAPLIBS@ EXTRAYAPLIBS=@EXTRAYAPLIBS@
@ -192,7 +192,7 @@ HEADERS = \
H/inline-only.h \ H/inline-only.h \
H/iopreds.h \ H/iopreds.h \
H/iswiatoms.h \ H/iswiatoms.h \
H/qly.h \ H/qly.h \
H/rclause.h \ H/rclause.h \
H/rglobals.h \ H/rglobals.h \
H/rlocals.h \ H/rlocals.h \
@ -208,7 +208,7 @@ H/qly.h \
H/iatoms.h H/ratoms.h H/tatoms.h \ H/iatoms.h H/ratoms.h H/tatoms.h \
CXX/yapdb.hh \ CXX/yapdb.hh \
CXX/yapi.hh \ CXX/yapi.hh \
BEAM/eam.h BEAM/eamamasm.h \ BEAM/eam.h BEAM/eamamasm.h \
OPTYap/opt.config.h \ OPTYap/opt.config.h \
OPTYap/opt.proto.h OPTYap/opt.structs.h \ OPTYap/opt.proto.h OPTYap/opt.structs.h \
OPTYap/opt.macros.h OPTYap/or.macros.h \ OPTYap/opt.macros.h OPTYap/or.macros.h \
@ -301,10 +301,10 @@ C_SOURCES= \
library/dialect/swi/fli/blobs.c \ library/dialect/swi/fli/blobs.c \
# library/mpi/mpi.c library/mpi/mpe.c \ # library/mpi/mpi.c library/mpi/mpe.c \
# library/lammpi/yap_mpi.c library/lamm1pi/hash.c library/lammpi/prologterms2c.c # library/lammpi/yap_mpi.c library/lamm1pi/hash.c library/lammpi/prologterms2c.c
CXX_SOURCES = \ CXX_SOURCES = \
CXX/yapi.cpp \ CXX/yapi.cpp \
CXX/yapi.cpp \ JIT/JIT_Compiler.cpp
JIT/JIT_Compiler.cpp
PLCONS_SOURCES = \ PLCONS_SOURCES = \
console/LGPL/pl-nt.c \ console/LGPL/pl-nt.c \
@ -401,16 +401,28 @@ ENGINE_OBJECTS = \
udi.o\ udi.o\
unify.o userpreds.o utilpreds.o \ unify.o userpreds.o utilpreds.o \
yap-args.o write.o \ yap-args.o write.o \
blobs.o swi.o ypstdio.o $(IOLIB_OBJECTS) blobs.o swi.o ypstdio.o \
$(IOLIB_OBJECTS)
JIT_OBJECTS = \ JIT_OBJECTS = \
@JITCOMPILER@ \ @JITCOMPILER@ \
@JITCONFIGPREDS@ \ @JITCONFIGPREDS@ \
@JITANALYSISPREDS@ \ @JITANALYSISPREDS@ \
@JITTRANSFORMPREDS@ \ @JITTRANSFORMPREDS@ \
@JITCODEGENPREDS@ \ @JITCODEGENPREDS@ \
@JITDEBUGPREDS@ \ @JITDEBUGPREDS@ \
@JITSTATISTICPREDS@ @JITSTATISTICPREDS@
MYDDAS_OBJECTS = \
@INCLUDE_MYDDAS@ myddas_initialization.o \
myddas_mysql.o \
myddas_odbc.o \
myddas_postgres.o \
myddas_shared.o \
myddas_sqlite3.o \
myddas_statistics.o \
myddas_util.o \
myddas_wkb2prolog.o
LIBTAI_OBJECTS = \ LIBTAI_OBJECTS = \
tai_add.o tai_now.o tai_pack.o \ tai_add.o tai_now.o tai_pack.o \
@ -439,7 +451,11 @@ BEAM_OBJECTS = \
STATIC_OBJECTS = \ STATIC_OBJECTS = \
@STATIC_MODE@sys.o yap_random.o regexp.o @NO_BUILTIN_REGEXP@ regcomp.o regerror.o regfree.o regexec.o @STATIC_MODE@sys.o yap_random.o regexp.o @NO_BUILTIN_REGEXP@ regcomp.o regerror.o regfree.o regexec.o
LIB_OBJECTS = $(ENGINE_OBJECTS) $(C_INTERFACE_OBJECTS) $(OR_OBJECTS) $(BEAM_OBJECTS) $(STATIC_OBJECTS) $(LIBTAI_OBJECTS) $(JIT_OBJECTS) LIB_OBJECTS = $(ENGINE_OBJECTS) \
$(C_INTERFACE_OBJECTS) $(OR_OBJECTS) \
$(BEAM_OBJECTS) $(STATIC_OBJECTS) \
$(LIBTAI_OBJECTS) $(JIT_OBJECTS) \
$(MYDDAS_OBJECTS)
OBJECTS = yap.o yapi.o $(LIB_OBJECTS) OBJECTS = yap.o yapi.o $(LIB_OBJECTS)
@ -482,6 +498,9 @@ save.o: C/save.c
%.o: C/%.c config.h %.o: C/%.c config.h
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
%.o: packages/myddas/%.c config.h
$(CC) -c $(CFLAGS) @MYDDAS_CPPFLAGS@ $< -o $@
%.o: OPTYap/%.c config.h %.o: OPTYap/%.c config.h
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
@ -544,7 +563,7 @@ c_interface.i: C/c_interface.c include/c_interface.h
$(CC) -E $(C_INTERF_FLAGS) C/c_interface.c > $@ $(CC) -E $(C_INTERF_FLAGS) C/c_interface.c > $@
# #
INSTALLED_PACKAGES= \ lINSTALLED_PACKAGES= \
library/matrix \ library/matrix \
library/random \ library/random \
library/regex \ library/regex \
@ -607,7 +626,7 @@ yapwin: yap-win@EXEC_SUFFIX@
yap-win@EXEC_SUFFIX@: $(PLCONS_OBJECTS) $(HEADERS) @YAPLIB@ yap-win@EXEC_SUFFIX@: $(PLCONS_OBJECTS) $(HEADERS) @YAPLIB@
$(MAKE) -C swi/console $(MAKE) -C swi/console
$(MPI_CC) -municode -DUNICODE -D_UNICODE $(EXECUTABLE_CFLAGS) $(LDFLAGS) -Wl,-subsystem,windows -o yap-win@EXEC_SUFFIX@ $(PLCONS_OBJECTS) plterm.dll @YAPLIB@ $(LIBS) -lgdi32 @MPILDF@ $(MPI_CC) -municode -DUNICODE -D_UNICODE $(EXECUTABLE_CFLAGS) $(LDFLAGS) -Wl,-subsystem,windows -o yap-win@EXEC_SUFFIX@ $(PLCONS_OBJECTS) plterm.dll @YAPLIB@ $(LIBS) @MYDDAS_LIBS@ -lgdi32 @MPILDF@
libYap.a: $(LIB_OBJECTS) yapi.o libYap.a: $(LIB_OBJECTS) yapi.o
-rm -f libYap.a -rm -f libYap.a
@ -637,6 +656,7 @@ libYap.a: $(LIB_OBJECTS) yapi.o
adb shell $(LN_S) /data/yap/@DYNYAPLIB@ /data/yap/$$p; \ adb shell $(LN_S) /data/yap/@DYNYAPLIB@ /data/yap/$$p; \
done done
adb push $(GMPDIR)/lib/libgmp.so /data/yap adb push $(GMPDIR)/lib/libgmp.so /data/yap
adb push $(SQLITE3DIR)/lib/libsqliteX.so /data/yap
#adb push packages/clib/*.so /data/yap #adb push packages/clib/*.so /data/yap
#adb push library/system/*.so /data/yap #adb push library/system/*.so /data/yap
adb push $(srcdir)/swi/library /data/yap/swi/library adb push $(srcdir)/swi/library /data/yap/swi/library

172
configure vendored
View File

@ -726,6 +726,7 @@ JITFLAGS
LLVM_CONFIG LLVM_CONFIG
MYDDAS_LIBS MYDDAS_LIBS
MYDDAS_CPPFLAGS MYDDAS_CPPFLAGS
INCLUDE_MYDDAS
PKG_MYDDAS PKG_MYDDAS
EXTRA_LIBS_FOR_SWIDLLS EXTRA_LIBS_FOR_SWIDLLS
CLIB_PTHREADS CLIB_PTHREADS
@ -10755,6 +10756,7 @@ done
fi fi
#from SWI PROSQLITE library. #from SWI PROSQLITE library.
havelib=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_open in -lsqlite3" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_open in -lsqlite3" >&5
$as_echo_n "checking for sqlite3_open in -lsqlite3... " >&6; } $as_echo_n "checking for sqlite3_open in -lsqlite3... " >&6; }
if ${ac_cv_lib_sqlite3_sqlite3_open+:} false; then : if ${ac_cv_lib_sqlite3_sqlite3_open+:} false; then :
@ -10796,9 +10798,56 @@ if test "x$ac_cv_lib_sqlite3_sqlite3_open" = xyes; then :
havelib=yes havelib=yes
fi fi
if test "$havelib" = no
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_open in -lsqliteX" >&5
$as_echo_n "checking for sqlite3_open in -lsqliteX... " >&6; }
if ${ac_cv_lib_sqliteX_sqlite3_open+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsqliteX $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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 sqlite3_open ();
int
main ()
{
return sqlite3_open ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_sqliteX_sqlite3_open=yes
else
ac_cv_lib_sqliteX_sqlite3_open=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sqliteX_sqlite3_open" >&5
$as_echo "$ac_cv_lib_sqliteX_sqlite3_open" >&6; }
if test "x$ac_cv_lib_sqliteX_sqlite3_open" = xyes; then :
# android
LIBS="-lsqliteX $LIBS"
havelib=yes
fi
for ac_header in sqlite3.h fi
if test "$havelib" = no
then
yap_cv_sqlite3=no
else
for ac_header in sqlite3.h
do : do :
ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
if test "x$ac_cv_header_sqlite3_h" = xyes; then : if test "x$ac_cv_header_sqlite3_h" = xyes; then :
@ -10812,12 +10861,14 @@ fi
done done
fi
if test "$yap_cv_sqlite3" != no if test "$yap_cv_sqlite3" != no
then then
use_myddas=true use_myddas=true
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_SQLITE3" YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_SQLITE3"
fi fi
havelib=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PQconnectdbParams in -lpq" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PQconnectdbParams in -lpq" >&5
$as_echo_n "checking for PQconnectdbParams in -lpq... " >&6; } $as_echo_n "checking for PQconnectdbParams in -lpq... " >&6; }
if ${ac_cv_lib_pq_PQconnectdbParams+:} false; then : if ${ac_cv_lib_pq_PQconnectdbParams+:} false; then :
@ -10903,6 +10954,14 @@ else
ENABLE_MYDDAS="" ENABLE_MYDDAS=""
fi fi
INCLUDE_MYDDAS="#"
if test x"$ENABLE_MYDDAS" = x -a x"$STARTUP_ANDROID" = x
then
#in Android we have to actually include myddas in the binary
INCLUDE_MYDDAS=""
fi
@ -12071,7 +12130,69 @@ fi
fi fi
dl to be installed in various places.
# brew in OSX
if test -d /usr/local/opt/ossp-uuid; then
CPPFLAGS="$CPPFLAGS -I /usr/local/opt/ossp-uuid/include"
UUID_LIB_PATH="-L /usr/local/opt/ossp-uuid/lib"
fi
# /opt
if test -d /opt/include/ossp; then
CPPFLAGS="$CPPFLAGS -I /opt/include"
UUID_LIB_PATH="-L /opt/lib"
fi
# /usr/local
if test -d /opt/include/ossp; then
CPPFLAGS="$CPPFLAGS -I /opt/include"
UUID_LIB_PATH="-L /opt/lib"
fi
if test x"$UUID_H" = "x"; then
ac_fn_c_check_header_compile "$LINENO" "ossp/uuid.h" "ac_cv_header_ossp_uuid_h" "/*first*/
"
if test "x$ac_cv_header_ossp_uuid_h" = xyes; then :
UUID_H=ossp/uuid.h
has_uuid=true
fi
fi
if test x"$UUID_H" = "x" -a ! -d /usr/include/uuid; then
ac_fn_c_check_header_compile "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "/*first*/
"
if test "x$ac_cv_header_uuid_uuid_h" = xyes; then :
UUID_H=uuid/uuid.h
has_uuid=true
fi
fi
if test x"$UUID_H" = "x"; then
ac_fn_c_check_header_compile "$LINENO" "uuid.h" "ac_cv_header_uuid_h" "/*first*/
"
if test "x$ac_cv_header_uuid_h" = xyes; then :
UUID_H=uuid.h
has_uuid=true
fi
fi
if test x"$UUID_H" = "x"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find uuid.h -- dropping uuid.pl" >&5
$as_echo "$as_me: WARNING: Cannot find uuid.h -- dropping uuid.pl" >&2;}
else
cat >>confdefs.h <<_ACEOF
#define UUID_H <$UUID_H>
_ACEOF
has_uuid=true
fi
if test x"$has_uuid" != "x"; then
ac_fn_c_check_func "$LINENO" "uuid_create" "ac_cv_func_uuid_create" ac_fn_c_check_func "$LINENO" "uuid_create" "ac_cv_func_uuid_create"
if test "x$ac_cv_func_uuid_create" = xyes; then : if test "x$ac_cv_func_uuid_create" = xyes; then :
has_uuid=true has_uuid=true
@ -12115,7 +12236,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_create" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_create" >&5
$as_echo "$ac_cv_lib_uuid_uuid_create" >&6; } $as_echo "$ac_cv_lib_uuid_uuid_create" >&6; }
if test "x$ac_cv_lib_uuid_uuid_create" = xyes; then : if test "x$ac_cv_lib_uuid_uuid_create" = xyes; then :
CLIB_LIBUUID=-luuid CLIB_LIBUUID="$UUID_LIB_PATH -luuid"
has_uuid=true has_uuid=true
fi fi
@ -12129,45 +12250,6 @@ $as_echo "$as_me: WARNING: Cannot find libossp-uuid or libuuid -- dropping uuid
fi fi
if test x"$has_uuid" != "x"; then
if test x"$UUID_H" = "x"; then
ac_fn_c_check_header_compile "$LINENO" "ossp/uuid.h" "ac_cv_header_ossp_uuid_h" "/*first*/
"
if test "x$ac_cv_header_ossp_uuid_h" = xyes; then :
UUID_H=ossp/uuid.h
fi
fi
if test x"$UUID_H" = "x" -a ! -d /usr/include/uuid; then
ac_fn_c_check_header_compile "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "/*first*/
"
if test "x$ac_cv_header_uuid_uuid_h" = xyes; then :
UUID_H=uuid/uuid.h
fi
fi
if test x"$UUID_H" = "x"; then
ac_fn_c_check_header_compile "$LINENO" "uuid.h" "ac_cv_header_uuid_h" "/*first*/
"
if test "x$ac_cv_header_uuid_h" = xyes; then :
UUID_H=uuid.h
fi
fi
if test x"$UUID_H" = "x"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find uuid.h -- dropping uuid.pl" >&5
$as_echo "$as_me: WARNING: Cannot find uuid.h -- dropping uuid.pl" >&2;}
else
cat >>confdefs.h <<_ACEOF
#define UUID_H <$UUID_H>
_ACEOF
CLIB_TARGETS="$CLIB_TARGETS uuid.$SO"
fi
fi fi
@ -14409,7 +14491,7 @@ else
JAVA_TEST=Test.java JAVA_TEST=Test.java
CLASS_TEST=Test.class CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST cat << \EOF > $JAVA_TEST
/* #line 14412 "configure" */ /* #line 14494 "configure" */
public class Test { public class Test {
} }
EOF EOF
@ -14585,7 +14667,7 @@ EOF
if uudecode$EXEEXT Test.uue; then if uudecode$EXEEXT Test.uue; then
ac_cv_prog_uudecode_base64=yes ac_cv_prog_uudecode_base64=yes
else else
echo "configure: 14588: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 echo "configure: 14670: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: failed file was:" >&5 echo "configure: failed file was:" >&5
cat Test.uue >&5 cat Test.uue >&5
ac_cv_prog_uudecode_base64=no ac_cv_prog_uudecode_base64=no
@ -14716,7 +14798,7 @@ else
JAVA_TEST=Test.java JAVA_TEST=Test.java
CLASS_TEST=Test.class CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST cat << \EOF > $JAVA_TEST
/* #line 14719 "configure" */ /* #line 14801 "configure" */
public class Test { public class Test {
} }
EOF EOF
@ -14751,7 +14833,7 @@ JAVA_TEST=Test.java
CLASS_TEST=Test.class CLASS_TEST=Test.class
TEST=Test TEST=Test
cat << \EOF > $JAVA_TEST cat << \EOF > $JAVA_TEST
/* [#]line 14754 "configure" */ /* [#]line 14836 "configure" */
public class Test { public class Test {
public static void main (String args[]) { public static void main (String args[]) {
System.exit (0); System.exit (0);

View File

@ -7,6 +7,7 @@
# SDK_ROOT: where is the SDK # SDK_ROOT: where is the SDK
# NDK_ROOT: and the NDK # NDK_ROOT: and the NDK
# GMPDIR: get your copy of GMP from # GMPDIR: get your copy of GMP from
# SQLite3DIr: a pre-compiled version of sqlite3
# BUILDDROID: where we want to compile yap # BUILDDROID: where we want to compile yap
@ -73,7 +74,7 @@ fi
# This one is used to build myddas # This one is used to build myddas
if test -d /scratch if test -d /scratch
then then
export SQLITE3DIR=/scratch/vitor/sqlite3-android export SQLITE3DIR=/scratch/vitor/sqlite3-android
else else
export SQLITE3DIR="$HOME"/Yap/sqlite3-android export SQLITE3DIR="$HOME"/Yap/sqlite3-android
fi fi
@ -155,16 +156,18 @@ else
startemulator startemulator
rm -rf "$BUILDDROID"/* rm -rf "$BUILDDROID"/*
cd "$BUILDDROID" cd "$BUILDDROID"
export HOST="$ANDROID_ARCH"-linux-androideabi
export CPP="$HOST"-cpp
"$YAP_SRC"/configure \ "$YAP_SRC"/configure \
--host="$ANDROID_ARCH"-linux-androideabi \ --host="$HOST" \
--prefix=`pwd` \ --prefix=`pwd` \
--enable-low-level-tracer \ --enable-low-level-tracer \
--enable-debug-yap \ --enable-debug-yap \
--enable-dynamic-loading \ --enable-dynamic-loading \
--with-swig \ --with-swig \
--with-gmp=$GMPDIR \ --with-gmp=$GMPDIR \
--with-sqlite3=$SQLITE3DIR \ --with-sqlite3=$SQLITE3DIR \
--with-chr=no #--enable-threads --enable-chr=yes #--enable-threads
make depend make depend
make -j install make -j install
fi fi

View File

@ -39,7 +39,7 @@ CWD=$(PWD)
# #
MYDDAS_HEADERS= \ MYDDAS_HEADERS= \
$(srcdir)/myddas.h $(srcdir)/myddas_structs.h \ $(srcdir)/myddas.h $(srcdir)/myddas_structs.h \
$(srcdir)/myddas_statistics.h \ $(srcdir)/myddas_statistics.h \
$(srcdir)/myddas_statistics_structs.h \ $(srcdir)/myddas_statistics_structs.h \
$(srcdir)/myddas_wkb.h $(srcdir)/myddas_wkb2prolog.h $(srcdir)/myddas_wkb.h $(srcdir)/myddas_wkb2prolog.h
@ -49,7 +49,7 @@ MYDDAS_SOURCES= \
myddas_odbc.c \ myddas_odbc.c \
myddas_postgres.c \ myddas_postgres.c \
myddas_sqlite3.c \ myddas_sqlite3.c \
myddas_util.c \ myddas_util.c \
myddas_initialization.c \ myddas_initialization.c \
myddas_shared.c \ myddas_shared.c \
myddas_statistics.c \ myddas_statistics.c \
@ -71,8 +71,7 @@ MYDDAS_PROLOG= \
OBJS= $(MYDDAS_SOURCES:.c=.o) OBJS= $(MYDDAS_SOURCES:.c=.o)
MYDDAS_YAP= $(MYDDAS_PROLOG:.ypp=.yap) MYDDAS_YAP= $(MYDDAS_PROLOG:.ypp=.yap)
SOBJS= myddas.@SO@ SOBJS= libmyddas.@SO@
#in some systems we just create a single object, in others we need to #in some systems we just create a single object, in others we need to
# create a libray # create a libray
@ -85,10 +84,10 @@ all: $(SOBJS) $(MYDDAS_YAP)
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
%.yap: $(srcdir)/pl/%.ypp %.yap: $(srcdir)/pl/%.ypp
cpp $(YAP_EXTRAS) -P -E -w $< -o $@ $(CPP) $(YAP_EXTRAS) -P -w $< -o $@
@DO_SECOND_LD@%.@SO@: $(OBJS) @DO_SECOND_LD@%.@SO@: $(OBJS)
@DO_SECOND_LD@ @SHLIB_LD@ $(LDFLAGS) -o $@ $(OBJS) @EXTRA_LIBS_FOR_DLLS@ @MYDDAS_LIBS@ @DO_SECOND_LD@ @SHLIB_LD@ $(LDFLAGS) -o $@ $(OBJS) @EXTRA_LIBS_FOR_DLLS@ @MYDDAS_LIBS@
install: all install_myddas install-examples install: all install_myddas install-examples
mkdir -p $(DESTDIR)$(SHAREDIR) mkdir -p $(DESTDIR)$(SHAREDIR)
@ -99,11 +98,11 @@ install-examples:
install_myddas: install_myddas:
count=`echo "$(YAP_EXTRAS)" | grep MYDDAS | wc -l`; \ count=`echo "$(YAP_EXTRAS)" | grep MYDDAS | wc -l`; \
if [ $$count -ne 0 ]; then \ if [ $$count -ne 0 ]; then \
mkdir -p $(DESTDIR)$(SHAREDIR); \ mkdir -p $(DESTDIR)$(SHAREDIR); \
for p in $(MYDDAS_PROLOG); \ for p in $(MYDDAS_PROLOG); \
do name=`basename $$p .ypp`; echo $$name;\ do name=`basename $$p .ypp`; echo $$name;\
$(INSTALL_DATA) $$name.yap $(DESTDIR)$(SHAREDIR); \ $(INSTALL_DATA) $$name.yap $(DESTDIR)$(SHAREDIR); \
done; \ done; \
fi fi
clean: clean:

View File

@ -138,18 +138,29 @@ then
fi fi
#from SWI PROSQLITE library. #from SWI PROSQLITE library.
havelib=no
AC_CHECK_LIB(sqlite3, sqlite3_open, AC_CHECK_LIB(sqlite3, sqlite3_open,
LIBS="-lsqlite3 $LIBS" LIBS="-lsqlite3 $LIBS"
havelib=yes) havelib=yes)
if test "$havelib" = no
then
AC_CHECK_HEADERS(sqlite3.h, [], [yap_cv_sqlite3="no"]) AC_CHECK_LIB(sqliteX, sqlite3_open, # android
LIBS="-lsqliteX $LIBS"
havelib=yes)
fi
if test "$havelib" = no
then
yap_cv_sqlite3=no
else
AC_CHECK_HEADERS(sqlite3.h, [], [yap_cv_sqlite3="no"])
fi
if test "$yap_cv_sqlite3" != no if test "$yap_cv_sqlite3" != no
then then
use_myddas=true use_myddas=true
YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_SQLITE3" YAP_EXTRAS="$YAP_EXTRAS -DMYDDAS_SQLITE3"
fi fi
havelib=no
AC_CHECK_LIB(pq, PQconnectdbParams, AC_CHECK_LIB(pq, PQconnectdbParams,
LIBS="-lpq $LIBS" LIBS="-lpq $LIBS"
havelib=yes) havelib=yes)
@ -184,6 +195,14 @@ else
ENABLE_MYDDAS="" ENABLE_MYDDAS=""
fi fi
INCLUDE_MYDDAS="#"
if test x"$ENABLE_MYDDAS" = x -a x"$STARTUP_ANDROID" = x
then
#in Android we have to actually include myddas in the binary
INCLUDE_MYDDAS=""
fi
AC_SUBST(PKG_MYDDAS) AC_SUBST(PKG_MYDDAS)
AC_SUBST(INCLUDE_MYDDAS)
AC_SUBST(MYDDAS_CPPFLAGS) AC_SUBST(MYDDAS_CPPFLAGS)
AC_SUBST(MYDDAS_LIBS) AC_SUBST(MYDDAS_LIBS)

View File

@ -17,7 +17,7 @@
#if 1 //USE_MYDDAS #if 1 //USE_MYDDAS
:- load_foreign_files([myddas], [], init_myddas). :- load_foreign_files([libmyddas], [], init_myddas).
/* Initialize MYDDAS GLOBAL STRUCTURES */ /* Initialize MYDDAS GLOBAL STRUCTURES */
:- c_db_initialize_myddas. :- c_db_initialize_myddas.

View File

@ -23,7 +23,7 @@ include $(CLEAR_VARS)
NDK_TOOLCHAIN_VERSION := @GCC_VERSION@ NDK_TOOLCHAIN_VERSION := @GCC_VERSION@
LOCAL_LDLIBS := -landroid -llog LOCAL_LDLIBS := -landroid -llog
LOCAL_MODULE := example LOCAL_MODULE := example
LOCAL_SHARED_LIBRARIES := yap0 yap1 sqliteX LOCAL_SHARED_LIBRARIES := yap0 yap1 sqliteX yap2
LOCAL_STATIC_LIBRARIES := @abs_top_builddir@/libYap.ar LOCAL_STATIC_LIBRARIES := @abs_top_builddir@/libYap.ar
LOCAL_SRC_FILES += @abs_top_builddir@/packages/swig/android/jni/yap_wrap.cpp LOCAL_SRC_FILES += @abs_top_builddir@/packages/swig/android/jni/yap_wrap.cpp
LOCAL_SRC_FILES += @srcdir@/../prosqlite/c/prosqlite.c LOCAL_SRC_FILES += @srcdir@/../prosqlite/c/prosqlite.c

View File

@ -89,19 +89,20 @@ JavaYap-debug.apk: android/libs/armeabi/libexample.so
android/libs/armeabi/libexample.so: android/jni/Android.mk android/jni/Application.mk android/jni/yap_wrap.cpp android/libs/armeabi/libexample.so: android/jni/Android.mk android/jni/Application.mk android/jni/yap_wrap.cpp
( cd android/jni && NDK_DEBUG=1 ndk-build ) ( cd android/jni && NDK_DEBUG=1 ndk-build )
cp -r $(YAP_EXPORT_PLS)/* android/assets/share/Yap
cp -r $(YAP_EXPORT_DLLS)/*.so android/jni
cp -r $(YAP_EXPORT_SAVED_STATE) android/assets/lib/Yap
android/jni/Application.mk: android/jni/Android.mk android/jni/Application.mk: android/jni/Android.mk
cp $(srcdir)/android/jni/Application.mk android/jni cp $(srcdir)/android/jni/Application.mk android/jni
android/jni/Android.mk: android/AndroidManifest.xml android/jni/Android.mk: android/AndroidManifest.xml
cp Android.mk android/jni
cp $(srcdir)/android/JavaYap.java android/src/pt/up/fc/dcc/yap cp $(srcdir)/android/JavaYap.java android/src/pt/up/fc/dcc/yap
cp $(srcdir)/android/main.xml android/res/layout cp $(srcdir)/android/main.xml android/res/layout
cp -r $(YAP_EXPORT_PLS)/* android/assets/share/Yap
cp -r $(YAP_EXPORT_DLLS)/*.so android/jni
cp -r $(YAP_EXPORT_SAVED_STATE) android/assets/lib/Yap
cp -r $(JNI_SQLITE) android/jni cp -r $(JNI_SQLITE) android/jni
cp -r $(JAVA_SQLITE) android/src cp -r $(JAVA_SQLITE) android/src
cp Android.mk android/jni
android/AndroidManifest.xml: $(ANDROID_PKG) android/AndroidManifest.xml: $(ANDROID_PKG)
android create project --target $(ANDROID_TARGET) --name JavaYap --path ./android --activity JavaYap --package pt.up.fc.dcc.yap android create project --target $(ANDROID_TARGET) --name JavaYap --path ./android --activity JavaYap --package pt.up.fc.dcc.yap

View File

@ -70,7 +70,7 @@ public class JavaYap extends Activity
{ {
// check if at initial query // check if at initial query
if (!running) { if (!running) {
q = eng.query( str ); q = eng.query( str );
// get the uninstantiated query variables. // get the uninstantiated query variables.
vs0 = q.namedVars(); vs0 = q.namedVars();
running = true; running = true;
@ -169,7 +169,7 @@ public class JavaYap extends Activity
} }
eng.setYAPCallback(callback); eng.setYAPCallback(callback);
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
Log.i(TAG, "callback done"); Log.i(TAG, "callback done");
} }
} }
@ -181,8 +181,13 @@ public class JavaYap extends Activity
// Ensure scroll to end of text // Ensure scroll to end of text
scroller.post(new Runnable() { scroller.post(new Runnable() {
public void run() { public void run() {
scroller.fullScroll(ScrollView.FOCUS_DOWN); scroller.fullScroll(ScrollView.FOCUS_DOWN);
text.setText(""); if (running) {
q.close();
q = null;
}
running = false;
text.setText("");
} }
}); });
} }
@ -214,7 +219,7 @@ public class JavaYap extends Activity
public void run() { public void run() {
scroller.fullScroll(ScrollView.FOCUS_DOWN); scroller.fullScroll(ScrollView.FOCUS_DOWN);
str = text.getText().toString(); str = text.getText().toString();
outputText.append("?- " + str+"\n\n"); outputText.append("?- " + str + "\n\n");
Log.i(TAG, "onAllButtonClick "+str + "\n"); Log.i(TAG, "onAllButtonClick "+str + "\n");
runQuery(str, true); runQuery(str, true);
} }

View File

@ -7,6 +7,7 @@ include $(CLEAR_VARS)
LOCAL_CFLAGS += -DHAVE_CONFIG_H -DKHTML_NO_EXCEPTIONS -DGKWQ_NO_JAVA LOCAL_CFLAGS += -DHAVE_CONFIG_H -DKHTML_NO_EXCEPTIONS -DGKWQ_NO_JAVA
LOCAL_CFLAGS += -DNO_SUPPORT_JS_BINDING -DQT_NO_WHEELEVENT -DKHTML_NO_XBL LOCAL_CFLAGS += -DNO_SUPPORT_JS_BINDING -DQT_NO_WHEELEVENT -DKHTML_NO_XBL
LOCAL_CFLAGS += -DSQLITE_ENABLE_COLUMN_METADATA
LOCAL_CFLAGS += -U__APPLE__ LOCAL_CFLAGS += -U__APPLE__
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-int-to-pointer-cast LOCAL_CFLAGS += -Wno-unused-parameter -Wno-int-to-pointer-cast
LOCAL_CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses LOCAL_CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses
@ -34,4 +35,3 @@ LOCAL_MODULE:= libsqliteX
LOCAL_LDLIBS += -ldl -llog LOCAL_LDLIBS += -ldl -llog
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)