20221212
[devspec.git] / devspec.en_US / project / recutils / configure.ac
blob875de0dc3ca1180f911fcefb8338100bc1b9eb21
1 dnl configure.ac for GNU rec
2 dnl
3 dnl Please process this file with autoconf to get a 'configure'
4 dnl script.
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.
12 dnl
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.
17 dnl
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])
29 dnl Autobuild
30 AB_INIT
32 AC_PROG_CC
33 gl_EARLY
35 LT_INIT
36 AC_PROG_CC_C99
37 AM_PROG_CC_C_O
39 dnl Both lex and yacc are required to generate the lexer/parser source
40 dnl files.
42 : ${LEX='flex'}
43 : ${LEXLIB='-lfl'}
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.])
49 gl_BISON
51 dnl System
52 AC_CANONICAL_HOST
53 canonical=$host
55 gl_INIT
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)
64 else
65   HELP2MAN=:
68 dnl Seach for headers
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
76 AC_FUNC_FSEEKO
78 dnl Search for required libraries
80 have_check=no
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])
87 have_curl=no
88 AC_CHECK_LIB([curl],[curl_global_init],[have_curl=yes],)
89 if test "x$have_curl" = "xyes"; then
90    CURLLIBS=-lcurl
92 AC_SUBST([CURLLIBS])
94 have_uuid=no
95 AC_CHECK_LIB([uuid],[uuid_generate],[have_uuid=yes],)
96 if test "x$have_uuid" = "xyes"; then
97    UUIDLIBS=-luuid
99 AC_SUBST([UUIDLIBS])
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])
107 crypt_support=no
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])
115    fi
118 AM_CONDITIONAL([CRYPT], [test "x$crypt_support" = "xyes"])
119 AC_SUBST([crypt_support])
121 have_glib=no
122 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.0.0],
123                   [have_glib=yes], [have_glib=no])
125 have_mdb=no
126 AC_CHECK_LIB([mdb],[mdb_init],[have_mdb=yes],)
127 if test "x$have_mdb" = "xyes"; then
128    MDBLIBS=-lmdb
130    OLD_CFLAGS=$CFLAGS
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>])
135    CFLAGS=$OLD_CFLAGS
137    if test "x$mdb_uses_sdatetime" = "xyes"; then
138       MDB_DATETIME="MDB_SDATETIME"
139    else
140       MDB_DATETIME="MDB_DATETIME"
141    fi
143    AC_SUBST([MDB_DATETIME])
145 AC_SUBST([MDBLIBS])
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"])
152 dnl Bash builtins
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
169 else
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])
192 AC_SUBST([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
197 case "${host}" in
198      *-mingw32*)
199           compile_w32_system=yes
200           ;;
201      *)
202           ;;
203 esac
205 dnl i18n with gettext
206 AM_GNU_GETTEXT_VERSION([0.19.8])
207 AM_GNU_GETTEXT([external])
209 dnl gcov compilation
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
218                 lib/Makefile
219                 libcsv/Makefile
220                 src/Makefile
221                 utils/Makefile
222                 bash/Makefile
223                 doc/Makefile
224                 po/Makefile.in
225                 torture/Makefile
226                 torture/utils/Makefile
227                 torture/utils/config.sh
228                 man/Makefile
229                 etc/Makefile
230                 algol68/Makefile)
231 AC_OUTPUT
233 dnl Report warnings
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