File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / sqlite / config.m4
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:01 2012 UTC (13 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_3_10, HEAD
php

    1: dnl $Id: config.m4,v 1.1.1.1 2012/02/21 23:48:01 misho Exp $
    2: dnl config.m4 for extension sqlite
    3: dnl vim:et:ts=2:sw=2
    4: 
    5: PHP_ARG_WITH(sqlite, for sqlite support,
    6: [  --without-sqlite=DIR    Do not include sqlite support.  DIR is the sqlite base
    7:                           install directory [BUNDLED]], yes)
    8: 
    9: PHP_ARG_ENABLE(sqlite-utf8, whether to enable UTF-8 support in sqlite (default: ISO-8859-1),
   10: [  --enable-sqlite-utf8      SQLite: Enable UTF-8 support for SQLite], no, no)
   11: 
   12: 
   13: 
   14: dnl
   15: dnl PHP_PROG_LEMON
   16: dnl
   17: dnl Search for lemon binary and check its version
   18: dnl
   19: AC_DEFUN([PHP_PROG_LEMON],[
   20:   # we only support certain lemon versions
   21:   lemon_version_list="1.0"
   22: 
   23:   AC_CHECK_PROG(LEMON, lemon, lemon)
   24:   if test "$LEMON"; then
   25:     AC_CACHE_CHECK([for lemon version], php_cv_lemon_version, [
   26:       lemon_version=`$LEMON -x 2>/dev/null | $SED -e 's/^.* //'`
   27:       php_cv_lemon_version=invalid
   28:       for lemon_check_version in $lemon_version_list; do
   29:         if test "$lemon_version" = "$lemon_check_version"; then
   30:           php_cv_lemon_version="$lemon_check_version (ok)"
   31:         fi
   32:       done
   33:     ])
   34:   else
   35:     lemon_version=none
   36:   fi
   37:   case $php_cv_lemon_version in
   38:     ""|invalid[)]
   39:       lemon_msg="lemon versions supported for regeneration of libsqlite parsers: $lemon_version_list (found: $lemon_version)."
   40:       AC_MSG_WARN([$lemon_msg])
   41:       LEMON="exit 0;"
   42:       ;;
   43:   esac
   44:   PHP_SUBST(LEMON)
   45: ])
   46: 
   47: 
   48: if test "$PHP_SQLITE" != "no"; then
   49:   if test "$PHP_PDO" != "no"; then
   50:     PHP_CHECK_PDO_INCLUDES([], [AC_MSG_WARN([Cannot find php_pdo_driver.h.])])
   51:     if test -n "$pdo_inc_path"; then
   52:       AC_DEFINE([PHP_SQLITE2_HAVE_PDO], [1], [Have PDO])
   53:       pdo_inc_path="-I$pdo_inc_path"
   54:     fi
   55:   fi  
   56: 
   57:   if test "$PHP_SQLITE" != "yes"; then
   58:     SEARCH_PATH="/usr/local /usr"
   59:     SEARCH_FOR="/include/sqlite.h"
   60:     if test -r $PHP_SQLITE/; then # path given as parameter
   61:       SQLITE_DIR=$PHP_SQLITE
   62:     else # search default path list
   63:       AC_MSG_CHECKING([for sqlite files in default path])
   64:       for i in $SEARCH_PATH ; do
   65:         if test -r $i/$SEARCH_FOR; then
   66:           SQLITE_DIR=$i
   67:           AC_MSG_RESULT(found in $i)
   68:         fi
   69:       done
   70:     fi
   71:   
   72:     if test -z "$SQLITE_DIR"; then
   73:       AC_MSG_RESULT([not found])
   74:       AC_MSG_ERROR([Please reinstall the sqlite distribution from http://www.sqlite.org])
   75:     fi
   76: 
   77:     PHP_CHECK_LIBRARY(sqlite, sqlite_open, [
   78:       PHP_ADD_LIBRARY_WITH_PATH(sqlite, $SQLITE_DIR/$PHP_LIBDIR, SQLITE_SHARED_LIBADD)
   79:       PHP_ADD_INCLUDE($SQLITE_DIR/include)
   80:     ],[
   81:       AC_MSG_ERROR([wrong sqlite lib version or lib not found])
   82:     ],[
   83:       -L$SQLITE_DIR/$PHP_LIBDIR -lm
   84:     ])
   85:     SQLITE_MODULE_TYPE=external
   86:     PHP_SQLITE_CFLAGS=$pdo_inc_path
   87:     sqlite_extra_sources="libsqlite/src/encode.c"
   88:   else
   89:     # use bundled library
   90:     PHP_PROG_LEMON
   91:     SQLITE_MODULE_TYPE=builtin
   92:     PHP_SQLITE_CFLAGS="-I@ext_srcdir@/libsqlite/src -I@ext_builddir@/libsqlite/src $pdo_inc_path"
   93:     sqlite_extra_sources="libsqlite/src/opcodes.c \
   94:         libsqlite/src/parse.c libsqlite/src/encode.c \
   95:         libsqlite/src/auth.c libsqlite/src/btree.c libsqlite/src/build.c \
   96:         libsqlite/src/delete.c libsqlite/src/expr.c libsqlite/src/func.c \
   97:         libsqlite/src/hash.c libsqlite/src/insert.c libsqlite/src/main.c \
   98:         libsqlite/src/os.c libsqlite/src/pager.c \
   99:         libsqlite/src/printf.c libsqlite/src/random.c \
  100:         libsqlite/src/select.c libsqlite/src/table.c libsqlite/src/tokenize.c \
  101:         libsqlite/src/update.c libsqlite/src/util.c libsqlite/src/vdbe.c \
  102:         libsqlite/src/attach.c libsqlite/src/btree_rb.c libsqlite/src/pragma.c \
  103:         libsqlite/src/vacuum.c libsqlite/src/copy.c \
  104:         libsqlite/src/vdbeaux.c libsqlite/src/date.c \
  105:         libsqlite/src/where.c libsqlite/src/trigger.c"
  106:   fi
  107:   dnl
  108:   dnl Common for both bundled/external
  109:   dnl
  110:   sqlite_sources="sqlite.c sess_sqlite.c pdo_sqlite2.c $sqlite_extra_sources" 
  111:   PHP_NEW_EXTENSION(sqlite, $sqlite_sources, $ext_shared,,$PHP_SQLITE_CFLAGS)
  112:   PHP_ADD_EXTENSION_DEP(sqlite, spl, true)
  113:   PHP_ADD_EXTENSION_DEP(sqlite, pdo, true)
  114: 
  115:   PHP_ADD_MAKEFILE_FRAGMENT
  116:   PHP_SUBST(SQLITE_SHARED_LIBADD)
  117:   PHP_INSTALL_HEADERS([$ext_builddir/libsqlite/src/sqlite.h])
  118:   
  119:   if test "$SQLITE_MODULE_TYPE" = "builtin"; then
  120:     PHP_ADD_BUILD_DIR($ext_builddir/libsqlite/src, 1)
  121:     AC_CHECK_SIZEOF(char *, 4)
  122:     AC_DEFINE(SQLITE_PTR_SZ, SIZEOF_CHAR_P, [Size of a pointer])
  123:     dnl use latin 1 for SQLite older than 2.8.9; the utf-8 handling 
  124:     dnl in funcs.c uses assert(), which is a bit silly and something 
  125:     dnl we want to avoid. This assert() was removed in SQLite 2.8.9.
  126:     if test "$PHP_SQLITE_UTF8" = "yes"; then
  127:       SQLITE_ENCODING="UTF8"
  128:       AC_DEFINE(SQLITE_UTF8, 1, [ ])
  129:     else
  130:       SQLITE_ENCODING="ISO8859"
  131:     fi
  132:     PHP_SUBST(SQLITE_ENCODING)
  133: 
  134:     SQLITE_VERSION=`cat $ext_srcdir/libsqlite/VERSION`
  135:     PHP_SUBST(SQLITE_VERSION)
  136: 
  137:     sed -e s/--VERS--/$SQLITE_VERSION/ -e s/--ENCODING--/$SQLITE_ENCODING/ $ext_srcdir/libsqlite/src/sqlite.h.in > $ext_builddir/libsqlite/src/sqlite.h
  138: 
  139:     if test "$ext_shared" = "no" || test "$ext_srcdir" != "$abs_srcdir"; then
  140:       echo '#include <php_config.h>' > $ext_builddir/libsqlite/src/config.h
  141:     else
  142:       echo "#include \"$abs_builddir/config.h\"" > $ext_builddir/libsqlite/src/config.h
  143:     fi
  144:     
  145:     cat >> $ext_builddir/libsqlite/src/config.h <<EOF
  146: #if ZTS
  147: # define THREADSAFE 1
  148: #endif
  149: #if !ZEND_DEBUG
  150: # define NDEBUG
  151: #endif
  152: EOF
  153:   fi
  154:   
  155:   AC_CHECK_FUNCS(usleep nanosleep)
  156:   AC_CHECK_HEADERS(time.h)
  157: fi

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>