Mercurial > hg > audiodb
changeset 584:e3790284fd4a
Merged through librdf storage hooks and apache2 module.
Squashed commit of the following:
commit a6cfca8f04036e12e7d7fcd55c47224e802582f0
Author: Michael Jewell <mjewell@harrison.(none)>
Date: Fri Jul 31 15:23:32 2009 +0100
Removed leftover bits and bobs.
commit f1f0dd074d0767de3e24ba636779fd8701d73d9e
Author: Michael Jewell <mjewell@harrison.(none)>
Date: Fri Jul 31 15:07:20 2009 +0100
Simple test of database creation via librdf.
commit 90e6350538e004d8785137e5ff2ac878c22a5d42
Author: Michael Jewell <mjewell@harrison.(none)>
Date: Fri Jul 31 15:05:10 2009 +0100
Added the apache2 module which will hook into the librdf storage module
commit c75bf53763b7078c83ae97fcf247da2576baa79a
Author: Michael Jewell <mjewell@harrison.(none)>
Date: Fri Jul 31 15:04:53 2009 +0100
Added sparql librdf source - requires the librdf sources to compile.
commit 0646f0190112a73ddb2533537e2cc9832c066b52
Author: Michael Jewell <mjewell@harrison.(none)>
Date: Mon Jul 27 12:12:26 2009 +0100
Adding execution to mod_audiodb
commit 8f83f27ba4d917278bca0c7cb665d930e28c86df
Author: Michael Jewell <mjewell@harrison.(none)>
Date: Wed Jul 22 12:15:57 2009 +0100
Some initial returns for the sparql handler.
commit dc639aed11943a5b0c379eb47cf293f76908b1b7
Author: Michael Jewell <mjewell@harrison.(none)>
Date: Wed Jul 22 12:06:20 2009 +0100
Added a little setup.sh script to do libtoolize/autoconf etc.
commit 3a679da499db647fc82cf2797daeb5cc44ed7655
Author: Michael Jewell <mjewell@harrison.(none)>
Date: Wed Jul 22 12:03:42 2009 +0100
Adding initial bits for apache mod
author | mas01mj |
---|---|
date | Fri, 31 Jul 2009 14:36:12 +0000 |
parents | 46673db7c6a4 |
children | 5098bd155c39 |
files | sparql/librdf/AUTHORS sparql/librdf/ChangeLog sparql/librdf/Makefile.am sparql/librdf/NEWS sparql/librdf/README sparql/librdf/autogen.sh sparql/librdf/configure.ac sparql/librdf/src/Makefile.am sparql/librdf/src/rdf_storage_audiodb.c sparql/mod_audiodb/AUTHORS sparql/mod_audiodb/ChangeLog sparql/mod_audiodb/Makefile.am sparql/mod_audiodb/NEWS sparql/mod_audiodb/README sparql/mod_audiodb/autogen.sh sparql/mod_audiodb/configure.ac sparql/mod_audiodb/mod_audiodb.c sparql/mod_audiodb/mod_audiodb.h sparql/tests/storage_test.c |
diffstat | 10 files changed, 2341 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sparql/librdf/Makefile.am Fri Jul 31 14:36:12 2009 +0000 @@ -0,0 +1,3 @@ +SUBDIRS=$(subdirs) src + +@SET_MAKE@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sparql/librdf/autogen.sh Fri Jul 31 14:36:12 2009 +0000 @@ -0,0 +1,346 @@ +#!/bin/sh +# +# autogen.sh - Generates initial makefiles from a pristine CVS tree +# +# USAGE: +# autogen.sh [configure options] +# +# Configuration is affected by environment variables as follows: +# +# DRYRUN +# If set to any value it will do no configuring but will emit the +# programs that would be run. +# e.g. DRYRUN=1 ./autogen.sh +# +# AUTOMAKE ACLOCAL AUTOCONF AUTOHEADER LIBTOOLIZE GTKDOCIZE +# If set (named after program) then this overrides any searching for +# the programs on the current PATH. +# e.g. AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ./autogen.sh +# +# CONFIG_DIR (default ../config) +# The directory where fresh GNU config.guess and config.sub can be +# found for automatic copying in-place. +# +# PATH +# Where the programs are searched for +# +# SRCDIR (default .) +# Source directory +# +# This script is based on similar scripts used in various tools +# commonly made available via CVS and used with GNU automake. +# Try 'locate autogen.sh' on your system and see what you get. +# +# This script is in the public domain +# + +# Directory for the sources +SRCDIR=${SRCDIR-.} + +# Where the GNU config.sub, config.guess might be found +CONFIG_DIR=${CONFIG_DIR-../config} + +# The programs required for configuring which will be searched for +# in the current PATH. +# Set an envariable of the same name in uppercase, to override scan +# +programs="automake aclocal autoconf autoheader libtoolize" +confs=`find . -name configure.ac -print` +if grep "^GTK_DOC_CHECK" $confs >/dev/null; then + programs="$programs gtkdocize" +fi +if grep "^AC_CHECK_PROGS.SWIG" $confs >/dev/null; then + programs="$programs swig" +fi +ltdl= +if grep "^LTDL_INIT" $confs >/dev/null; then + ltdl="--ltdl" +fi + +# Some dependencies for autotools: +# automake 1.10 requires autoconf 2.60 +# automake 1.9 requires autoconf 2.58 +# automake 1.8 requires autoconf 2.58 +# automake 1.7 requires autoconf 2.54 +automake_min_vers=010700 +aclocal_min_vers=$automake_min_vers +autoconf_min_vers=025400 +autoheader_min_vers=$autoconf_min_vers +libtoolize_min_vers=020200 +gtkdocize_min_vers=010300 +swig_min_vers=010324 + +# Default program arguments +automake_args="--add-missing" +autoconf_args= +libtoolize_args="$ltdl --force --copy --automake" +gtkdocize_args="--copy" +aclocal_args= +automake_args="--gnu --add-missing --force --copy" +# --enable-gtk-doc does no harm if it's not available +configure_args="--enable-maintainer-mode --enable-gtk-doc" + + +# You should not need to edit below here +###################################################################### + + +# number comparisons may need a C locale +LANG=C +LC_NUMERIC=C + + +program=`basename $0` + +if test "X$DRYRUN" != X; then + DRYRUN=echo +fi + +cat > autogen-get-version.pl <<EOF +use File::Basename; +my \$prog=basename \$0; +die "\$prog: USAGE PATH PROGRAM-NAME\n e.g. \$prog /usr/bin/foo-123 foo\n" + unless @ARGV==2; + +my(\$path,\$name)=@ARGV; +exit 0 if !-f \$path; +die "\$prog: \$path not found\n" if !-r \$path; + +my \$mname=\$name; \$mname =~ s/^g(libtoolize)\$/\$1/; + +my(@vnums); +for my \$varg (qw(--version -version)) { + my \$cmd="\$path \$varg"; + open(PIPE, "\$cmd 2>&1 |") || next; + while(<PIPE>) { + chomp; + next if @vnums; # drain pipe if we got a vnums + next unless /^\$mname/i; + my(\$v)=/(\S+)\$/i; \$v =~ s/-.*\$//; + @vnums=grep { defined \$_ && !/^\s*\$/} map { s/\D//g; \$_; } split(/\./, \$v); + } + close(PIPE); + last if @vnums; +} + +@vnums=(@vnums, 0, 0, 0)[0..2]; +\$vn=join('', map { sprintf('%02d', \$_) } @vnums); +print "\$vn\n"; +exit 0; +EOF + +autogen_get_version="`pwd`/autogen-get-version.pl" + +trap "rm -f $autogen_get_version" 0 1 9 15 + + +update_prog_version() { + dir=$1 + prog=$2 + + # If there exists an envariable PROG in uppercase, use that and do not scan + ucprog=`echo $prog | tr 'a-z' 'A-Z' ` + eval env=\$${ucprog} + if test X$env != X; then + prog_name=$env + prog_vers=`perl $autogen_get_version $prog_name $prog` + + if test X$prog_vers = X; then + prog_vers=0 + fi + eval ${prog}_name=${prog_name} + eval ${prog}_vers=${prog_vers} + eval ${prog}_dir=environment + return + fi + + eval prog_name=\$${prog}_name + eval prog_vers=\$${prog}_vers + eval prog_dir=\$${prog}_dir + if test X$prog_vers = X; then + prog_vers=0 + fi + + save_PATH="$PATH" + + cd "$dir" + PATH=".:$PATH" + + names=`ls $prog* 2>/dev/null` + if [ "X$names" != "X" ]; then + for name in $names; do + vers=`perl $autogen_get_version $dir/$name $prog` + if [ "X$vers" = "X" ]; then + continue + fi + + if expr $vers '>' $prog_vers >/dev/null; then + prog_name=$name + prog_vers=$vers + prog_dir="$dir" + fi + done + fi + + eval ${prog}_name=${prog_name} + eval ${prog}_vers=${prog_vers} + eval ${prog}_dir=${prog_dir} + + PATH="$save_PATH" +} + + +check_prog_version() { + prog=$1 + + eval min=\$${prog}_min_vers + + eval prog_name=\$${prog}_name + eval prog_vers=\$${prog}_vers + eval prog_dir=\$${prog}_dir + + echo "$program: $prog program '$prog_name' V $prog_vers (min $min) in $prog_dir" 1>&2 + + rc=1 + if test $prog_vers != 0; then + if expr $prog_vers '<' $min >/dev/null; then + echo "$program: ERROR: \`$prog' version $prog_vers in $prog_dir is too old." + echo " (version $min or newer is required)" + rc=0 + else + # Things are ok, so set the ${prog} name + eval ${prog}=${prog_name} + fi + else + echo "$program: ERROR: You must have \`$prog' installed to compile this package." + echo " (version $min or newer is required)" + rc=0 + fi + + return $rc +} + + +# Find newest version of programs in the current PATH +save_args=${1+"$*"} +save_ifs="$IFS" +IFS=":" +set - $PATH +IFS="$save_ifs" + +echo "$program: Looking for programs: $programs" + +here=`pwd` +while [ $# -ne 0 ] ; do + dir=$1 + shift + if [ ! -d "$dir" ]; then + continue + fi + + for prog in $programs; do + update_prog_version "$dir" $prog + done +done +cd $here + +set - $save_args +# END Find programs + + +# Check the versions meet the requirements +for prog in $programs; do + if check_prog_version $prog; then + exit 1 + fi +done + +echo "$program: Dependencies satisfied" + +# Delete this libtoolize- generated directory now so that it is never +# considered by autogen.sh +$DRURUN rm -rf libltdl + +config_dir= +if test -d $CONFIG_DIR; then + config_dir=`cd $CONFIG_DIR; pwd` +fi + + +for coin in `find $SRCDIR -name configure.ac -print` +do + dir=`dirname $coin` + if test -f "$dir/NO-AUTO-GEN"; then + echo $program: Skipping $dir -- flagged as no auto-gen + else + echo " " + echo $program: Processing directory $dir + ( cd "$dir" + + # Ensure that these are created by the versions on this system + # (indirectly via automake) + $DRYRUN rm -f ltconfig ltmain.sh libtool stamp-h* + # Made by automake + $DRYRUN rm -f missing depcomp + # automake junk + $DRYRUN rm -rf autom4te*.cache + + if test "X$config_dir" != X; then + echo "$program: Updating config.guess and config.sub" + for file in config.guess config.sub; do + cfile=$config_dir/$file + if test -f $cfile; then + $DRYRUN rm -f $file + $DRYRUN cp -p $cfile $file + fi + done + fi + + echo "$program: Running $libtoolize $libtoolize_args" + $DRYRUN rm -f ltmain.sh libtool + eval $DRYRUN $libtoolize $libtoolize_args + + if grep "^GTK_DOC_CHECK" configure.ac >/dev/null; then + # gtkdocize junk + $DRYRUN rm -rf gtk-doc.make + echo "$program: Running $gtkdocize $gtkdocize_args" + $DRYRUN $gtkdocize $gtkdocize_args + fi + + echo "$program: Running $aclocal $aclocal_args" + $DRYRUN $aclocal $aclocal_args + if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then + echo "$program: Running $autoheader" + $DRYRUN $autoheader + fi + echo "$program: Running $automake $automake_args" + $DRYRUN $automake $automake_args $automake_args + echo "$program: Running $autoconf" + $DRYRUN $autoconf $autoconf_args + ) + fi +done + + +rm -f config.cache + +AUTOMAKE=$automake +AUTOCONF=$autoconf +ACLOCAL=$aclocal +export AUTOMAKE AUTOCONF ACLOCAL + +echo " " +if test -z "$*"; then + echo "$program: WARNING: Running \`configure' with arguments:" + echo "$configure_args" + echo "If you wish to pass others to it, please specify them on the" + echo "\`$program' command line." +fi + +echo "$program: Running ./configure $configure_args $@" +if test "X$DRYRUN" = X; then + $DRYRUN ./configure $configure_args "$@" \ + && echo "$program: Now type \`make' to compile this package" || exit 1 +else + $DRYRUN ./configure $configure_args "$@" +fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sparql/librdf/configure.ac Fri Jul 31 14:36:12 2009 +0000 @@ -0,0 +1,1018 @@ +dnl -*- Mode: autoconf -*- +dnl +dnl configure.ac - top level autoconf file for Redland +dnl (Process this file with autoconf to produce a configure script.) +dnl +dnl Copyright (C) 2000-2009 David Beckett http://www.dajobe.org/ +dnl Copyright (C) 2000-2005 University of Bristol, UK http://www.bristol.ac.uk/ +dnl +dnl This package is Free Software and part of Redland http://librdf.org/ +dnl +dnl It is licensed under the following three licenses as alternatives: +dnl 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version +dnl 2. GNU General Public License (GPL) V2 or any newer version +dnl 3. Apache License, V2.0 or any newer version +dnl +dnl You may not use this file except in compliance with at least one of +dnl the above three licenses. +dnl +dnl See LICENSE.html or LICENSE.txt at the top of this package for the +dnl complete terms and further detail along with the license texts for +dnl the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. +dnl +dnl + + +AC_INIT([Redland RDF Application Framework], 1.0.9, http://bugs.librdf.org/, redland) +AC_PREREQ(2.53) +dnl AC_CONFIG_SRCDIR(src/rdf_node.c) +AC_REVISION($Revision$)dnl + +AM_INIT_AUTOMAKE([1.7 check-news std-options -Wobsolete -Wportability -Wsyntax -Wunsupported]) +dnl AM_CONFIG_HEADER(src/rdf_config.h) +AM_MAINTAINER_MODE + +AC_CANONICAL_HOST + + +changequote(<<, >>)dnl +version_major=`echo $VERSION | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\1/'` +version_minor=`echo $VERSION | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\2/'` +version_release=`echo $VERSION | sed -e 's/^\([^\.]*\)\.\([^\.]*\)\.\(.*\)$/\3/'` +changequote([, ])dnl + +version_decimal=`expr $version_major \* 10000 + $version_minor \* 100 + $version_release` + +AC_DEFINE_UNQUOTED(LIBRDF_VERSION_MAJOR, $version_major, [Major version number]) +AC_DEFINE_UNQUOTED(LIBRDF_VERSION_MINOR, $version_minor, [Minor version number]) +AC_DEFINE_UNQUOTED(LIBRDF_VERSION_RELEASE, $version_release, [Release version number]) +AC_DEFINE_UNQUOTED(LIBRDF_VERSION_DECIMAL, $version_decimal, [Release version as a decimal]) + +# for redland-config.in +LIBRDF_VERSION_DECIMAL=$version_decimal +AC_SUBST(LIBRDF_VERSION_DECIMAL) + + +# Libtool versioning +# +# CURRENT +# The most recent interface number that this library implements. +# +# REVISION +# The implementation number of the CURRENT interface. +# +# AGE +# The difference between the newest and oldest interfaces that this +# library implements. In other words, the library implements all the +# interface numbers in the range from number `CURRENT - AGE' to +# `CURRENT'. +# +# Rules: +# 1. Start with version information of `0:0:0' for each libtool library. +# +# 2. Update the version information only immediately before a public +# release of your software. More frequent updates are unnecessary, +# and only guarantee that the current interface number gets larger +# faster. +# +# 3. If the library source code has changed at all since the last +# update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). +# +# 4. If any interfaces have been added, removed, or changed since the +# last update, increment CURRENT, and set REVISION to 0. +# +# 5. If any interfaces have been added since the last public release, +# then increment AGE. +# +# 6. If any interfaces have been removed since the last public release, +# then set AGE to 0. +# +# syntax: CURRENT[:REVISION[:AGE]] +LIBRDF_LIBTOOL_VERSION=0:0:0 +AC_SUBST(LIBRDF_LIBTOOL_VERSION) + +dnl Checks for programs. +AM_SANITY_CHECK +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET + +m4_undefine([AC_PROG_CXX]) +m4_defun([AC_PROG_CXX],[]) +m4_undefine([AC_PROG_F77]) +m4_defun([AC_PROG_F77],[]) + +# Libtool and LTDL initialising +LT_CONFIG_LTDL_DIR([libltdl]) +LT_INIT([dlopen]) +LTDL_INIT([convenience]) + +# Find a tar command for 'make dist' +AC_CHECK_PROGS(TAR, gnutar gtar tar) + +AC_CHECK_PROGS(PERL, perl) +# Gnome +AC_CHECK_PROGS(PKG_CONFIG, pkg-config) + + +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) + + +release_version=no +AC_ARG_ENABLE(release, [ --enable-release Turn on optimizations (for maintainer). ], \ + if test "$enableval" = "yes"; then \ + release_version=yes +fi;) + +modular=yes +AC_ARG_ENABLE(modular, [ --disable-modular Build storage backends into librdf library. ], \ + if test "$enableval" = "no"; then \ + modular=no +fi;) + +dnl compiler checks + +AC_DEFUN([REDLAND_CC_TRY_FLAG], [ + AC_MSG_CHECKING([whether $CC supports $1]) + redland_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + AC_COMPILE_IFELSE([ ], [redland_cc_flag=yes], [redland_cc_flag=no]) + CFLAGS="$redland_save_CFLAGS" + if test "X$redland_cc_flag" = "Xyes"; then + ifelse([$2], , :, [$2]) + else + ifelse([$3], , :, [$3]) + fi + AC_MSG_RESULT($redland_cc_flag) +]) + +possible_warnings="-Wall -Wextra \ +-Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ +-Wmissing-declarations -Wnested-externs -Wredundant-decls -Wswitch-enum \ +-Wsign-compare -Werror-implicit-function-declaration -Wwrite-strings +-Wpacked -Wmissing-format-attribute -Wpointer-arith -Wcast-align -Winit-self \ +-Wunsafe-loop-optimizations -Wdeclaration-after-statement \ +-Wold-style-definition \ +-Wno-missing-field-initializers -Wno-unused-parameter \ +-Wformat-security" + +warning_cflags= +if test "$USE_MAINTAINER_MODE" = yes; then + AC_MSG_CHECKING(for supported $CC warning flags) + AC_MSG_RESULT($warning_cflags) + for warning in $possible_warnings; do + REDLAND_CC_TRY_FLAG([$warning], [warning_cflags="$warning_cflags $warning"]) + done + AC_MSG_CHECKING($CC supports warning flags) + AC_MSG_RESULT($warning_cflags) +fi + +MAINTAINER_CFLAGS="$warning_cflags" + + +# Externally linked libraries - appear in redland-config +# -Dfoo -Idir +LIBRDF_CPPFLAGS=$CPPFLAGS +# -Ldir +LIBRDF_LDFLAGS=$LDFLAGS +# -llib +LIBRDF_LIBS=$LIBS + +# Internally linked libraries - never given to users +# -Dfoo -Idir +LIBRDF_INTERNAL_CPPFLAGS= +# -Ldir -llib +LIBRDF_INTERNAL_LIBS= + +# Libraries linked externally also may be internal - presently just +# raptor and rasqal but in future may include others +# Currently only substituted into redland-src-config. +# -Dfoo -Idir +LIBRDF_EXTERNAL_CPPFLAGS= +# -Ldir -llib +LIBRDF_EXTERNAL_LIBS= + +# do these first because somehow they get messed up by bdb checks +AC_CHECK_TYPES([byte]) +AC_CHECK_TYPES([u32]) +AC_CHECK_TYPES([u64]) + +AC_CHECK_SIZEOF(unsigned char, 1) +AC_CHECK_SIZEOF(unsigned int, 4) +AC_CHECK_SIZEOF(unsigned long, 4) +AC_CHECK_SIZEOF(unsigned long long, 8) + +dnl Location of the librdf source +AC_ARG_WITH(librdf, [ --with-librdf=DIR librdf (Redland) source folder], librdf_src_dir="$withval", librdf_src_dir="none") + +if test "$librdf_src_dir" = "none" ; then + AC_MSG_ERROR(Please supply your librdf source folder (e.g. /home/bob/librdf/src)) +fi + +LIBRDF_SRC_DIR=$librdf_src_dir +AC_SUBST(LIBRDF_SRC_DIR) + +dnl Checks for libraries. + + +dnl Berkeley DB +AC_ARG_WITH(bdb, [ --with-bdb=DIR Berkeley DB install area (default=/usr)], bdb_prefix="$withval", bdb_prefix="none") +AC_ARG_WITH(bdb_lib, [ --with-bdb-lib=DIR Berkeley DB lib directory (default=/usr/lib)], bdb_lib_dir="$withval", bdb_lib_dir="none") +AC_ARG_WITH(bdb_include, [ --with-bdb-include=DIR Berkeley DB include directory (default=/usr/include)], bdb_include_dir="$withval", bdb_include_dir="none") +AC_ARG_WITH(bdb_dbname, [ --with-bdb-dbname=NAME Berkeley DB library name (auto)], bdb_dbname="$withval", bdb_dbname="none") + +bdb_version=unknown +bdb_available=Missing + +if test "x$bdb_prefix" != "xno" ; then + + if test "x$bdb_prefix" = "xyes" ; then + bdb_prefix="none" + fi + + # Only prefix given - set lib and include + if test "X$bdb_prefix" != "Xnone" -a "X$bdb_lib_dir" = "Xnone" -a "X$bdb_include_dir" = "Xnone" ; then + bdb_lib_dir="$bdb_prefix/lib" + bdb_include_dir="$bdb_prefix/include" + fi + + # Nothing given - search + if test "X$bdb_prefix" = "Xnone" -a "X$bdb_lib_dir" = "Xnone" -a "X$bdb_include_dir" = "Xnone" -a "X$bdb_dbname" = "Xnone" ; then + bdb_prefix="/usr" + bdb_lib_dir="/usr/lib" + bdb_include_dir="/usr/include" + + extraprefix= + # OSX fink area added if found and /sw/bin is in the PATH + if test -d /sw/include -a -d /sw/lib ; then + if echo $PATH |grep /sw/bin >/dev/null; then + extraprefix=/sw + fi + fi + + # Sigh! And this still might not be good enough. + for bdbc_version in 4.7 4.6 4.5 4.4 4.3 4.2 4.1 4.0 4 3.3 3.2 3.1 3 2; do + bdbc_major=`echo $bdbc_version | sed -e 's/^\(.\).*$/\1/'`; + bdbc_version2=`echo $bdbc_version | sed -e 's/^\(.\).\(.\)$/\1\2/'` + + for bdbc_prefix in $extraprefix /usr/local/BerkeleyDB.$bdbc_version /usr/local /opt/local /usr; do + bdbc_libdir=$bdbc_prefix/lib + + for bdbc_incdir in $bdbc_prefix/include/db$bdbc_version $bdbc_prefix/include/db$bdbc_version2 $bdbc_prefix/include/db$bdbc_major $bdbc_prefix/include ; do + if test -r $bdbc_incdir/db.h ; then + header_bdbc_version=`sed -ne 's/^.*DB_VERSION_STRING.*Berkeley DB \(...\).*/\1/p' $bdbc_incdir/db.h` + if test "X$header_bdbc_version" = "X$bdbc_version" ; then + for bdbc_name in db-$bdbc_version db$bdbc_version db-$bdbc_version2 db$bdbc_version2; do + for bdbc_libdir2 in $bdbc_libdir $bdbc_libdir/db$bdbc_version $bdbc_libdir/db$bdbc_version2; do + if test -r $bdbc_libdir2/lib$bdbc_name.a -o -r $bdbc_libdir2/lib$bdbc_name.so -o -r $bdbc_libdir2/lib$bdbc_name.dylib; then + bdb_version=$bdbc_version + bdb_prefix=$bdbc_prefix + bdb_include_dir=$bdbc_incdir + bdb_lib_dir=$bdbc_libdir2 + bdb_dbname=$bdbc_name + break 5 + fi + done + done + fi + fi + + done + done + done + + fi + + AC_MSG_CHECKING(BDB version) + AC_MSG_RESULT($bdb_version) + AC_MSG_CHECKING(location of BDB libs) + AC_MSG_RESULT($bdb_lib_dir) + AC_MSG_CHECKING(location of BDB includes) + AC_MSG_RESULT($bdb_include_dir) + + if test "$bdb_prefix" != no; then + nLDFLAGS=$LDFLAGS + nCPPFLAGS= + + if test "$bdb_lib_dir" != /usr/lib; then + nLDFLAGS="-L$bdb_lib_dir"; + fi + + if test "$bdb_dbname" = none; then + # Yuck, yuck, yuck - can't they create a bdb-config program like GNOME? + bdb_dbname=`cd $bdb_lib_dir; ls -1 libdb*.a 2>/dev/null |sed -e 's/^lib//' -e 's/\.a$//' | head -1` + if test "X$bdb_dbname" = X; then + AC_MSG_WARN(Cannot find the BDB library name from the files in $bdb_lib_dir) + AC_MSG_WARN(Assuming it is 'db' and will link like -ldb) + AC_MSG_WARN(Use --with-bdb-dbname=NAME if this is wrong) + bdb_dbname=db + fi + fi + + AC_MSG_CHECKING(name of BDB library) + AC_MSG_RESULT($bdb_dbname) + + if test "$bdb_include_dir" != /usr/include; then + nCPPFLAGS="-I$bdb_include_dir"; + fi + + LDFLAGS="$nLDFLAGS $LDFLAGS" + CPPFLAGS="$nCPPFLAGS $CPPFLAGS" + LIBS="-l$bdb_dbname $LIBS" + + AC_CHECK_HEADERS(db.h) + if test "$ac_cv_header_db_h" = yes ; then + have_libdb=no + + AC_MSG_CHECKING(for BDB V1 dbopen) + AC_TRY_LINK([#include <stdio.h> + #include <db.h>], [dbopen(NULL, 0, 0, DB_BTREE, NULL);], + AC_DEFINE(HAVE_DBOPEN, 1, [BDB has dbopen method]) + if test $have_libdb = no; then + bdb_available="Version 1.x - not supported" + have_libdb=no + fi + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + + AC_MSG_CHECKING(for BDB V2 db_open) + AC_TRY_LINK([#include <stdio.h> + #include <db.h>], [db_open(NULL, DB_BTREE, 0, 0, NULL, NULL, NULL);], + AC_DEFINE(HAVE_DB_OPEN, 1, [BDB has db_open method]) + have_libdb=yes + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + + AC_MSG_CHECKING(for BDB V3/V4.x db_create) + AC_TRY_LINK([#include <stdio.h> + #include <db.h>], [db_create(NULL, NULL, 0);], + AC_DEFINE(HAVE_DB_CREATE, 1, [BDB has db_create method]) + have_libdb=yes + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + + AC_MSG_CHECKING(for BDB V4.0 DB->open with 6 arguments) + AC_TRY_LINK([#include <stdio.h> + #include <db.h>], [DB *bdb; bdb->open(bdb, NULL, NULL, DB_BTREE, 0, 0);], + AC_DEFINE(HAVE_BDB_OPEN_6_ARGS, 1, [BDB has open method with 6 args]) + have_libdb=yes + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + + AC_MSG_CHECKING(for BDB DB->close with 2 arguments) + AC_TRY_LINK([#include <stdio.h> + #include <db.h>], [DB *bdb; bdb->close(bdb, 0);], + AC_DEFINE(HAVE_BDB_CLOSE_2_ARGS, 1, [BDB has close method with 2 args]) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + + AC_MSG_CHECKING(for BDB DB->fd with 2 arguments) + AC_TRY_LINK([#include <stdio.h> + #include <db.h>], [DB *bdb; bdb->fd(bdb, 0);], + AC_DEFINE(HAVE_BDB_FD_2_ARGS, 1, [BDB has fd method with 2 args]) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + + AC_MSG_CHECKING(for BDB DB->set_flags) + AC_TRY_LINK([#include <stdio.h> + #include <db.h>], [DB *bdb; bdb->set_flags(bdb, 0);], + AC_DEFINE(HAVE_BDB_SET_FLAGS, 1, [BDB has set_flags method]) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + + AC_MSG_CHECKING(for BDB V4.1+ DB->open with 7 arguments) + AC_TRY_LINK([#include <stdio.h> + #include <db.h>], [DB *bdb; bdb->open(bdb, NULL, NULL, NULL, DB_BTREE, 0, 0);], + AC_DEFINE(HAVE_BDB_OPEN_7_ARGS, 1, [BDB has open method with 7 args]) + have_libdb=yes + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + + AC_MSG_CHECKING(whether DB_TXN defined in db.h) + dnl In BDB, DB_TXN is a pointer to a structure never defined + AC_TRY_LINK([#include <stdio.h> + #include <db.h>], [DB_TXN* ptr=(DB_TXN*)NULL], + AC_DEFINE(HAVE_BDB_DB_TXN, 1, [BDB defines DB_TXN]) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + AC_MSG_CHECKING(whether DBC defined in db.h) + AC_TRY_LINK([#include <db.h>], [size_t len=sizeof(DBC)], + AC_DEFINE(HAVE_BDB_CURSOR, 1, [BDB defines DBC]) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + AC_MSG_CHECKING(number of arguments to db_cursor) + AC_TRY_LINK([#include <stdio.h> + #include <db.h>], [DB* db; db->cursor(db, NULL, NULL, 0);], + AC_DEFINE(HAVE_BDB_CURSOR_4_ARGS, 1, [BDB cursor method has 4 arguments]) + AC_MSG_RESULT(4), + AC_MSG_RESULT(3)) + fi + + if test "$have_libdb" = yes; then + bdb_available="Version $bdb_version (library $bdb_dbname in $bdb_lib_dir)" + LIBRDF_LIBS="$LIBRDF_LIBS $nLDFLAGS -l$bdb_dbname" + LIBRDF_CPPFLAGS="$LIBRDF_CPPFLAGS $nCPPFLAGS" + fi + + fi + +fi + +CPPFLAGS="$LIBRDF_CPPFLAGS" +LDFLAGS="$LIBRDF_LDFLAGS" +LIBS="$LIBRDF_LIBS" + + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(errno.h stdlib.h unistd.h string.h fcntl.h dmalloc.h time.h sys/time.h sys/stat.h getopt.h) +AC_HEADER_TIME + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_BIGENDIAN + +dnl Checks for library functions. +AC_CHECK_FUNCS(getopt getopt_long memcmp mkstemp mktemp tmpnam gettimeofday getenv) + +AM_CONDITIONAL(MEMCMP, test $ac_cv_func_memcmp = no) +AM_CONDITIONAL(GETOPT, test $ac_cv_func_getopt = no -a $ac_cv_func_getopt_long = no) + +dnl Checks for URI resolvers + +CPPFLAGS="$LIBRDF_CPPFLAGS" +LDFLAGS="$LIBRDF_LDFLAGS" +LIBS="$LIBRDF_LIBS" + + +dnl Checks for XML parsers + +# At present this is for passing on to raptor and not used here +AC_ARG_WITH(xml-parser, [ --with-xml-parser=NAME Use XML parser - expat, libxml (default=libxml)], xml_parser="$withval", xml_parser="libxml") + + + + +dnl Checks for RDF parsers +parser_modules=raptor +rdf_parsers_available= + +# Check for raptor +AC_MSG_CHECKING(for raptor) + +RAPTOR_MIN_VERSION=1.4.17 +AC_SUBST(RAPTOR_MIN_VERSION) +if $PKG_CONFIG raptor --exists; then + : +else + AC_MSG_ERROR(Raptor is not installed - see http://librdf.org/raptor/ to get a version newer than $RAPTOR_MIN_VERSION) +fi + +RAPTOR_VERSION=`$PKG_CONFIG raptor --modversion 2>/dev/null` + +if $PKG_CONFIG raptor --atleast-version=$RAPTOR_MIN_VERSION; then + : +else + AC_MSG_ERROR(Installed raptor $RAPTOR_VERSION is too old - need $RAPTOR_MIN_VERSION) +fi + +LIBRDF_EXTERNAL_CPPFLAGS="`$PKG_CONFIG raptor --cflags` $LIBRDF_EXTERNAL_CPPFLAGS" +LIBRDF_EXTERNAL_LIBS="`$PKG_CONFIG raptor --libs` $LIBRDF_EXTERNAL_LIBS" + +rdf_parsers_available="$parser_available raptor(system $RAPTOR_VERSION)" +AC_MSG_RESULT(system $RAPTOR_VERSION) + +# Check for rasqal +AC_MSG_CHECKING(for rasqal) + +RASQAL_MIN_VERSION=0.9.16 +RASQAL_MAX_VERSION=0.9.99 +AC_SUBST(RASQAL_MIN_VERSION) +AC_SUBST(RASQAL_MAX_VERSION) +if $PKG_CONFIG rasqal --exists; then + : +else + AC_MSG_ERROR(Rasqal is not installed - see http://librdf.org/rasqal/ to get a version in range $RASQAL_MIN_VERSION to $RASQAL_MAX_VERSION) +fi + +RASQAL_VERSION=`$PKG_CONFIG rasqal --modversion 2>/dev/null` + +if $PKG_CONFIG rasqal --atleast-version=$RASQAL_MIN_VERSION --max-version=$RASQAL_MAX_VERSION; then + : +else + AC_MSG_ERROR(Installed rasqal $RASQAL_VERSION is not in range $RASQAL_MIN_VERSION to $RASQAL_MAX_VERSION) +fi + +LIBRDF_EXTERNAL_CPPFLAGS="`$PKG_CONFIG rasqal --cflags` $LIBRDF_EXTERNAL_CPPFLAGS" +LIBRDF_EXTERNAL_LIBS="`$PKG_CONFIG rasqal --libs` $LIBRDF_EXTERNAL_LIBS" + +rdf_query="rasqal(system $RASQAL_VERSION)" +AC_MSG_RESULT(system $RASQAL_VERSION) + + +dnl Checks for modules +digest_modules="md5 sha1 ripemd160" + +AC_MSG_CHECKING(digests wanted) +AC_ARG_ENABLE(digests, [ --enable-digests=LIST Use digests (default=md5 sha1 ripemd160)], digest_modules="$enableval") +AC_MSG_RESULT($digest_modules) + +DIGEST_OBJS= +DIGEST_SRCS= + +AC_ARG_WITH(openssl-digests, [ --with-openssl-digests Use openssl digests (default=yes)], enable_openssl_digests="no", enable_openssl_digests="no") + +digest_modules_available= + + +dnl hashes +HASH_OBJS= +HASH_SRCS= + +AC_MSG_CHECKING(for bdb hash support) +if test "$have_libdb" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BDB_HASH, 1, [Have BDB hash support]) + HASH_OBJS="$HASH_OBJS rdf_hash_bdb.lo" + HASH_SRCS="$HASH_SRCS rdf_hash_bdb.c" +else + AC_MSG_RESULT(no) +fi + + +AC_SUBST(HASH_OBJS) +AC_SUBST(HASH_SRCS) + + +dnl Storages +persistent_storages="/file/tstore/mysql/sqlite/" +persistent_store=no +all_storages="audiodb memory file hashes trees mysql sqlite tstore postgresql" +always_available_storages="audiodb memory file hashes trees" + +dnl default availabilities and enablements +for storage in $all_storages; do + eval $storage'_storage_available=no' + eval $storage'_storage=no' +done +for storage in $always_available_storages; do + eval $storage'_storage_available=yes' + eval $storage'_storage=yes' +done + + +storages_available="audiodb memory file hashes(memory) trees" +if test "$have_libdb" = yes; then + storages_available="$storages_available hashes(bdb $bdb_version)" +fi + +AC_ARG_WITH(threestore, [ --with-threestore(=CONFIG|yes|no) Location of 3store-config (default=auto)], tstore_config="$withval", tstore_config="") +if test "X$tstore_config" != "Xno"; then + if test "X$tstore_config" != "Xyes" ; then + TSTORE_CONFIG=$tstore_config + fi + tstore_config=yes +fi +if test $tstore_config = yes -a "X$TSTORE_CONFIG" = "X" ; then + AC_CHECK_PROGS(TSTORE_CONFIG, 3store-config) +fi + +AC_MSG_CHECKING(for 3store library) +if test "X$TSTORE_CONFIG" != X -a "X$PKG_CONFIG" != X ; then + tstore_version=`$TSTORE_CONFIG --version` + + storages_available="$storages_available 3store($tstore_version)" + tstore_storage_available=yes + + AC_MSG_RESULT(yes - version $tstore_version) +else + AC_MSG_RESULT(no) +fi + + +AC_ARG_WITH(mysql, [ --with-mysql(=CONFIG|yes|no) Location of MySQL 3/4 mysql_config (default=auto)], mysql_config="$withval", mysql_config="") +if test "X$mysql_config" != "Xno"; then + if test "X$mysql_config" != "Xyes" ; then + MYSQL_CONFIG=$mysql_config + fi + mysql_config=yes +fi +if test $mysql_config = yes -a "X$MYSQL_CONFIG" = "X" ; then + AC_CHECK_PROGS(MYSQL_CONFIG, mysql_config) +fi + +libmysql_min_version=3.23.56 +# Also tested on 4.0.14 + +mysql_cflags= +mysql_libs= +if test "X$MYSQL_CONFIG" != X; then + dnl need to change quotes to allow square brackets + changequote(<<, >>)dnl + mysql_libs=`$MYSQL_CONFIG --libs | sed -e "s/'//g"` + # Stop the MySQL config program adding -Os or -O<n> options to CFLAGS + mysql_cflags=`$MYSQL_CONFIG --cflags | sed -e "s/'//g" -e "s/[ \t]-O[A-Za-z0-9]*/ /" ` + changequote([, ])dnl + + LIBS="$LIBRDF_LIBS $mysql_libs" + CPPFLAGS="$LIBRDF_CPPFLAGS $mysql_cflags" + AC_MSG_CHECKING(for mysql library) + LIBMYSQL_VERSION=`$MYSQL_CONFIG --version` + libmysql_version_dec=`echo $LIBMYSQL_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` + libmysql_min_version_dec=`echo $libmysql_min_version | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'` + AC_MSG_RESULT(yes - version $LIBMYSQL_VERSION) + if test $libmysql_version_dec -lt $libmysql_min_version_dec; then + AC_MSG_WARN(Using libmysql $LIBMYSQL_VERSION is unsupported - $libmysql_min_version or newer recommended.) + else + storages_available="$storages_available mysql($LIBMYSQL_VERSION)" + mysql_storage_available=yes + fi + +AC_MSG_CHECKING(whether MYSQL_OPT_RECONNECT is declared) +AC_COMPILE_IFELSE([#include <mysql.h> +int x=MYSQL_OPT_RECONNECT;], + AC_DEFINE(HAVE_MYSQL_OPT_RECONNECT, 1, [have MYSQL_OPT_RECONNECT declared]) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + + + LIBS="$LIBRDF_LIBS" + CPPFLAGS="$LIBRDF_CPPFLAGS" +fi + + + +AC_ARG_WITH(sqlite, [ --with-sqlite(=yes|no|2|3) Enable SQLite store with version (default=auto)], sqlite_api_version="$withval", sqlite_api_version="auto") +AC_ARG_WITH(sqlite-version, [ --with-sqlite-version(=yes|no|2|3) SQLite version to use (default=auto)], sqlite_api_version="$withval") +if test "x$sqlite_api_version" = "xyes" ; then + sqlite_api_version="auto" +fi + +AC_MSG_CHECKING(for sqlite library versions available) +sqlite_versions= +if test "X$PKG_CONFIG" != X ; then + sqlite_version=`$PKG_CONFIG sqlite3 --modversion 2>/dev/null` + if test "X$sqlite_version" != X; then + if test "X$sqlite_api_version" = Xauto; then + sqlite_api_version=3 + fi + sqlite_versions=$sqlite_version + fi + sqlite_version=`$PKG_CONFIG sqlite --modversion 2>/dev/null` + if test "X$sqlite_version" != X; then + if test "X$sqlite_api_version" = Xauto; then + sqlite_api_version=2 + fi + sqlite_versions="$sqlite_version $sqlite_versions" + fi +fi +AC_MSG_RESULT($sqlite_versions) + +if test "X$sqlite_api_version" = Xauto; then + sqlite_api_version=no +fi + +AC_MSG_CHECKING(using sqlite library) +if test "X$sqlite_api_version" != Xno ; then + if test "$sqlite_api_version" = 3; then + SQLITE_CONFIG="$PKG_CONFIG sqlite3" + else + SQLITE_CONFIG="$PKG_CONFIG sqlite" + fi + sqlite_version=`$SQLITE_CONFIG --modversion 2>/dev/null` + AC_DEFINE_UNQUOTED(SQLITE_API, $sqlite_api_version, [SQLite API version]) + + storages_available="$storages_available sqlite($sqlite_version)" + sqlite_storage_available=yes + AC_MSG_RESULT(yes - version $sqlite_version) + + CPPFLAGS="$LIBRDF_CPPFLAGS `$SQLITE_CONFIG --cflags`" + AC_CHECK_HEADERS(sqlite3.h sqlite.h) + CPPFLAGS="$LIBRDF_CPPFLAGS" +else + AC_MSG_RESULT(no) +fi + +AC_ARG_WITH(postgresql, [ --with-postgresql(=CONFIG|yes|no) Location of pg_config (default=auto)], pg_config="$withval", postgresql_config="") +if test "X$pg_config" != "Xno"; then + if test "X$pg_config" != "Xyes" ; then + PG_CONFIG=$pg_config + fi + pg_config=yes +fi +if test $pg_config = yes -a "X$PG_CONFIG" = "X" ; then + AC_CHECK_PROGS(PG_CONFIG, pg_config) +fi + +AC_MSG_CHECKING(for postgresql library) +if test "X$PG_CONFIG" != X ; then + postgresql_version=`$PG_CONFIG --version | sed -e 's/^.* //'` + storages_available="$storages_available postgresql($postgresql_version)" + postgresql_storage_available=yes + + AC_MSG_RESULT(yes - version $postgresql_version) + + CPPFLAGS="$LIBRDF_CPPFLAGS -I`$PG_CONFIG --includedir`" + AC_CHECK_HEADERS(libpq-fe.h) + CPPFLAGS="$LIBRDF_CPPFLAGS" + + LIBS="$LIBRDF_LIBS -L`$PG_CONFIG --libdir` -lpq" +else + AC_MSG_RESULT(no) +fi + + +# This is needed because autoheader can't work out which computed +# symbols must be pulled from acconfig.h into config.h.in +if test "x" = "y"; then + AC_DEFINE(STORAGE_FILE, 1, [Building file storage]) + AC_DEFINE(STORAGE_HASHES, 1, [Building hashes storage]) + AC_DEFINE(STORAGE_TREES, 1, [Building trees storage]) + AC_DEFINE(STORAGE_MEMORY, 1, [Building memory storage]) + AC_DEFINE(STORAGE_MYSQL, 1, [Building MySQL storage]) + AC_DEFINE(STORAGE_SQLITE, 1, [Building SQLite storage]) + AC_DEFINE(STORAGE_TSTORE, 1, [Building 3store storage]) + AC_DEFINE(STORAGE_POSTGRESQL, 1, [Building PostgreSQL storage]) + AC_DEFINE(STORAGE_AUDIODB, 1, [Building AudioDB storage]) +fi + + +AC_MSG_CHECKING(storages required) +AC_ARG_ENABLE(storages, [ --enable-storages=LIST Use storages (default=all)], storages="$enableval") +if test "X$storages" = Xall -o "X$storages" = X; then + storages="$all_storages" + AC_MSG_RESULT(all) +else + AC_MSG_RESULT($storages) +fi + +dnl absolutely ensuring memory is enabled +if echo $storages | grep memory >/dev/null; then + : +else + storages="memory $storages" +fi + +for storage in $storages; do + if eval test \$$storage'_storage_available' = yes; then + eval $storage'_storage=yes' + NAME=`echo $storage | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + n=STORAGE_${NAME} + AC_DEFINE_UNQUOTED($n) + storages_enabled="$storages_enabled $storage" + + if echo $persistent_storages | grep "/$storage/" >/dev/null; then + persistent_store=yes + fi + fi + +done + +AM_CONDITIONAL(STORAGE_FILE, test $file_storage = yes) +AM_CONDITIONAL(STORAGE_HASHES, test $hashes_storage = yes) +AM_CONDITIONAL(STORAGE_TREES, test $trees_storage = yes) +AM_CONDITIONAL(STORAGE_MEMORY, test $memory_storage = yes) +AM_CONDITIONAL(STORAGE_MYSQL, test $mysql_storage = yes) +AM_CONDITIONAL(STORAGE_SQLITE, test $sqlite_storage = yes) +AM_CONDITIONAL(STORAGE_TSTORE, test $tstore_storage = yes) +AM_CONDITIONAL(STORAGE_POSTGRESQL, test $postgresql_storage = yes) +AM_CONDITIONAL(STORAGE_AUDIODB, test $audiodb_storage = yes) + +if test $mysql_storage = yes; then + MYSQL_CPPFLAGS=`$MYSQL_CONFIG --cflags | sed -e "s/'//g" -e "s/-O[A-Za-z0-9]*//" ` + MYSQL_LIBS="$LIBRDF_LIBS $mysql_libs" +fi +if test $sqlite_storage = yes; then + SQLITE_CPPFLAGS="`$SQLITE_CONFIG --cflags`" + SQLITE_LIBS="`$SQLITE_CONFIG --libs`" +fi + AUDIODB_CPPFLAGS="`$PKG_CONFIG glib --cflags`" + AUDIODB_LIBS="-laudioDB `$PKG_CONFIG glib --libs`" +if test $tstore_storage = yes; then + TSTORE_CPPFLAGS="`$TSTORE_CONFIG --cflags` `$PKG_CONFIG glib --cflags`" + TSTORE_LIBS="`$TSTORE_CONFIG --libs` `$PKG_CONFIG glib --libs`" +fi +if test $postgresql_storage = yes; then + POSTGRESQL_CPPFLAGS="-I`$PG_CONFIG --includedir`" + POSTGRESQL_LIBS="-L`$PG_CONFIG --libdir` -lpq" +fi + + +if test "$persistent_store" = no; then + AC_MSG_WARN(No persistant storage is available or enabled) +fi + +AC_SUBST(MYSQL_CPPFLAGS) +AC_SUBST(MYSQL_LIBS) +AC_SUBST(SQLITE_CPPFLAGS) +AC_SUBST(SQLITE_LIBS) +AC_SUBST(AUDIODB_CPPFLAGS) +AC_SUBST(AUDIODB_LIBS) +AC_SUBST(TSTORE_CPPFLAGS) +AC_SUBST(TSTORE_LIBS) +AC_SUBST(POSTGRESQL_CPPFLAGS) +AC_SUBST(POSTGRESQL_LIBS) + + +if test "$modular" = yes; then + LIBRDF_CPPFLAGS="$LIBRDF_CPPFLAGS $INCLTDL" + LIBRDF_LIBS="$LIBRDF_LIBS $LIBLTDL" + AC_DEFINE(MODULAR_LIBRDF, 1, [Build storage backends as modules]) +# AC_CONFIG_SUBDIRS([libltdl]) +else + LIBRDF_CPPFLAGS="$LIBRDF_CPPFLAGS $MYSQL_CPPFLAGS $SQLITE_CPPFLAGS $TSTORE_CPPFLAGS $POSTGRESQL_CPPFLAGS" + LIBRDF_LIBS="$LIBRDF_LIBS $MYSQL_LIBS $SQLITE_LIBS $TSTORE_LIBS $POSTGRESQL_LIBS" +fi + +AM_CONDITIONAL(MODULAR_LIBRDF, test $modular = yes) + +CPPFLAGS="$LIBRDF_CPPFLAGS" +LDFLAGS="$LIBRDF_LDFLAGS" +LIBS="$LIBRDF_LIBS" + + +dnl Check for use of threads + +AC_ARG_WITH(threads, [ --with-threads With POSIX thread support (default=no)], with_threads="$withval", with_threads="no") + +AC_CHECK_HEADERS(pthread.h) + +AC_MSG_CHECKING(if POSIX threads should be used) +if test $with_threads = "yes" ; then + + if test "$ac_cv_header_pthread_h" = yes ; then + AC_DEFINE(WITH_THREADS, 1, [Use POSIX threads]) + LIBRDF_LIBS="$LIBRDF_LIBS -lpthread" + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi +else + AC_MSG_RESULT(no) +fi + +LIBS=$LIBRDF_LIBS + + +# Maybe add some local digest modules +for module in $digest_modules; do + module_u=`echo $module | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_MSG_CHECKING(for local $module digest module) + base=rdf_digest_$module + if test -r $srcdir/src/$base.c; then + AC_MSG_RESULT(yes) + + n=HAVE_LOCAL_${module_u}_DIGEST + AC_DEFINE_UNQUOTED($n) + + DIGEST_OBJS="$DIGEST_OBJS $base.lo" + DIGEST_SRCS="$DIGEST_SRCS $base.c" + digest_modules_available="$digest_modules_available $module" + else + AC_MSG_RESULT(no) + fi +done + +AC_SUBST(DIGEST_OBJS) +AC_SUBST(DIGEST_SRCS) + +# This is needed because autoheader can't work out which computed +# symbols must be pulled from acconfig.h into config.h.in +if test "x" = "y"; then + AC_DEFINE(HAVE_LOCAL_MD5_DIGEST, 1, [Have local MD5 digest]) + AC_DEFINE(HAVE_LOCAL_SHA1_DIGEST, 1, [Have local SHA1 digest]) + AC_DEFINE(HAVE_LOCAL_RIPEMD160_DIGEST, 1, [Have local RIPEMD160 digest]) +fi + + + +#LIBRDF_EXTERNAL_CPPFLAGS="$LIBRDF_EXTERNAL_CPPFLAGS $LIBRDF_CPPFLAGS" +LIBRDF_EXTERNAL_LIBS="$LIBRDF_EXTERNAL_LIBS $LIBRDF_LIBS" + +# Everything except things with .pc files (raptor and rasqal) +# 3store uses it but is optional and thus tricky to specify this way +LIBRDF_PKGCONFIG_PRIVATE_LIBS=`echo $LIBRDF_LIBS | sed -e 's, ..top_build_prefix.libltdl/libltdlc.la, ,'` + +# Make final changes to cflags +CFLAGS="-DLIBRDF_INTERNAL=1 $CFLAGS" +MEM= +MEM_LIBS= +AC_ARG_WITH(dmalloc, [ --with-dmalloc Use dmalloc debugging library (default=no)], use_dmalloc="$withval", use_dmalloc="no") +AC_MSG_CHECKING(using dmalloc library) +if test "$USE_MAINTAINER_MODE" = yes; then + if test "$ac_cv_header_dmalloc_h" = yes; then + if test "X$use_dmalloc" = Xauto; then + use_dmalloc=yes + fi + else + use_dmalloc=no + fi +else + use_dmalloc=no +fi +AC_MSG_RESULT($use_dmalloc) +if test $use_dmalloc = yes; then + MEM=-DLIBRDF_MEMORY_DEBUG_DMALLOC=1 + MEM_LIBS=-ldmalloc +fi +AC_ARG_WITH(memory-signing, [ --with-memory-signing Sign allocated memory (default=no)], use_memory_signing="$withval", use_memory_signing="no") +AC_MSG_CHECKING(using memory signing) +AC_MSG_RESULT($use_memory_signing) +if test $use_memory_signing = yes; then + MEM=-DLIBRDF_MEMORY_SIGN=1 + MEM_LIBS= +fi + +assert=yes +AC_ARG_ENABLE(assertions, [ --enable-assertions Perform run time assertion checks (default yes). ], assert=$enableval) +if test "$assert" = "yes"; then + AC_DEFINE(LIBRDF_ASSERT, 1, [Run time assertion checks.]) +fi + +assert_messages=yes +AC_ARG_ENABLE(assert-messages, [ --enable-assert-messages Print run time assertion check failure messages (default yes). ], assert_messages=$enableval) +if test "$assert_messages" = "yes"; then + AC_DEFINE(LIBRDF_ASSERT_MESSAGES, 1, [Print run time assertion check failure messages.]) +fi + +debug_messages=no +if test "$USE_MAINTAINER_MODE" = yes; then + debug_messages=yes; +fi + +AC_ARG_ENABLE(debug, [ --enable-debug Enable debug messages (default no). ], debug_messages=$enableval) +if test "$debug_messages" = "yes"; then + LIBRDF_CPPFLAGS="-g -DLIBRDF_DEBUG=1 $LIBRDF_CPPFLAGS" +fi + +if test "$USE_MAINTAINER_MODE" = yes; then + CFLAGS="$MAINTAINER_CFLAGS $CFLAGS" +fi + +if test "$USE_MAINTAINER_MODE" = yes -a $release_version = no; then + dnl need to change quotes to allow square brackets + changequote(<<, >>)dnl + CFLAGS=`echo $CFLAGS | sed -e "s/-O[A-Za-z0-9]*//"` + CXXFLAGS=`echo $CXXFLAGS | sed -e "s/-O[A-Za-z0-9]*//"` + LIBRDF_CPPFLAGS=`echo $LIBRDF_CPPFLAGS | sed -e "s/-O[A-Za-z0-9]*//"` + LIBRDF_EXTERNAL_CPPFLAGS=`echo $LIBRDF_EXTERNAL_CPPFLAGS | sed -e "s/-O[A-Za-z0-9]*//"` + LIBRDF_INTERNAL_CPPFLAGS=`echo $LIBRDF_INTERNAL_CPPFLAGS | sed -e "s/-O[A-Za-z0-9]*//"` + changequote([, ])dnl +fi + + +LIBS="$LIBS" +CPPFLAGS="$CPPFLAGS" +LDFLAGS="$LDFLAGS" + +LIBRDF_LIBTOOLLIBS=librdf.la + +AC_SUBST(LIBRDF_EXTERNAL_CPPFLAGS) +AC_SUBST(LIBRDF_EXTERNAL_LIBS) + +AC_SUBST(LIBRDF_INTERNAL_CPPFLAGS) +AC_SUBST(LIBRDF_INTERNAL_LIBS) + +AC_SUBST(LIBRDF_CPPFLAGS) +AC_SUBST(LIBRDF_LDFLAGS) +AC_SUBST(LIBRDF_LIBTOOLLIBS) +AC_SUBST(LIBRDF_PKGCONFIG_PRIVATE_LIBS) + +AC_SUBST(MEM) +AC_SUBST(MEM_LIBS) + +abs_top_srcdir=`cd $srcdir; pwd` +AC_SUBST(abs_top_srcdir) +abs_top_builddir=`pwd` +AC_SUBST(abs_top_builddir) + +AC_CONFIG_FILES([Makefile src/Makefile]) + +dnl Check for gtk-doc and docbook +GTK_DOC_CHECK([1.3]) + +AC_OUTPUT + +AC_MSG_RESULT([ +Redland build summary: +]) + +if test "$modular" = yes; then + AC_MSG_RESULT([ Using modular storage backends]) +else + AC_MSG_RESULT([ Using monolithic storage backends]) +fi + +AC_MSG_RESULT([ + Berkeley/Sleepycat DB : $bdb_available + Triple stores available : $storages_available + Triple stores enabled :$storages_enabled + RDF parsers :$rdf_parsers_available + RDF query : $rdf_query + Content digests :$digest_modules_available +])
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sparql/librdf/src/Makefile.am Fri Jul 31 14:36:12 2009 +0000 @@ -0,0 +1,55 @@ +# -*- Mode: Makefile -*- +# +# Makefile.am - top level automake file for Redland +# +# Copyright (C) 2000-2009, David Beckett http://www.dajobe.org/ +# Copyright (C) 2000-2004, Copyright (C) 2000-2006, University of Bristol, UK http://www.bristol.ac.uk/ +# +# This package is Free Software and part of Redland http://librdf.org/ +# +# It is licensed under the following three licenses as alternatives: +# 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version +# 2. GNU General Public License (GPL) V2 or any newer version +# 3. Apache License, V2.0 or any newer version +# +# You may not use this file except in compliance with at least one of +# the above three licenses. +# +# See LICENSE.html or LICENSE.txt at the top of this package for the +# complete terms and further detail along with the license texts for +# the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. +# +# + +plugindir = $(libdir)/redland + +plugin_LTLIBRARIES = librdf_storage_audiodb.la +librdf_storage_audiodb_la_SOURCES = rdf_storage_audiodb.c +librdf_storage_audiodb_la_CPPFLAGS = @AUDIODB_CPPFLAGS@ `pkg-config redland --cflags` -I@LIBRDF_SRC_DIR@ +librdf_storage_audiodb_la_LIBADD = @AUDIODB_LIBS@ -laudioDB +librdf_storage_audiodb_la_LDFLAGS = -module -avoid-version `pkg-config redland --libs` + +# Use tar, whatever it is called (better be GNU tar though) +TAR=@TAR@ + +# Why is this not in the default makefile? +CC=@CC@ + +AM_CPPFLAGS=@LIBRDF_INTERNAL_CPPFLAGS@ @LIBRDF_CPPFLAGS@ @LIBRDF_EXTERNAL_CPPFLAGS@ +AM_CFLAGS=@LIBRDF_INTERNAL_CPPFLAGS@ @LIBRDF_CPPFLAGS@ @LIBRDF_EXTERNAL_CPPFLAGS@ $(MEM) + + +AM_CPPFLAGS += -DPKGDATADIR="\"$(pkgdatadir)\"" +AM_CFLAGS += -DLIBRDF_MODULE_DIR="\"$(libdir)/redland\"" +AM_LDFLAGS = -L/usr/local/lib/ + +LOCAL_LIB_DIR=lib + +# rule for building tests in one step +COMPILE_LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ + +@SET_MAKE@ + +${top_build_prefix}libltdl/libltdlc.la: + cd ${top_build_prefix}libltdl && R(MAKE) libltdlc.la +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sparql/librdf/src/rdf_storage_audiodb.c Fri Jul 31 14:36:12 2009 +0000 @@ -0,0 +1,398 @@ +#ifdef HAVE_CONFIG_H +#include <rdf_config.h> +#endif + +#ifdef WIN32 +#include <win32_rdf_config.h> +#endif + +#include <unistd.h> +#include <fcntl.h> +#include <stdio.h> +#include <string.h> +#ifdef HAVE_STDLIB_H +#include <stdlib.h> /* for abort() as used in errors */ +#endif +#include <sys/types.h> + +#include <redland.h> +#include <audioDB_API.h> + + +typedef struct { + librdf_model* model; + librdf_storage* storage; + char *name; + size_t name_len; + int is_new; + + adb_t *adb; + +} librdf_storage_audiodb_instance; + +typedef struct { + librdf_storage* storage; + librdf_storage_audiodb_instance* audiodb_context; + int finished; + librdf_statement* statement; + librdf_statement* query_statement; + librdf_node* context; + +} librdf_storage_audiodb_find_statements_stream_context; + +static int librdf_storage_audiodb_init(librdf_storage* storage, const char *name, librdf_hash* options); +static int librdf_storage_audiodb_open(librdf_storage* storage, librdf_model* model); +static int librdf_storage_audiodb_close(librdf_storage* storage); +static int librdf_storage_audiodb_size(librdf_storage* storage); +static int librdf_storage_audiodb_add_statement(librdf_storage* storage, librdf_statement* statement); +static int librdf_storage_audiodb_add_statements(librdf_storage* storage, librdf_stream* statement_stream); +static int librdf_storage_audiodb_remove_statement(librdf_storage* storage, librdf_statement* statement); +static int librdf_storage_audiodb_contains_statement(librdf_storage* storage, librdf_statement* statement); +static librdf_stream* librdf_storage_audiodb_serialise(librdf_storage* storage); +static librdf_stream* librdf_storage_audiodb_find_statements(librdf_storage* storage, librdf_statement* statement); + +/* find_statements implementing functions */ +static int librdf_storage_audiodb_find_statements_end_of_stream(void* context); +static int librdf_storage_audiodb_find_statements_next_statement(void* context); +static void* librdf_storage_audiodb_find_statements_get_statement(void* context, int flags); +static void librdf_storage_audiodb_find_statements_finished(void* context); + +static int librdf_storage_audiodb_sync(librdf_storage *storage); + +static void librdf_storage_audiodb_register_factory(librdf_storage_factory *factory); +#ifdef MODULAR_LIBRDF +void librdf_storage_module_register_factory(librdf_world *world); +#endif + + +static int librdf_storage_audiodb_init(librdf_storage* storage, const char *name, librdf_hash* options) { + + librdf_storage_audiodb_instance* context; + char* name_copy; + + context = (librdf_storage_audiodb_instance*)LIBRDF_CALLOC(librdf_storage_audiodb_instance, 1, sizeof(librdf_storage_audiodb_instance)); + + if(!context) + { + if(options) + librdf_free_hash(options); + return 1; + } + + librdf_storage_set_instance(storage, context); + + context->storage = storage; + + // Store the name of the db + context->name_len=strlen(name); + name_copy=(char*)LIBRDF_MALLOC(cstring, context->name_len+1); + if(!name_copy) { + if(options) + librdf_free_hash(options); + return 1; + } + strncpy(name_copy, name, context->name_len+1); + context->name=name_copy; + + if(librdf_hash_get_as_boolean(options, "new") > 0) + context->is_new = 1; + + if(options) + librdf_free_hash(options); + + librdf_log(storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "Initialised!"); + + return 0; +} + +static int librdf_storage_audiodb_open(librdf_storage* storage, librdf_model* model) { + + librdf_storage_audiodb_instance* context = (librdf_storage_audiodb_instance*)storage->instance; + int db_file_exists = 0; + + librdf_log(storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "open"); + + if(!access((const char*)context->name, F_OK)) + db_file_exists = 1; + else + context->is_new = 1; + + if(context->is_new && db_file_exists) + unlink(context->name); + + context->adb = NULL; + + if(context->is_new) { + if(!(context->adb = audiodb_create(context->name, 0, 0, 0))) { + librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL, + "Unable to create %s", context->name); + return 1; + } + } + else + { + if(!(context->adb = audiodb_open(context->name, O_RDWR))) { + librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL, + "Unable to open %s", context->name); + return 1; + } + } + + return 0; +} + +static int librdf_storage_audiodb_close(librdf_storage* storage) { + librdf_storage_audiodb_instance* context = (librdf_storage_audiodb_instance*)storage->instance; + + librdf_log(storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "close"); + + if(context->adb) + { + audiodb_close(context->adb); + context->adb = NULL; + } + + return 0; +} + +static int librdf_storage_audiodb_size(librdf_storage* storage) { + librdf_log(storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "size"); + return 0; +} + +static int librdf_storage_audiodb_add_statement(librdf_storage* storage, librdf_statement* statement) { + librdf_log(storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "add statement"); + return 0; +} + +static int librdf_storage_audiodb_add_statements(librdf_storage* storage, librdf_stream* statement_stream) { + librdf_log(storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "add statements"); + return 0; +} + +static int librdf_storage_audiodb_remove_statement(librdf_storage* storage, librdf_statement* statement) { + librdf_log(storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "remove statement"); + return 0; +} + +static int librdf_storage_audiodb_contains_statement(librdf_storage* storage, librdf_statement* statement) { + librdf_log(storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "Contains statement"); + return 0; +} + +static librdf_stream* librdf_storage_audiodb_serialise(librdf_storage* storage) { + librdf_log(storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "serialise"); + return NULL; +} + +static librdf_stream* librdf_storage_audiodb_find_statements(librdf_storage* storage, librdf_statement* statement) { + + librdf_storage_audiodb_instance* context = (librdf_storage_audiodb_instance*)storage->instance; + librdf_storage_audiodb_find_statements_stream_context* scontext; + librdf_stream* stream; + + librdf_log(storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "find statements %s", librdf_statement_to_string(statement)); + + scontext = (librdf_storage_audiodb_find_statements_stream_context*)LIBRDF_CALLOC(librdf_storage_audiodb_find_statements_stream_context, 1, sizeof(librdf_storage_audiodb_find_statements_stream_context)); + + if(!scontext) + return NULL; + + scontext->storage = storage; + librdf_storage_add_reference(scontext->storage); + + scontext->audiodb_context = context; + + scontext->query_statement = librdf_new_statement_from_statement(statement); + if(!scontext->query_statement) { + librdf_storage_audiodb_find_statements_finished((void*)scontext); + return NULL; + } + + stream = librdf_new_stream(storage->world, + (void*)scontext, + &librdf_storage_audiodb_find_statements_end_of_stream, + &librdf_storage_audiodb_find_statements_next_statement, + &librdf_storage_audiodb_find_statements_get_statement, + &librdf_storage_audiodb_find_statements_finished); + + if(!stream) { + librdf_storage_audiodb_find_statements_finished((void*)scontext); + return NULL; + } + + return stream; +} + +static void librdf_storage_audiodb_find_statements_finished(void* context) { + librdf_storage_audiodb_find_statements_stream_context* scontext=(librdf_storage_audiodb_find_statements_stream_context*)context; + + if(scontext->storage) + librdf_storage_remove_reference(scontext->storage); + + if(scontext->query_statement) + librdf_free_statement(scontext->query_statement); + + if(scontext->statement) + librdf_free_statement(scontext->statement); + + if(scontext->context) + librdf_free_node(scontext->context); + + LIBRDF_FREE(librdf_storage_audiodb_find_statements_stream_context, scontext); +} + +static int librdf_storage_audiodb_get_next_common(librdf_storage_audiodb_instance* scontext, + librdf_statement **statement, + librdf_node **context_node) { + + librdf_node* node; + + + if(!*statement) { + if(!(*statement = librdf_new_statement(scontext->storage->world))) + return 1; + } + + librdf_log(scontext->storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "Handle statement %s", librdf_statement_to_string(statement)); + + librdf_statement_clear(*statement); + + node = librdf_new_node_from_uri_string(scontext->storage->world, "testing"); + + if(!node) + return 1; + + librdf_statement_set_subject(*statement, node); + + node = librdf_new_node_from_uri_string(scontext->storage->world, "foootle"); + + if(!node) + return 1; + + librdf_statement_set_predicate(*statement, node); + + node = librdf_new_node_from_uri_string(scontext->storage->world, "barble"); + + if(!node) + return 1; + + librdf_statement_set_object(*statement, node); + + return -1; +} + +static int librdf_storage_audiodb_find_statements_end_of_stream(void* context) { + librdf_storage_audiodb_find_statements_stream_context* scontext=(librdf_storage_audiodb_find_statements_stream_context*)context; + + if(scontext->finished) + return 1; + + if(scontext->statement == NULL) { + int result; + result = librdf_storage_audiodb_get_next_common(scontext->audiodb_context, + &scontext->statement, + &scontext->context); + + librdf_log(scontext->storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "Handle eos statement %s %d", librdf_statement_to_string(scontext->query_statement), result); + + if(result) { + scontext->finished = 1; + } + } + return scontext->finished; + +} + +static int librdf_storage_audiodb_find_statements_next_statement(void* context) { + librdf_storage_audiodb_find_statements_stream_context* scontext=(librdf_storage_audiodb_find_statements_stream_context*)context; + int result; + + + if(scontext->finished) + return 1; + + result = librdf_storage_audiodb_get_next_common(scontext->audiodb_context, + &scontext->statement, + &scontext->context); + + librdf_log(scontext->storage->world, 0, LIBRDF_LOG_INFO, LIBRDF_FROM_STORAGE, NULL, + "Handle next statement %s %d", librdf_statement_to_string(scontext->query_statement), result); + + if(result) { + scontext->finished = 1; + } + + return result; +} + +static void* librdf_storage_audiodb_find_statements_get_statement(void* context, int flags) { + librdf_storage_audiodb_find_statements_stream_context* scontext=(librdf_storage_audiodb_find_statements_stream_context*)context; + + switch(flags) { + case LIBRDF_ITERATOR_GET_METHOD_GET_OBJECT: + return scontext->statement; + case LIBRDF_ITERATOR_GET_METHOD_GET_CONTEXT: + return scontext->context; + default: + librdf_log(scontext->storage->world, + 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL, + "Unknown iterator method flag %d", flags); + return NULL; + } + +} + + + +static int librdf_storage_audiodb_sync(librdf_storage *storage) { + return 0; +} + +static void +librdf_storage_audiodb_register_factory(librdf_storage_factory *factory) { + LIBRDF_ASSERT_CONDITION(!strcmp(factory->name, "audiodb")); + + + factory->version = LIBRDF_STORAGE_INTERFACE_VERSION; + factory->init = librdf_storage_audiodb_init; + factory->open = librdf_storage_audiodb_open; + factory->close = librdf_storage_audiodb_close; + factory->size = librdf_storage_audiodb_size; + factory->add_statement = librdf_storage_audiodb_add_statement; + factory->remove_statement = librdf_storage_audiodb_remove_statement; + factory->contains_statement = librdf_storage_audiodb_contains_statement; + factory->serialise = librdf_storage_audiodb_serialise; + factory->find_statements = librdf_storage_audiodb_find_statements; +} + +#ifdef MODULAR_LIBRDF + +/** Entry point for dynamically loaded storage module */ +void librdf_storage_module_register_factory(librdf_world *world) { + librdf_storage_register_factory(world, "audiodb", "AudioDB", + &librdf_storage_audiodb_register_factory); +} + +#else + +void librdf_init_storage_audiodb(librdf_world *world) { + librdf_storage_register_factory(world, "audiodb", "AudioDB", + &librdf_storage_audiodb_register_factory); +} + +#endif + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sparql/mod_audiodb/Makefile.am Fri Jul 31 14:36:12 2009 +0000 @@ -0,0 +1,14 @@ +all: mod_audiodb.so + +SOURCE = mod_audiodb.c + +HEAD = mod_audiodb.h +ACLOCAL_AMFLAGS = -I m4 +EXTRA_DIST = $(SOURCE) $(HEAD) + +mod_audiodb.so: $(SOURCE) $(HEAD) + @APXS@ -Wc,-g\ -Wall `@APREQ2@ --ldflags --libs --includes` -lrdf -laudioDB -I/usr/include/ $(GLIB_CFLAGS) -c $(SOURCE) + +install: mod_audiodb.so + @APXS@ -i -a `test -f mod_audiodb.so && echo "mod_audiodb.so" || echo "mod_audiodb.la"` +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sparql/mod_audiodb/autogen.sh Fri Jul 31 14:36:12 2009 +0000 @@ -0,0 +1,346 @@ +#!/bin/sh +# +# autogen.sh - Generates initial makefiles from a pristine CVS tree +# +# USAGE: +# autogen.sh [configure options] +# +# Configuration is affected by environment variables as follows: +# +# DRYRUN +# If set to any value it will do no configuring but will emit the +# programs that would be run. +# e.g. DRYRUN=1 ./autogen.sh +# +# AUTOMAKE ACLOCAL AUTOCONF AUTOHEADER LIBTOOLIZE GTKDOCIZE +# If set (named after program) then this overrides any searching for +# the programs on the current PATH. +# e.g. AUTOMAKE=automake-1.7 ACLOCAL=aclocal-1.7 ./autogen.sh +# +# CONFIG_DIR (default ../config) +# The directory where fresh GNU config.guess and config.sub can be +# found for automatic copying in-place. +# +# PATH +# Where the programs are searched for +# +# SRCDIR (default .) +# Source directory +# +# This script is based on similar scripts used in various tools +# commonly made available via CVS and used with GNU automake. +# Try 'locate autogen.sh' on your system and see what you get. +# +# This script is in the public domain +# + +# Directory for the sources +SRCDIR=${SRCDIR-.} + +# Where the GNU config.sub, config.guess might be found +CONFIG_DIR=${CONFIG_DIR-../config} + +# The programs required for configuring which will be searched for +# in the current PATH. +# Set an envariable of the same name in uppercase, to override scan +# +programs="automake aclocal autoconf autoheader libtoolize" +confs=`find . -name configure.ac -print` +if grep "^GTK_DOC_CHECK" $confs >/dev/null; then + programs="$programs gtkdocize" +fi +if grep "^AC_CHECK_PROGS.SWIG" $confs >/dev/null; then + programs="$programs swig" +fi +ltdl= +if grep "^LTDL_INIT" $confs >/dev/null; then + ltdl="--ltdl" +fi + +# Some dependencies for autotools: +# automake 1.10 requires autoconf 2.60 +# automake 1.9 requires autoconf 2.58 +# automake 1.8 requires autoconf 2.58 +# automake 1.7 requires autoconf 2.54 +automake_min_vers=010700 +aclocal_min_vers=$automake_min_vers +autoconf_min_vers=025400 +autoheader_min_vers=$autoconf_min_vers +libtoolize_min_vers=020200 +gtkdocize_min_vers=010300 +swig_min_vers=010324 + +# Default program arguments +automake_args="--add-missing" +autoconf_args= +libtoolize_args="$ltdl --force --copy --automake" +gtkdocize_args="--copy" +aclocal_args= +automake_args="--gnu --add-missing --force --copy" +# --enable-gtk-doc does no harm if it's not available +configure_args="--enable-maintainer-mode --enable-gtk-doc" + + +# You should not need to edit below here +###################################################################### + + +# number comparisons may need a C locale +LANG=C +LC_NUMERIC=C + + +program=`basename $0` + +if test "X$DRYRUN" != X; then + DRYRUN=echo +fi + +cat > autogen-get-version.pl <<EOF +use File::Basename; +my \$prog=basename \$0; +die "\$prog: USAGE PATH PROGRAM-NAME\n e.g. \$prog /usr/bin/foo-123 foo\n" + unless @ARGV==2; + +my(\$path,\$name)=@ARGV; +exit 0 if !-f \$path; +die "\$prog: \$path not found\n" if !-r \$path; + +my \$mname=\$name; \$mname =~ s/^g(libtoolize)\$/\$1/; + +my(@vnums); +for my \$varg (qw(--version -version)) { + my \$cmd="\$path \$varg"; + open(PIPE, "\$cmd 2>&1 |") || next; + while(<PIPE>) { + chomp; + next if @vnums; # drain pipe if we got a vnums + next unless /^\$mname/i; + my(\$v)=/(\S+)\$/i; \$v =~ s/-.*\$//; + @vnums=grep { defined \$_ && !/^\s*\$/} map { s/\D//g; \$_; } split(/\./, \$v); + } + close(PIPE); + last if @vnums; +} + +@vnums=(@vnums, 0, 0, 0)[0..2]; +\$vn=join('', map { sprintf('%02d', \$_) } @vnums); +print "\$vn\n"; +exit 0; +EOF + +autogen_get_version="`pwd`/autogen-get-version.pl" + +trap "rm -f $autogen_get_version" 0 1 9 15 + + +update_prog_version() { + dir=$1 + prog=$2 + + # If there exists an envariable PROG in uppercase, use that and do not scan + ucprog=`echo $prog | tr 'a-z' 'A-Z' ` + eval env=\$${ucprog} + if test X$env != X; then + prog_name=$env + prog_vers=`perl $autogen_get_version $prog_name $prog` + + if test X$prog_vers = X; then + prog_vers=0 + fi + eval ${prog}_name=${prog_name} + eval ${prog}_vers=${prog_vers} + eval ${prog}_dir=environment + return + fi + + eval prog_name=\$${prog}_name + eval prog_vers=\$${prog}_vers + eval prog_dir=\$${prog}_dir + if test X$prog_vers = X; then + prog_vers=0 + fi + + save_PATH="$PATH" + + cd "$dir" + PATH=".:$PATH" + + names=`ls $prog* 2>/dev/null` + if [ "X$names" != "X" ]; then + for name in $names; do + vers=`perl $autogen_get_version $dir/$name $prog` + if [ "X$vers" = "X" ]; then + continue + fi + + if expr $vers '>' $prog_vers >/dev/null; then + prog_name=$name + prog_vers=$vers + prog_dir="$dir" + fi + done + fi + + eval ${prog}_name=${prog_name} + eval ${prog}_vers=${prog_vers} + eval ${prog}_dir=${prog_dir} + + PATH="$save_PATH" +} + + +check_prog_version() { + prog=$1 + + eval min=\$${prog}_min_vers + + eval prog_name=\$${prog}_name + eval prog_vers=\$${prog}_vers + eval prog_dir=\$${prog}_dir + + echo "$program: $prog program '$prog_name' V $prog_vers (min $min) in $prog_dir" 1>&2 + + rc=1 + if test $prog_vers != 0; then + if expr $prog_vers '<' $min >/dev/null; then + echo "$program: ERROR: \`$prog' version $prog_vers in $prog_dir is too old." + echo " (version $min or newer is required)" + rc=0 + else + # Things are ok, so set the ${prog} name + eval ${prog}=${prog_name} + fi + else + echo "$program: ERROR: You must have \`$prog' installed to compile this package." + echo " (version $min or newer is required)" + rc=0 + fi + + return $rc +} + + +# Find newest version of programs in the current PATH +save_args=${1+"$*"} +save_ifs="$IFS" +IFS=":" +set - $PATH +IFS="$save_ifs" + +echo "$program: Looking for programs: $programs" + +here=`pwd` +while [ $# -ne 0 ] ; do + dir=$1 + shift + if [ ! -d "$dir" ]; then + continue + fi + + for prog in $programs; do + update_prog_version "$dir" $prog + done +done +cd $here + +set - $save_args +# END Find programs + + +# Check the versions meet the requirements +for prog in $programs; do + if check_prog_version $prog; then + exit 1 + fi +done + +echo "$program: Dependencies satisfied" + +# Delete this libtoolize- generated directory now so that it is never +# considered by autogen.sh +$DRURUN rm -rf libltdl + +config_dir= +if test -d $CONFIG_DIR; then + config_dir=`cd $CONFIG_DIR; pwd` +fi + + +for coin in `find $SRCDIR -name configure.ac -print` +do + dir=`dirname $coin` + if test -f "$dir/NO-AUTO-GEN"; then + echo $program: Skipping $dir -- flagged as no auto-gen + else + echo " " + echo $program: Processing directory $dir + ( cd "$dir" + + # Ensure that these are created by the versions on this system + # (indirectly via automake) + $DRYRUN rm -f ltconfig ltmain.sh libtool stamp-h* + # Made by automake + $DRYRUN rm -f missing depcomp + # automake junk + $DRYRUN rm -rf autom4te*.cache + + if test "X$config_dir" != X; then + echo "$program: Updating config.guess and config.sub" + for file in config.guess config.sub; do + cfile=$config_dir/$file + if test -f $cfile; then + $DRYRUN rm -f $file + $DRYRUN cp -p $cfile $file + fi + done + fi + + echo "$program: Running $libtoolize $libtoolize_args" + $DRYRUN rm -f ltmain.sh libtool + eval $DRYRUN $libtoolize $libtoolize_args + + if grep "^GTK_DOC_CHECK" configure.ac >/dev/null; then + # gtkdocize junk + $DRYRUN rm -rf gtk-doc.make + echo "$program: Running $gtkdocize $gtkdocize_args" + $DRYRUN $gtkdocize $gtkdocize_args + fi + + echo "$program: Running $aclocal $aclocal_args" + $DRYRUN $aclocal $aclocal_args + if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then + echo "$program: Running $autoheader" + $DRYRUN $autoheader + fi + echo "$program: Running $automake $automake_args" + $DRYRUN $automake $automake_args $automake_args + echo "$program: Running $autoconf" + $DRYRUN $autoconf $autoconf_args + ) + fi +done + + +rm -f config.cache + +AUTOMAKE=$automake +AUTOCONF=$autoconf +ACLOCAL=$aclocal +export AUTOMAKE AUTOCONF ACLOCAL + +echo " " +if test -z "$*"; then + echo "$program: WARNING: Running \`configure' with arguments:" + echo "$configure_args" + echo "If you wish to pass others to it, please specify them on the" + echo "\`$program' command line." +fi + +echo "$program: Running ./configure $configure_args $@" +if test "X$DRYRUN" = X; then + $DRYRUN ./configure $configure_args "$@" \ + && echo "$program: Now type \`make' to compile this package" || exit 1 +else + $DRYRUN ./configure $configure_args "$@" +fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sparql/mod_audiodb/configure.ac Fri Jul 31 14:36:12 2009 +0000 @@ -0,0 +1,21 @@ +AC_INIT +AM_INIT_AUTOMAKE(mod_audiodb, 0.1) +AC_CONFIG_MACRO_DIR([m4]) + +AC_PROG_CC +AM_PROG_LIBTOOL + +AC_PATH_PROG([APXS], [apxs2], [false], [/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin]) +if test "$APXS" = false; then + AC_MSG_ERROR([Cannot find apxs2. Make sure you have apache-devel installed]) +fi + +AC_MSG_NOTICE([checking for apreq2]) +AC_PATH_PROG([APREQ2], [apreq2-config], [false], [/sbin:/usr/bin:/usr/local/sbin:/bin:/usr/bin]) +if test "$APREQ2" = false; then + AC_MSG_ERROR([Cannot find apreq2-config.]) +fi + +AC_SUBST(APXS) +AC_SUBST(APREQ2) +AC_OUTPUT(Makefile)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sparql/mod_audiodb/mod_audiodb.c Fri Jul 31 14:36:12 2009 +0000 @@ -0,0 +1,110 @@ + +#include <httpd.h> +#include <ap_config.h> +#include <http_config.h> +#include <http_protocol.h> +#include <apr_strings.h> +#include <librdf.h> +#include <apreq_module.h> +#include <apreq_parser.h> +#include <apreq_param.h> +#include "apreq2/apreq_module_apache2.h" + +static int ap_dump_table(void *baton, const char *key, const char *value) +{ + if (key && value) + fprintf(stderr, "%s:%s\n", key, value); + fflush(stderr); + return 1; +} + +static int log_out(void *user_data, librdf_log_message *message) +{ + fprintf(stderr, "%s\n", librdf_log_message_message(message)); + fflush(stderr); + return 1; +} + +static int adb_handle_sparql_req(request_rec *r) { + if(strcmp(r->handler, "audiodb-sparql-handler") != 0) { + return DECLINED; + } + + r->content_type = "text/plain"; + r->status = OK; + r->status_line = "200 OK"; + + if(!r->args) { + r->args = ""; + } + + const apr_table_t *form_table; + apreq_handle_t *h = apreq_handle_apache2(r); + if(apreq_args(h, &form_table) != APR_SUCCESS) + return DECLINED; + + const unsigned char *query_string = apr_table_get(form_table, "query"); + + int rc = 0; + + librdf_world* world = librdf_new_world(); + if(!world) + { + rc = 1; + goto error; + } + + + librdf_world_open(world); + librdf_world_set_logger(world, NULL, log_out); + librdf_storage* storage = librdf_new_storage(world, "audiodb", "/tmp/test.adb", "new='yes'"); + if(!storage) + { + rc = 2; + goto error; + } + + librdf_model *model; + if (!(model = librdf_new_model(world, storage, NULL))) + { + rc = 5; + goto error; + } + + librdf_query *query; + if (!(query = librdf_new_query(world, "sparql", NULL, query_string, NULL))) + { + rc = 3; + goto error; + } + + librdf_query_results *results; + if (!(results = librdf_query_execute(query, model))) + { + rc = 4; + goto error; + } + + ap_rprintf(r, "Everything went awesomely!"); + + rc = 0; + return r->status; + + error: + ap_rprintf(r, "Fail %d", rc); + return OK; +} + +static void mod_audiodb_register_hooks (apr_pool_t *p) { + ap_hook_handler(adb_handle_sparql_req, NULL, NULL, APR_HOOK_FIRST); +} + +module AP_MODULE_DECLARE_DATA audiodb_module = { + STANDARD20_MODULE_STUFF, + NULL, + NULL, + NULL, + NULL, + NULL, + mod_audiodb_register_hooks, +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sparql/tests/storage_test.c Fri Jul 31 14:36:12 2009 +0000 @@ -0,0 +1,30 @@ +#include <librdf.h> + +int main() +{ + librdf_world* world = librdf_new_world(); + librdf_storage* storage = librdf_new_storage(world, "audiodb", "test.adb", "new='yes'"); + + librdf_model *model; + if (!(model = librdf_new_model(world, storage, NULL))) + goto librdf_error; + + librdf_storage_close(storage); +/* + librdf_query *query; + if (!(query = librdf_new_query(world, "sparql", NULL, "PREFIX abc: <http://example.com/exampleOntology#> SELECT ?capital ?country WHERE { ?x abc:cityname ?capital ; abc:isCapitalOf ?y . ?y abc:countryname ?country ; abc:isInContinent abc:Africa . }", NULL))) + goto librdf_error; + + librdf_query_results *results; + if (!(results = librdf_query_execute(query, model))) + goto librdf_error; + + if(!librdf_query_results_is_bindings(results)) + goto librdf_error; +*/ + return 0; + + librdf_error: + printf("Wah!\n"); + return 1; +}