Commit graph

16 commits

Author SHA1 Message Date
Sam James
022af9c528
libraries/libapparmor: fix syntax in configure
We're not trying to execute a command in EXTRA_WARNINGS, so don't try to spawn
a subshell for it which gives:
```
./configure: 14770: EXTRA_WARNINGS: not found
checking whether C compiler accepts -flto-partition=none... yes
```

We can either use ${} or just $ (style). Use $ to be consistent with other
uses in the file.

Signed-off-by: Sam James <sam@gentoo.org>
2024-03-15 02:36:12 +00:00
Georgia Garcia
aedb8a5b00 libapparmor: check if AX_CHECK_COMPILE_FLAG is available
The error message when autoconf-archive is not installed is not very
intuitive:

./configure: line 14422: EXTRA_WARNINGS: command not found
./configure: line 14423: syntax error near unexpected token `-flto-partition=none,'
./configure: line 14423: `AX_CHECK_COMPILE_FLAG(-flto-partition=none, , , -Werror)'

So, check if AX_CHECK_COMPILE_FLAG is defined and if not, complain
that autoconf-archive is missing.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-03-04 10:27:34 -03:00
Félix Poisot
420d3395fc makefiles: test for support of flto-partition flag
Test for compiler support of "-flto-partition=none" flag before passing
it.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/310
2024-02-24 16:07:55 +00:00
Helmut Grohne
60e6847e85 Do not abuse AC_CHECK_FILE
AC_CHECK_FILE is meant to check for host files and therefore fails hard during cross compilation unless one supplies a cached check result. Here we want to know about the presence of a build system file though, so AC_CHECK_FILE is the wrong tool.
2021-03-20 05:41:48 +00:00
John Johansen
955439cbb3 libapparmor: force library configuration to search for python3
libapparmor and the pyton tools now require python3 but on systems
where python2 is the default the build will fail unless the PYTHON=
env var is set to the systems python3.

Instead just force autoconf to search for python3 as the python
version to use.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-04-26 03:05:48 -07:00
John Johansen
ff7d1a4eb7 library: swig: require python 3 when building the swig interface
If Swig builds the library against python 2 and the utils/tests
run using python3, parts of the library are in accesible with
failures like

Traceback (most recent call last):
  File "test-pivot_root_parse.py", line 12, in <module>
    import apparmor.aa as aa
  File "/home/jj/apparmor/apparmor-jjohansen.git/utils/apparmor/aa.py", line 28, in <module>
    import apparmor.logparser
  File "/home/jj/apparmor/apparmor-jjohansen.git/utils/apparmor/logparser.py", line 19, in <module>
    import LibAppArmor
ImportError: No module named LibAppArmor

Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-04-20 02:09:22 -07:00
Steve Beattie
06d9a8eff0 libapparmor: fix reallocarray FTBFS w/older glibc
The recently added overlay cache directory support added to libapparmor
makes use of reallocarray(3) to resize memory allocations; however,
reallocarray() was only included in glibc 2.26. This commit adds a
configure check for reallocarray() and if it's not available, provides
it as a wrapper around realloc(3).

PR: https://gitlab.com/apparmor/apparmor/merge_requests/100
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
2018-04-18 21:08:03 -07:00
Tyler Hicks
0d06dfa24c libapparmor: Fix FTBFS when secure_getenv() is not available
Allow libapparmor to build on older systems where secure_getenv() is
still named __secure_getenv(). This snippet was taken from the glibc
wiki:

 https://sourceware.org/glibc/wiki/Tips_and_Tricks/secure_getenv

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2015-03-26 16:25:16 -05: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
Tyler Hicks
27ac220535 libapparmor: Require and build libapparmor with C99 mode
This is needed for some of the parser functionality that will be moved
to libapparmor. In the short term, only the 'bool' type is needed but it
makes sense to simply require a C99 compliant compiler for libapparmor
since the parser is being rewritten in C++. The use of C99 will reduce
future headaches when moving code between the two code bases.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2015-03-25 17:09:27 -05:00
Tyler Hicks
c308e6b24e libapparmor: Make man page generation optional
This patch adds the --enable-man-pages option, defaulting to "yes", to
libapparmor's configure stage so that libapparmor can be built on
systems lacking Perl.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-11-17 21:20:14 -06:00
Tyler Hicks
806374b5f9 libapparmor: Fix spacing in the configure script usage
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-11-17 21:20:11 -06:00
Tyler Hicks
b57a229c56 libapparmor: Check for podchecker during configure stage
Fail the configure stage if podchecker is not available since man page
generation always happens.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-11-17 21:19:55 -06:00
Steve Beattie
a72f0693f3 libapparmor: move public headers to separate directory
This patch moves the apparmor.h and aalogparse.h headers
from the libapparmor/src/ directory to a new directory
libapparmor/include/. The apparmor.h header is stored in a sys/
directory within libapparmor/include/ to match its usual install
location in /usr/include/sys/, simplifying the #include statements of
source that wishes to include either the in-tree or system installed
version of the header (i.e. #include <sys/apparmor.h> can be used
everywhere).

The patch size is inflated by the movements of the header files, which
are unchanged except for their locations. Otherwise, the rest of the
changes are to modify the include search path or to stop looking in
$CWD for one of the headers.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2014-01-06 14:08:55 -08:00
Steve Beattie
a1bf63dbe9 Subject: libapparmor - add python bindings tests based on C tests
This patch adds tests for the swig generated python library bindings
that reuse the C language tests.

Fitting it into autotools was a bit of a trick, and is likely pretty
brittle, as before the test script runs, it needs to know the location
of the built libapparmor.so library, the built _LibAppArmor.so library
and the python wrapper bits (thankfully, the latter two are the same
directory). It's also unclear how to get autotools to emit the output of
the test_python.py script when building, rather than just summarizing it
as one test run.

Also note that test_python.py is doing a bit of magic to automatically
generate test case methods based on the contents of the test_multi/
directory. This has the disadvantage of breaking tools like nosetests
and other external tools that try to automatically detect testcases.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2013-09-06 14:18:08 -07:00
Steve Beattie
994d1ddbba Subject: libapparmor - rename configure.in to configure.ac
The oldstyle name configure.in has been deprecated by autotools. This
patch renames configure.in to the new standard name configure.ac.
The AC_INIT() entry was adjusted as well to point to configure.ac
instead of configure.in.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2013-09-06 13:49:00 -07:00
Renamed from libraries/libapparmor/configure.in (Browse further)