]> git.ipfire.org Git - thirdparty/squid.git/blame - acinclude/tdb.m4
Source Format Enforcement (#532)
[thirdparty/squid.git] / acinclude / tdb.m4
CommitLineData
77b1029d 1## Copyright (C) 1996-2020 The Squid Software Foundation and contributors
acd207af
AJ
2##
3## Squid software is distributed under GPLv2+ license and includes
4## contributions from numerous individuals and organizations.
5## Please see the COPYING and CONTRIBUTORS files for details.
6##
7
8dnl check for --with-tdb option
9AC_DEFUN([SQUID_CHECK_LIBTDB],[
10AC_ARG_WITH(tdb,
11 AS_HELP_STRING([--without-tdb],
12 [Do not use Samba TrivialDB. Default: auto-detect]), [
13case "$with_tdb" in
14 yes|no|auto)
15 : # Nothing special to do here
16 ;;
17 *)
18 AS_IF([test ! -d "$withval"],
19 AC_MSG_ERROR([--with-tdb path ($with_tdb) does not point to a directory])
20 )
21 LIBTDB_PATH="-L$withval/lib"
22 CPPFLAGS="-I$withval/include $CPPFLAGS"
23 ;;
24esac
25])
26AH_TEMPLATE(USE_TRIVIALDB,[Samba TrivialDB support is available])
27AS_IF([test "x$with_tdb" != "xno"],[
28 SQUID_STATE_SAVE(squid_libtdb_state)
29 LIBS="$LIBS $LIBTDB_PATH"
30 PKG_CHECK_MODULES([LIBTDB],[tdb],[CPPFLAGS="$CPPFLAGS $LIBTDB_CFLAGS"],[:])
31 AC_CHECK_HEADERS([sys/stat.h tdb.h],,,[
32#if HAVE_SYS_STAT_H
33#include <sys/stat.h>
34#endif
35 ])
36 SQUID_STATE_ROLLBACK(squid_libtdb_state) #de-pollute LIBS
37
38 AS_IF([test "x$with_tdb" = "xyes" -a "x$LIBTDB_LIBS" = "x"],
39 AC_MSG_ERROR([Required TrivialDB library not found])
40 )
41 AS_IF([test "x$LIBTDB_LIBS" != "x"],[
42 CXXFLAGS="$LIBTDB_CFLAGS $CXXFLAGS"
43 LIBTDB_LIBS="$LIBTDB_PATH $LIBTDB_LIBS"
44 AC_DEFINE_UNQUOTED(USE_TRIVIALDB, HAVE_TDB_H, [Samba TrivialDB support is available])
45 ],[with_tdb=no])
46])
47AC_MSG_NOTICE([Samba TrivialDB library support: ${with_tdb:=auto} ${LIBTDB_PATH} ${LIBTDB_LIBS}])
48AC_SUBST(LIBTDB_LIBS)
49])