# # SYNOPSIS # # AX_SAGA_CHECK_SQLITE3([MINIMUM-VERSION]) # # DESCRIPTION # # Test for the SQLITE3 libraries of a particular version (or newer) # # If no path to the installed sqlite3 library is given, # the macro searchs under /usr, /usr/local, /opt and # /usr/local/package/sqlite3-* # # This macro calls: # # AC_SUBST(HAVE_SQLITE3) # AC_SUBST(SQLITE3_LOCATION) # AC_SUBST(SQLITE3_CPPFLAGS) # AC_SUBST(SQLITE3_LDFLAGS) # # LAST MODIFICATION # # 2007-03-04 # # COPYLEFT # # Copyright (c) 2007 Andre Merzky # # Copying and distribution of this file, with or without # modification, are permitted in any medium without royalty provided # the copyright notice and this notice are preserved. AC_DEFUN([AX_SAGA_CHECK_SQLITE3], [ AC_ARG_VAR([SQLITE3_LOCATION],[SQLITE3 installation directory]) HAVE_SQLITE3=no tmp_location="" AC_ARG_WITH([sqlite3], AS_HELP_STRING([--with-sqlite3=DIR], [use sqlite3 (default is YES) at DIR (optional)]), [ if test "$withval" = "no"; then want_sqlite3="no" elif test "$withval" = "yes"; then want_sqlite3="yes" tmp_location="" else want_sqlite3="yes" tmp_location="$withval" fi ], [want_sqlite3="yes"]) # use SQLITE3_LOCATION if avaialble, and if not # overwritten by --with-sqlite3= if test "x$want_sqlite3" = "xyes"; then # unused # sqlite3_lib_version_req=ifelse([$1], ,0.8.6,$1) packages=`ls /usr/local/package/sqlite3-* 2>>/dev/null` for tmp_path in $tmp_location $SQLITE3_LOCATION /usr /usr/local /opt $packages; do AC_MSG_CHECKING(for sqlite3 in $tmp_path) saved_cppflags=$CPPFLAGS saved_ldflags=$LDFLAGS SQLITE3_PATH=$tmp_path SQLITE3_LDFLAGS="-L$tmp_path/lib/ -lsqlite3" SQLITE3_CPPFLAGS="-I$tmp_path/include/" CPPFLAGS="$CPPFLAGS $SQLITE3_CPPFLAGS" export CPPFLAGS LDFLAGS="$LDFLAGS $SQLITE3_LDFLAGS" export LDFLAGS AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], [[sqlite3 *db; int t = 1; return (sqlite3_open ("test_db", &db)); ]])], link_sqlite3="yes", link_sqlite3="no") if test "x$link_sqlite3" = "xno"; then AC_MSG_RESULT(no) LDFLAGS=$saved_ldflags CPPFLAGS=$saved_cppflags else AC_MSG_RESULT(yes) SQLITE3_LOCATION=$tmp_path HAVE_SQLITE3=yes export HAVE_SQLITE3 AC_SUBST(HAVE_SQLITE3) AC_SUBST(SQLITE3_LOCATION) AC_SUBST(SQLITE3_CPPFLAGS) AC_SUBST(SQLITE3_LDFLAGS) if test "$tmp_location" != "" && \ test "$tmp_location" != "$tmp_path" ; then AC_MSG_WARN([SQLITE3 found: not in $tmp_location but in $tmp_path]) fi break; fi # link ok done # foreach path if test "$HAVE_SQLITE3" == "no" ; then AC_MSG_WARN(SQLITE3 not found) fi fi # want_sqlite3 ])