aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: 3cb4b62ad13feb3bf2159c428162d23c64578477 (plain)
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
# This file is part of GDBM.                                   -*- autoconf -*-
# Copyright (C) 2007-2023 Free Software Foundation, Inc.
#
# GDBM is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# GDBM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GDBM. If not, see <http://www.gnu.org/licenses/>. */

m4_define([_GDBM_VERSION_MAJOR], 1)
m4_define([_GDBM_VERSION_MINOR], 23)
m4_define([_GDBM_VERSION_PATCH], 90)

AC_INIT([gdbm],
        _GDBM_VERSION_MAJOR._GDBM_VERSION_MINOR[]m4_ifdef([_GDBM_VERSION_PATCH],._GDBM_VERSION_PATCH),
	[bug-gdbm@gnu.org],,
	[http://www.gnu.org/software/gdbm])

dnl When switching to 2.70, see Internationalization macros below
AC_PREREQ([2.69]) 
AC_CONFIG_SRCDIR([src/gdbmdefs.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([autoconf.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([gnits 1.11 std-options silent-rules])

# Enable silent rules by default:
AM_SILENT_RULES([yes])

AC_SUBST([GDBM_VERSION_MAJOR], _GDBM_VERSION_MAJOR)
AC_SUBST([GDBM_VERSION_MINOR], _GDBM_VERSION_MINOR)
AC_SUBST([GDBM_VERSION_PATCH], m4_ifdef([_GDBM_VERSION_PATCH],_GDBM_VERSION_PATCH,0))

AC_ARG_ENABLE([memory-mapped-io],
  AS_HELP_STRING(
    [--enable-memory-mapped-io],
    [Use mmap(2) for disk I/O. (Default is YES.)]),
  [mapped_io=$enableval],
  [mapped_io=yes])

AC_ARG_ENABLE([libgdbm-compat],
  AS_HELP_STRING(
    [--enable-libgdbm-compat],
    [Build and install libgdbm_compat. (Default is NO.)]),
  [want_compat=$enableval],
  [want_compat=no])
AC_ARG_VAR([COMPATINCLUDEDIR],[installation directory for dbm.h and ndbm.h])
test -z "$COMPATINCLUDEDIR" && COMPATINCLUDEDIR='$(includedir)'

AC_ARG_ENABLE([gdbmtool-debug],
  AS_HELP_STRING(
    [--enable-gdbmtool-debug],
    [instrument gdbmtool for additional debugging]),
    [want_gdbmtool_debug=$enableval],
    [want_gdbmtool_debug=default])

dnl Check for programs
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
LT_INIT
AC_PATH_PROG([BISON],[bison],[\$(SHELL) \$(top_srcdir)/build-aux/missing bison])
AC_PATH_PROG([FLEX],[flex],[\$(SHELL) \$(top_srcdir)/build-aux/missing flex])

AC_ARG_VAR([GZIP_BIN],[Absolute filename of the gzip binary])
AC_PATH_PROG(GZIP_BIN,[gzip])
AC_ARG_VAR([BASE64_BIN],[Absolute filename of the base64 binary])
AC_PATH_PROG(BASE64_BIN,[base64])

AC_SYS_LARGEFILE
AC_C_CONST
AC_TYPE_UNSIGNED_LONG_LONG_INT

AC_SUBST(GDBM_COUNT_T)
if test $ac_cv_type_unsigned_long_long_int = yes; then
	GDBM_COUNT_T="unsigned long long int"
else
	GDBM_COUNT_T="unsigned long"
fi

AC_MSG_CHECKING([for TLS qualifier])
AC_COMPILE_IFELSE(
  [AC_LANG_PROGRAM([],
                   [static __thread int x = 0;])],
  [gdbm_cv__thread=__thread],
  [gdbm_cv__thread=])
AC_MSG_RESULT($gdbm_cv__thread)
AC_DEFINE_UNQUOTED([GDBM_THREAD_LOCAL],$gdbm_cv__thread,[TLS qualifier])

dnl Internationalization macros.
AM_GNU_GETTEXT([external], [need-ngettext])
AM_GNU_GETTEXT_REQUIRE_VERSION([0.19])
dnl The following kludge is needed when using autoconf 2.69.
dnl Observe the following:
dnl 1. Autopoint (0.19.8.1) understands the AM_GNU_GETTEXT_REQUIRE_VERSION
dnl    macro, but autoreconf 2.69 reports:
dnl      configure.ac: AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION
dnl    and doesn't call autopoint at all.
dnl 2. On the other hand, when both macros are used, autopoint warns:
dnl      using AM_GNU_GETTEXT_REQUIRE_VERSION instead of AM_GNU_GETTEXT_VERSION
dnl    (which it actually does).
dnl
dnl To make both happy, the following kludge is installed, which uses the fact
dnl that autoreconf 2.69 looks for /^AM_GNU_GETTEXT_VERSION/ (see line 341),
dnl and autopoint, when working with the file written for autoconf 2.69, uses a
dnl simple sed logic to detect the presence of either macro.  The kludge below
dnl easily fools that logic.  When working with autoconf 2.70 and later,
dnl autopoint traces the m4 output, in which m4_if expands to nothing.
dnl
dnl When we finally switch to 2.70, this will be removed.
dnl
m4_if([
AM_GNU_GETTEXT_VERSION
])

AC_CHECK_HEADERS([sys/file.h string.h locale.h getopt.h])

AC_CHECK_FUNCS([ftruncate flock lockf fsync setlocale getopt_long getline])

if test x$mapped_io = xyes
then
  AC_FUNC_MMAP()
  AC_CHECK_FUNCS([msync])
fi
AC_TYPE_OFF_T
AC_CHECK_SIZEOF(off_t)
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_mtim, struct stat.st_mtimespec],[],[],
                 [#include <sys/types.h>
	          #include <sys/stat.h>])

AM_CONDITIONAL([COMPAT_OPT], [test "$want_compat" = yes])

# Check for Curses libs.
for lib in ncurses curses termcap
do
  AC_CHECK_LIB($lib, tputs, [CURSES_LIBS="-l$lib"; break])
done

AC_SUBST(CURSES_LIBS)
# Readline
AC_ARG_WITH([readline],
            AS_HELP_STRING([--without-readline],
                           [do not use readline]),
            [
case "${withval}" in
  yes) status_readline=yes ;;
  no)  status_readline=no ;;
  *)   AC_MSG_ERROR(bad value ${withval} for --without-readline) ;;
esac],[status_readline=probe])

AC_SUBST(READLINE_LIBS)

if test "$status_readline" != "no"; then
  dnl FIXME This should only link in the curses libraries if it's
  dnl really needed!
  saved_LIBS=$LIBS
  LIBS="$LIBS $CURSES_LIBS"
  AC_CHECK_LIB(readline, readline,
    [status_readline=yes],
    [if test "$status_readline" = "yes"; then
       AC_MSG_ERROR(readline requested but does not seem to be installed)
     else
       status_readline=no
     fi])
  LIBS=$saved_LIBS

  if test "$status_readline" = "yes"; then
    AC_CHECK_HEADERS(readline/readline.h,
      AC_DEFINE(WITH_READLINE,1,[Enable use of readline]))
      READLINE_LIBS="-lreadline $CURSES_LIBS"
      saved_LIBS=$LIBS
      LIBS="$LIBS $READLINE_LIBS"
      AC_CHECK_FUNCS(rl_completion_matches)
      LIBS=$saved_LIBS
  fi
else
  status_readline=no
fi

AM_CONDITIONAL([GDBM_COND_READLINE], [test "$status_readline" = "yes"])

# CoW crash tolerance support
AC_ARG_ENABLE([crash-tolerance],
  AS_HELP_STRING(
    [--enable-crash-tolerance],
    [Enable crash tolerance, based on clone/copy-on-write (needs support for FICLONE)]),
  [status_ficlone=$enableval],
  [status_ficlone=probe])

if test $status_ficlone = probe; then
  AC_CHECK_HEADER([linux/fs.h],
    [AC_MSG_CHECKING([for FICLONE ioctl support])
       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
         #include <linux/fs.h>
         #include <sys/ioctl.h>],
	 [ioctl(0, FICLONE, 1);])],
       [status_ficlone=yes],
       [status_ficlone=no])
     AC_MSG_RESULT($status_ficlone)],
     [status_ficlone=no])
fi
if test $status_ficlone = yes; then
  AC_DEFINE([GDBM_FAILURE_ATOMIC], 1, [Define if support for atomic failures is enabled])
fi

# Additional debugging
AC_ARG_ENABLE([debug],
              AS_HELP_STRING([--enable-debug],
                             [provide additional debugging information]),
              [status_debug=$withval],
	      [status_debug=no])

AC_SUBST([GDBM_DEBUG_ENABLE])
if test "$status_debug" = "yes"; then
  GDBM_DEBUG_ENABLE=1
else
  GDBM_DEBUG_ENABLE=0
fi  
AM_CONDITIONAL([GDBM_COND_DEBUG_ENABLE], [test "$status_debug" = "yes"])

AC_SUBST(YFLAGS_DEBUG)
AC_SUBST(LFLAGS_DEBUG)
if test "$want_gdbmtool_debug" = yes; then
    YFLAGS_DEBUG=-t
    LFLAGS_DEBUG=-d
fi    

AM_CONDITIONAL([COND_GDBMTOOL_DEBUG], [test "$want_gdbmtool_debug" = yes])

# Initialize the test suite.
AC_CONFIG_TESTDIR(tests)
AC_CONFIG_FILES([tests/Makefile tests/atlocal po/Makefile.in])
AC_CONFIG_FILES([tests/gdbmtool/Makefile])
AM_MISSING_PROG([AUTOM4TE], [autom4te])

AC_CONFIG_COMMANDS([status],[
cat <<EOF

*******************************************************************
GDBM settings summary:

Compatibility library ......................... $status_compat
Memory mapped I/O ............................. $mapped_io
GNU Readline .................................. $status_readline
Debugging support ............................. $status_debug
Reflink crash tolerance ....................... $status_ficlone
*******************************************************************

EOF
if test "$want_gdbmtool_debug" != default; then
    cat <<EOF    
NOTE: You used the --enable-gdbmtool-debug option. In order for your changes
NOTE: to take effect, please run the following commands prior to building the
NOTE: package:
NOTE:
NOTE:   make -C src maintainer-clean-generic
NOTE:   make -C tools maintainer-clean-generic
NOTE:
EOF
fi
],
[status_compat=$want_compat
mapped_io=$mapped_io
status_readline=$status_readline
status_debug=$status_debug
want_gdbmtool_debug=$want_gdbmtool_debug
status_ficlone=$status_ficlone])

AC_CONFIG_FILES([Makefile
                 src/Makefile
		 src/gdbm.h
		 tools/Makefile
		 doc/Makefile
		 compat/Makefile])

AC_OUTPUT

Return to:

Send suggestions and report system problems to the System administrator.