1dnl Find the compiler and linker flags for the kadmin client library. 2dnl 3dnl Finds the compiler and linker flags for linking with the kadmin client 4dnl library. Provides the --with-kadm5clnt, --with-kadm5clnt-include, and 5dnl --with-kadm5clnt-lib configure option to specify a non-standard path to 6dnl the library. Uses krb5-config where available unless reduced dependencies 7dnl is requested or --with-kadm5clnt-include or --with-kadm5clnt-lib are 8dnl given. 9dnl 10dnl Provides the macros RRA_LIB_KADM5CLNT and RRA_LIB_KADM5CLNT_OPTIONAL and 11dnl sets the substitution variables KADM5CLNT_CPPFLAGS, KADM5CLNT_LDFLAGS, and 12dnl KADM5CLNT_LIBS. Also provides RRA_LIB_KADM5CLNT_SWITCH to set CPPFLAGS, 13dnl LDFLAGS, and LIBS to include the kadmin client libraries, saving the 14dnl ecurrent values, and RRA_LIB_KADM5CLNT_RESTORE to restore those settings 15dnl to before the last RRA_LIB_KADM5CLNT_SWITCH. Defines HAVE_KADM5CLNT and 16dnl sets rra_use_KADM5CLNT to true if the library is found. 17dnl 18dnl Depends on the RRA_LIB helper routines. 19dnl 20dnl The canonical version of this file is maintained in the rra-c-util 21dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>. 22dnl 23dnl Written by Russ Allbery <eagle@eyrie.org> 24dnl Copyright 2005-2009, 2011, 2013 25dnl The Board of Trustees of the Leland Stanford Junior University 26dnl 27dnl This file is free software; the authors give unlimited permission to copy 28dnl and/or distribute it, with or without modifications, as long as this 29dnl notice is preserved. 30dnl 31dnl SPDX-License-Identifier: FSFULLR 32 33dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to 34dnl versions that include the kadmin client flags. Used as a wrapper, with 35dnl RRA_LIB_KADM5CLNT_RESTORE, around tests. 36AC_DEFUN([RRA_LIB_KADM5CLNT_SWITCH], [RRA_LIB_HELPER_SWITCH([KADM5CLNT])]) 37 38dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before 39dnl RRA_LIB_KADM5CLNT_SWITCH was called). 40AC_DEFUN([RRA_LIB_KADM5CLNT_RESTORE], [RRA_LIB_HELPER_RESTORE([KADM5CLNT])]) 41 42dnl Set KADM5CLNT_CPPFLAGS and KADM5CLNT_LDFLAGS based on rra_KADM5CLNT_root, 43dnl rra_KADM5CLNT_libdir, and rra_KADM5CLNT_includedir. 44AC_DEFUN([_RRA_LIB_KADM5CLNT_PATHS], [RRA_LIB_HELPER_PATHS([KADM5CLNT])]) 45 46dnl Does the appropriate library checks for reduced-dependency kadmin client 47dnl linkage. The single argument, if "true", says to fail if the kadmin 48dnl client library could not be found. 49AC_DEFUN([_RRA_LIB_KADM5CLNT_REDUCED], 50[RRA_LIB_KADM5CLNT_SWITCH 51 AC_CHECK_LIB([kadm5clnt], [kadm5_init_with_password], 52 [KADM5CLNT_LIBS=-lkadm5clnt], 53 [AS_IF([test x"$1" = xtrue], 54 [AC_MSG_ERROR([cannot find usable kadmin client library])])]) 55 RRA_LIB_KADM5CLNT_RESTORE]) 56 57dnl Sanity-check the results of krb5-config and be sure we can really link a 58dnl GSS-API program. If not, fall back on the manual check. 59AC_DEFUN([_RRA_LIB_KADM5CLNT_CHECK], 60[RRA_LIB_HELPER_CHECK([$1], [KADM5CLNT], [kadm5_init_with_password], 61 [kadmin client])]) 62 63dnl Determine GSS-API compiler and linker flags from krb5-config. 64AC_DEFUN([_RRA_LIB_KADM5CLNT_CONFIG], 65[RRA_KRB5_CONFIG([${rra_KADM5CLNT_root}], [kadm-client], [KADM5CLNT], 66 [_RRA_LIB_KADM5CLNT_CHECK([$1])], 67 [_RRA_LIB_KADM5CLNT_PATHS 68 _RRA_LIB_KADM5CLNT_REDUCED([$1])])]) 69 70dnl The core of the library checking, shared between RRA_LIB_KADM5CLNT and 71dnl RRA_LIB_KADM5CLNT_OPTIONAL. The single argument, if "true", says to fail 72dnl if the kadmin client library could not be found. 73AC_DEFUN([_RRA_LIB_KADM5CLNT_INTERNAL], 74[AC_REQUIRE([RRA_ENABLE_REDUCED_DEPENDS]) 75 AS_IF([test x"$rra_reduced_depends" = xtrue], 76 [_RRA_LIB_KADM5CLNT_PATHS 77 _RRA_LIB_KADM5CLNT_REDUCED([$1])], 78 [AS_IF([test x"$rra_KADM5CLNT_includedir" = x \ 79 && test x"$rra_KADM5CLNT_libdir" = x], 80 [_RRA_LIB_KADM5CLNT_CONFIG([$1])], 81 [_RRA_LIB_KADM5CLNT_PATHS 82 _RRA_LIB_KADM5CLNT_REDUCED([$1])])])]) 83 84dnl The main macro for packages with mandatory kadmin client support. 85AC_DEFUN([RRA_LIB_KADM5CLNT], 86[RRA_LIB_HELPER_VAR_INIT([KADM5CLNT]) 87 RRA_LIB_HELPER_WITH([kadm-client], [kadmin client], [KADM5CLNT]) 88 _RRA_LIB_KADM5CLNT_INTERNAL([true]) 89 rra_use_KADM5CLNT=true 90 AC_DEFINE([HAVE_KADM5CLNT], 1, [Define to enable kadmin client features.])]) 91 92dnl The main macro for packages with optional kadmin client support. 93AC_DEFUN([RRA_LIB_KADM5CLNT_OPTIONAL], 94[RRA_LIB_HELPER_VAR_INIT([KADM5CLNT]) 95 RRA_LIB_HELPER_WITH_OPTIONAL([kadm-client], [kadmin client], [KADM5CLNT]) 96 AS_IF([test x"$rra_use_KADM5CLNT" != xfalse], 97 [AS_IF([test x"$rra_use_KADM5CLNT" = xtrue], 98 [_RRA_LIB_KADM5CLNT_INTERNAL([true])], 99 [_RRA_LIB_KADM5CLNT_INTERNAL([false])])]) 100 AS_IF([test x"$KADM5CLNT_LIBS" != x], 101 [rra_use_KADM5CLNT=true 102 AC_DEFINE([HAVE_KADM5CLNT], 1, 103 [Define to enable kadmin client features.])])]) 104