config.m4 17 KB

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