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