1# 2# Copyright (c) 2004,2008 Oracle. All rights reserved. 3# 4# http://www.apache.org/licenses/LICENSE-2.0.txt 5# 6 7dnl $Id: config.m4,v 12.11 2008/01/08 20:58:46 bostic Exp $ 8dnl config.m4 for extension db4 9 10dnl Comments in this file start with the string 'dnl'. 11dnl Remove where necessary. This file will not work 12dnl without editing. 13 14PHP_ARG_WITH(db4, whether to enable db4 support, 15[ --with-db4 Enable db4 support]) 16 17PHP_ARG_WITH(mod_db4, whether to link against mod_db4, 18[ --with-mod_db4 Enable mod_db4 support]) 19 20if test "$PHP_DB4" != "no"; then 21 if test "$PHP_DB4" != "no"; then 22 for i in $PHP_DB4 /usr/local/BerkeleyDB.4.7 /usr/local /usr; do 23 if test -f "$i/db4/db.h"; then 24 THIS_PREFIX=$i 25 INC_DIR=$i/db4 26 THIS_INCLUDE=$i/db4/db.h 27 break 28 elif test -f "$i/include/db4/db.h"; then 29 THIS_PREFIX=$i 30 INC_DIR=$i/include/db4 31 THIS_INCLUDE=$i/include/db4/db.h 32 break 33 elif test -f "$i/include/db/db4.h"; then 34 THIS_PREFIX=$i 35 INC_DIR=$i/include/db4 36 THIS_INCLUDE=$i/include/db/db4.h 37 break 38 elif test -f "$i/include/db4.h"; then 39 THIS_PREFIX=$i 40 INC_DIR=$i/include 41 THIS_INCLUDE=$i/include/db4.h 42 break 43 elif test -f "$i/include/db.h"; then 44 THIS_PREFIX=$i 45 INC_DIR=$i/include 46 THIS_INCLUDE=$i/include/db.h 47 break 48 fi 49 done 50 PHP_ADD_INCLUDE($INC_DIR) 51 PHP_ADD_LIBRARY_WITH_PATH(db_cxx, $THIS_PREFIX/lib, DB4_SHARED_LIBADD) 52 fi 53 AC_MSG_CHECKING([if we really need to link against mod_db4]) 54 55 # crazy hard-coding to yes in shared extension builds is really annoying 56 # user must specify a path for PHP_MOD_DB4 57 if test "$PHP_MOD_DB4" = "yes" ; then 58 PHP_MOD_DB4="no" 59 fi 60 61 if test "$PHP_MOD_DB4" != "no" && test "$PHP_MOD_DB4" != "yes"; then 62 PHP_ADD_INCLUDE("$PHP_MOD_DB4") 63 AC_DEFINE(HAVE_MOD_DB4, 1, [Whether you have mod_db4]) 64 AC_MSG_RESULT(yes) 65 elif test "$PHP_MOD_DB4" = "no"; then 66 PHP_ADD_LIBRARY(db_cxx, $THIS_PREFIX/lib, DB4_SHARED_LIBADD) 67 AC_MSG_RESULT(no) 68 else 69 AC_MSG_RESULT([err, don't really know] $PHP_MOD_DB4) 70 fi 71 EXTRA_CXXFLAGS="-g -DHAVE_CONFIG_H -O2 -Wall" 72 PHP_REQUIRE_CXX() 73 PHP_ADD_LIBRARY(stdc++, 1, DB4_SHARED_LIBADD) 74 PHP_NEW_EXTENSION(db4, db4.cpp, $ext_shared) 75 PHP_ADD_MAKEFILE_FRAGMENT 76 PHP_SUBST(DB4_SHARED_LIBADD) 77 AC_MSG_WARN([*** A note about pthreads *** 78 The db4 c++ library by default tries to link against libpthread on some 79 systems (notably Linux). If your PHP install is not linked against 80 libpthread, you will need to disable pthread support in db4. This can 81 be done by compiling db4 with the flag --with-mutex=x86/gcc-assembly. 82 PHP can itself be forced to link against libpthread either by manually editing 83 its build files (which some distributions do), or by building it with 84 --with-experimental-zts.]) 85 86 87fi 88