]> eyrie.org Git - kerberos/krb5-strength.git/commitdiff
Simplify TinyCDB Autoconf probes
authorRuss Allbery <rra@stanford.edu>
Tue, 8 Oct 2013 18:33:40 +0000 (11:33 -0700)
committerRuss Allbery <rra@stanford.edu>
Tue, 8 Oct 2013 18:33:40 +0000 (11:33 -0700)
Refactor common code and ensure that rra_use_CDB is always set
properly.

m4/tinycdb.m4

index cb8c1f73b29d0721e2a13a81440484cc527a4492..1c9ef437e10a0d4411cf127a00774ed11f036bea 100644 (file)
@@ -9,9 +9,10 @@ dnl substitution variables CDB_CPPFLAGS, CDB_LDFLAGS, and CDB_LIBS.  Also
 dnl provides RRA_LIB_CDB_SWITCH to set CPPFLAGS, LDFLAGS, and LIBS to include
 dnl the kadmin client libraries, saving the ecurrent values, and
 dnl RRA_LIB_CDB_RESTORE to restore those settings to before the last
-dnl RRA_LIB_CDB_SWITCH.  Define HAVE_CDB if the library is found.
+dnl RRA_LIB_CDB_SWITCH.  Defines HAVE_CDB and sets rra_use_CDB to true if the
+dnl library is found.
 dnl
-dnl Depends on RRA_SET_LDFLAGS.
+dnl Depends on the lib-helper.m4 infrastructure.
 dnl
 dnl Written by Russ Allbery <rra@stanford.edu>
 dnl Copyright 2010, 2013
@@ -35,7 +36,10 @@ dnl says to fail if the libcdb library could not be found.
 AC_DEFUN([_RRA_LIB_CDB_INTERNAL],
 [RRA_LIB_HELPER_PATHS([CDB])
  RRA_LIB_CDB_SWITCH
- AC_CHECK_LIB([cdb], [cdb_init], [CDB_LIBS=-lcdb],
+ AC_CHECK_LIB([cdb], [cdb_init],
+    [CDB_LIBS=-lcdb
+     AC_DEFINE([HAVE_CDB], 1, [Define if libcdb is available.])
+     rra_use_CDB=true],
     [AS_IF([test x"$1" = xtrue],
         [AC_MSG_ERROR([cannot find usable TinyCDB library])])])
  AC_CHECK_HEADERS([cdb.h])
@@ -45,8 +49,7 @@ dnl The main macro for packages with mandatory kadmin client support.
 AC_DEFUN([RRA_LIB_CDB],
 [RRA_LIB_HELPER_VAR_INIT([CDB])
  RRA_LIB_HELPER_WITH([tinycdb], [TinyCDB], [CDB])
- _RRA_LIB_CDB_INTERNAL([true])
- AC_DEFINE([HAVE_CDB], 1, [Define if libcdb is available.])])
+ _RRA_LIB_CDB_INTERNAL([true])])
 
 dnl The main macro for packages with optional kadmin client support.
 AC_DEFUN([RRA_LIB_CDB_OPTIONAL],
@@ -55,6 +58,4 @@ AC_DEFUN([RRA_LIB_CDB_OPTIONAL],
  AS_IF([test x"$rra_use_CDB" != xfalse],
     [AS_IF([test x"$rra_use_CDB" = xtrue],
         [_RRA_LIB_CDB_INTERNAL([true])],
-        [_RRA_LIB_CDB_INTERNAL([false])])])
- AS_IF([test x"$CDB_LIBS" != x],
-    [AC_DEFINE([HAVE_CDB], 1, [Define if libcdb is available.])])])
+        [_RRA_LIB_CDB_INTERNAL([false])])])])