config.m4 18 KB

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