xref: /PHP-5.6/ext/dba/config.m4 (revision 38b68fc0)
1dnl
2dnl $Id$
3dnl
4
5dnl Suppose we need FlatFile if no support or only CDB is used.
6
7AC_DEFUN([PHP_DBA_STD_BEGIN],[
8  unset THIS_INCLUDE THIS_LIBS THIS_LFLAGS THIS_PREFIX THIS_RESULT
9])
10
11AC_DEFUN([PHP_TEMP_LDFLAGS],[
12  old_LDFLAGS=$LDFLAGS
13  LDFLAGS="$1 $LDFLAGS"
14  old_LIBS=$LIBS
15  LIBS="$2 $LIBS"
16  $3
17  LDFLAGS=$old_LDFLAGS
18  LIBS=$old_LIBS
19])
20
21dnl Assign INCLUDE/LFLAGS from PREFIX
22AC_DEFUN([PHP_DBA_STD_ASSIGN],[
23  if test -n "$THIS_PREFIX" && test "$THIS_PREFIX" != "/usr"; then
24    THIS_LFLAGS=$THIS_PREFIX/$PHP_LIBDIR
25  fi
26])
27
28dnl Standard check
29AC_DEFUN([PHP_DBA_STD_CHECK],[
30  THIS_RESULT=yes
31  if test -z "$THIS_INCLUDE"; then
32    AC_MSG_ERROR([DBA: Could not find necessary header file(s).])
33  fi
34  if test -z "$THIS_LIBS"; then
35    AC_MSG_ERROR([DBA: Could not find necessary library.])
36  fi
37])
38
39dnl Attach THIS_x to DBA_x
40AC_DEFUN([PHP_DBA_STD_ATTACH],[
41  PHP_ADD_LIBRARY_WITH_PATH($THIS_LIBS, $THIS_LFLAGS, DBA_SHARED_LIBADD)
42  unset THIS_INCLUDE THIS_LIBS THIS_LFLAGS THIS_PREFIX
43])
44
45dnl Print the result message
46dnl parameters(name [, full name [, empty or error message]])
47AC_DEFUN([PHP_DBA_STD_RESULT],[
48  THIS_NAME=[]translit($1,a-z0-9-,A-Z0-9_)
49  if test -n "$2"; then
50    THIS_FULL_NAME="$2"
51  else
52    THIS_FULL_NAME="$THIS_NAME"
53  fi
54  AC_MSG_CHECKING([for $THIS_FULL_NAME support])
55  if test -n "$3"; then
56    AC_MSG_ERROR($3)
57  fi
58  if test "$THIS_RESULT" = "yes" || test "$THIS_RESULT" = "builtin"; then
59    HAVE_DBA=1
60    eval HAVE_$THIS_NAME=1
61    AC_MSG_RESULT([$THIS_RESULT])
62  else
63    AC_MSG_RESULT(no)
64  fi
65  unset THIS_RESULT THIS_NAME THIS_FULL_NAME
66])
67
68dnl
69dnl Options
70dnl
71
72PHP_ARG_ENABLE(dba,,
73[  --enable-dba            Build DBA with bundled modules. To build shared DBA
74                          extension use --enable-dba=shared])
75
76PHP_ARG_WITH(qdbm,,
77[  --with-qdbm[=DIR]         DBA: QDBM support], no, no)
78
79PHP_ARG_WITH(gdbm,,
80[  --with-gdbm[=DIR]         DBA: GDBM support], no, no)
81
82PHP_ARG_WITH(ndbm,,
83[  --with-ndbm[=DIR]         DBA: NDBM support], no, no)
84
85PHP_ARG_WITH(db4,,
86[  --with-db4[=DIR]          DBA: Oracle Berkeley DB 4.x or 5.x support], no, no)
87
88PHP_ARG_WITH(db3,,
89[  --with-db3[=DIR]          DBA: Oracle Berkeley DB 3.x support], no, no)
90
91PHP_ARG_WITH(db2,,
92[  --with-db2[=DIR]          DBA: Oracle Berkeley DB 2.x support], no, no)
93
94PHP_ARG_WITH(db1,,
95[  --with-db1[=DIR]          DBA: Oracle Berkeley DB 1.x support/emulation], no, no)
96
97PHP_ARG_WITH(dbm,,
98[  --with-dbm[=DIR]          DBA: DBM support], no, no)
99
100PHP_ARG_WITH(tcadb,,
101[  --with-tcadb[=DIR]        DBA: Tokyo Cabinet abstract DB support], no, no)
102
103
104dnl
105dnl Library checks
106dnl
107
108# QDBM
109if test "$PHP_QDBM" != "no"; then
110  PHP_DBA_STD_BEGIN
111  for i in $PHP_QDBM /usr/local /usr; do
112    if test -f "$i/include/depot.h"; then
113      THIS_PREFIX=$i
114      THIS_INCLUDE=$i/include/depot.h
115      break
116    fi
117  done
118
119  if test -n "$THIS_INCLUDE"; then
120    for LIB in qdbm; do
121      PHP_CHECK_LIBRARY($LIB, dpopen, [
122        AC_DEFINE_UNQUOTED(QDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
123        AC_DEFINE(DBA_QDBM, 1, [ ])
124        THIS_LIBS=$LIB
125      ], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
126      if test -n "$THIS_LIBS"; then
127        break
128      fi
129    done
130  fi
131
132  PHP_DBA_STD_ASSIGN
133  PHP_DBA_STD_CHECK
134  PHP_DBA_STD_ATTACH
135fi
136PHP_DBA_STD_RESULT(qdbm)
137
138# GDBM
139if test "$PHP_GDBM" != "no"; then
140  PHP_DBA_STD_BEGIN
141  if test "$HAVE_QDBM" = "1"; then
142    PHP_DBA_STD_RESULT(gdbm, gdbm, [You cannot combine --with-gdbm with --with-qdbm])
143  fi
144  for i in $PHP_GDBM /usr/local /usr; do
145    if test -f "$i/include/gdbm.h"; then
146      THIS_PREFIX=$i
147      THIS_INCLUDE=$i/include/gdbm.h
148      break
149    fi
150  done
151
152  if test -n "$THIS_INCLUDE"; then
153    PHP_CHECK_LIBRARY(gdbm, gdbm_open, [
154      AC_DEFINE_UNQUOTED(GDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
155      AC_DEFINE(DBA_GDBM, 1, [ ])
156      THIS_LIBS=gdbm
157    ], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
158  fi
159
160  PHP_DBA_STD_ASSIGN
161  PHP_DBA_STD_CHECK
162  PHP_DBA_STD_ATTACH
163fi
164PHP_DBA_STD_RESULT(gdbm)
165
166# NDBM
167if test "$PHP_NDBM" != "no"; then
168  PHP_DBA_STD_BEGIN
169  for i in $PHP_NDBM /usr/local /usr; do
170    if test -f "$i/include/ndbm.h"; then
171      THIS_PREFIX=$i
172      THIS_INCLUDE=$i/include/ndbm.h
173      break
174    elif test -f "$i/include/db1/ndbm.h"; then
175      THIS_PREFIX=$i
176      THIS_INCLUDE=$i/include/db1/ndbm.h
177      break
178    fi
179  done
180
181  if test -n "$THIS_INCLUDE"; then
182    for LIB in ndbm db1 c; do
183      PHP_CHECK_LIBRARY($LIB, dbm_open, [
184        AC_DEFINE_UNQUOTED(NDBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
185        AC_DEFINE(DBA_NDBM, 1, [ ])
186        THIS_LIBS=$LIB
187      ], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
188      if test -n "$THIS_LIBS"; then
189        break
190      fi
191    done
192  fi
193
194  PHP_DBA_STD_ASSIGN
195  PHP_DBA_STD_CHECK
196  PHP_DBA_STD_ATTACH
197fi
198PHP_DBA_STD_RESULT(ndbm)
199
200dnl TCADB
201if test "$PHP_TCADB" != "no"; then
202  PHP_DBA_STD_BEGIN
203  for i in $PHP_TCADB /usr/local /usr; do
204	if test -f "$i/include/tcadb.h"; then
205	  THIS_PREFIX=$i
206	  PHP_ADD_INCLUDE($THIS_PREFIX/include)
207	  THIS_INCLUDE=$i/include/tcadb.h
208	  break
209	fi
210  done
211
212  if test -n "$THIS_INCLUDE"; then
213	for LIB in tokyocabinet; do
214	  PHP_CHECK_LIBRARY($LIB, tcadbopen, [
215		AC_DEFINE_UNQUOTED(TCADB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
216		AC_DEFINE(DBA_TCADB, 1, [ ])
217		THIS_LIBS=$LIB
218	  ], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
219	  if test -n "$THIS_LIBS"; then
220		break
221	  fi
222	done
223  fi
224
225  PHP_DBA_STD_ASSIGN
226  PHP_DBA_STD_CHECK
227  PHP_DBA_STD_ATTACH
228fi
229PHP_DBA_STD_RESULT(tcadb)
230
231dnl Berkeley specific (library and version test)
232dnl parameters(version, library list, function)
233AC_DEFUN([PHP_DBA_DB_CHECK],[
234  if test -z "$THIS_INCLUDE"; then
235    AC_MSG_ERROR([DBA: Could not find necessary header file(s).])
236  fi
237  for LIB in $2; do
238    if test -f $THIS_PREFIX/$PHP_LIBDIR/lib$LIB.a || test -f $THIS_PREFIX/$PHP_LIBDIR/lib$LIB.$SHLIB_SUFFIX_NAME; then
239      lib_found="";
240      PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/$PHP_LIBDIR, -l$LIB,[
241        AC_TRY_LINK([
242#include "$THIS_INCLUDE"
243        ],[
244          $3;
245        ],[
246          AC_EGREP_CPP(yes,[
247#include "$THIS_INCLUDE"
248#if DB_VERSION_MAJOR == $1 || ($1 == 4 && DB_VERSION_MAJOR == 5)
249            yes
250#endif
251          ],[
252            THIS_LIBS=$LIB
253            lib_found=1
254          ])
255        ])
256      ])
257      if test -n "$lib_found"; then
258        lib_found="";
259        break;
260      fi
261    fi
262  done
263  if test -z "$THIS_LIBS"; then
264    AC_MSG_CHECKING([for DB$1 major version])
265    AC_MSG_ERROR([Header contains different version])
266  fi
267  if test "$1" = "4"; then
268    AC_MSG_CHECKING([for DB4 minor version and patch level])
269    AC_EGREP_CPP(yes,[
270#include "$THIS_INCLUDE"
271#if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR != 1) || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 1 && DB_VERSION_PATCH >= 25)
272      yes
273#endif
274    ],[
275      AC_MSG_RESULT(ok)
276    ],[
277      AC_MSG_ERROR([Version 4.1 requires patch level 25])
278    ])
279  fi
280  if test "$ext_shared" = "yes"; then
281    AC_MSG_CHECKING([if dba can be used as shared extension])
282    AC_EGREP_CPP(yes,[
283#include "$THIS_INCLUDE"
284#if DB_VERSION_MAJOR > 3 || (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR > 2)
285      yes
286#endif
287    ],[
288      AC_MSG_RESULT(yes)
289    ],[
290      AC_MSG_ERROR([At least version 3.3 is required])
291    ])
292  fi
293  if test -n "$THIS_LIBS"; then
294    AC_DEFINE(DBA_DB$1, 1, [ ])
295    if test -n "$THIS_INCLUDE"; then
296      AC_DEFINE_UNQUOTED(DB$1_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
297    fi
298  else
299    AC_MSG_ERROR([DBA: Could not find necessary library.])
300  fi
301  THIS_RESULT=yes
302  DB$1_LIBS=$THIS_LIBS
303  DB$1_PREFIX=$THIS_PREFIX
304  DB$1_INCLUDE=$THIS_INCLUDE
305  PHP_DBA_STD_ASSIGN
306  PHP_DBA_STD_ATTACH
307])
308
309# DB4
310if test "$PHP_DB4" != "no"; then
311  PHP_DBA_STD_BEGIN
312  dbdp4="/usr/local/BerkeleyDB.4."
313  dbdp5="/usr/local/BerkeleyDB.5."
314  for i in $PHP_DB4 ${dbdp5}1 ${dbdp5}0 ${dbdp4}8 ${dbdp4}7 ${dbdp4}6 ${dbdp4}5 ${dbdp4}4 ${dbdp4}3 ${dbdp4}2 ${dbdp4}1 ${dbdp}0 /usr/local /usr; do
315    if test -f "$i/db5/db.h"; then
316      THIS_PREFIX=$i
317      THIS_INCLUDE=$i/db5/db.h
318      break
319    elif test -f "$i/db4/db.h"; then
320      THIS_PREFIX=$i
321      THIS_INCLUDE=$i/db4/db.h
322      break
323    elif test -f "$i/include/db5.3/db.h"; then
324      THIS_PREFIX=$i
325      THIS_INCLUDE=$i/include/db5.3/db.h
326      break
327    elif test -f "$i/include/db5.1/db.h"; then
328      THIS_PREFIX=$i
329      THIS_INCLUDE=$i/include/db5.1/db.h
330      break
331    elif test -f "$i/include/db5.0/db.h"; then
332      THIS_PREFIX=$i
333      THIS_INCLUDE=$i/include/db5.0/db.h
334      break
335    elif test -f "$i/include/db4.8/db.h"; then
336      THIS_PREFIX=$i
337      THIS_INCLUDE=$i/include/db4.8/db.h
338      break
339    elif test -f "$i/include/db4.7/db.h"; then
340      THIS_PREFIX=$i
341      THIS_INCLUDE=$i/include/db4.7/db.h
342      break
343    elif test -f "$i/include/db4.6/db.h"; then
344      THIS_PREFIX=$i
345      THIS_INCLUDE=$i/include/db4.6/db.h
346      break
347    elif test -f "$i/include/db4.5/db.h"; then
348      THIS_PREFIX=$i
349      THIS_INCLUDE=$i/include/db4.5/db.h
350      break
351    elif test -f "$i/include/db4/db.h"; then
352      THIS_PREFIX=$i
353      THIS_INCLUDE=$i/include/db4/db.h
354      break
355    elif test -f "$i/include/db/db4.h"; then
356      THIS_PREFIX=$i
357      THIS_INCLUDE=$i/include/db/db4.h
358      break
359    elif test -f "$i/include/db4.h"; then
360      THIS_PREFIX=$i
361      THIS_INCLUDE=$i/include/db4.h
362      break
363    elif test -f "$i/include/db.h"; then
364      THIS_PREFIX=$i
365      THIS_INCLUDE=$i/include/db.h
366      break
367    fi
368  done
369  PHP_DBA_DB_CHECK(4, db-5.3 db-5.1 db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
370fi
371PHP_DBA_STD_RESULT(db4,Berkeley DB4)
372
373# DB3
374if test "$PHP_DB3" != "no"; then
375  PHP_DBA_STD_BEGIN
376  if test "$HAVE_DB4" = "1"; then
377    PHP_DBA_STD_RESULT(db3, Berkeley DB3, [You cannot combine --with-db3 with --with-db4])
378  fi
379  for i in $PHP_DB3 /usr/local/BerkeleyDB.3.3 /usr/local/BerkeleyDB.3.2 /usr/local/BerkeleyDB.3.1 /usr/local/BerkeleyDB.3.0 /usr/local /usr; do
380    if test -f "$i/db3/db.h"; then
381      THIS_PREFIX=$i
382      THIS_INCLUDE=$i/include/db3/db.h
383      break
384    elif test -f "$i/include/db3/db.h"; then
385      THIS_PREFIX=$i
386      THIS_INCLUDE=$i/include/db3/db.h
387      break
388    elif test -f "$i/include/db/db3.h"; then
389      THIS_PREFIX=$i
390      THIS_INCLUDE=$i/include/db/db3.h
391      break
392    elif test -f "$i/include/db3.h"; then
393      THIS_PREFIX=$i
394      THIS_INCLUDE=$i/include/db3.h
395      break
396    elif test -f "$i/include/db.h"; then
397      THIS_PREFIX=$i
398      THIS_INCLUDE=$i/include/db.h
399      break
400    fi
401  done
402  PHP_DBA_DB_CHECK(3, db-3.3 db-3.2 db-3.1 db-3.0 db-3 db3 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
403fi
404PHP_DBA_STD_RESULT(db3,Berkeley DB3)
405
406# DB2
407if test "$PHP_DB2" != "no"; then
408  PHP_DBA_STD_BEGIN
409  if test "$HAVE_DB3" = "1" || test "$HAVE_DB4" = "1"; then
410    PHP_DBA_STD_RESULT(db2, Berkeley DB2, [You cannot combine --with-db2 with --with-db3 or --with-db4])
411  fi
412  for i in $PHP_DB2 $PHP_DB2/BerkeleyDB /usr/BerkeleyDB /usr/local /usr; do
413    if test -f "$i/db2/db.h"; then
414      THIS_PREFIX=$i
415      THIS_INCLUDE=$i/db2/db.h
416      break
417    elif test -f "$i/include/db2/db.h"; then
418      THIS_PREFIX=$i
419      THIS_INCLUDE=$i/include/db2/db.h
420      break
421    elif test -f "$i/include/db/db2.h"; then
422      THIS_PREFIX=$i
423      THIS_INCLUDE=$i/include/db/db2.h
424      break
425    elif test -f "$i/include/db2.h"; then
426      THIS_PREFIX=$i
427      THIS_INCLUDE=$i/include/db2.h
428      break
429    elif test -f "$i/include/db.h"; then
430      THIS_PREFIX=$i
431      THIS_INCLUDE=$i/include/db.h
432      break
433    fi
434  done
435  PHP_DBA_DB_CHECK(2, db-2 db2 db,  [(void)db_appinit("", NULL, (DB_ENV*)0, 0)])
436fi
437PHP_DBA_STD_RESULT(db2, Berkeley DB2)
438
439# DB1
440if test "$PHP_DB1" != "no"; then
441  PHP_DBA_STD_BEGIN
442  AC_MSG_CHECKING([for DB1 in library])
443  if test "$HAVE_DB4" = "1"; then
444    THIS_VERSION=4
445    THIS_LIBS=$DB4_LIBS
446    THIS_PREFIX=$DB4_PREFIX
447  elif test "$HAVE_DB3" = "1"; then
448    THIS_LIBS=$DB3_LIBS
449    THIS_PREFIX=$DB3_PREFIX
450  elif test "$HAVE_DB2" = "1"; then
451    THIS_VERSION=2
452    THIS_LIBS=$DB2_LIBS
453    THIS_PREFIX=$DB2_PREFIX
454  fi
455  if test "$HAVE_DB4" = "1" || test "$HAVE_DB3" = "1" || test "$HAVE_DB2" = "1"; then
456    AC_DEFINE_UNQUOTED(DB1_VERSION, "Berkeley DB 1.85 emulation in DB$THIS_VERSION", [ ])
457    for i in db$THIS_VERSION/db_185.h include/db$THIS_VERSION/db_185.h include/db/db_185.h; do
458      if test -f "$THIS_PREFIX/$i"; then
459        THIS_INCLUDE=$THIS_PREFIX/$i
460        break
461      fi
462    done
463  else
464    AC_DEFINE_UNQUOTED(DB1_VERSION, "Unknown DB1", [ ])
465    for i in $PHP_DB1 /usr/local /usr; do
466      if test -f "$i/db1/db.h"; then
467        THIS_PREFIX=$i
468        THIS_INCLUDE=$i/db1/db.h
469        break
470      elif test -f "$i/include/db1/db.h"; then
471        THIS_PREFIX=$i
472        THIS_INCLUDE=$i/include/db1/db.h
473        break
474      elif test -f "$i/include/db.h"; then
475        THIS_PREFIX=$i
476        THIS_INCLUDE=$i/include/db.h
477        break
478      fi
479    done
480    THIS_LIBS=db
481  fi
482  AC_MSG_RESULT([$THIS_LIBS])
483  AC_MSG_CHECKING([for DB1 in header])
484  AC_MSG_RESULT([$THIS_INCLUDE])
485  if test -n "$THIS_INCLUDE"; then
486    PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/$PHP_LIBDIR, -l$THIS_LIBS,[
487      AC_TRY_LINK([
488#include "$THIS_INCLUDE"
489      ],[
490        DB * dbp = dbopen("", 0, 0, DB_HASH, 0);
491      ],[
492        AC_DEFINE_UNQUOTED(DB1_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
493        AC_DEFINE(DBA_DB1, 1, [ ])
494        THIS_RESULT=yes
495      ],[
496        THIS_RESULT=no
497      ])
498    ])
499  fi
500  PHP_DBA_STD_ASSIGN
501  PHP_DBA_STD_CHECK
502  PHP_DBA_STD_ATTACH
503fi
504PHP_DBA_STD_RESULT(db1, DB1)
505
506# DBM
507if test "$PHP_DBM" != "no"; then
508  PHP_DBA_STD_BEGIN
509  if test "$HAVE_QDBM" = "1"; then
510    PHP_DBA_STD_RESULT(dbm, dbm, [You cannot combine --with-dbm with --with-qdbm])
511  fi
512  for i in $PHP_DBM /usr/local /usr; do
513    if test -f "$i/include/dbm.h"; then
514      THIS_PREFIX=$i
515      THIS_INCLUDE=$i/include/dbm.h
516      break
517    elif test -f "$i/include/gdbm/dbm.h"; then
518      THIS_PREFIX=$i
519      THIS_INCLUDE=$i/include/gdbm/dbm.h
520      break
521    fi
522  done
523
524  if test -n "$THIS_INCLUDE"; then
525    for LIB in dbm c gdbm; do
526      PHP_CHECK_LIBRARY($LIB, dbminit, [
527        AC_MSG_CHECKING(for DBM using GDBM)
528        AC_DEFINE_UNQUOTED(DBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
529        if test "$LIB" = "gdbm"; then
530          AC_DEFINE_UNQUOTED(DBM_VERSION, "GDBM", [ ])
531          AC_MSG_RESULT(yes)
532        else
533          AC_DEFINE_UNQUOTED(DBM_VERSION, "DBM", [ ])
534          AC_MSG_RESULT(no)
535        fi
536        AC_DEFINE(DBA_DBM, 1, [ ])
537        THIS_LIBS=$LIB
538      ], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
539      if test -n "$THIS_LIBS"; then
540        break
541      fi
542    done
543  fi
544
545  PHP_DBA_STD_ASSIGN
546  PHP_DBA_STD_CHECK
547  PHP_DBA_STD_ATTACH
548fi
549PHP_DBA_STD_RESULT(dbm)
550
551dnl
552dnl Bundled modules that should be enabled by default if any other option is enabled
553dnl
554if test "$PHP_DBA" != "no" || test "$HAVE_DBA" = "1" || test "$with_cdb" = "yes" || test "$enable_inifile" = "yes" || test "$enable_flatfile" = "yes"; then
555  php_dba_enable=yes
556else
557  php_dba_enable=no
558fi
559
560PHP_ARG_WITH(cdb,,
561[  --without-cdb[=DIR]       DBA: CDB support (bundled)], $php_dba_enable, no)
562
563PHP_ARG_ENABLE(inifile,,
564[  --disable-inifile       DBA: INI support (bundled)], $php_dba_enable, no)
565
566PHP_ARG_ENABLE(flatfile,,
567[  --disable-flatfile      DBA: FlatFile support (bundled)], $php_dba_enable, no)
568
569# CDB
570if test "$PHP_CDB" = "yes"; then
571  AC_DEFINE(DBA_CDB_BUILTIN, 1, [ ])
572  AC_DEFINE(DBA_CDB_MAKE, 1, [ ])
573  AC_DEFINE(DBA_CDB, 1, [ ])
574  cdb_sources="libcdb/cdb.c libcdb/cdb_make.c libcdb/uint32.c"
575  THIS_RESULT="builtin"
576elif test "$PHP_CDB" != "no"; then
577  PHP_DBA_STD_BEGIN
578  for i in $PHP_CDB /usr/local /usr; do
579    if test -f "$i/include/cdb.h"; then
580      THIS_PREFIX=$i
581      THIS_INCLUDE=$i/include/cdb.h
582      break
583    fi
584  done
585
586  if test -n "$THIS_INCLUDE"; then
587    for LIB in cdb c; do
588      PHP_CHECK_LIBRARY($LIB, cdb_read, [
589        AC_DEFINE_UNQUOTED(CDB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
590        AC_DEFINE(DBA_CDB, 1, [ ])
591        THIS_LIBS=$LIB
592      ], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
593      if test -n "$THIS_LIBS"; then
594        break
595      fi
596    done
597  fi
598
599  PHP_DBA_STD_ASSIGN
600  PHP_DBA_STD_CHECK
601  PHP_DBA_STD_ATTACH
602fi
603PHP_DBA_STD_RESULT(cdb)
604
605# INIFILE
606if test "$PHP_INIFILE" != "no"; then
607  AC_DEFINE(DBA_INIFILE, 1, [ ])
608  ini_sources="libinifile/inifile.c"
609  THIS_RESULT="builtin"
610fi
611PHP_DBA_STD_RESULT(inifile, [INI File])
612
613# FLATFILE
614if test "$PHP_FLATFILE" != "no"; then
615  AC_DEFINE(DBA_FLATFILE, 1, [ ])
616  flat_sources="libflatfile/flatfile.c"
617  THIS_RESULT="builtin"
618fi
619PHP_DBA_STD_RESULT(FlatFile, FlatFile)
620
621dnl
622dnl Extension setup
623dnl
624AC_MSG_CHECKING([whether to enable DBA interface])
625if test "$HAVE_DBA" = "1"; then
626  if test "$ext_shared" = "yes"; then
627    AC_MSG_RESULT([yes, shared])
628  else
629    AC_MSG_RESULT([yes])
630  fi
631  AC_DEFINE(HAVE_DBA, 1, [ ])
632  PHP_NEW_EXTENSION(dba, dba.c dba_cdb.c dba_dbm.c dba_gdbm.c dba_ndbm.c dba_db1.c dba_db2.c dba_db3.c dba_db4.c dba_flatfile.c dba_inifile.c dba_qdbm.c dba_tcadb.c $cdb_sources $flat_sources $ini_sources, $ext_shared)
633  PHP_ADD_BUILD_DIR($ext_builddir/libinifile)
634  PHP_ADD_BUILD_DIR($ext_builddir/libcdb)
635  PHP_ADD_BUILD_DIR($ext_builddir/libflatfile)
636  PHP_SUBST(DBA_SHARED_LIBADD)
637else
638  AC_MSG_RESULT(no)
639fi
640