Annotation of embedaddon/php/ext/dba/config.m4, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>