xref: /freebsd/contrib/pam-krb5/configure.ac (revision bf6873c5786e333d679a7838d28812febf479a8a)
1dnl Autoconf configuration for pam-krb5.
2dnl
3dnl Written by Russ Allbery <eagle@eyrie.org>
4dnl Copyright 2005-2009, 2014, 2017, 2020-2021 Russ Allbery <eagle@eyrie.org>
5dnl Copyright 2009-2013
6dnl     The Board of Trustees of the Leland Stanford Junior University
7dnl Copyright 2005 Andres Salomon <dilinger@debian.org>
8dnl Copyright 1999-2000 Frank Cusack <fcusack@fcusack.com>
9dnl
10dnl SPDX-License-Identifier: BSD-3-clause or GPL-1+
11
12AC_PREREQ([2.64])
13AC_INIT([pam-krb5], [4.11], [eagle@eyrie.org])
14AC_CONFIG_AUX_DIR([build-aux])
15AC_CONFIG_LIBOBJ_DIR([portable])
16AC_CONFIG_MACRO_DIR([m4])
17AM_INIT_AUTOMAKE([1.11 check-news dist-xz foreign silent-rules subdir-objects
18    -Wall -Werror])
19AM_MAINTAINER_MODE
20
21dnl Detect unexpanded macros.
22m4_pattern_forbid([^PKG_])
23m4_pattern_forbid([^_?RRA_])
24
25AC_PROG_CC
26AC_USE_SYSTEM_EXTENSIONS
27RRA_PROG_CC_WARNINGS_FLAGS
28AC_SYS_LARGEFILE
29AM_PROG_CC_C_O
30m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
31AC_PROG_INSTALL
32LT_INIT([disable-static])
33AC_CANONICAL_HOST
34RRA_LD_VERSION_SCRIPT
35
36dnl Only used for the test suite.
37AC_ARG_VAR([PATH_OPENSSL], [Path to openssl for the test suite])
38AC_PATH_PROG([PATH_OPENSSL], [openssl])
39AS_IF([test x"$PATH_OPENSSL" != x],
40    [AC_DEFINE_UNQUOTED([PATH_OPENSSL], ["$PATH_OPENSSL"],
41        [Define to the full path to openssl for some tests.])])
42AC_ARG_VAR([PATH_VALGRIND], [Path to valgrind for the test suite])
43AC_PATH_PROG([PATH_VALGRIND], [valgrind])
44
45dnl Probe for the functionality of the PAM libraries and their include file
46dnl naming.  Mac OS X puts them in pam/* instead of security/*.
47AC_SEARCH_LIBS([pam_set_data], [pam])
48AC_CHECK_FUNCS([pam_getenv pam_getenvlist pam_modutil_getpwnam])
49AC_REPLACE_FUNCS([pam_syslog pam_vsyslog])
50AC_CHECK_HEADERS([security/pam_modutil.h], [],
51    [AC_CHECK_HEADERS([pam/pam_modutil.h])])
52AC_CHECK_HEADERS([security/pam_appl.h], [],
53    [AC_CHECK_HEADERS([pam/pam_appl.h], [],
54        [AC_MSG_ERROR([No PAM header files found])])])
55AC_CHECK_HEADERS([security/pam_ext.h], [],
56    [AC_CHECK_HEADERS([pam/pam_ext.h])])
57RRA_HEADER_PAM_CONST
58RRA_HEADER_PAM_STRERROR_CONST
59AC_DEFINE([MODULE_NAME], ["pam_krb5"],
60    [The name of the PAM module, used by the pam_vsyslog replacement.])
61
62dnl Probe for the location and functionality of the Kerberos libraries.
63RRA_LIB_KRB5
64RRA_LIB_KRB5_SWITCH
65AC_CHECK_HEADERS([hx509_err.h])
66AC_CHECK_MEMBER([krb5_creds.session],
67    [AC_DEFINE([HAVE_KRB5_HEIMDAL], [1],
68        [Define if your Kerberos implementation is Heimdal.])],
69    [AC_DEFINE([HAVE_KRB5_MIT], [1],
70        [Define if your Kerberos implementation is MIT.])],
71    [RRA_INCLUDES_KRB5])
72AC_CHECK_TYPES([krb5_realm], [], [], [RRA_INCLUDES_KRB5])
73AC_CHECK_FUNCS([krb5_cc_get_full_name \
74    krb5_data_free \
75    krb5_free_default_realm \
76    krb5_free_string \
77    krb5_get_init_creds_opt_alloc \
78    krb5_get_init_creds_opt_set_anonymous \
79    krb5_get_init_creds_opt_set_change_password_prompt \
80    krb5_get_init_creds_opt_set_default_flags \
81    krb5_get_init_creds_opt_set_fast_ccache_name \
82    krb5_get_init_creds_opt_set_out_ccache \
83    krb5_get_init_creds_opt_set_pa \
84    krb5_get_prompt_types \
85    krb5_init_secure_context \
86    krb5_principal_get_realm \
87    krb5_principal_set_comp_string \
88    krb5_set_password \
89    krb5_set_trace_filename \
90    krb5_verify_init_creds_opt_init \
91    krb5_xfree])
92AC_CHECK_FUNCS([krb5_get_init_creds_opt_set_pkinit],
93    [RRA_FUNC_KRB5_GET_INIT_CREDS_OPT_SET_PKINIT_ARGS])
94AC_CHECK_FUNCS([krb5_get_init_creds_opt_free],
95    [RRA_FUNC_KRB5_GET_INIT_CREDS_OPT_FREE_ARGS])
96AC_CHECK_DECLS([krb5_kt_free_entry], [], [], [RRA_INCLUDES_KRB5])
97AC_CHECK_FUNCS([krb5_appdefault_string], [],
98    [AC_CHECK_FUNCS([krb5_get_profile])
99     AC_CHECK_HEADERS([k5profile.h profile.h])
100     AC_LIBOBJ([krb5-profile])])
101AC_LIBOBJ([krb5-extra])
102RRA_LIB_KRB5_RESTORE
103
104dnl The kadmin client libraries are only used for the test suite.
105RRA_LIB_KADM5CLNT_OPTIONAL
106RRA_LIB_KADM5CLNT_SWITCH
107AC_CHECK_HEADERS([kadm5/kadm5_err.h])
108AC_CHECK_FUNCS([kadm5_init_krb5_context kadm5_init_with_skey_ctx])
109RRA_LIB_KADM5CLNT_RESTORE
110
111dnl Regex support is only used for the test suite.
112AC_CHECK_HEADER([regex.h], [AC_CHECK_FUNCS([regcomp])])
113
114dnl Other probes of the system libraries.
115AC_HEADER_STDBOOL
116AC_CHECK_HEADERS([strings.h sys/bittypes.h sys/select.h sys/time.h])
117AC_CHECK_DECLS([reallocarray])
118AC_TYPE_LONG_LONG_INT
119AC_CHECK_TYPES([ssize_t], [], [],
120    [#include <sys/types.h>])
121AC_CHECK_FUNCS([explicit_bzero])
122AC_REPLACE_FUNCS([asprintf issetugid mkstemp reallocarray strndup])
123
124dnl Try to specify the binding so that any references within the PAM module
125dnl are resolved to the functions in that module in preference to any external
126dnl function.
127dnl
128dnl More platforms could be handled here.  Contributions welcome.
129AS_CASE([$host],
130    [*-hpux*],
131    [AS_IF([test x"$GCC" = x"yes"],
132        [AM_LDFLAGS="-Wl,-Bsymbolic $AM_LDFLAGS"],
133        [AM_LDFLAGS="-Wl,+vshlibunsats $AM_LDFLAGS"])],
134
135    [*-linux*],
136    [AM_LDFLAGS="-Wl,-z,defs -Wl,-Bsymbolic $AM_LDFLAGS"],
137
138    [*-solaris2*],
139    [AS_IF([test x"$GCC" = x"yes"],
140        [AM_LDFLAGS="-Wl,-Bsymbolic $AM_LDFLAGS"],
141        [AM_LDFLAGS="-Wl,-xldscope=symbolic $AM_LDFLAGS"])])
142
143AC_CONFIG_HEADERS([config.h])
144AC_CONFIG_FILES([Makefile])
145AC_OUTPUT
146