2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 13:58:22 +00:00
Tyler Hicks 6b200b6f08 libapparmor: Add basic logging functionality
This patch adds equivalents of the parser's PDEBUG() and PERROR()
functions to libapparmor.

It does not add gettext(3) support to libapparmor since these are
messages that only developers will see (debug builds with
LIBAPPARMOR_DEBUG=1) or messages that go to the syslog.

PDEBUG() does nothing unless libapparmor is built with --enable-debug.
It prints to stderr if libapparmor is built with --enable-debug and the
LIBAPPARMOR_DEBUG environment variable is set.

PERROR() uses syslog(LOG_ERR, ...) by default. The message is sent to
the syslog and to stderr if libapparmor is built with --enable-debug and
the LIBAPPARMOR_DEBUG environment variable is set.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2015-03-25 17:09:27 -05:00

113 lines
3.5 KiB
Plaintext

m4_define([__apparmor_version], m4_sinclude(common/Version))
m4_ifdef(__apparmor_version, , m4_define([__apparmor_version], m4_sinclude(../../common/Version)))
m4_define([__aalen], decr(len(__apparmor_version)))
m4_define([apparmor_version], m4_substr(__apparmor_version, 0, __aalen))
AC_INIT(configure.ac)
AM_INIT_AUTOMAKE(libapparmor1, apparmor_version)
AM_PROG_LEX
AC_PROG_YACC
AC_PROG_SED
PKG_PROG_PKG_CONFIG
AC_PATH_PROG([SWIG], [swig])
AC_MSG_CHECKING([whether the libapparmor debug output should be enabled])
AC_ARG_ENABLE([debug_output],
[AS_HELP_STRING([--enable-debug-output], [generate the libapparmor debug output [[default=no]]])],
[AC_MSG_RESULT([$enableval])],
[enable_debug_output=no]
[AC_MSG_RESULT([$enable_debug_output])])
AS_IF([test "$enable_debug_output" = "yes"], [AC_DEFINE([ENABLE_DEBUG_OUTPUT], [1], [debug output])])
AC_MSG_CHECKING([whether the libapparmor man pages should be generated])
AC_ARG_ENABLE(man_pages,
[AS_HELP_STRING([--enable-man-pages], [generate the libapparmor man pages [[default=yes]]])],
[AC_MSG_RESULT($enableval)],
[enable_man_pages=yes]
[AC_MSG_RESULT($enable_man_pages)])
if test "$enable_man_pages" = "yes"; then
sinclude(m4/ac_podchecker.m4)
PROG_PODCHECKER
sinclude(m4/ac_pod2man.m4)
PROG_POD2MAN
fi
AC_MSG_CHECKING([whether python bindings are enabled])
AC_ARG_WITH(python,
[ --with-python enable the python wrapper [[default=no]]],
[AC_MSG_RESULT($withval)], [AC_MSG_RESULT(no)])
if test "$with_python" = "yes"; then
test -z "$SWIG" && AC_MSG_ERROR([swig is required when enabling python bindings])
AC_PATH_PROG(PYTHON, python)
test -z "$PYTHON" && AC_MSG_ERROR([python is required when enabling python bindings])
sinclude(m4/ac_python_devel.m4)
AC_PYTHON_DEVEL
AM_PATH_PYTHON
fi
AC_MSG_CHECKING([whether perl bindings are enabled])
AC_ARG_WITH(perl,
[ --with-perl enable the perl wrapper [[default=no]]],
[AC_MSG_RESULT($withval)], [AC_MSG_RESULT(no)])
if test "$with_perl" = "yes"; then
test -z "$SWIG" && AC_MSG_ERROR([swig is required when enabling perl bindings])
AC_PATH_PROG(PERL, perl)
test -z "$PERL" && AC_MSG_ERROR([perl is required when enabling perl bindings])
perl_includedir="`$PERL -e 'use Config; print $Config{archlib}'`/CORE"
AC_CHECK_FILE($perl_includedir/perl.h, enable_perl=yes, enable_perl=no)
fi
AC_MSG_CHECKING([whether ruby bindings are enabled])
AC_ARG_WITH(ruby,
[ --with-ruby enable the ruby wrapper [[default=no]]],
[AC_MSG_RESULT($withval)], [AC_MSG_RESULT(no)])
if test "$with_ruby" = "yes"; then
test -z "$SWIG" && AC_MSG_ERROR([swig is required when enabling ruby bindings])
AC_PATH_PROG([RUBY], [ruby])
test -z "$RUBY" && AC_MSG_ERROR([ruby is required when enabling ruby bindings])
fi
AM_CONDITIONAL(ENABLE_MAN_PAGES, test x$enable_man_pages = xyes)
AM_CONDITIONAL(HAVE_PYTHON, test x$with_python = xyes)
AM_CONDITIONAL(HAVE_PERL, test x$with_perl = xyes)
AM_CONDITIONAL(HAVE_RUBY, test x$with_ruby = xyes)
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h stdint.h syslog.h)
AC_CHECK_FUNCS(asprintf)
AM_PROG_CC_C_O
AC_C_CONST
AM_PROG_LIBTOOL
AC_PROG_CC_C99
if test "$ac_cv_prog_cc_c99" = "no"; then
AC_MSG_ERROR([C99 mode is required to build libapparmor])
fi
AC_OUTPUT(
Makefile
doc/Makefile
src/Makefile
swig/Makefile
swig/perl/Makefile
swig/perl/Makefile.PL
swig/python/Makefile
swig/python/setup.py
swig/python/test/Makefile
swig/ruby/Makefile
testsuite/Makefile
testsuite/config/Makefile
testsuite/libaalogparse.test/Makefile
testsuite/lib/Makefile
include/Makefile
include/sys/Makefile
)