1 dnl configure.ac for GNU rec
3 dnl Please process this file with autoconf to get a 'configure'
6 dnl Copyright (C) 2009-2019 Jose E. Marchesi
8 dnl This program is free software: you can redistribute it and/or modify
9 dnl it under the terms of the GNU General Public License as published by
10 dnl the Free Software Foundation, either version 3 of the License, or
11 dnl (at your option) any later version.
13 dnl This program is distributed in the hope that it will be useful,
14 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 dnl GNU General Public License for more details.
18 dnl You should have received a copy of the GNU General Public License
19 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
21 AC_INIT([GNU recutils], [1.8], [bug-recutils@gnu.org])
23 dnl Must come before AM_INIT_AUTOMAKE
24 AC_CONFIG_AUX_DIR([build-aux])
25 AM_INIT_AUTOMAKE([subdir-objects])
26 AC_CONFIG_HEADERS(src/config.h)
27 AC_CONFIG_MACRO_DIR([m4])
39 dnl Both lex and yacc are required to generate the lexer/parser source
44 : ${LEX_OUTPUT_ROOT='lex.yy'}
45 AC_ARG_VAR([LEX], [The flex implementation to use.])
46 AC_ARG_VAR([LEXLIB], [Options for linking with the flex runtime library.])
47 AC_ARG_VAR([LEX_OUTPUT_ROOT], [Base of the file name that the lexer generates.])
57 # GNU help2man creates man pages from --help output; in many cases, this
58 # is sufficient, and obviates the need to maintain man pages separately.
59 # However, this means invoking executables, which we generally cannot do
60 # when cross-compiling, so we test to avoid that (the variable
61 # "cross_compiling" is set by AC_PROG_CC).
62 if test $cross_compiling = no; then
63 AM_MISSING_PROG(HELP2MAN, help2man)
69 AC_CHECK_HEADERS([malloc.h string.h])
71 dnl Search for data types
72 AC_CHECK_TYPE(size_t, unsigned)
73 AC_CHECK_TYPE(off_t, long)
75 dnl Search for functions
78 dnl Search for required libraries
81 PKG_CHECK_MODULES([CHECK], [check],
82 [have_check=yes], [have_check=no])
83 AM_CONDITIONAL([CHECK], [test "x$have_check" != "xno"])
84 AC_SUBST([CHECK_CFLAGS])
85 AC_SUBST([CHECK_LIBS])
88 AC_CHECK_LIB([curl],[curl_global_init],[have_curl=yes],)
89 if test "x$have_curl" = "xyes"; then
95 AC_CHECK_LIB([uuid],[uuid_generate],[have_uuid=yes],)
96 if test "x$have_uuid" = "xyes"; then
100 AC_SUBST([have_uuid])
102 AC_ARG_ENABLE([encryption],
103 AS_HELP_STRING([--enable-encryption],
104 [Compile recutils with encryption support (default is YES)]),
105 [crypt_enabled=$enableval], [crypt_enabled=yes])
108 if test "x$crypt_enabled" = "xyes"; then
110 AC_LIB_HAVE_LINKFLAGS([gcrypt],[gpg-error],[#include <gpg-error.h>])
111 crypt_support=$HAVE_LIBGCRYPT
113 if test "x$crypt_support" = "xyes"; then
114 AC_DEFINE([REC_CRYPT_SUPPORT],[1],[Compile encryption support])
118 AM_CONDITIONAL([CRYPT], [test "x$crypt_support" = "xyes"])
119 AC_SUBST([crypt_support])
122 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.0.0],
123 [have_glib=yes], [have_glib=no])
126 AC_CHECK_LIB([mdb],[mdb_init],[have_mdb=yes],)
127 if test "x$have_mdb" = "xyes"; then
131 CFLAGS="$CFLAGS $pkg_cv_GLIB_CFLAGS"
132 mdb_uses_sdatetime=no
133 AC_CHECK_DECL([MDB_SDATETIME],[mdb_uses_sdatetime=yes],,[#include <glib.h>
134 #include <mdbtools.h>])
137 if test "x$mdb_uses_sdatetime" = "xyes"; then
138 MDB_DATETIME="MDB_SDATETIME"
140 MDB_DATETIME="MDB_DATETIME"
143 AC_SUBST([MDB_DATETIME])
147 AM_CONDITIONAL([COMPILE_MDB2REC],
148 [test "x$have_glib" = "xyes" && test "x$have_mdb" = "xyes"])
149 AM_CONDITIONAL([REMOTE_DESCRIPTORS], [test "x$have_curl" = "xyes"])
150 AM_CONDITIONAL([UUID_TYPE], [test "x$have_uuid" = "xyes"])
154 dnl It would be much better to use AC_CHECK_HEADER([bash/config.h]) instead
155 dnl of a fixed value like /usr/include/bash, but then it would be difficult
156 dnl to set a proper search path for the preprocessor, since the bash
157 dnl headers which are needed to compile loadable builtins are not
158 dnl very well designed.
160 BASH_HEADERS=/usr/include/bash
161 AC_ARG_WITH([bash-headers],
162 AS_HELP_STRING([--with-bash-headers],
163 [location of the bash header files (default is /usr/include/bash)]),
164 [BASH_HEADERS=$withval],)
166 if test -f ${BASH_HEADERS}/config.h; then
167 AC_SUBST([BASH_HEADERS])
168 bash_headers_available=yes
170 bash_headers_available=no
173 AC_ARG_ENABLE([bash-builtins],
174 AS_HELP_STRING([--enable-bash-builtins],
175 [Build the recutils bash builtins (default is YES)]),
176 [bash_builtins_enabled=$enableval], [bash_builtins_enabled=yes])
178 AM_CONDITIONAL([BASH_BUILTINS],
179 [test "x$bash_headers_available" = "xyes" && test "x$bash_builtins_enabled" = "xyes"])
181 dnl Check for an Algol 68 compiler
183 AC_ARG_ENABLE([algol68],
184 AS_HELP_STRING([--enable-algol68],
185 [Build the bindings for Algol 68 (default is NO)]),
186 [algol68_enabled=$enableval], [algol68_enabled=no])
188 if test "x$algol68_enabled" = "xyes"; then
189 AC_CHECK_PROGS([CA68], [ca68])
193 AM_CONDITIONAL([BUILD_A68],[test -n "$CA68" && test "x$algol68_enabled" = "xyes"])
195 dnl Platform-based compilation options
196 compile_w32_system=no
199 compile_w32_system=yes
205 dnl i18n with gettext
206 AM_GNU_GETTEXT_VERSION([0.19.8])
207 AM_GNU_GETTEXT([external])
210 AC_ARG_ENABLE([coverage],
211 AS_HELP_STRING([--enable-coverage],
212 [Compile the library with code coverage support (default is NO)]),
213 [use_gcov=$enableval], [use_gcov=no])
214 AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
216 dnl Generate output files
217 AC_CONFIG_FILES(Makefile
226 torture/utils/Makefile
227 torture/utils/config.sh
235 if test "x$have_check" = "xno"; then
236 echo "warning: libcheck was not found in the system."
237 echo "warning: unit tests wont be compiled and executed upon make check."
240 if test "x$have_mdb" = "xno"; then
241 echo "warning: libmdb was not found in the system."
242 echo "warning: the mdb2rec utility won't get built."
245 if test "x$have_glib" = "xno"; then
246 echo "warning: glib was not found in the system."
247 echo "warning: the mdb2rec utility won't get built."
250 if test "x$crypt_support" = "xno"; then
251 echo "warning: building recutils without encryption support."
254 if test "x$have_uuid" = "xno"; then
255 echo "warning: building recutils without support for uuid types."
258 if test "x$bash_headers_available" = "xno" || test "x$bash_builtins_enabled" = "xno"; then
259 echo "warning: not building the recutils bash builtins."
262 dnl End of configure.ac