2 # Copyright (c) 2004-2009 Oracle. All rights reserved.
4 # http://www.apache.org/licenses/LICENSE-2.0.txt
8 dnl config.m4 for extension db4
10 dnl Comments in this file start with the string 'dnl'.
11 dnl Remove where necessary. This file will not work
14 PHP_ARG_WITH(db4, whether to enable db4 support,
15 [ --with-db4 Enable db4 support])
17 PHP_ARG_WITH(mod_db4, whether to link against mod_db4,
18 [ --with-mod_db4 Enable mod_db4 support])
20 if 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
26 THIS_INCLUDE=$i/db4/db.h
28 elif test -f "$i/include/db4/db.h"; then
30 INC_DIR=$i/include/db4
31 THIS_INCLUDE=$i/include/db4/db.h
33 elif test -f "$i/include/db/db4.h"; then
35 INC_DIR=$i/include/db4
36 THIS_INCLUDE=$i/include/db/db4.h
38 elif test -f "$i/include/db4.h"; then
41 THIS_INCLUDE=$i/include/db4.h
43 elif test -f "$i/include/db.h"; then
46 THIS_INCLUDE=$i/include/db.h
50 PHP_ADD_INCLUDE($INC_DIR)
51 PHP_ADD_LIBRARY_WITH_PATH(db_cxx, $THIS_PREFIX/lib, DB4_SHARED_LIBADD)
53 AC_MSG_CHECKING([if we really need to link against mod_db4])
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
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])
65 elif test "$PHP_MOD_DB4" = "no"; then
66 PHP_ADD_LIBRARY(db_cxx, $THIS_PREFIX/lib, DB4_SHARED_LIBADD)
69 AC_MSG_RESULT([err, don't really know] $PHP_MOD_DB4)
71 EXTRA_CXXFLAGS="-g -DHAVE_CONFIG_H -O2 -Wall"
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.])