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

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

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