config.m4 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. dnl config.m4 for extension dba
  2. dnl Suppose we need FlatFile if no support or only CDB is used.
  3. AC_DEFUN([PHP_DBA_STD_BEGIN],[
  4. unset THIS_INCLUDE THIS_LIBS THIS_LFLAGS THIS_PREFIX THIS_RESULT
  5. ])
  6. AC_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. dnl Assign INCLUDE/LFLAGS from PREFIX
  16. AC_DEFUN([PHP_DBA_STD_ASSIGN],[
  17. if test -n "$THIS_PREFIX" && test "$THIS_PREFIX" != "/usr"; then
  18. THIS_LFLAGS=$THIS_PREFIX/$PHP_LIBDIR
  19. fi
  20. ])
  21. dnl Standard check
  22. AC_DEFUN([PHP_DBA_STD_CHECK],[
  23. THIS_RESULT=yes
  24. if test -z "$THIS_INCLUDE"; then
  25. AC_MSG_ERROR([DBA: Could not find necessary header file(s).])
  26. fi
  27. if test -z "$THIS_LIBS"; then
  28. AC_MSG_ERROR([DBA: Could not find necessary library.])
  29. fi
  30. ])
  31. dnl Attach THIS_x to DBA_x
  32. AC_DEFUN([PHP_DBA_STD_ATTACH],[
  33. PHP_ADD_LIBRARY_WITH_PATH($THIS_LIBS, $THIS_LFLAGS, DBA_SHARED_LIBADD)
  34. unset THIS_INCLUDE THIS_LIBS THIS_LFLAGS THIS_PREFIX
  35. ])
  36. dnl Print the result message
  37. dnl parameters(name [, full name [, empty or error message]])
  38. AC_DEFUN([PHP_DBA_STD_RESULT],[
  39. THIS_NAME=[]translit($1,a-z0-9-,A-Z0-9_)
  40. if test -n "$2"; then
  41. THIS_FULL_NAME="$2"
  42. else
  43. THIS_FULL_NAME="$THIS_NAME"
  44. fi
  45. AC_MSG_CHECKING([for $THIS_FULL_NAME support])
  46. if test -n "$3"; then
  47. AC_MSG_ERROR($3)
  48. fi
  49. if test "$THIS_RESULT" = "yes" || test "$THIS_RESULT" = "builtin"; then
  50. HAVE_DBA=1
  51. eval HAVE_$THIS_NAME=1
  52. AC_MSG_RESULT([$THIS_RESULT])
  53. else
  54. AC_MSG_RESULT(no)
  55. fi
  56. unset THIS_RESULT THIS_NAME THIS_FULL_NAME
  57. ])
  58. dnl
  59. dnl Options
  60. dnl
  61. PHP_ARG_ENABLE(dba,,
  62. [ --enable-dba Build DBA with bundled modules. To build shared DBA
  63. extension use --enable-dba=shared])
  64. PHP_ARG_WITH(qdbm,,
  65. [ --with-qdbm[=DIR] DBA: QDBM support], no, no)
  66. PHP_ARG_WITH(gdbm,,
  67. [ --with-gdbm[=DIR] DBA: GDBM support], no, no)
  68. PHP_ARG_WITH(ndbm,,
  69. [ --with-ndbm[=DIR] DBA: NDBM support], no, no)
  70. PHP_ARG_WITH(db4,,
  71. [ --with-db4[=DIR] DBA: Oracle Berkeley DB 4.x or 5.x support], no, no)
  72. PHP_ARG_WITH(db3,,
  73. [ --with-db3[=DIR] DBA: Oracle Berkeley DB 3.x support], no, no)
  74. PHP_ARG_WITH(db2,,
  75. [ --with-db2[=DIR] DBA: Oracle Berkeley DB 2.x support], no, no)
  76. PHP_ARG_WITH(db1,,
  77. [ --with-db1[=DIR] DBA: Oracle Berkeley DB 1.x support/emulation], no, no)
  78. PHP_ARG_WITH(dbm,,
  79. [ --with-dbm[=DIR] DBA: DBM support], no, no)
  80. PHP_ARG_WITH(tcadb,,
  81. [ --with-tcadb[=DIR] DBA: Tokyo Cabinet abstract DB support], no, no)
  82. PHP_ARG_WITH(lmdb,,
  83. [ --with-lmdb[=DIR] DBA: Lightning memory-mapped database 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 LMDB
  199. if test "$PHP_LMDB" != "no"; then
  200. PHP_DBA_STD_BEGIN
  201. for i in $PHP_LMDB /usr/local /usr; do
  202. if test -f "$i/include/lmdb.h"; then
  203. THIS_PREFIX=$i
  204. PHP_ADD_INCLUDE($THIS_PREFIX/include)
  205. THIS_INCLUDE=$i/include/lmdb.h
  206. break
  207. fi
  208. done
  209. if test -n "$THIS_INCLUDE"; then
  210. for LIB in lmdb; do
  211. PHP_CHECK_LIBRARY($LIB, mdb_env_open, [
  212. AC_DEFINE_UNQUOTED(LMDB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
  213. AC_DEFINE(DBA_LMDB, 1, [ ])
  214. THIS_LIBS=$LIB
  215. ], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
  216. if test -n "$THIS_LIBS"; then
  217. break
  218. fi
  219. done
  220. fi
  221. PHP_DBA_STD_ASSIGN
  222. PHP_DBA_STD_CHECK
  223. PHP_DBA_STD_ATTACH
  224. fi
  225. PHP_DBA_STD_RESULT(lmdb)
  226. dnl Berkeley specific (library and version test)
  227. dnl parameters(version, library list, function)
  228. AC_DEFUN([PHP_DBA_DB_CHECK],[
  229. if test -z "$THIS_INCLUDE"; then
  230. AC_MSG_ERROR([DBA: Could not find necessary header file(s).])
  231. fi
  232. for LIB in $2; do
  233. if test -f $THIS_PREFIX/$PHP_LIBDIR/lib$LIB.a || test -f $THIS_PREFIX/$PHP_LIBDIR/lib$LIB.$SHLIB_SUFFIX_NAME; then
  234. lib_found="";
  235. PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/$PHP_LIBDIR, -l$LIB,[
  236. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  237. #include "$THIS_INCLUDE"
  238. ]],[[
  239. $3;
  240. ]])],[
  241. AC_EGREP_CPP(yes,[
  242. #include "$THIS_INCLUDE"
  243. #if DB_VERSION_MAJOR == $1 || ($1 == 4 && DB_VERSION_MAJOR == 5)
  244. yes
  245. #endif
  246. ],[
  247. THIS_LIBS=$LIB
  248. lib_found=1
  249. ])
  250. ],[])
  251. ])
  252. if test -n "$lib_found"; then
  253. lib_found="";
  254. break;
  255. fi
  256. fi
  257. done
  258. if test -z "$THIS_LIBS"; then
  259. AC_MSG_CHECKING([for DB$1 major version])
  260. AC_MSG_ERROR([Header contains different version])
  261. fi
  262. if test "$1" = "4"; then
  263. AC_MSG_CHECKING([for DB4 minor version and patch level])
  264. AC_EGREP_CPP(yes,[
  265. #include "$THIS_INCLUDE"
  266. #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)
  267. yes
  268. #endif
  269. ],[
  270. AC_MSG_RESULT(ok)
  271. ],[
  272. AC_MSG_ERROR([Version 4.1 requires patch level 25])
  273. ])
  274. fi
  275. if test "$ext_shared" = "yes"; then
  276. AC_MSG_CHECKING([if dba can be used as shared extension])
  277. AC_EGREP_CPP(yes,[
  278. #include "$THIS_INCLUDE"
  279. #if DB_VERSION_MAJOR > 3 || (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR > 2)
  280. yes
  281. #endif
  282. ],[
  283. AC_MSG_RESULT(yes)
  284. ],[
  285. AC_MSG_ERROR([At least version 3.3 is required])
  286. ])
  287. fi
  288. if test -n "$THIS_LIBS"; then
  289. AC_DEFINE(DBA_DB$1, 1, [ ])
  290. if test -n "$THIS_INCLUDE"; then
  291. AC_DEFINE_UNQUOTED(DB$1_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
  292. fi
  293. else
  294. AC_MSG_ERROR([DBA: Could not find necessary library.])
  295. fi
  296. THIS_RESULT=yes
  297. DB$1_LIBS=$THIS_LIBS
  298. DB$1_PREFIX=$THIS_PREFIX
  299. DB$1_INCLUDE=$THIS_INCLUDE
  300. PHP_DBA_STD_ASSIGN
  301. PHP_DBA_STD_ATTACH
  302. ])
  303. # DB4
  304. if test "$PHP_DB4" != "no"; then
  305. PHP_DBA_STD_BEGIN
  306. dbdp4="/usr/local/BerkeleyDB.4."
  307. dbdp5="/usr/local/BerkeleyDB.5."
  308. 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
  309. if test -f "$i/db5/db.h"; then
  310. THIS_PREFIX=$i
  311. THIS_INCLUDE=$i/db5/db.h
  312. break
  313. elif test -f "$i/db4/db.h"; then
  314. THIS_PREFIX=$i
  315. THIS_INCLUDE=$i/db4/db.h
  316. break
  317. elif test -f "$i/include/db5.3/db.h"; then
  318. THIS_PREFIX=$i
  319. THIS_INCLUDE=$i/include/db5.3/db.h
  320. break
  321. elif test -f "$i/include/db5.1/db.h"; then
  322. THIS_PREFIX=$i
  323. THIS_INCLUDE=$i/include/db5.1/db.h
  324. break
  325. elif test -f "$i/include/db5.0/db.h"; then
  326. THIS_PREFIX=$i
  327. THIS_INCLUDE=$i/include/db5.0/db.h
  328. break
  329. elif test -f "$i/include/db4.8/db.h"; then
  330. THIS_PREFIX=$i
  331. THIS_INCLUDE=$i/include/db4.8/db.h
  332. break
  333. elif test -f "$i/include/db4.7/db.h"; then
  334. THIS_PREFIX=$i
  335. THIS_INCLUDE=$i/include/db4.7/db.h
  336. break
  337. elif test -f "$i/include/db4.6/db.h"; then
  338. THIS_PREFIX=$i
  339. THIS_INCLUDE=$i/include/db4.6/db.h
  340. break
  341. elif test -f "$i/include/db4.5/db.h"; then
  342. THIS_PREFIX=$i
  343. THIS_INCLUDE=$i/include/db4.5/db.h
  344. break
  345. elif test -f "$i/include/db4/db.h"; then
  346. THIS_PREFIX=$i
  347. THIS_INCLUDE=$i/include/db4/db.h
  348. break
  349. elif test -f "$i/include/db/db4.h"; then
  350. THIS_PREFIX=$i
  351. THIS_INCLUDE=$i/include/db/db4.h
  352. break
  353. elif test -f "$i/include/db4.h"; then
  354. THIS_PREFIX=$i
  355. THIS_INCLUDE=$i/include/db4.h
  356. break
  357. elif test -f "$i/include/db.h"; then
  358. THIS_PREFIX=$i
  359. THIS_INCLUDE=$i/include/db.h
  360. break
  361. fi
  362. done
  363. 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)])
  364. fi
  365. PHP_DBA_STD_RESULT(db4,Berkeley DB4)
  366. # DB3
  367. if test "$PHP_DB3" != "no"; then
  368. PHP_DBA_STD_BEGIN
  369. if test "$HAVE_DB4" = "1"; then
  370. PHP_DBA_STD_RESULT(db3, Berkeley DB3, [You cannot combine --with-db3 with --with-db4])
  371. fi
  372. 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
  373. if test -f "$i/db3/db.h"; then
  374. THIS_PREFIX=$i
  375. THIS_INCLUDE=$i/include/db3/db.h
  376. break
  377. elif test -f "$i/include/db3/db.h"; then
  378. THIS_PREFIX=$i
  379. THIS_INCLUDE=$i/include/db3/db.h
  380. break
  381. elif test -f "$i/include/db/db3.h"; then
  382. THIS_PREFIX=$i
  383. THIS_INCLUDE=$i/include/db/db3.h
  384. break
  385. elif test -f "$i/include/db3.h"; then
  386. THIS_PREFIX=$i
  387. THIS_INCLUDE=$i/include/db3.h
  388. break
  389. elif test -f "$i/include/db.h"; then
  390. THIS_PREFIX=$i
  391. THIS_INCLUDE=$i/include/db.h
  392. break
  393. fi
  394. done
  395. 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)])
  396. fi
  397. PHP_DBA_STD_RESULT(db3,Berkeley DB3)
  398. # DB2
  399. if test "$PHP_DB2" != "no"; then
  400. PHP_DBA_STD_BEGIN
  401. if test "$HAVE_DB3" = "1" || test "$HAVE_DB4" = "1"; then
  402. PHP_DBA_STD_RESULT(db2, Berkeley DB2, [You cannot combine --with-db2 with --with-db3 or --with-db4])
  403. fi
  404. for i in $PHP_DB2 $PHP_DB2/BerkeleyDB /usr/BerkeleyDB /usr/local /usr; do
  405. if test -f "$i/db2/db.h"; then
  406. THIS_PREFIX=$i
  407. THIS_INCLUDE=$i/db2/db.h
  408. break
  409. elif test -f "$i/include/db2/db.h"; then
  410. THIS_PREFIX=$i
  411. THIS_INCLUDE=$i/include/db2/db.h
  412. break
  413. elif test -f "$i/include/db/db2.h"; then
  414. THIS_PREFIX=$i
  415. THIS_INCLUDE=$i/include/db/db2.h
  416. break
  417. elif test -f "$i/include/db2.h"; then
  418. THIS_PREFIX=$i
  419. THIS_INCLUDE=$i/include/db2.h
  420. break
  421. elif test -f "$i/include/db.h"; then
  422. THIS_PREFIX=$i
  423. THIS_INCLUDE=$i/include/db.h
  424. break
  425. fi
  426. done
  427. PHP_DBA_DB_CHECK(2, db-2 db2 db, [(void)db_appinit("", NULL, (DB_ENV*)0, 0)])
  428. fi
  429. PHP_DBA_STD_RESULT(db2, Berkeley DB2)
  430. # DB1
  431. if test "$PHP_DB1" != "no"; then
  432. PHP_DBA_STD_BEGIN
  433. AC_MSG_CHECKING([for DB1 in library])
  434. if test "$HAVE_DB4" = "1"; then
  435. THIS_VERSION=4
  436. THIS_LIBS=$DB4_LIBS
  437. THIS_PREFIX=$DB4_PREFIX
  438. elif test "$HAVE_DB3" = "1"; then
  439. THIS_LIBS=$DB3_LIBS
  440. THIS_PREFIX=$DB3_PREFIX
  441. elif test "$HAVE_DB2" = "1"; then
  442. THIS_VERSION=2
  443. THIS_LIBS=$DB2_LIBS
  444. THIS_PREFIX=$DB2_PREFIX
  445. fi
  446. if test "$HAVE_DB4" = "1" || test "$HAVE_DB3" = "1" || test "$HAVE_DB2" = "1"; then
  447. AC_DEFINE_UNQUOTED(DB1_VERSION, "Berkeley DB 1.85 emulation in DB$THIS_VERSION", [ ])
  448. for i in db$THIS_VERSION/db_185.h include/db$THIS_VERSION/db_185.h include/db/db_185.h; do
  449. if test -f "$THIS_PREFIX/$i"; then
  450. THIS_INCLUDE=$THIS_PREFIX/$i
  451. break
  452. fi
  453. done
  454. else
  455. AC_DEFINE_UNQUOTED(DB1_VERSION, "Unknown DB1", [ ])
  456. for i in $PHP_DB1 /usr/local /usr; do
  457. if test -f "$i/db1/db.h"; then
  458. THIS_PREFIX=$i
  459. THIS_INCLUDE=$i/db1/db.h
  460. break
  461. elif test -f "$i/include/db1/db.h"; then
  462. THIS_PREFIX=$i
  463. THIS_INCLUDE=$i/include/db1/db.h
  464. break
  465. elif test -f "$i/include/db.h"; then
  466. THIS_PREFIX=$i
  467. THIS_INCLUDE=$i/include/db.h
  468. break
  469. fi
  470. done
  471. THIS_LIBS=db
  472. fi
  473. AC_MSG_RESULT([$THIS_LIBS])
  474. AC_MSG_CHECKING([for DB1 in header])
  475. AC_MSG_RESULT([$THIS_INCLUDE])
  476. if test -n "$THIS_INCLUDE"; then
  477. PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/$PHP_LIBDIR, -l$THIS_LIBS,[
  478. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  479. #include "$THIS_INCLUDE"
  480. ]],[[
  481. DB * dbp = dbopen("", 0, 0, DB_HASH, 0);
  482. ]])],[
  483. AC_DEFINE_UNQUOTED(DB1_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
  484. AC_DEFINE(DBA_DB1, 1, [ ])
  485. THIS_RESULT=yes
  486. ],[
  487. THIS_RESULT=no
  488. ])
  489. ])
  490. fi
  491. PHP_DBA_STD_ASSIGN
  492. PHP_DBA_STD_CHECK
  493. PHP_DBA_STD_ATTACH
  494. fi
  495. PHP_DBA_STD_RESULT(db1, DB1)
  496. # DBM
  497. if test "$PHP_DBM" != "no"; then
  498. PHP_DBA_STD_BEGIN
  499. if test "$HAVE_QDBM" = "1"; then
  500. PHP_DBA_STD_RESULT(dbm, dbm, [You cannot combine --with-dbm with --with-qdbm])
  501. fi
  502. for i in $PHP_DBM /usr/local /usr; do
  503. if test -f "$i/include/dbm.h"; then
  504. THIS_PREFIX=$i
  505. THIS_INCLUDE=$i/include/dbm.h
  506. break
  507. elif test -f "$i/include/gdbm/dbm.h"; then
  508. THIS_PREFIX=$i
  509. THIS_INCLUDE=$i/include/gdbm/dbm.h
  510. break
  511. fi
  512. done
  513. if test -n "$THIS_INCLUDE"; then
  514. for LIB in dbm c gdbm; do
  515. PHP_CHECK_LIBRARY($LIB, dbminit, [
  516. AC_MSG_CHECKING(for DBM using GDBM)
  517. AC_DEFINE_UNQUOTED(DBM_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
  518. if test "$LIB" = "gdbm"; then
  519. AC_DEFINE_UNQUOTED(DBM_VERSION, "GDBM", [ ])
  520. AC_MSG_RESULT(yes)
  521. else
  522. AC_DEFINE_UNQUOTED(DBM_VERSION, "DBM", [ ])
  523. AC_MSG_RESULT(no)
  524. fi
  525. AC_DEFINE(DBA_DBM, 1, [ ])
  526. THIS_LIBS=$LIB
  527. ], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
  528. if test -n "$THIS_LIBS"; then
  529. break
  530. fi
  531. done
  532. fi
  533. PHP_DBA_STD_ASSIGN
  534. PHP_DBA_STD_CHECK
  535. PHP_DBA_STD_ATTACH
  536. fi
  537. PHP_DBA_STD_RESULT(dbm)
  538. dnl
  539. dnl Bundled modules that should be enabled by default if any other option is enabled
  540. dnl
  541. if test "$PHP_DBA" != "no" || test "$HAVE_DBA" = "1" || test "$with_cdb" = "yes" || test "$enable_inifile" = "yes" || test "$enable_flatfile" = "yes"; then
  542. php_dba_enable=yes
  543. else
  544. php_dba_enable=no
  545. fi
  546. PHP_ARG_WITH(cdb,,
  547. [ --without-cdb[=DIR] DBA: CDB support (bundled)], $php_dba_enable, no)
  548. PHP_ARG_ENABLE(inifile,,
  549. [ --disable-inifile DBA: INI support (bundled)], $php_dba_enable, no)
  550. PHP_ARG_ENABLE(flatfile,,
  551. [ --disable-flatfile DBA: FlatFile support (bundled)], $php_dba_enable, no)
  552. # CDB
  553. if test "$PHP_CDB" = "yes"; then
  554. AC_DEFINE(DBA_CDB_BUILTIN, 1, [ ])
  555. AC_DEFINE(DBA_CDB_MAKE, 1, [ ])
  556. AC_DEFINE(DBA_CDB, 1, [ ])
  557. cdb_sources="libcdb/cdb.c libcdb/cdb_make.c libcdb/uint32.c"
  558. THIS_RESULT="builtin"
  559. elif test "$PHP_CDB" != "no"; then
  560. PHP_DBA_STD_BEGIN
  561. for i in $PHP_CDB /usr/local /usr; do
  562. if test -f "$i/include/cdb.h"; then
  563. THIS_PREFIX=$i
  564. THIS_INCLUDE=$i/include/cdb.h
  565. break
  566. fi
  567. done
  568. if test -n "$THIS_INCLUDE"; then
  569. for LIB in cdb c; do
  570. PHP_CHECK_LIBRARY($LIB, cdb_read, [
  571. AC_DEFINE_UNQUOTED(CDB_INCLUDE_FILE, "$THIS_INCLUDE", [ ])
  572. AC_DEFINE(DBA_CDB, 1, [ ])
  573. THIS_LIBS=$LIB
  574. ], [], [-L$THIS_PREFIX/$PHP_LIBDIR])
  575. if test -n "$THIS_LIBS"; then
  576. break
  577. fi
  578. done
  579. fi
  580. PHP_DBA_STD_ASSIGN
  581. PHP_DBA_STD_CHECK
  582. PHP_DBA_STD_ATTACH
  583. fi
  584. PHP_DBA_STD_RESULT(cdb)
  585. # INIFILE
  586. if test "$PHP_INIFILE" != "no"; then
  587. AC_DEFINE(DBA_INIFILE, 1, [ ])
  588. ini_sources="libinifile/inifile.c"
  589. THIS_RESULT="builtin"
  590. fi
  591. PHP_DBA_STD_RESULT(inifile, [INI File])
  592. # FLATFILE
  593. if test "$PHP_FLATFILE" != "no"; then
  594. AC_DEFINE(DBA_FLATFILE, 1, [ ])
  595. flat_sources="libflatfile/flatfile.c"
  596. THIS_RESULT="builtin"
  597. fi
  598. PHP_DBA_STD_RESULT(FlatFile, FlatFile)
  599. dnl
  600. dnl Extension setup
  601. dnl
  602. AC_MSG_CHECKING([whether to enable DBA interface])
  603. if test "$HAVE_DBA" = "1"; then
  604. if test "$ext_shared" = "yes"; then
  605. AC_MSG_RESULT([yes, shared])
  606. else
  607. AC_MSG_RESULT([yes])
  608. fi
  609. AC_DEFINE(HAVE_DBA, 1, [ ])
  610. 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)
  611. PHP_ADD_BUILD_DIR($ext_builddir/libinifile)
  612. PHP_ADD_BUILD_DIR($ext_builddir/libcdb)
  613. PHP_ADD_BUILD_DIR($ext_builddir/libflatfile)
  614. PHP_SUBST(DBA_SHARED_LIBADD)
  615. else
  616. AC_MSG_RESULT(no)
  617. fi