summaryrefslogtreecommitdiff
path: root/bindings/swig/package
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/swig/package')
-rw-r--r--bindings/swig/package/Makefile.am96
-rw-r--r--bindings/swig/package/README.cvs10
-rwxr-xr-xbindings/swig/package/autogen.sh16
-rw-r--r--bindings/swig/package/configure.ac41
-rw-r--r--bindings/swig/package/perl.m471
-rw-r--r--bindings/swig/package/php4.m433
-rw-r--r--bindings/swig/package/python.m4117
-rw-r--r--bindings/swig/package/swig.m429
-rw-r--r--bindings/swig/package/sword.m4172
-rw-r--r--bindings/swig/package/tcl.m4114
-rw-r--r--bindings/swig/package/zlib.m4111
11 files changed, 810 insertions, 0 deletions
diff --git a/bindings/swig/package/Makefile.am b/bindings/swig/package/Makefile.am
new file mode 100644
index 0000000..c8a50e3
--- /dev/null
+++ b/bindings/swig/package/Makefile.am
@@ -0,0 +1,96 @@
+EXTRA_DIST = *.i
+
+if RUNSWIG
+PERLSWIG=perlswig
+TCLSWIG=tclswig
+PYTHONSWIG=pythonswig
+PHPSWIG=phpswig
+else
+PERLSWIG=
+TCLSWIG=
+PYTHONSWIG=
+PHPSWIG=
+endif
+
+all: $(PERLBUILD) $(TCLBUILD) $(PYTHONBUILD) $(PHPBUILD)
+ echo "built"
+
+perl_make: perl_makebuild
+ cd perl && make
+
+perlswig: sword.i
+ mkdir -p perl
+ $(SWIG) -perl -c++ -shadow -o perl/Sword.cxx -I$(top_srcdir) $(SWORD_INCLUDES) $(top_srcdir)/sword.i
+
+perl_makebuild: $(PERLSWIG)
+ mkdir -p perl
+ echo "writing perl/Makefile.PL"
+ @echo "#! /usr/bin/perl" > perl/Makefile.PL
+ @echo "" >> perl/Makefile.PL
+ @echo "use ExtUtils::MakeMaker;" >> perl/Makefile.PL
+ @echo "" >> perl/Makefile.PL
+ @echo "# See lib/ExtUtils/MakeMaker.pm for details of how to influence" >> perl/Makefile.PL
+ @echo "# the contents of the Makefile that is written." >> perl/Makefile.PL
+ @echo "WriteMakefile(" >> perl/Makefile.PL
+ @echo " 'NAME' => 'Sword'," >> perl/Makefile.PL
+ @echo " 'VERSION' => '$(VERSION)'," >> perl/Makefile.PL
+ @echo " 'INC' => '$(SWORD_INCLUDES)'," >> perl/Makefile.PL
+ @echo " 'DEFINE' => '-DSWIG'," >> perl/Makefile.PL
+ @echo " 'LIBS' => '$(LIB_SWORD) -lz'," >> perl/Makefile.PL
+ @echo " 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1" >> perl/Makefile.PL
+ @echo " ($$] >= 5.005 ? ## Add these new keywords supported since 5.005" >> perl/Makefile.PL
+ @echo " (ABSTRACT => 'Sword Project perl bindings', # retrieve abstract from module" >> perl/Makefile.PL
+ @echo " AUTHOR => 'Sword Project <sword-devel@crosswire.org>') : ())," >> perl/Makefile.PL
+ @echo ");" >> perl/Makefile.PL
+ @echo "" >> perl/Makefile.PL
+ @echo "rename 'Makefile', 'Makefile.old' or die \"can't rename Makefile\";" >> perl/Makefile.PL
+ @echo "open(INPUT, '<Makefile.old') or die \"can't open input Makefile.old\";" >> perl/Makefile.PL
+ @echo "open(OUTPUT, '>Makefile') or die \"can't open output Makefile\";" >> perl/Makefile.PL
+ @echo "while (<INPUT>) {" >> perl/Makefile.PL
+ @echo " s/\-lsword/\-lsword \-lstdc\+\+/;" >> perl/Makefile.PL
+ @echo " print OUTPUT \"$$""_\";" >> perl/Makefile.PL
+ @echo "}" >> perl/Makefile.PL
+ @echo "" >> perl/Makefile.PL
+ @echo "close INPUT;" >> perl/Makefile.PL
+ @echo "close OUTPUT;" >> perl/Makefile.PL
+ cd perl && $(PERL) Makefile.PL && make clean
+ @echo "\.old" > perl/MANIFEST.SKIP
+ @echo "~$$" >> perl/MANIFEST.SKIP
+ @echo "\.bak" >> perl/MANIFEST.SKIP
+ @echo "^CVS" >> perl/MANIFEST.SKIP
+ @echo "Makefile$$" >> perl/MANIFEST.SKIP
+ cd perl && $(PERL) Makefile.PL && make manifest
+
+tclswig: sword.i
+ mkdir -p tcl
+ $(SWIG) -tcl -c++ -namespace -pkgversion $(VERSION) -o tcl/Sword.cxx -I$(top_srcdir) $(top_srcdir)/sword.i
+
+python_make: python_makebuild
+ cd python && $(PYTHON) setup.py build_ext $(SWORD_INCLUDES) $(LIB_SWORD)
+
+pythonswig: sword.i
+ mkdir -p python
+ $(SWIG) -python -c++ -shadow -o python/Sword.cxx -I$(top_srcdir) $(top_srcdir)/sword.i
+
+python_makebuild: $(PYTHONSWIG)
+ mkdir -p python
+ echo "writing python/setup.py"
+ @echo "#! /usr/bin/python" > python/setup.py
+ @echo "" >> python/setup.py
+ @echo "from distutils.core import setup, Extension" >> python/setup.py
+ @echo "setup (name = \"sword\"," >> python/setup.py
+ @echo " version = \"$(VERSION)\"," >> python/setup.py
+ @echo " maintainer = \"Sword Developers\"," >> python/setup.py
+ @echo " maintainer_email = \"sword-devel@crosswire.org\"," >> python/setup.py
+ @echo " url = \"http://www.crosswire.org/sword\"," >> python/setup.py
+ @echo " py_modules = [\"Sword\"]," >> python/setup.py
+ @echo " ext_modules = [Extension(\"sword\", [\"Sword.cxx\"]," >> python/setup.py
+ @echo " define_macros=[('SWIG',1)])], " >> python/setup.py
+ @echo ")" >> python/setup.py
+
+
+
+phpswig: sword.i
+ mkdir -p php
+ $(SWIG) -php4 -c++ -fullmake -o php/Sword.cxx -I$(top_srcdir) $(top_srcdir)/sword.i
+
diff --git a/bindings/swig/package/README.cvs b/bindings/swig/package/README.cvs
new file mode 100644
index 0000000..db24038
--- /dev/null
+++ b/bindings/swig/package/README.cvs
@@ -0,0 +1,10 @@
+README
+------
+
+To build the sword bindings for Sword you require
+
+SWIG 1.3 (see http://www.swig.org)
+one of perl, python, tcl, php
+Sword 1.5.6
+
+First run ./autogen.sh to generate this directory
diff --git a/bindings/swig/package/autogen.sh b/bindings/swig/package/autogen.sh
new file mode 100755
index 0000000..dac8704
--- /dev/null
+++ b/bindings/swig/package/autogen.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+echo "*** copying swig files"
+cp -a ../*.i .
+
+ACLOCAL="$AUTODIR""aclocal"
+echo "*** Recreating aclocal.m4"
+echo "$ACLOCAL"
+ $ACLOCAL -I .;
+
+echo "*** Recreating configure"
+AUTOCONF="$AUTODIR""autoconf"
+ $AUTOCONF;
+
+echo "*** Recreating the Makefile.in files"
+AUTOMAKE="$AUTODIR""automake"
+ $AUTOMAKE -ac --foreign;
diff --git a/bindings/swig/package/configure.ac b/bindings/swig/package/configure.ac
new file mode 100644
index 0000000..63b7a43
--- /dev/null
+++ b/bindings/swig/package/configure.ac
@@ -0,0 +1,41 @@
+# ---------------------------------------------------------------------
+# Initialisation
+# ---------------------------------------------------------------------
+AC_INIT(swordbindings, 1.5.6, sword-bugs@crosswire.org)
+AC_CONFIG_SRCDIR(sword.i)
+AC_PREREQ(2.52)
+AC_REVISION($Revision: 1.1 $)
+AM_INIT_AUTOMAKE(swordbindings,1.5.6)
+
+# ---------------------------------------------------------------------
+# Check Programs
+# ---------------------------------------------------------------------
+AC_LANG(C++)
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_INSTALL
+SW_PROG_SWIG
+
+# ---------------------------------------------------------------------
+# Check libraries
+# ---------------------------------------------------------------------
+SW_CHECK_SWORD(1.5.5.99)
+
+# ---------------------------------------------------------------------
+# Misc
+# ---------------------------------------------------------------------
+AM_MAINTAINER_MODE
+
+# ---------------------------------------------------------------------
+# Check Scripting languages
+# ---------------------------------------------------------------------
+SW_FIND_PERL
+SW_FIND_PYTHON
+SW_FIND_PHP4
+SW_FIND_TCL
+
+# ---------------------------------------------------------------------
+# Final output
+# ---------------------------------------------------------------------
+AC_CONFIG_FILES(Makefile)
+AC_OUTPUT
diff --git a/bindings/swig/package/perl.m4 b/bindings/swig/package/perl.m4
new file mode 100644
index 0000000..9add0b3
--- /dev/null
+++ b/bindings/swig/package/perl.m4
@@ -0,0 +1,71 @@
+#----------------------------------------------------------------
+# Look for Perl5
+#----------------------------------------------------------------
+
+AC_DEFUN(SW_FIND_PERL,
+[
+
+
+PERLBIN=
+PERLSWIG=
+
+AC_ARG_WITH(perl,[ --with-perl=path Set location of Perl5 executable],[ PERLBIN="$withval"], [PERLBIN=])
+
+# First figure out what the name of Perl5 is
+
+if test -z "$PERLBIN"; then
+AC_PATH_PROGS(PERL, perl perl5.6.1 perl5.6.0 perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl)
+else
+AC_PATH_PROG(PERL, perl, , $PERLBIN)
+#PERL="$PERLBIN"
+fi
+
+
+AC_MSG_CHECKING(for Perl5 header files)
+if test -n "$PERL"; then
+ PERL5DIR=`($PERL -e 'use Config; print $Config{archlib};') 2>/dev/null`
+ if test "$PERL5DIR" != ""; then
+ dirs="$PERL5DIR $PERL5DIR/CORE"
+ PERL5EXT=none
+ PERLBUILD=perl_make
+ for i in $dirs; do
+ if test -r $i/perl.h; then
+ AC_MSG_RESULT($i)
+ PERL5EXT="$i"
+ break;
+ fi
+ done
+ if test "$PERL5EXT" = none; then
+ PERL5EXT="$PERL5DIR/CORE"
+ AC_MSG_RESULT(could not locate perl.h...using $PERL5EXT)
+ fi
+
+ AC_MSG_CHECKING(for Perl5 library)
+ PERL5LIB=`($PERL -e 'use Config; $_=$Config{libperl}; s/^lib//; s/$Config{_a}$//; print $_') 2>/dev/null`
+ if test "$PERL5LIB" = "" ; then
+ AC_MSG_RESULT(not found)
+ else
+ AC_MSG_RESULT($PERL5LIB)
+ fi
+ else
+ AC_MSG_RESULT(unable to determine perl5 configuration)
+ PERL5EXT=$PERL5DIR
+ fi
+else
+ AC_MSG_RESULT(could not figure out how to run perl5)
+# PERL5EXT="/usr/local/lib/perl/archname/5.003/CORE"
+fi
+
+# Only cygwin (Windows) needs the library for dynamic linking
+case $ac_sys_system/$ac_sys_release in
+CYGWIN*) PERL5DYNAMICLINKING="-L$PERL5EXT -l$PERL5LIB";;
+*)PERL5DYNAMICLINKING="";;
+esac
+
+
+AC_SUBST(PERL5EXT)
+AC_SUBST(PERL5DYNAMICLINKING)
+AC_SUBST(PERL5LIB)
+AC_SUBST(PERLBUILD)
+
+])
diff --git a/bindings/swig/package/php4.m4 b/bindings/swig/package/php4.m4
new file mode 100644
index 0000000..d184ec2
--- /dev/null
+++ b/bindings/swig/package/php4.m4
@@ -0,0 +1,33 @@
+#-------------------------------------------------------------------------
+# Look for Php4
+#-------------------------------------------------------------------------
+
+AC_DEFUN(SW_FIND_PHP4,
+[
+
+PHP4BIN=
+
+AC_ARG_WITH(php4,[ --with-php4=path Set location of PHP4 executable],[ PHP4BIN="$withval"], [PHP4BIN=])
+
+if test -z "$PHP4BIN"; then
+AC_PATH_PROGS(PHP4, php php4)
+else
+PHP4="$PHP4BIN"
+fi
+AC_MSG_CHECKING(for PHP4 header files)
+dirs="/usr/include/php /usr/local/include/php /usr/local/apache/php /usr/include/php4 /usr/local/include/php4 /usr/local/apache/php4"
+for i in $dirs; do
+ if test -r $i/php_config.h -o -r $i/php_version.h; then
+ AC_MSG_RESULT($i)
+ PHP4EXT="$i"
+ PHP4INC="-I$PHP4EXT -I$PHP4EXT/Zend -I$PHP4EXT/main -I$PHP4EXT/TSRM"
+ break;
+ fi
+done
+if test -z "$PHP4INC"; then
+ AC_MSG_RESULT(not found)
+fi
+
+AC_SUBST(PHP4INC)
+
+])
diff --git a/bindings/swig/package/python.m4 b/bindings/swig/package/python.m4
new file mode 100644
index 0000000..a047ea4
--- /dev/null
+++ b/bindings/swig/package/python.m4
@@ -0,0 +1,117 @@
+#----------------------------------------------------------------
+# Look for Python
+#----------------------------------------------------------------
+
+AC_DEFUN(SW_FIND_PYTHON,
+[
+
+PYINCLUDE=
+PYLIB=
+PYPACKAGE=
+PYTHONBUILD=
+
+# I don't think any of this commented stuff works anymore
+
+#PYLINK="-lModules -lPython -lObjects -lParser"
+
+#AC_ARG_WITH(py,[ --with-py=path Set location of Python],[
+# PYPACKAGE="$withval"], [PYPACKAGE=])
+#AC_ARG_WITH(pyincl,[ --with-pyincl=path Set location of Python include directory],[
+# PYINCLUDE="$withval"], [PYINCLUDE=])
+#AC_ARG_WITH(pylib,[ --with-pylib=path Set location of Python library directory],[
+# PYLIB="$withval"], [PYLIB=])
+
+#if test -z "$PYINCLUDE"; then
+# if test -n "$PYPACKAGE"; then
+# PYINCLUDE="$PYPACKAGE/include"
+# fi
+#fi
+
+#if test -z "$PYLIB"; then
+# if test -n "$PYPACKAGE"; then
+# PYLIB="$PYPACKAGE/lib"
+# fi
+#fi
+
+AC_ARG_WITH(python,[ --with-python=path Set location of Python executable],[ PYBIN="$withval"], [PYBIN=])
+
+# First figure out the name of the Python executable
+
+if test -z "$PYBIN"; then
+AC_PATH_PROGS(PYTHON, $prefix/bin/python python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python1.4 python)
+else
+PYTHON="$PYBIN"
+fi
+
+if test -n "$PYTHON"; then
+ AC_MSG_CHECKING(for Python prefix)
+ PYPREFIX=`($PYTHON -c "import sys; print sys.prefix") 2>/dev/null`
+ AC_MSG_RESULT($PYPREFIX)
+ AC_MSG_CHECKING(for Python exec-prefix)
+ PYEPREFIX=`($PYTHON -c "import sys; print sys.exec_prefix") 2>/dev/null`
+ AC_MSG_RESULT($PYEPREFIX)
+
+
+ # Note: I could not think of a standard way to get the version string from different versions.
+ # This trick pulls it out of the file location for a standard library file.
+
+ AC_MSG_CHECKING(for Python version)
+
+ # Need to do this hack since autoconf replaces __file__ with the name of the configure file
+ filehack="file__"
+ PYVERSION=`($PYTHON -c "import string,operator; print operator.getitem(string.split(string.__$filehack,'/'),-2)")`
+ AC_MSG_RESULT($PYVERSION)
+
+ # Set the include directory
+
+ AC_MSG_CHECKING(for Python header files)
+ if test -r $PYPREFIX/include/$PYVERSION/Python.h; then
+ PYINCLUDE="-I$PYPREFIX/include/$PYVERSION -I$PYEPREFIX/lib/$PYVERSION/config"
+ fi
+ if test -z "$PYINCLUDE"; then
+ if test -r $PYPREFIX/include/Py/Python.h; then
+ PYINCLUDE="-I$PYPREFIX/include/Py -I$PYEPREFIX/lib/python/lib"
+ fi
+ fi
+ AC_MSG_RESULT($PYINCLUDE)
+
+ # Set the library directory blindly. This probably won't work with older versions
+ AC_MSG_CHECKING(for Python library)
+ dirs="$PYVERSION/config $PYVERSION/lib python/lib"
+ for i in $dirs; do
+ if test -d $PYEPREFIX/lib/$i; then
+ PYLIB="$PYEPREFIX/lib/$i"
+ PYTHONBUILD=python_make
+ break
+ fi
+ done
+ if test -z "$PYLIB"; then
+ AC_MSG_RESULT(Not found)
+ else
+ AC_MSG_RESULT($PYLIB)
+ fi
+
+ # Check for really old versions
+ if test -r $PYLIB/libPython.a; then
+ PYLINK="-lModules -lPython -lObjects -lParser"
+ else
+ PYLINK="-l$PYVERSION"
+ fi
+fi
+
+# Only cygwin (Windows) needs the library for dynamic linking
+case $ac_sys_system/$ac_sys_release in
+CYGWIN*) PYTHONDYNAMICLINKING="-L$PYLIB $PYLINK"
+ PYINCLUDE="-DUSE_DL_IMPORT $PYINCLUDE"
+ ;;
+*)PYTHONDYNAMICLINKING="";;
+esac
+
+
+AC_SUBST(PYINCLUDE)
+AC_SUBST(PYLIB)
+AC_SUBST(PYLINK)
+AC_SUBST(PYTHONBUILD)
+AC_SUBST(PYTHONDYNAMICLINKING)
+
+])
diff --git a/bindings/swig/package/swig.m4 b/bindings/swig/package/swig.m4
new file mode 100644
index 0000000..9ff89d7
--- /dev/null
+++ b/bindings/swig/package/swig.m4
@@ -0,0 +1,29 @@
+#----------------------------------------------------------------
+# Look for SWIG
+#----------------------------------------------------------------
+
+AC_DEFUN(SW_PROG_SWIG,
+[
+
+AC_ARG_WITH(swigbin,[ --with-swigbin=path Set location of swig executable],[ SWIGBIN="$withval"], [SWIGBIN=])
+AC_ARG_ENABLE(swig,[ --enable-swig=path Run swig to generate new source default=no],, enable_swig=no)
+
+if test -z "$SWIGBIN"; then
+AC_PATH_PROG(SWIG, swig)
+else
+AC_PATH_PROG(SWIG, swig, "not found", $SWIGBIN)
+fi
+
+runswig=true
+if test x"$SWIG"="xnot found"; then
+ runswig=false
+fi
+if test x"$enable_swig"="xno"; then
+ runswig=false
+fi
+
+AM_CONDITIONAL(RUNSWIG, test x$runswig = xtrue)
+
+#ac_cv_swigversion=``
+
+])
diff --git a/bindings/swig/package/sword.m4 b/bindings/swig/package/sword.m4
new file mode 100644
index 0000000..f22da68
--- /dev/null
+++ b/bindings/swig/package/sword.m4
@@ -0,0 +1,172 @@
+## -*- autoconf -*-
+dnl This file was created by Joachim Ansorg <jansorg@gmx.de>
+dnl It provides macord for the autoconf package to find the Sword library on your system.
+
+dnl ----------------------------------------------------------------------
+dnl Check wheter to use static linking
+dnl first parameter is the required version
+dnl second is whether to use static sword library
+dnl ----------------------------------------------------------------------
+AC_DEFUN(SW_CHECK_SWORD,
+[
+dnl AC_MSG_CHECKING([for a Sword installation])
+
+dnl The option for the configure script
+AC_ARG_WITH(sword-dir,
+[ --with-sword-dir=DIR Patch where Sword is being installed (default=/usr) ],
+[
+ ac_sword_dir=$withval
+],ac_sword_dir=/usr
+)
+
+AC_ARG_ENABLE(static-sword,
+[ --enable-static-sword Link to the static Sword library],
+ ac_static_sword="YES",
+ [ ac_static_sword="$2" ]
+)
+
+dnl try to find Sword library files
+AC_MSG_CHECKING([for Sword library files])
+AC_REQUIRE([AC_FIND_ZLIB])
+ac_sword_library_dirs="$ac_sword_dir/lib /usr/lib /usr/lib/sword /usr/local/lib /usr/local/lib/sword /usr/local/sword/lib"
+
+if test "$ac_static_sword" = "YES"; then
+ SEARCH_LIBS="libsword.a";
+else
+ SEARCH_LIBS="libsword.a libsword.so";
+fi
+
+
+AC_CACHE_VAL(ac_cv_sword_libdir, AC_FIND_FILE($SEARCH_LIBS, $ac_sword_library_dirs, ac_cv_sword_libdir))
+
+if test "$ac_cv_sword_libdir" = "NO"; then
+ AC_MSG_ERROR(SWORD library not found. Try to use configure with --with-sword-dir=/your/SWORD/path!);
+fi
+
+if test "$ac_static_sword" = "YES"; then
+ LIB_SWORD="$ac_cv_sword_libdir/libsword.a";
+else
+ LIB_SWORD="-L$ac_cv_sword_libdir -lsword";
+fi
+
+#AC_SUBST(SWORD_LIBRARY_PATH)
+AC_SUBST(LIB_SWORD)
+all_libraries="$all_libraries -L$ac_cv_sword_libdir"
+
+if test "$ac_static_sword" = "YES"; then
+ MESSAGE="static library $ac_cv_sword_libdir/libsword.a";
+else
+ MESSAGE="$ac_cv_sword_libdir";
+fi
+AC_MSG_RESULT([$MESSAGE])
+
+
+
+dnl -- try to find Swords include files --
+AC_MSG_CHECKING([for Sword include files])
+ac_sword_include_dirs="$ac_sword_dir/include/sword $ac_sword_dir/include /usr/include/sword /usr/include /usr/local/include/sword /usr/local/include /usr/local/sword/include /usr/local/sword/include/sword"
+
+AC_CACHE_VAL(ac_cv_sword_incdir, AC_FIND_FILE(swmgr.h, $ac_sword_include_dirs, ac_cv_sword_incdir))
+
+if test "$ac_cv_sword_incdir" = "NO"; then
+ AC_MSG_ERROR([The Sword include file files were not found.
+Please try to use configure with --with-sword-dir=/your/SWORD/path !
+])
+fi
+
+SWORD_INCLUDES="-I$ac_cv_sword_incdir"
+AC_SUBST(SWORD_INCLUDES)
+all_includes="$all_includes -I$ac_cv_sword_incdir"
+
+AC_MSG_RESULT([$ac_cv_sword_incdir])
+
+
+
+dnl -- check if Sword matches the minimum version --
+AC_MSG_CHECKING([if you have Sword $1 or later])
+
+AC_CACHE_VAL(ac_cv_installed_sword_version,
+[
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
+ac_LIBRARY_PATH="$LIBRARY_PATH"
+ac_cxxflags_safe="$CXXFLAGS"
+ac_ldflags_safe="$LDFLAGS"
+ac_libs_safe="$LIBS"
+
+CXXFLAGS="$CXXFLAGS -I$"
+LDFLAGS="$LDFLAGS -L$ac_cv_sword_libdir"
+LIBS="$LIB_SWORD -lz"
+LD_LIBRARY_PATH="$ac_cv_sword_libdir"
+export LD_LIBRARY_PATH
+LIBRARY_PATH=
+export LIBRARY_PATH
+
+cat > conftest.$ac_ext <<EOF
+#include <iostream.h>
+#include <swversion.h>
+using std::cout;
+using std::endl;
+using sword::SWVersion;
+
+int main(int argc, char* argv[]) {
+ if (argc != 2) {
+ cout << SWVersion::currentVersion << endl;
+ }
+ else if (argc == 2)
+ {
+ if (SWVersion(&argv[[1]]) < SWVersion::currentVersion || SWVersion(&argv[[1]]) == SWVersion::currentVersion)
+ {
+ cout << 0 << endl;
+ return 0;
+ }
+ else
+ {
+ cout << 1 << endl;
+ return 1; //version not recent enough
+ }
+ }
+ return 0;
+}
+EOF
+
+ac_link='${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+if AC_TRY_EVAL(ac_link) && test -s conftest; then
+ if test -x conftest; then
+ eval ac_cv_installed_sword_version=`./conftest 2>&5`
+ echo "configure: ac_cv_installed_sword_version=$ac_cv_installed_sword_version" >&AC_FD_CC
+ eval sword_test_returncode=`./conftest $1 2>&5`;
+ echo "configure: sword_test_returncode=$sword_test_returncode" >&AC_FD_CC
+ fi
+else
+ echo "configure: failed program was:" >&AC_FD_CC
+ cat conftest.$ac_ext >&AC_FD_CC
+fi
+
+rm -f conftest*
+CXXFLAGS="$ac_cxxflags_safe"
+LDFLAGS="$ac_ldflags_safe"
+LIBS="$ac_libs_safe"
+
+LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
+export LD_LIBRARY_PATH
+LIBRARY_PATH="$ac_LIBRARY_PATH"
+export LIBRARY_PATH
+AC_LANG_RESTORE
+])
+
+right_version="ok";
+if test "x$sword_test_returncode" = "x1"; then
+ echo "configure: changing right_version" >&AC_FD_CC
+ right_version="wrong version";
+fi;
+
+AC_MSG_RESULT([$ac_cv_installed_sword_version])
+echo "configure: right_version=$right_version" >&AC_FD_CC
+if test "x$right_version" != "xok"; then
+ AC_MSG_ERROR([Your Sword installation is not recent enough! $sword_test_returncode Please
+upgrade to version $1!]);
+fi;
+
+])
diff --git a/bindings/swig/package/tcl.m4 b/bindings/swig/package/tcl.m4
new file mode 100644
index 0000000..9b99c7f
--- /dev/null
+++ b/bindings/swig/package/tcl.m4
@@ -0,0 +1,114 @@
+#--------------------------------------------------------------------
+# Try to locate the Tcl package
+#--------------------------------------------------------------------
+
+AC_DEFUN(SW_FIND_TCL,
+[
+
+
+TCLINCLUDE=
+TCLLIB=
+TCLPACKAGE=
+#TCLSWIG=
+
+AC_ARG_WITH(tclconfig,[ --with-tclconfig=path Set location of tclConfig.sh],
+ with_tclconfig="$withval")
+AC_ARG_WITH(tcl,[ --with-tcl=path Set location of Tcl package],[
+ TCLPACKAGE="$withval"], [TCLPACKAGE=])
+AC_ARG_WITH(tclincl,[ --with-tclincl=path Set location of Tcl include directory],[
+ TCLINCLUDE="-I$withval"], [TCLINCLUDE=])
+AC_ARG_WITH(tcllib,[ --with-tcllib=path Set location of Tcl library directory],[
+ TCLLIB="-L$withval"], [TCLLIB=])
+
+AC_MSG_CHECKING([for Tcl configuration])
+# First check to see if --with-tclconfig was specified.
+if test x"${with_tclconfig}" != x ; then
+ if test -f "${with_tclconfig}/tclConfig.sh" ; then
+ TCLCONFIG=`(cd ${with_tclconfig}; pwd)`
+ else
+ AC_MSG_ERROR([${with_tcl} directory doesn't contain tclConfig.sh])
+ fi
+fi
+# check in a few common install locations
+if test x"${TCLCONFIG}" = x ; then
+ for i in `ls -d /usr/lib 2>/dev/null` \
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` ; do
+ if test -f "$i/tclConfig.sh" ; then
+ TCLCONFIG=`(cd $i; pwd)`
+ break
+ fi
+ done
+fi
+if test x"${TCLCONFIG}" = x ; then
+ AC_MSG_RESULT(no)
+else
+ AC_MSG_RESULT(found $TCLCONFIG/tclConfig.sh)
+ . $TCLCONFIG/tclConfig.sh
+ TCLINCLUDE=-I$TCL_PREFIX/include
+ TCLLIB=$TCL_LIB_SPEC
+fi
+
+if test -z "$TCLINCLUDE"; then
+ if test -n "$TCLPACKAGE"; then
+ TCLINCLUDE="-I$TCLPACKAGE/include"
+ fi
+fi
+
+if test -z "$TCLLIB"; then
+ if test -n "$TCLPACKAGE"; then
+ TCLLIB="-L$TCLPACKAGE/lib -ltcl"
+ fi
+fi
+
+AC_MSG_CHECKING(for Tcl header files)
+if test -z "$TCLINCLUDE"; then
+AC_TRY_CPP([#include <tcl.h>], , TCLINCLUDE="")
+if test -z "$TCLINCLUDE"; then
+ dirs="$prefix/include /usr/local/include /usr/include /opt/local/include"
+ for i in $dirs ; do
+ if test -r $i/tcl.h; then
+ AC_MSG_RESULT($i)
+ TCLINCLUDE="-I$i"
+ break
+ fi
+ done
+fi
+if test -z "$TCLINCLUDE"; then
+# TCLINCLUDE="-I/usr/local/include"
+ AC_MSG_RESULT(not found)
+fi
+else
+ AC_MSG_RESULT($TCLINCLUDE)
+fi
+
+AC_MSG_CHECKING(for Tcl library)
+if test -z "$TCLLIB"; then
+dirs="$prefix/lib /usr/local/lib /usr/lib /opt/local/lib"
+for i in $dirs ; do
+ if test -r $i/libtcl.a; then
+ AC_MSG_RESULT($i)
+ TCLLIB="-L$i -ltcl"
+ break
+ fi
+done
+if test -z "$TCLLIB"; then
+ AC_MSG_RESULT(not found)
+# TCLLIB="-L/usr/local/lib"
+fi
+else
+AC_MSG_RESULT($TCLLIB)
+fi
+
+# Only cygwin (Windows) needs the library for dynamic linking
+case $ac_sys_system/$ac_sys_release in
+CYGWIN*) TCLDYNAMICLINKING="$TCLLIB";;
+*)TCLDYNAMICLINKING="";;
+esac
+
+AC_SUBST(TCLINCLUDE)
+AC_SUBST(TCLLIB)
+AC_SUBST(TCLDYNAMICLINKING)
+#AC_SUBST(TCLSWIG)
+
+])
diff --git a/bindings/swig/package/zlib.m4 b/bindings/swig/package/zlib.m4
new file mode 100644
index 0000000..952e5bd
--- /dev/null
+++ b/bindings/swig/package/zlib.m4
@@ -0,0 +1,111 @@
+## -*- autoconf -*-
+
+
+AC_DEFUN(AC_FIND_ZLIB,
+[
+AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+AC_MSG_CHECKING([for libz])
+AC_CACHE_VAL(ac_cv_lib_z,
+[
+AC_LANG_C
+kde_save_LIBS="$LIBS"
+LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
+kde_save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
+AC_TRY_LINK(dnl
+[
+#include<zlib.h>
+],
+ [return (zlibVersion() == ZLIB_VERSION); ],
+ eval "ac_cv_lib_z='-lz'",
+ eval "ac_cv_lib_z=no")
+LIBS="$kde_save_LIBS"
+CFLAGS="$kde_save_CFLAGS"
+])dnl
+if test ! "$ac_cv_lib_z" = no; then
+ AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
+ LIBZ="$ac_cv_lib_z"
+ AC_SUBST(LIBZ)
+ AC_MSG_RESULT($ac_cv_lib_z)
+else
+ AC_MSG_ERROR(not found. Check your installation and look into config.log)
+ LIBZ=""
+ AC_SUBST(LIBZ)
+fi
+])
+
+AC_DEFUN(KDE_CHECK_EXTRA_LIBS,
+[
+AC_MSG_CHECKING(for extra includes)
+AC_ARG_WITH(extra-includes, [ --with-extra-includes=DIR
+ adds non standard include paths],
+ kde_use_extra_includes="$withval",
+ kde_use_extra_includes=NONE
+)
+kde_extra_includes=
+if test -n "$kde_use_extra_includes" && \
+ test "$kde_use_extra_includes" != "NONE"; then
+
+ ac_save_ifs=$IFS
+ IFS=':'
+ for dir in $kde_use_extra_includes; do
+ kde_extra_includes="$kde_extra_includes $dir"
+ USER_INCLUDES="$USER_INCLUDES -I$dir"
+ done
+ IFS=$ac_save_ifs
+ kde_use_extra_includes="added"
+else
+ kde_use_extra_includes="no"
+fi
+AC_SUBST(USER_INCLUDES)
+
+AC_MSG_RESULT($kde_use_extra_includes)
+
+kde_extra_libs=
+AC_MSG_CHECKING(for extra libs)
+AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR adds non standard library paths],
+ kde_use_extra_libs=$withval,
+ kde_use_extra_libs=NONE
+)
+if test -n "$kde_use_extra_libs" && \
+ test "$kde_use_extra_libs" != "NONE"; then
+
+ ac_save_ifs=$IFS
+ IFS=':'
+ for dir in $kde_use_extra_libs; do
+ kde_extra_libs="$kde_extra_libs $dir"
+ KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
+ USER_LDFLAGS="$USER_LDFLAGS -L$dir"
+ done
+ IFS=$ac_save_ifs
+ kde_use_extra_libs="added"
+else
+ kde_use_extra_libs="no"
+fi
+
+AC_SUBST(USER_LDFLAGS)
+
+AC_MSG_RESULT($kde_use_extra_libs)
+
+])
+
+dnl ------------------------------------------------------------------------
+dnl Find a file (or one of more files in a list of dirs)
+dnl ------------------------------------------------------------------------
+dnl
+AC_DEFUN(AC_FIND_FILE,
+[
+$3=NO
+for i in $2;
+do
+ for j in $1;
+ do
+ echo "configure: __oline__: $i/$j" >&AC_FD_CC
+ if test -r "$i/$j"; then
+ echo "taking that" >&AC_FD_CC
+ $3=$i
+ break 2
+ fi
+ done
+done
+])