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