tests/util/xmalloc-t tools/heimdal-strength.pod
# Do this globally. Everything needs to find the Kerberos headers and
-# libraries, and if we're using the system CrackLib or libcdb, add its
-# location unconditionally as well.
-AM_CPPFLAGS = $(CRACKLIB_CPPFLAGS) $(KRB5_CPPFLAGS) $(CDB_CPPFLAGS)
-AM_LDFLAGS = $(CRACKLIB_LDFLAGS) $(KRB5_LDFLAGS) $(CDB_LDFLAGS)
+# libraries, and if we're using the system CrackLib, TinyCDB, or SQLite, add
+# its location unconditionally as well.
+AM_CPPFLAGS = $(CRACKLIB_CPPFLAGS) $(KRB5_CPPFLAGS) $(CDB_CPPFLAGS) \
+ $(SQLITE_CPPFLAGS)
+AM_LDFLAGS = $(CRACKLIB_LDFLAGS) $(KRB5_LDFLAGS) $(CDB_LDFLAGS) \
+ $(SQLITE_LDFLAGS)
# Build our portability library.
noinst_LTLIBRARIES = portable/libportable.la
else
plugin_strength_la_LIBADD = $(CRACKLIB_LIBS)
endif
-plugin_strength_la_LIBADD += portable/libportable.la $(KRB5_LIBS) $(CDB_LIBS)
+plugin_strength_la_LIBADD += portable/libportable.la $(KRB5_LIBS) \
+ $(CDB_LIBS) $(SQLITE_LIBS)
# The Heimdal external check program.
bin_PROGRAMS = tools/heimdal-strength
tools_heimdal_strength_LDADD = $(CRACKLIB_LIBS)
endif
tools_heimdal_strength_LDADD += util/libutil.a portable/libportable.la \
- $(KRB5_LIBS) $(CDB_LIBS)
+ $(KRB5_LIBS) $(CDB_LIBS) $(SQLITE_LIBS)
# Other tools.
dist_bin_SCRIPTS = tools/heimdal-history tools/krb5-strength-wordlist
--- /dev/null
+dnl Find the compiler and linker flags for SQLite.
+dnl
+dnl Finds the compiler and linker flags for linking with the SQLite library.
+dnl Provides the --with-sqlite, --with-sqlite-lib, and --with-sqlite-include
+dnl configure options to specify non-standard paths to the SQLite libraries or
+dnl header files. Currently, only SQLite 3 is considered sufficient.
+dnl
+dnl Provides the macros RRA_LIB_SQLITE and RRA_LIB_SQLITE_OPTIONAL and sets
+dnl the substitution variables SQLITE_CPPFLAGS, SQLITE_LDFLAGS, and
+dnl SQLITE_LIBS. Also provides RRA_LIB_SQLITE_SWITCH to set CPPFLAGS,
+dnl LDFLAGS, and LIBS to include the SQLite libraries, saving the current
+dnl values first, and RRA_LIB_SQLITE_RESTORE to restore those settings to
+dnl before the last RRA_LIB_SQLITE_SWITCH. Defines HAVE_SQLITE and sets
+dnl rra_use_SQLITE to true if libevent is found. If it isn't found, the
+dnl substitution variables will be empty.
+dnl
+dnl Depends on the lib-helper.m4 framework.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Written by Russ Allbery <eagle@eyrie.org>
+dnl Copyright 2014
+dnl The Board of Trustees of the Leland Stanford Junior University
+dnl
+dnl This file is free software; the authors give unlimited permission to copy
+dnl and/or distribute it, with or without modifications, as long as this
+dnl notice is preserved.
+
+dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to
+dnl versions that include the libevent flags. Used as a wrapper, with
+dnl RRA_LIB_SQLITE_RESTORE, around tests.
+AC_DEFUN([RRA_LIB_SQLITE_SWITCH], [RRA_LIB_HELPER_SWITCH([SQLITE])])
+
+dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values before
+dnl RRA_LIB_SQLITE_SWITCH was called.
+AC_DEFUN([RRA_LIB_SQLITE_RESTORE], [RRA_LIB_HELPER_RESTORE([SQLITE])])
+
+dnl Checks if SQLite is present. The single argument, if "true", says to fail
+dnl if the SQLite library could not be found. Prefer probing with pkg-config
+dnl if available and the --with flags were not given.
+AC_DEFUN([_RRA_LIB_SQLITE_INTERNAL],
+[RRA_LIB_HELPER_PATHS([SQLITE])
+ AS_IF([test x"$SQLITE_CPPFLAGS" = x && test x"$SQLITE_LDFLAGS" = x],
+ [PKG_CHECK_EXISTS([sqlite3],
+ [PKG_CHECK_MODULES([SQLITE], [sqlite3])
+ SQLITE_CPPFLAGS="$SQLITE_CFLAGS"])])
+ AS_IF([test x"$SQLITE_LIBS" = x],
+ [RRA_LIB_SQLITE_SWITCH
+ LIBS=
+ AC_SEARCH_LIBS([sqlite3_open_v2], [sqlite3],
+ [SQLITE_LIBS="$LIBS"],
+ [AS_IF([test x"$1" = xtrue],
+ [AC_MSG_ERROR([cannot find usable SQLite library])])])
+ RRA_LIB_SQLITE_RESTORE])
+ RRA_LIB_SQLITE_SWITCH
+ AC_CHECK_HEADERS([sqlite3.h])
+ RRA_LIB_SQLITE_RESTORE])
+
+dnl The main macro for packages with mandatory SQLite 3 support.
+AC_DEFUN([RRA_LIB_SQLITE],
+[RRA_LIB_HELPER_VAR_INIT([SQLITE])
+ RRA_LIB_HELPER_WITH([sqlite], [SQLite], [SQLITE])
+ _RRA_LIB_SQLITE_INTERNAL([true])
+ rra_use_SQLITE=true
+ AC_DEFINE([HAVE_SQLITE], 1, [Define if SQLite is available.])])
+
+dnl The main macro for packages with optional SQLite support.
+AC_DEFUN([RRA_LIB_SQLITE_OPTIONAL],
+[RRA_LIB_HELPER_VAR_INIT([SQLITE])
+ RRA_LIB_HELPER_WITH_OPTIONAL([sqlite], [SQLite], [SQLITE])
+ AS_IF([test x"$rra_use_SQLITE" != xfalse],
+ [AS_IF([test x"$rra_use_SQLITE" = xtrue],
+ [_RRA_LIB_SQLITE_INTERNAL([true])],
+ [_RRA_LIB_SQLITE_INTERNAL([false])])])
+ AS_IF([test x"$SQLITE_LIBS" != x],
+ [rra_use_SQLITE=true
+ AC_DEFINE([HAVE_SQLITE], 1, [Define if SQLite is available.])])])
#endif /* !HAVE_CDB */
-#ifdef HAVE_SQLITE3
+#ifdef HAVE_SQLITE
/*
* If built with SQLite, set up krb5.conf to use a SQLite dictionary
is_password_test(ctx, vtable, data, &principal_tests[i]);
vtable->close(ctx, data);
-#else /* !HAVE_SQLITE3 */
+#else /* !HAVE_SQLITE */
/* Otherwise, mark the SQLite tests as skipped. */
count = ARRAY_SIZE(sqlite_tests) + ARRAY_SIZE(principal_tests);
skip_block(count * 2 + 1, "not built with SQLite support");
-#endif /* !HAVE_SQLITE3 */
+#endif /* !HAVE_SQLITE */
/* Manually clean up after the results of make-krb5-conf. */
basprintf(&path, "%s/krb5.conf", tmpdir);