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