Imported Upstream version 2.4.3
[platform/upstream/audit.git] / configure.ac
1 dnl
2 define([AC_INIT_NOTICE],
3 [### Generated automatically using autoconf version] AC_ACVERSION [
4 ### Copyright 2005-15 Steve Grubb <sgrubb@redhat.com>
5 ###
6 ### Permission is hereby granted, free of charge, to any person obtaining a
7 ### copy of this software and associated documentation files (the "Software"),
8 ### to deal in the Software without restriction, including without limitation
9 ### the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 ### and/or sell copies of the Software, and to permit persons to whom the
11 ### Software is furnished to do so, subject to the following conditions:
12 ###
13 ### The above copyright notice and this permission notice shall be included
14 ### in all copies or substantial portions of the Software.
15 ###
16 ### THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 ### IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 ### FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 ### THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 ### OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 ### ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 ### OTHER DEALINGS IN THE SOFTWARE.
23 ###
24 ### For usage, run `./configure --help'
25 ### For more detailed information on installation, read the file `INSTALL'.
26 ###
27 ### If configuration succeeds, status is in the file `config.status'.
28 ### A log of configuration tests is in `config.log'.
29 ])
30
31 AC_REVISION($Revision: 1.3 $)dnl
32 AC_INIT(audit,2.4.3)
33 AC_PREREQ(2.12)dnl
34 AM_CONFIG_HEADER(config.h)
35
36 echo Configuring auditd $VERSION
37
38 AC_CONFIG_MACRO_DIR([m4])
39 AC_CANONICAL_TARGET
40 AM_INIT_AUTOMAKE
41 AM_PROG_LIBTOOL
42 AC_SUBST(LIBTOOL_DEPS)
43 OLDLIBS="$LIBS"
44 m4_include([src/libev/libev.m4])
45 libev_LIBS="$LIBS"
46 LIBS="$OLDLIBS"
47
48 echo .
49 echo Checking for programs
50
51 AC_PROG_CC
52 AC_PROG_INSTALL
53 AC_PROG_AWK
54 AX_PROG_CC_FOR_BUILD
55
56 echo .
57 echo Checking for header files
58 AC_HEADER_STDC
59 AC_HEADER_TIME
60
61 AC_C_CONST
62 AC_C_INLINE
63 AC_CHECK_SIZEOF([unsigned int])
64 AC_CHECK_SIZEOF([unsigned long])
65 AM_PROG_CC_C_O
66 AC_CHECK_DECLS([AUDIT_FEATURE_VERSION], [], [], [[#include <linux/audit.h>]])
67 AC_CHECK_DECLS([AUDIT_VERSION_BACKLOG_WAIT_TIME], [], [], [[#include <linux/audit.h>]])
68 AC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>])
69 AC_CHECK_FUNCS([posix_fallocate])
70
71 ALLWARNS=""
72 ALLDEBUG="-g"
73 OPT="-O"
74 if test x"$GCC" = x"yes"; then
75   OPT="-O2 -pipe"
76   case "$target" in
77     *linux*)
78              ALLWARNS="-W -Wall -Wundef -Wpointer-arith -Wcast-align \
79 -Wwrite-strings -Waggregate-return -Wstrict-prototypes \
80 -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
81 -Wnested-externs -Winline -Wfloat-equal -Wchar-subscripts"
82              ;;
83     esac
84 fi
85
86 AC_MSG_CHECKING(whether to create python bindings)
87 AC_ARG_WITH(python,
88 AS_HELP_STRING([--with-python],[enable building python bindings]),
89 use_python=$withval,
90 use_python=auto)
91 if test x$use_python = xno ; then
92         python_found="no"
93         AC_MSG_RESULT(no)
94 else
95 AC_MSG_RESULT(testing)
96 AM_PATH_PYTHON
97 PYINCLUDEDIR=`python${am_cv_python_version} -c "from distutils import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))"`
98 if test -f ${PYINCLUDEDIR}/Python.h ; then
99         python_found="yes"
100         AC_SUBST(PYINCLUDEDIR)
101         pybind_dir="python"
102         AC_SUBST(pybind_dir)
103         AC_MSG_NOTICE(Python bindings will be built)
104 else
105         python_found="no"
106         if test x$use_python = xyes ; then
107                 AC_MSG_ERROR([Python explicitly required and python headers found])
108         else
109                 AC_MSG_WARN("Python headers not found - python bindings will not be made")
110         fi
111 fi
112 fi
113 AM_CONDITIONAL(HAVE_PYTHON, test ${python_found} = "yes")
114
115 AC_MSG_CHECKING(whether to create python3 bindings)
116 AC_ARG_WITH(python3,
117 AS_HELP_STRING([--with-python3],[enable building python3 bindings]),
118 use_python3=$withval,
119 use_python3=auto)
120 if test x$use_python3 = xno ; then
121         AC_MSG_RESULT(no)
122 else
123         AC_MSG_RESULT(investigating)
124         AC_PATH_PROG([use_python3], [python3-config], [no])
125         if test ${use_python3} = no ; then
126                 if test ${withval} = yes ; then
127                         echo "Python3 bindings were selected but python3-config was not found."
128                         echo "Please ensure that it's installed or pass --without-python3 to ./configure"
129                         exit 1
130                 fi
131                 echo "Python3 bindings will NOT be built"
132         else
133         echo "Python3 bindings WILL be built"
134         use_python3=yes
135         AC_PATH_PROG([PYTHON3], [python3], [no])
136         if test "$PYTHON3" == "no" ; then
137                 echo "The python3 program was not found in the search path. Please ensure"
138                 echo "that it is installed and its directory is included in the search path or"
139                 echo "pass --without-python3 to ./configure."
140                 exit 1
141         fi
142         PYTHON3_CFLAGS=`python3-config --cflags 2> /dev/null`
143         PYTHON3_LIBS=`python3-config --libs 2> /dev/null`
144         PYTHON3_INCLUDES=`python3-config --includes 2> /dev/null`
145         AC_SUBST([PYTHON3_PREFIX], ['${prefix}'])
146         AC_SUBST([PYTHON3_EXEC_PREFIX], ['${exec_prefix}'])
147         PYTHON3_DIR=`$PYTHON3 -c "import distutils.sysconfig; \
148         print(distutils.sysconfig.get_python_lib(0,0,prefix='$PYTHON3_PREFIX'))"`
149         PYTHON3_EXECDIR=`$PYTHON3 -c "import distutils.sysconfig; \
150         print(distutils.sysconfig.get_python_lib(1,0,prefix='$PYTHON3_EXEC_PREFIX'))"`
151         AC_SUBST(PYTHON3_CFLAGS)
152         AC_SUBST(PYTHON3_LIBS)
153         AC_SUBST(PYTHON3_INCLUDES)
154         AC_SUBST(python3dir, $PYTHON3_DIR)
155         AC_SUBST(py3execdir, $PYTHON3_EXECDIR)
156         fi
157 fi
158 AM_CONDITIONAL(USE_PYTHON3, test ${use_python3} = "yes")
159
160 AC_MSG_CHECKING(whether to create Go language bindings)
161 AC_ARG_WITH(golang,
162 AS_HELP_STRING([--with-golang],[enable building golang bindings]),
163 use_golang=$withval,
164 use_golang=auto)
165 if test x$use_golang = xno ; then
166     golang_found="no"
167     AC_MSG_RESULT(no)
168 else
169     AC_MSG_RESULT(testing)
170     AC_CHECK_PROG([GOLANG],[go],[go],[no])
171     AS_IF([test "x$GOLANG" != "xno"],[
172         AC_MSG_NOTICE(Go bindings will be built)
173         golang_found="yes"
174
175         # Substitute some golang environment.
176         GOROOT=`$GOLANG env GOROOT`
177         AC_SUBST([GOROOT])
178         gobind_dir="golang"
179         AC_SUBST([gobind_dir])
180     ], [
181         if test x$use_golang = xyes ; then
182                 AC_MSG_ERROR([Go language explicitly requested and program not found])
183         else
184                 AC_MSG_WARN("Go not found - go bindings will not be made")
185         fi
186     ])
187 fi
188 AM_CONDITIONAL(HAVE_GOLANG, test ${golang_found} = "yes")
189
190 #auditd listener
191 AC_MSG_CHECKING(whether to include auditd network listener support)
192 AC_ARG_ENABLE(listener,
193               [AS_HELP_STRING([--disable-listener],
194                               [Disable auditd network listener support])],
195               enable_listener=$enableval,
196               enable_listener=yes)
197 if test "x$enable_listener" != "xno"; then
198         AC_DEFINE(USE_LISTENER, 1,
199                   [Define if you want to use the auditd network listener.])
200 fi
201 AM_CONDITIONAL(ENABLE_LISTENER, test "x$enable_listener" != "xno")
202 AC_MSG_RESULT($enable_listener)
203
204 #audisp zos-remote plugin
205 AC_MSG_CHECKING(whether to include audisp ZOS remote plugin)
206 AC_ARG_ENABLE(zos-remote,
207               [AS_HELP_STRING([--disable-zos-remote],
208                               [Disable audisp ZOS remote plugin])],
209               enable_zos_remote=$enableval,
210               enable_zos_remote=yes)
211 AM_CONDITIONAL(ENABLE_ZOS_REMOTE, test "x$enable_zos_remote" != "xno")
212 AC_MSG_RESULT($enable_zos_remote)
213
214 #gssapi
215 AC_ARG_ENABLE(gssapi_krb5,
216         [AS_HELP_STRING([--enable-gssapi-krb5],[Enable GSSAPI Kerberos 5 support @<:@default=no@:>@])],
217         [case "${enableval}" in
218          yes) want_gssapi_krb5="yes" ;;
219           no) want_gssapi_krb5="no" ;;
220            *) AC_MSG_ERROR(bad value ${enableval} for --enable-gssapi-krb5) ;;
221          esac],
222         [want_gssapi_krb5="no"]
223 )
224 if test $want_gssapi_krb5 = yes; then
225         AC_CHECK_LIB(gssapi_krb5, gss_acquire_cred, [
226                 AC_CHECK_HEADER(gssapi/gssapi.h, [
227                         AC_DEFINE(USE_GSSAPI,,
228                                   Define if you want to use GSSAPI)
229                         gss_libs="-lgssapi_krb5 -lkrb5"
230                         AC_SUBST(gss_libs)
231                 ])
232         ])
233 fi
234 AM_CONDITIONAL(ENABLE_GSSAPI, test x$want_gssapi_krb5 = xyes)
235
236 #systemd
237 AC_ARG_ENABLE(systemd,
238         [AS_HELP_STRING([--enable-systemd],[Enable systemd init scripts @<:@default=no@:>@])],
239         [case "${enableval}" in
240          yes) want_systemd="yes" ;;
241           no) want_systemd="no" ;;
242            *) AC_MSG_ERROR(bad value ${enableval} for --enable-systemd) ;;
243          esac],
244         [want_systemd="no"]
245 )
246 AM_CONDITIONAL(ENABLE_SYSTEMD, test x$want_systemd = xyes)
247
248 ALLDEBUG="-g"
249 AC_ARG_WITH(debug,
250 [  --with-debug            turn on debugging [[default=no]]],
251 [
252 if test "x${withval}" = xyes; then
253         DEBUG="$ALLDEBUG"
254         OPT="-O"
255         AM_CONDITIONAL(DEBUG, true)
256 else
257         DEBUG="-DNDEBUG"
258         AM_CONDITIONAL(DEBUG, false)
259 fi
260 ],
261 [ DEBUG="-DNDEBUG"; AM_CONDITIONAL(DEBUG, false) ])
262
263 AC_ARG_WITH(warn,
264 [  --with-warn             turn on warnings [[default=yes]]],
265 [
266 if test "x${withval}" = xyes; then
267         WARNS="$ALLWARNS"
268 else
269         WARNS=""
270 fi
271 ],WARNS="$ALLWARNS")
272
273 AC_MSG_CHECKING(whether to include alpha processor support)
274 AC_ARG_WITH(alpha,
275 AS_HELP_STRING([--with-alpha],[enable Alpha processor support]),
276 use_alpha=$withval,
277 use_alpha=no)
278 if test x$use_alpha != xno ; then
279       AC_DEFINE(WITH_ALPHA,1,[Define if you want to enable Alpha processor support.])
280 fi
281 AM_CONDITIONAL(USE_ALPHA, test x$use_alpha = xyes)
282 AC_MSG_RESULT($use_alpha)
283
284 AC_MSG_CHECKING(whether to include arm eabi processor support)
285 AC_ARG_WITH(arm,
286 AS_HELP_STRING([--with-arm],[enable Arm eabi processor support]),
287 use_arm=$withval,
288 use_arm=no)
289 if test x$use_arm != xno ; then
290       AC_DEFINE(WITH_ARM,1,[Define if you want to enable Arm eabi processor support.])
291 fi
292 AM_CONDITIONAL(USE_ARM, test x$use_arm = xyes)
293 AC_MSG_RESULT($use_arm)
294
295 AC_MSG_CHECKING(whether to include aarch64 processor support)
296 AC_ARG_WITH(aarch64,
297 AS_HELP_STRING([--with-aarch64],[enable Aarch64 processor support]),
298 use_aarch64=$withval,
299 use_aarch64=no)
300 if test x$use_aarch64 != xno ; then
301       AC_DEFINE(WITH_AARCH64,1,[Define if you want to enable Aarch64 processor support.])
302 fi
303 AM_CONDITIONAL(USE_AARCH64, test x$use_aarch64 = xyes)
304 AC_MSG_RESULT($use_aarch64)
305
306 AC_MSG_CHECKING(whether to use apparmor)
307 AC_ARG_WITH(apparmor,
308 AS_HELP_STRING([--with-apparmor],[enable AppArmor events]),
309 use_apparmor=$withval,
310 use_apparmor=no)
311 if test x$use_apparmor != xno ; then
312       AC_DEFINE(WITH_APPARMOR,1,[Define if you want to enable AppArmor events.])
313 fi
314 AC_MSG_RESULT($use_apparmor)
315
316 AC_MSG_CHECKING(whether to use prelude)
317 AC_ARG_WITH(prelude,
318 AS_HELP_STRING([--with-prelude],[enable prelude IDS support]),
319 use_prelude=$withval,
320 use_prelude=no)
321 AC_MSG_RESULT($use_prelude)
322 if test x$use_prelude = xno ; then
323         have_prelude=no;
324 else
325       AC_CHECK_LIB(prelude, prelude_init,
326                  have_prelude=yes, have_prelude=no)
327       if test x$have_prelude = xno ; then
328         AC_MSG_ERROR([Prelude explicitly required and prelude library not found])
329       else
330         LIBPRELUDE_CFLAGS=`libprelude-config --pthread-cflags 2>/dev/null`
331         LIBPRELUDE_LDFLAGS=`libprelude-config --ldflags 2>/dev/null`
332         AC_MSG_RESULT(yes)
333       fi
334 fi
335 AM_CONDITIONAL(HAVE_PRELUDE, test x$have_prelude = xyes)
336
337 AC_MSG_CHECKING(whether to use libwrap)
338 AC_ARG_WITH(libwrap,
339 [  --with-libwrap[=PATH]   Compile in libwrap (tcp_wrappers) support.],
340 [ case "$withval" in
341         no)
342                 AC_MSG_RESULT(no)
343                 ;;
344         yes)
345                 AC_MSG_RESULT(yes)
346                 AC_CHECK_HEADER(tcpd.h, [],
347                         AC_MSG_ERROR([Could not find libwrap headers]),)
348                 AC_CHECK_LIB(wrap, request_init, [ LIBWRAP_LIBS="-lwrap" ])
349                 AC_CHECK_LIB(nsl, yp_get_default_domain, [
350                         LIBWRAP_LIBS="$LIBWRAP_LIBS -lnsl" ])
351                 ;;
352         *)
353                 AC_MSG_RESULT(yes)
354                 if test -d "$withval"; then
355                         LIBWRAP_LIBS="-L$withval -lwrap"
356                 else
357                         LIBWRAP_LIBS="$withval"
358                 fi
359                 AC_CHECK_HEADER(tcpd.h, [],
360                         AC_MSG_ERROR([Could not find libwrap headers]))
361                 AC_CHECK_LIB(wrap, request_init, [])
362                 AC_CHECK_LIB(nsl, yp_get_default_domain, [
363                         LIBWRAP_LIBS="$LIBWRAP_LIBS -lnsl" ])
364                 OLDLIBS="$LIBS"
365                 LIBS="$LIBWRAP_LIBS $LIBS"
366                 AC_TRY_LINK([ int allow_severity; int deny_severity; ],
367                         [ hosts_access(); ], [],
368                         [ AC_MSG_ERROR(Could not find the $withval library.  You must first install tcp_wrappers.) ])
369                 LIBS="$OLDLIBS"
370                 ;;
371         esac ],
372         AC_MSG_RESULT(no)
373 )
374 if test x"$LIBWRAP_LIBS" != "x"; then
375         AC_DEFINE_UNQUOTED(HAVE_LIBWRAP, [], Define if tcp_wrappers support is enabled )
376 fi
377
378 # See if we want to support lower capabilities for plugins
379 LIBCAP_NG_PATH
380
381 AC_SUBST(DEBUG)
382 AC_SUBST(LIBWRAP_LIBS)
383 #AC_SUBST(libev_LIBS)
384 AC_SUBST(LIBPRELUDE_CFLAGS)
385 AC_SUBST(LIBPRELUDE_LDFLAGS)
386
387 AC_OUTPUT(Makefile lib/Makefile lib/audit.pc lib/test/Makefile auparse/Makefile auparse/test/Makefile auparse/auparse.pc src/Makefile src/mt/Makefile src/libev/Makefile src/test/Makefile docs/Makefile init.d/Makefile audisp/Makefile audisp/plugins/Makefile audisp/plugins/builtins/Makefile audisp/plugins/prelude/Makefile audisp/plugins/remote/Makefile audisp/plugins/zos-remote/Makefile bindings/Makefile bindings/python/Makefile bindings/python/python2/Makefile bindings/python/python3/Makefile bindings/golang/Makefile bindings/swig/Makefile bindings/swig/src/Makefile bindings/swig/python/Makefile bindings/swig/python3/Makefile tools/Makefile tools/aulast/Makefile tools/aulastlog/Makefile tools/ausyscall/Makefile tools/auvirt/Makefile)
388
389 echo .
390 echo "
391
392   Auditd Version:         $VERSION
393   Target:                 $target
394   Installation prefix:    $prefix
395   Compiler:               $CC
396   Compiler flags:
397 `echo $CFLAGS | fmt -w 50 | sed 's,^,                          ,'`
398 "