]> eyrie.org Git - kerberos/remctl.git/blob - configure.ac
Ignore ignored attributes for Ruby
[kerberos/remctl.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl Written by Russ Allbery <eagle@eyrie.org>
4 dnl Copyright 2015-2016, 2018-2020, 2022 Russ Allbery <eagle@eyrie.org>
5 dnl Copyright 2016 Dropbox, Inc.
6 dnl Copyright 2002-2008, 2010-2014
7 dnl     The Board of Trustees of the Leland Stanford Junior University
8 dnl
9 dnl SPDX-License-Identifier: MIT
10
11 AC_PREREQ([2.64])
12 AC_INIT([remctl], [3.18], [eagle@eyrie.org])
13 AC_CONFIG_AUX_DIR([build-aux])
14 AC_CONFIG_LIBOBJ_DIR([portable])
15 AC_CONFIG_MACRO_DIR([m4])
16 AM_INIT_AUTOMAKE([1.11 check-news dist-xz foreign silent-rules subdir-objects
17     -Wall -Werror])
18 AM_MAINTAINER_MODE
19
20 dnl Detect unexpanded macros.
21 m4_pattern_forbid([^PKG_])
22 m4_pattern_forbid([^_?RRA_])
23
24 dnl AM_PROG_AR is required for Automake 1.12 by Libtool but not defined at all
25 dnl (or needed) in Automake 1.11.  Work around this bug.
26 AC_PROG_CC
27 AC_USE_SYSTEM_EXTENSIONS
28 RRA_PROG_CC_WARNINGS_FLAGS
29 AC_SYS_LARGEFILE
30 AM_PROG_CC_C_O
31 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
32 LT_INIT
33 RRA_LD_VERSION_SCRIPT
34
35 dnl Support installation of systemd unit files.
36 RRA_WITH_SYSTEMD_UNITDIR
37
38 dnl Find a sudo binary for the sudo remctld configuration option.
39 AC_ARG_VAR([PATH_SUDO], [Path to sudo for executing commands])
40 AC_PATH_PROG([PATH_SUDO], [sudo])
41
42 dnl Only used for the test suite.
43 AC_ARG_VAR([PATH_FAKEROOT], [Path to fakeroot for the test suite])
44 AC_PATH_PROG([PATH_FAKEROOT], [fakeroot])
45 AC_ARG_VAR([PATH_VALGRIND], [Path to valgrind for the test suite])
46 AC_PATH_PROG([PATH_VALGRIND], [valgrind])
47
48 dnl Probes for networking libraries.
49 AC_SEARCH_LIBS([gethostbyname], [nsl])
50 AC_SEARCH_LIBS([socket], [socket], [],
51     [AC_CHECK_LIB([nsl], [socket], [LIBS="-lnsl -lsocket $LIBS"], [],
52         [-lsocket])])
53
54 dnl Kerberos portability checks.
55 RRA_LIB_KRB5_OPTIONAL
56 AS_IF([test x"$rra_use_KRB5" = xtrue],
57     [RRA_LIB_KRB5_SWITCH
58      AC_CHECK_FUNCS([krb5_free_default_realm \
59          krb5_get_init_creds_opt_alloc \
60          krb5_get_init_creds_opt_set_anonymous \
61          krb5_get_init_creds_opt_set_default_flags \
62          krb5_get_init_creds_opt_set_out_ccache \
63          krb5_init_creds_set_password \
64          krb5_principal_get_realm \
65          krb5_xfree])
66      AC_CHECK_FUNCS([krb5_get_init_creds_opt_free],
67         [RRA_FUNC_KRB5_GET_INIT_CREDS_OPT_FREE_ARGS])
68      AC_CHECK_DECLS([krb5_kt_free_entry], [], [], [RRA_INCLUDES_KRB5])
69      AC_LIBOBJ([krb5-extra])
70      RRA_LIB_KRB5_RESTORE])
71 AM_CONDITIONAL([HAVE_KRB5], [test x"$rra_use_KRB5" = xtrue])
72
73 dnl GSS-API portability checks.
74 RRA_LIB_GSSAPI
75 RRA_LIB_GSSAPI_SWITCH
76 AC_CHECK_DECLS([GSS_KRB5_MECHANISM], [],
77    [AC_CHECK_DECLS([gss_mech_krb5], [],
78        [AC_LIBOBJ([gssapi-mech])], [RRA_INCLUDES_GSSAPI])],
79    [RRA_INCLUDES_GSSAPI])
80 AC_CHECK_FUNCS([gss_krb5_ccache_name gss_krb5_import_cred gss_oid_equal])
81 RRA_LIB_GSSAPI_RESTORE
82
83 dnl Check for libevent, used by the server.
84 RRA_LIB_EVENT
85 RRA_LIB_EVENT_SWITCH
86 AC_CHECK_HEADERS([event2/event.h])
87 AC_CHECK_TYPES([bufferevent_data_cb, bufferevent_event_cb, event_callback_fn,
88                 evutil_socket_t],
89     [], [], [RRA_INCLUDES_EVENT])
90 AC_CHECK_FUNCS([bufferevent_get_input \
91     bufferevent_read_buffer \
92     bufferevent_socket_new \
93     evbuffer_get_length \
94     event_base_got_break \
95     event_base_loopbreak \
96     event_free \
97     event_new \
98     event_set_fatal_callback \
99     libevent_global_shutdown])
100 RRA_LIB_EVENT_RESTORE
101
102 dnl Check for the systemd daemon support library.
103 RRA_LIB_SYSTEMD_DAEMON_OPTIONAL
104
105 dnl Check for the CMU GPUT library.
106 RRA_LIB_GPUT
107
108 dnl Check for regex libraries for pcre:* and regex:* ACL support.
109 RRA_LIB_PCRE2_OPTIONAL
110 AS_IF([test x"$rra_use_PCRE2" != xtrue], [RRA_LIB_PCRE_OPTIONAL])
111 AC_CHECK_HEADER([regex.h], [AC_CHECK_FUNCS([regcomp])])
112
113 dnl General C library and networking probes.
114 AC_HEADER_STDBOOL
115 AC_CHECK_HEADERS([sys/bitypes.h sys/filio.h sys/select.h sys/time.h \
116                   sys/uio.h syslog.h])
117 AC_CHECK_DECLS([reallocarray])
118 AC_CHECK_DECLS([h_errno], [], [], [#include <netdb.h>])
119 AC_CHECK_DECLS([inet_aton, inet_ntoa], [], [],
120     [#include <sys/types.h>
121      #include <netinet/in.h>
122      #include <arpa/inet.h>])
123 RRA_C_C99_VAMACROS
124 RRA_C_GNU_VAMACROS
125 AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [],
126     [#include <sys/types.h>
127      #include <sys/socket.h>])
128 AC_TYPE_LONG_LONG_INT
129 AC_TYPE_UINT32_T
130 AC_CHECK_TYPES([sig_atomic_t], [], [],
131     [#include <sys/types.h>
132      #include <signal.h>])
133 AC_CHECK_TYPES([ssize_t], [], [],
134     [#include <sys/types.h>])
135 AC_CHECK_TYPES([socklen_t], [], [],
136     [#include <sys/types.h>
137      #include <sys/socket.h>])
138 AC_CHECK_TYPES([struct sockaddr_in6],
139     [AC_DEFINE([HAVE_INET6], [1],
140         [Define to 1 if IPv6 library interfaces are available.])], [],
141     [#include <sys/types.h>
142      #include <netinet/in.h>])
143 AC_CHECK_TYPES([struct sockaddr_storage],
144     [AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], [], [],
145         [#include <sys/types.h>
146          #include <sys/socket.h>])], [],
147     [#include <sys/types.h>
148      #include <sys/socket.h>])
149 RRA_MACRO_IN6_ARE_ADDR_EQUAL
150 RRA_FUNC_INET_NTOA
151 AC_CHECK_FUNCS([getaddrinfo],
152     [RRA_FUNC_GETADDRINFO_ADDRCONFIG],
153     [AC_LIBOBJ([getaddrinfo])])
154 AC_CHECK_FUNCS([getgrnam_r setrlimit setsid])
155 AC_REPLACE_FUNCS([asprintf daemon getnameinfo getopt inet_aton inet_ntop \
156                   mkstemp reallocarray setenv strndup])
157
158 dnl Whether to build the Perl bindings.  Put this late so that it shows up
159 dnl near the bottom of the --help output.
160 build_perl=
161 AC_ARG_ENABLE([perl],
162     [AS_HELP_STRING([--enable-perl], [Build Perl libremctl bindings])],
163     [AS_IF([test x"$enableval" = xyes], [build_perl=yes])])
164 AM_CONDITIONAL([BUILD_PERL], [test x"$build_perl" = xyes])
165 AS_IF([test x"$build_perl" = xyes],
166     [RRA_PROG_PERL([5.008])
167      PERL_LDFLAGS=`"$PERL" -MConfig -e 'print $Config{lddlflags}'`])
168 AC_SUBST([PERL_LDFLAGS])
169
170 dnl Whether to build the PHP bindings.  The dance required to be able to run
171 dnl phpize before AC_OUTPUT sucks like a sucking thing.
172 build_php=
173 AC_ARG_ENABLE([php],
174     [AS_HELP_STRING([--enable-php], [Build remctl PECL extension for PHP])],
175     [AS_IF([test x"$enableval" = xyes],
176         [build_php=yes
177          AC_ARG_VAR([PHPIZE], [Path to phpize])
178          AC_PATH_PROG([PHPIZE], [phpize])
179          AS_IF([test x"$PHPIZE" = x],
180              [AC_MSG_ERROR([cannot build PECL extension without phpize])])])])
181 AM_CONDITIONAL([BUILD_PHP], [test x"$build_php" = xyes])
182
183 dnl Whether to build the Python bindings.
184 build_python=
185 AC_ARG_ENABLE([python],
186     [AS_HELP_STRING([--enable-python], [Build Python libremctl bindings])],
187     [AS_IF([test x"$enableval" = xyes], [build_python=yes])])
188 AM_CONDITIONAL([BUILD_PYTHON], [test x"$build_python" = xyes])
189 AS_IF([test x"$build_python" = xyes],
190     [RRA_PROG_PYTHON([2.3], [3.1])])
191
192 dnl Whether to build the Ruby bindings.
193 build_ruby=
194 AC_ARG_ENABLE([ruby],
195     [AS_HELP_STRING([--enable-ruby], [Build Ruby libremctl bindings])],
196     [AS_IF([test x"$enableval" = xyes], [build_ruby=yes])])
197 AM_CONDITIONAL([BUILD_RUBY], [test x"$build_ruby" = xyes])
198
199 dnl Used when building the Perl module.  Normally link against all the
200 dnl dependencies that libremctl may need, but don't do so if
201 dnl --enable-reduced-depends was specified.
202 AS_IF([test x"$rra_reduced_depends" = xtrue],
203     [DEPEND_LIBS=],
204     [DEPEND_LIBS="$GSSAPI_LDFLAGS $GSSAPI_LIBS $KRB5_LDFLAGS $KRB5_LIBS"])
205 AC_SUBST([DEPEND_LIBS])
206
207 AC_CONFIG_FILES([Makefile java/build.xml java/local.properties])
208 AC_CONFIG_FILES([tests/data/conf-simple])
209 AS_IF([test x"$build_php" = xyes],
210     [AC_CONFIG_FILES([php/config.m4 php/php_remctl.h])])
211 AS_IF([test x"$build_ruby" = xyes],
212     [AC_CONFIG_FILES([ruby/extconf.rb ruby/test_remctl.rb])])
213 AC_CONFIG_HEADERS([config.h])
214 AC_CONFIG_COMMANDS([docs], [test -d docs || mkdir docs])
215 AC_CONFIG_COMMANDS([tests/config],
216     [test -d tests/config || mkdir tests/config])
217 AC_OUTPUT