dnl dnl Configure ext/dbm dnl This file is included by the toplevel configure.in dnl # ext/dbm ------------------------------------------------- AC_CONFIG_HEADERS([ext/dbm/dbmconf.h]) dnl with-dbm option dnl dnl Example: --with-dbm=ndbm,odbm # only compile ndbm and odbm dnl --with-dbm=no # do not compile dbm support dnl dnl By default we autodetect available dbm libraries. This option dnl is to _exclude_ some or all libraries that would be compiled dnl otherwise. DBMS=gdbm,ndbm,odbm AC_ARG_WITH(dbm, AS_HELP_STRING([--with-dbm=DBM,...], [Select which dbm libraries to be compiled. You can specify any combinations of gdbm, ndbm and odbm, or just 'no' to disable external dbm libraries. Example: --with-dbm=ndbm,odbm (to use only ndbm and odbm) or --wtih-dbm=no (to not compile any of them). Note that fsdbm is always available, for it is implemented in pure Scheme. By default the configure script scans the system to find out available dbm libraries, so you don't need to specify this option. This options is to exclude some dbm libraries that would be compiled otherwise.]), [ AS_CASE([$with_dbm], [no], [DBMS=""], [yes], [], dnl Use the default [DBMS="$with_dbm"]) ]) dnl Check for various dbm libraries availability dnl On some systems, legacy DBM and NDBM is emulated by more powerful dnl packages like BSD DB or GDBM. We need to be careful to pick the dnl consistent header/library pair. dnl dnl Autoconf's cache mechanism (at least up to 2.59) can't distinguish dnl gdbm-ndbm.h and gdbm/ndbm.h, so we can't put those into single dnl AC_CHECK_HEADERS macro. Instead we use nested AC_CHECK_HEADER dnl macros, and manage the NDBM_HEADER variable on our own. dnl dnl The ndbm case is so complicated because, besides it may be emulated dnl by gdbm, the ndbm functions could be in libndbm, libdbm, or even libc. dnl gdbm AS_IF([echo $DBMS | tr "," "\012" | grep -q gdbm], [ AC_CHECK_HEADERS(gdbm.h, [ DBM_ARCHFILES=dbm--gdbm.$SHLIB_SO_SUFFIX DBM_SCMFILES=gdbm.sci DBM_OBJECTS=' $(gdbm_OBJECTS)' AC_CHECK_LIB(gdbm, gdbm_open, [ GDBMLIB="-lgdbm" ]) ]) ]) dnl end of (find "gdbm" DBMS) dnl ndbm AS_IF([echo $DBMS | tr "," "\012" | grep -q ndbm], [ NDBM_HEADER="" AC_CHECK_HEADER(ndbm.h, [ NDBM_HEADER="ndbm.h" AC_DEFINE(HAVE_NDBM_H, 1, [Define 1 you have the header file.]) AC_CHECK_FUNCS(dbm_open, [ NDBMLIB="" ], [ AC_CHECK_LIB(ndbm, dbm_open, [ NDBMLIB="-lndbm" ], [ AC_CHECK_LIB(dbm, dbm_open, [ NDBMLIB="-ldbm" ], [ AC_CHECK_LIB(gdbm, dbm_open, [ NDBMLIB="-lgdbm" ], [ AC_CHECK_LIB(gdbm_compat, dbm_open, [ NDBMLIB="-lgdbm -lgdbm_compat" ], [ AC_MSG_NOTICE([ndbm header is found but its library isn't. disabling ndbm.]) NDBM_HEADER=""], [-lgdbm]) ]) ]) ]) ]) ], [ unset ac_cv_header_gdbm_ndbm_h; dnl Ugly hack AC_CHECK_HEADER(gdbm/ndbm.h, [ NDBM_HEADER="gdbm/ndbm.h" AC_DEFINE(HAVE_GDBM_SLASH_NDBM_H, 1, [Define 1 you have the header file.]) AC_CHECK_LIB(gdbm, dbm_open, [ NDBMLIB="-lgdbm" ], [ AC_CHECK_LIB(gdbm_compat, dbm_open, [ NDBMLIB="-lgdbm -lgdbm_compat" ], [ AC_MSG_NOTICE([ndbm header is found but its library isn't. disabling ndbm.]) NDBM_HEADER=""], [-lgdbm]) ]) ], [ unset ac_cv_header_gdbm_ndbm_h; dnl Ugly hack AC_CHECK_HEADER(gdbm-ndbm.h, [ NDBM_HEADER="gdbm-ndbm.h" AC_DEFINE(HAVE_GDBM_MINUS_NDBM_H, 1, [Define 1 you have the header file.]) AC_CHECK_LIB(gdbm, dbm_open, [ NDBMLIB="-lgdbm" ], [ AC_CHECK_LIB(gdbm_compat, dbm_open, [ NDBMLIB="-lgdbm -lgdbm_compat" ], [ AC_MSG_NOTICE([ndbm header is found but its library isn't. disabling ndbm.]) NDBM_HEADER=""], [-lgdbm]) ]) ])])]) AS_IF([test "$NDBM_HEADER" != ""], [ DBM_ARCHFILES="dbm--ndbm.$SHLIB_SO_SUFFIX $DBM_ARCHFILES" DBM_SCMFILES="ndbm.sci $DBM_SCMFILES" DBM_OBJECTS=' $(ndbm_OBJECTS)'$DBM_OBJECTS ]) ]) dnl end of (find "ndbm" DBMS) dnl odbm AS_IF([echo $DBMS | tr "," "\012" | grep -q odbm], [ ODBM_HEADER="" AC_CHECK_HEADER(dbm.h, [ ODBM_HEADER="dbm.h" AC_DEFINE(HAVE_DBM_H, 1, [Define 1 you have the header file.]) AC_CHECK_LIB(dbm, dbminit, [ ODBMLIB="-ldbm" ], [ AC_CHECK_LIB(gdbm, dbminit, [ ODBMLIB="-lgdbm" ], [ AC_CHECK_LIB(gdbm_compat, dbminit, [ ODBMLIB="-lgdbm -lgdbm_compat" ], [ AC_MSG_NOTICE([odbm header is found but its library isn't. disabling odbm.]) ODBM_HEADER=""], [-lgdbm]) ]) ]) ], [ unset ac_cv_header_gdbm_dbm_h; dnl Ugly hack AC_CHECK_HEADER(gdbm/dbm.h, [ ODBM_HEADER="gdbm/dbm.h" AC_DEFINE(HAVE_GDBM_SLASH_DBM_H, 1, [Define 1 you have the header file.]) AC_CHECK_LIB(gdbm, dbminit, [ ODBMLIB="-lgdbm" ], [ AC_CHECK_LIB(gdbm_compat, dbminit, [ ODBMLIB="-lgdbm -lgdbm_compat" ], [ AC_MSG_NOTICE([odbm header is found but its library isn't. disabling odbm.]) ODBM_HEADER=""], [-lgdbm]) ]) ], [ unset ac_cv_header_gdbm_dbm_h; dnl Ugly hack AC_CHECK_HEADER(gdbm-dbm.h, [ ODBM_HEADER="gdbm-dbm.h" AC_DEFINE(HAVE_GDBM_MINUS_DBM_H, 1, [Define 1 you have the header file.]) AC_CHECK_LIB(gdbm, dbminit, [ ODBMLIB="-lgdbm" ], [ AC_CHECK_LIB(gdbm_compat, dbminit, [ ODBMLIB="-lgdbm -lgdbm_compat" ], [ AC_MSG_NOTICE([odbm header is found but its library isn't. disabling odbm.]) ODBM_HEADER=""], [-lgdbm]) ]) ])])]) AS_IF([test "$ODBM_HEADER" != ""], [ DBM_ARCHFILES="dbm--odbm.$SHLIB_SO_SUFFIX $DBM_ARCHFILES" DBM_SCMFILES="odbm.sci $DBM_SCMFILES" DBM_OBJECTS='$(odbm_OBJECTS)'$DBM_OBJECTS ]) ]) dnl end of (find "odbm" DBMS) AC_SUBST(DBM_ARCHFILES) AC_SUBST(DBM_SCMFILES) AC_SUBST(DBM_OBJECTS) AC_SUBST(GDBMLIB) AC_SUBST(NDBMLIB) AC_SUBST(ODBMLIB) EXT_LIBS="$EXT_LIBS $GDBMLIB $NDBMLIB $ODBMLIB" dnl Local variables: dnl mode: autoconf dnl end: