Debian Codegraph @

ext/dbm/dbm.ac

raw
1 dnl
2 dnl Configure ext/dbm
3 dnl This file is included by the toplevel configure.in
4 dnl
5
6 # ext/dbm -------------------------------------------------
7
8 AC_CONFIG_HEADERS([ext/dbm/dbmconf.h])
9
10 dnl with-dbm option
11 dnl
12 dnl Example: --with-dbm=ndbm,odbm # only compile ndbm and odbm
13 dnl --with-dbm=no # do not compile dbm support
14 dnl
15 dnl By default we autodetect available dbm libraries. This option
16 dnl is to _exclude_ some or all libraries that would be compiled
17 dnl otherwise.
18
19 DBMS=gdbm,ndbm,odbm
20 AC_ARG_WITH(dbm,
21 AS_HELP_STRING([--with-dbm=DBM,...],
22 [Select which dbm libraries to be compiled. You can specify
23 any combinations of gdbm, ndbm and odbm, or just 'no' to disable external
24 dbm libraries. Example: --with-dbm=ndbm,odbm
25 (to use only ndbm and odbm) or --wtih-dbm=no (to not compile any of them).
26 Note that fsdbm is always available, for it is implemented in pure Scheme.
27 By default the configure script scans the system to find out available dbm
28 libraries, so you don't need to specify this option. This options is to
29 exclude some dbm libraries that would be compiled otherwise.]),
30 [
31 AS_CASE([$with_dbm],
32 [no], [DBMS=""],
33 [yes], [], dnl Use the default
34 [DBMS="$with_dbm"])
35 ])
36
37 dnl Check for various dbm libraries availability
38 dnl On some systems, legacy DBM and NDBM is emulated by more powerful
39 dnl packages like BSD DB or GDBM. We need to be careful to pick the
40 dnl consistent header/library pair.
41 dnl
42 dnl Autoconf's cache mechanism (at least up to 2.59) can't distinguish
43 dnl gdbm-ndbm.h and gdbm/ndbm.h, so we can't put those into single
44 dnl AC_CHECK_HEADERS macro. Instead we use nested AC_CHECK_HEADER
45 dnl macros, and manage the NDBM_HEADER variable on our own.
46 dnl
47 dnl The ndbm case is so complicated because, besides it may be emulated
48 dnl by gdbm, the ndbm functions could be in libndbm, libdbm, or even libc.
49
50 dnl gdbm
51 AS_IF([echo $DBMS | tr "," "\012" | grep -q gdbm], [
52 AC_CHECK_HEADERS(gdbm.h, [
53 DBM_ARCHFILES=dbm--gdbm.$SHLIB_SO_SUFFIX
54 DBM_SCMFILES=gdbm.sci
55 DBM_OBJECTS=' $(gdbm_OBJECTS)'
56 AC_CHECK_LIB(gdbm, gdbm_open, [ GDBMLIB="-lgdbm" ])
57 ])
58 ]) dnl end of (find "gdbm" DBMS)
59
60 dnl ndbm
61 AS_IF([echo $DBMS | tr "," "\012" | grep -q ndbm], [
62
63 NDBM_HEADER=""
64 AC_CHECK_HEADER(ndbm.h, [
65 NDBM_HEADER="ndbm.h"
66 AC_DEFINE(HAVE_NDBM_H, 1, [Define 1 you have the <ndbm.h> header file.])
67 AC_CHECK_FUNCS(dbm_open, [ NDBMLIB="" ], [
68 AC_CHECK_LIB(ndbm, dbm_open, [ NDBMLIB="-lndbm" ], [
69 AC_CHECK_LIB(dbm, dbm_open, [ NDBMLIB="-ldbm" ], [
70 AC_CHECK_LIB(gdbm, dbm_open, [ NDBMLIB="-lgdbm" ], [
71 AC_CHECK_LIB(gdbm_compat, dbm_open, [ NDBMLIB="-lgdbm -lgdbm_compat" ], [
72 AC_MSG_NOTICE([ndbm header is found but its library isn't. disabling ndbm.])
73 NDBM_HEADER=""], [-lgdbm])
74 ])
75 ])
76 ])
77 ])
78 ], [
79 unset ac_cv_header_gdbm_ndbm_h; dnl Ugly hack
80 AC_CHECK_HEADER(gdbm/ndbm.h, [
81 NDBM_HEADER="gdbm/ndbm.h"
82 AC_DEFINE(HAVE_GDBM_SLASH_NDBM_H, 1, [Define 1 you have the <gdbm/ndbm.h> header file.])
83 AC_CHECK_LIB(gdbm, dbm_open, [ NDBMLIB="-lgdbm" ], [
84 AC_CHECK_LIB(gdbm_compat, dbm_open, [ NDBMLIB="-lgdbm -lgdbm_compat" ], [
85 AC_MSG_NOTICE([ndbm header is found but its library isn't. disabling ndbm.])
86 NDBM_HEADER=""], [-lgdbm])
87 ])
88 ], [
89 unset ac_cv_header_gdbm_ndbm_h; dnl Ugly hack
90 AC_CHECK_HEADER(gdbm-ndbm.h, [
91 NDBM_HEADER="gdbm-ndbm.h"
92 AC_DEFINE(HAVE_GDBM_MINUS_NDBM_H, 1, [Define 1 you have the <gdbm-ndbm.h> header file.])
93 AC_CHECK_LIB(gdbm, dbm_open, [ NDBMLIB="-lgdbm" ], [
94 AC_CHECK_LIB(gdbm_compat, dbm_open, [ NDBMLIB="-lgdbm -lgdbm_compat" ], [
95 AC_MSG_NOTICE([ndbm header is found but its library isn't. disabling ndbm.])
96 NDBM_HEADER=""], [-lgdbm])
97 ])
98 ])])])
99 AS_IF([test "$NDBM_HEADER" != ""], [
100 DBM_ARCHFILES="dbm--ndbm.$SHLIB_SO_SUFFIX $DBM_ARCHFILES"
101 DBM_SCMFILES="ndbm.sci $DBM_SCMFILES"
102 DBM_OBJECTS=' $(ndbm_OBJECTS)'$DBM_OBJECTS
103 ])
104
105 ]) dnl end of (find "ndbm" DBMS)
106
107 dnl odbm
108
109 AS_IF([echo $DBMS | tr "," "\012" | grep -q odbm], [
110
111 ODBM_HEADER=""
112 AC_CHECK_HEADER(dbm.h, [
113 ODBM_HEADER="dbm.h"
114 AC_DEFINE(HAVE_DBM_H, 1, [Define 1 you have the <dbm.h> header file.])
115 AC_CHECK_LIB(dbm, dbminit, [ ODBMLIB="-ldbm" ], [
116 AC_CHECK_LIB(gdbm, dbminit, [ ODBMLIB="-lgdbm" ], [
117 AC_CHECK_LIB(gdbm_compat, dbminit, [ ODBMLIB="-lgdbm -lgdbm_compat" ], [
118 AC_MSG_NOTICE([odbm header is found but its library isn't. disabling odbm.])
119 ODBM_HEADER=""], [-lgdbm])
120 ])
121 ])
122 ], [
123 unset ac_cv_header_gdbm_dbm_h; dnl Ugly hack
124 AC_CHECK_HEADER(gdbm/dbm.h, [
125 ODBM_HEADER="gdbm/dbm.h"
126 AC_DEFINE(HAVE_GDBM_SLASH_DBM_H, 1, [Define 1 you have the <gdbm/dbm.h> header file.])
127 AC_CHECK_LIB(gdbm, dbminit, [ ODBMLIB="-lgdbm" ], [
128 AC_CHECK_LIB(gdbm_compat, dbminit, [ ODBMLIB="-lgdbm -lgdbm_compat" ], [
129 AC_MSG_NOTICE([odbm header is found but its library isn't. disabling odbm.])
130 ODBM_HEADER=""], [-lgdbm])
131 ])
132 ], [
133 unset ac_cv_header_gdbm_dbm_h; dnl Ugly hack
134 AC_CHECK_HEADER(gdbm-dbm.h, [
135 ODBM_HEADER="gdbm-dbm.h"
136 AC_DEFINE(HAVE_GDBM_MINUS_DBM_H, 1, [Define 1 you have the <gdbm-dbm.h> header file.])
137 AC_CHECK_LIB(gdbm, dbminit, [ ODBMLIB="-lgdbm" ], [
138 AC_CHECK_LIB(gdbm_compat, dbminit, [ ODBMLIB="-lgdbm -lgdbm_compat" ], [
139 AC_MSG_NOTICE([odbm header is found but its library isn't. disabling odbm.])
140 ODBM_HEADER=""], [-lgdbm])
141 ])
142 ])])])
143 AS_IF([test "$ODBM_HEADER" != ""], [
144 DBM_ARCHFILES="dbm--odbm.$SHLIB_SO_SUFFIX $DBM_ARCHFILES"
145 DBM_SCMFILES="odbm.sci $DBM_SCMFILES"
146 DBM_OBJECTS='$(odbm_OBJECTS)'$DBM_OBJECTS
147 ])
148
149 ]) dnl end of (find "odbm" DBMS)
150
151 AC_SUBST(DBM_ARCHFILES)
152 AC_SUBST(DBM_SCMFILES)
153 AC_SUBST(DBM_OBJECTS)
154 AC_SUBST(GDBMLIB)
155 AC_SUBST(NDBMLIB)
156 AC_SUBST(ODBMLIB)
157
158 EXT_LIBS="$EXT_LIBS $GDBMLIB $NDBMLIB $ODBMLIB"
159
160 dnl Local variables:
161 dnl mode: autoconf
162 dnl end: