-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigure.ac
270 lines (247 loc) · 9.98 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
dnl Autoconf configuration for rra-c-util.
dnl
dnl Written by Russ Allbery <[email protected]>
dnl Copyright 2000, 2003, 2013-2018, 2020-2022, 2024
dnl Russ Allbery <[email protected]>
dnl Copyright 2002-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
dnl SPDX-License-Identifier: FSFULLR
dnl I use this introductory boilerplate for all configure.ac files, changing
dnl the AC_INIT arguments as appropriate.
AC_PREREQ([2.64])
AC_INIT([rra-c-util], [11.0.0], [[email protected]])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_LIBOBJ_DIR([portable])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 dist-xz foreign silent-rules subdir-objects -Wall
-Werror])
AM_MAINTAINER_MODE
dnl Detect unexpanded macros.
m4_pattern_forbid([^PKG_])
m4_pattern_forbid([^_?RRA_])
dnl Standard probes for the basic compilation environment. These are
dnl generally the same for every package, except that ones that include shared
dnl libraries change AC_PROG_RANLIB to AC_PROG_LIBTOOL. Add
dnl RRA_LD_VERSION_SCRIPT to probe for symbol versioning support for packages
dnl using shared libraries.
dnl
dnl AM_PROG_AR is required for Automake 1.12 by Libtool but not defined at all
dnl (or needed) in Automake 1.11. Work around this bug.
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
RRA_PROG_CC_WARNINGS_FLAGS
AC_SYS_LARGEFILE
AM_PROG_CC_C_O
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_PROG_INSTALL
AC_PROG_RANLIB
dnl Only needed when running mkdir -p in Makefile.am.
AC_PROG_MKDIR_P
dnl Add hardening flags to the link step if supported.
RRA_PROG_LD_FLAG([-Wl,-z,relro], [LDFLAGS="${LDFLAGS} -Wl,-z,relro"])
RRA_PROG_LD_FLAG([-Wl,-z,now], [LDFLAGS="${LDFLAGS} -Wl,-z,now"])
dnl Probe for Perl. This isn't used by this package except in tests, but
dnl probe for it anyway to exercise the macros. The Perl module is included
dnl in core, so that test should always succeed.
RRA_PROG_PERL([5.006])
RRA_PERL_CHECK_MODULE([File::Spec])
dnl Probe for Python. This isn't used by this package at all, but probe for
dnl it anyway to exercise the macros. The Python module is included in Python
dnl core, so that test should always succeed.
RRA_PROG_PYTHON([2.3], [3.0])
RRA_PYTHON_CHECK_MODULE([distutils])
dnl Only used for the test suite.
AC_ARG_VAR([PATH_VALGRIND], [Path to valgrind for the test suite])
AC_PATH_PROG([PATH_VALGRIND], [valgrind])
dnl Probes for networking libraries. Only needed for packages that make or
dnl receive network connections or do DNS lookups.
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([socket], [socket], [],
[AC_CHECK_LIB([nsl], [socket], [LIBS="-lnsl -lsocket $LIBS"], [],
[-lsocket])])
dnl Probe for Kerberos. This is only needed for packages that use Kerberos,
dnl of course. These are the necessary probes for building the full
dnl portability layer and the kerberos.c TAP library add-on. Many packages
dnl will need less than this. This should possibly move into krb5.m4.
RRA_LIB_KRB5
RRA_LIB_KRB5_SWITCH
AC_CHECK_TYPES([krb5_realm], [], [], [RRA_INCLUDES_KRB5])
AC_CHECK_FUNCS([krb5_cc_copy_cache \
krb5_cc_get_full_name \
krb5_data_free \
krb5_free_default_realm \
krb5_free_string \
krb5_get_init_creds_opt_alloc \
krb5_get_init_creds_opt_set_change_password_prompt \
krb5_get_init_creds_opt_set_default_flags \
krb5_init_secure_context \
krb5_principal_get_comp_string \
krb5_principal_get_num_comp \
krb5_principal_get_realm \
krb5_principal_set_realm \
krb5_set_password \
krb5_verify_init_creds_opt_init \
krb5_xfree])
AC_CHECK_FUNCS([krb5_get_init_creds_opt_set_pkinit],
[RRA_FUNC_KRB5_GET_INIT_CREDS_OPT_SET_PKINIT_ARGS])
AC_CHECK_FUNCS([krb5_get_init_creds_opt_free],
[RRA_FUNC_KRB5_GET_INIT_CREDS_OPT_FREE_ARGS])
AC_CHECK_DECLS([krb5_kt_free_entry], [], [], [RRA_INCLUDES_KRB5])
AC_CHECK_FUNCS([krb5_appdefault_string], [],
[AC_CHECK_FUNCS([krb5_get_profile])
AC_CHECK_HEADERS([k5profile.h profile.h])
AC_LIBOBJ([krb5-profile])])
AC_CHECK_FUNCS([krb5_get_renewed_creds], [],
[AC_CHECK_FUNCS([krb5_copy_creds_contents])
AC_LIBOBJ([krb5-renew])])
AC_LIBOBJ([krb5-extra])
RRA_LIB_KRB5_RESTORE
dnl Probe for GSS-API. This is only needed for packages that use GSS-API.
dnl The mechanism probe is not included in RRA_LIB_GSSAPI since it requires
dnl a replacement source file and is only needed for packages that need to
dnl refer to the Kerberos mechanism OID.
RRA_LIB_GSSAPI
RRA_LIB_GSSAPI_SWITCH
AC_CHECK_DECLS([GSS_KRB5_MECHANISM], [],
[AC_CHECK_DECLS([gss_mech_krb5], [],
[AC_LIBOBJ([gssapi-mech])], [RRA_INCLUDES_GSSAPI])],
[RRA_INCLUDES_GSSAPI])
AC_CHECK_FUNCS([gss_oid_equal])
RRA_LIB_GSSAPI_RESTORE
dnl Probe for Kerberos kadmin client libraries.
RRA_LIB_KADM5CLNT_OPTIONAL
RRA_LIB_KADM5CLNT_SWITCH
AC_CHECK_HEADERS([kadm5/kadm5_err.h])
AC_CHECK_FUNCS([kadm5_init_krb5_context kadm5_init_with_skey_ctx])
RRA_LIB_KADM5CLNT_RESTORE
dnl Probe for libevent.
RRA_LIB_EVENT_OPTIONAL
AS_IF([test x"$rra_use_LIBEVENT" = xtrue],
[RRA_LIB_EVENT_SWITCH
AC_CHECK_HEADERS([event2/event.h])
AC_CHECK_TYPES([bufferevent_data_cb, bufferevent_event_cb,
event_callback_fn, evutil_socket_t],
[], [], [RRA_INCLUDES_EVENT])
AC_CHECK_FUNCS([bufferevent_get_input \
bufferevent_read_buffer \
bufferevent_socket_new \
evbuffer_get_length \
event_base_got_break \
event_base_loopbreak \
event_free \
event_new \
event_set_fatal_callback \
libevent_global_shutdown])
AC_LIBOBJ([event-extra])
RRA_LIB_EVENT_RESTORE])
dnl Probe for libkafs. Do this so that we can test the libkafs portability
dnl library. For rra-c-util, AFS support is conditional and not built by
dnl default, so this is an example of that. For packages where it is not
dnl conditional, remove the test around RRA_LIB_KAFS and run it
dnl unconditionally.
rra_build_kafs=false
AC_ARG_ENABLE([kafs],
[AS_HELP_STRING([--enable-kafs], [Enable kafs library support])],
[AS_IF([test x"$enableval" != xno], [RRA_LIB_KAFS])])
AM_CONDITIONAL([NEED_KAFS], [test x"$rra_build_kafs" = xtrue])
dnl Probe for PAM. These are the tests required for portable/pam.h and its
dnl replacement functions.
AC_SEARCH_LIBS([pam_set_data], [pam])
AC_CHECK_FUNCS([pam_getenv pam_getenvlist pam_modutil_getpwnam])
AC_REPLACE_FUNCS([pam_syslog pam_vsyslog])
AC_CHECK_HEADERS([security/pam_modutil.h], [],
[AC_CHECK_HEADERS([pam/pam_modutil.h])])
AC_CHECK_HEADERS([security/pam_appl.h], [],
[AC_CHECK_HEADERS([pam/pam_appl.h], [],
[AC_MSG_ERROR([No PAM header files found])])])
AC_CHECK_HEADERS([security/pam_ext.h], [],
[AC_CHECK_HEADERS([pam/pam_ext.h])])
RRA_HEADER_PAM_CONST
RRA_HEADER_PAM_STRERROR_CONST
AC_DEFINE([MODULE_NAME], ["pam_example"],
[The name of the PAM module, used by the pam_vsyslog replacement.])
dnl Only required for the PAM test script facility.
AC_CHECK_HEADER([regex.h], [AC_CHECK_FUNCS([regcomp])])
dnl Probe for the flags to embed Perl. This isn't used by the package, but
dnl this ensures that we exercise the macros.
RRA_LIB_PERL
dnl Likewise for Python.
RRA_LIB_PYTHON
dnl Run other optional library probing checks, even though they're unused by
dnl the rra-c-util code itself, so that they're exercised during the
dnl rra-c-util configure run.
RRA_LIB_BDB_OPTIONAL
AS_IF([test x"$rra_use_BDB" = xtrue], [RRA_LIB_BDB_NDBM])
RRA_LIB_CDB_OPTIONAL
RRA_LIB_OPENSSL_OPTIONAL
RRA_LIB_PCRE_OPTIONAL
RRA_LIB_PCRE2_OPTIONAL
RRA_LIB_REMCTL_OPTIONAL
RRA_LIB_SASL_OPTIONAL
RRA_LIB_SQLITE3_OPTIONAL
RRA_LIB_SYSTEMD_DAEMON_OPTIONAL
RRA_LIB_ZLIB_OPTIONAL
dnl These probes are needed by anything that uses portable/system.h, the other
dnl portable replacements, and the messages utility library. sys/filio.h is
dnl only used by fdflag. sys/select.h is only used by the test for daemon.
AC_HEADER_STDBOOL
AC_CHECK_HEADERS([strings.h sys/bitypes.h sys/filio.h sys/select.h sys/uio.h])
AC_CHECK_HEADERS([sys/time.h syslog.h])
AC_CHECK_DECLS([reallocarray])
RRA_C_C99_VAMACROS
RRA_C_GNU_VAMACROS
AC_TYPE_LONG_LONG_INT
AC_TYPE_UINT32_T
AC_CHECK_TYPES([sig_atomic_t], [], [],
[#include <sys/types.h>
#include <signal.h>])
AC_CHECK_TYPES([ssize_t], [], [],
[#include <sys/types.h>])
AC_CHECK_FUNCS([explicit_bzero setrlimit setsid])
AC_REPLACE_FUNCS([asprintf daemon getopt issetugid mkstemp reallocarray])
AC_REPLACE_FUNCS([setenv seteuid strndup])
dnl Additional probes for networking portability, used for packages that have
dnl network code and support IPv6. Probing for sys/select.h is also required
dnl for any package that uses the process TAP add-on.
AC_CHECK_HEADERS([sys/select.h])
AC_CHECK_DECLS([h_errno], [], [], [#include <netdb.h>])
AC_CHECK_DECLS([inet_aton, inet_ntoa], [], [],
[#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>])
AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [],
[#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_TYPES([socklen_t], [], [],
[#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_TYPES([struct sockaddr_in6],
[AC_DEFINE([HAVE_INET6], [1],
[Define to 1 if IPv6 library interfaces are available.])], [],
[#include <sys/types.h>
#include <netinet/in.h>])
AC_CHECK_TYPES([struct sockaddr_storage],
[AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], [], [],
[#include <sys/types.h>
#include <sys/socket.h>])], [],
[#include <sys/types.h>
#include <sys/socket.h>])
RRA_MACRO_IN6_ARE_ADDR_EQUAL
RRA_FUNC_INET_NTOA
AC_CHECK_FUNCS([getaddrinfo],
[RRA_FUNC_GETADDRINFO_ADDRCONFIG],
[AC_LIBOBJ([getaddrinfo])])
AC_REPLACE_FUNCS([getnameinfo inet_aton inet_ntop])
dnl Additional probes for UNIX domain socket support. These are only needed
dnl by packages that want to use UNIX domain sockets.
RRA_SYS_UNIX_SOCKETS
RRA_MACRO_SUN_LEN
dnl Output section. This is generally the same for all packages.
AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT