[apparmor] [PATCH] tests: Use ldconfig for library detection in Makefile

Tyler Hicks tyhicks at canonical.com
Thu Oct 31 23:17:26 UTC 2013


The multiarch filesystem layout for Ubuntu uses directories such as
/usr/lib/{i386-linux-gnu,x86_64-linux-gnu,arm-linux-gnueabihf} so
peeking into /usr/{lib,lib64} is no longer sufficient.

This patch uses ldconfig to print out the libraries that it knows about
and grep that output for libapparmor.so or libimmunix.so.

Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
---
 tests/regression/apparmor/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/regression/apparmor/Makefile b/tests/regression/apparmor/Makefile
index 0e49517..c910c00 100644
--- a/tests/regression/apparmor/Makefile
+++ b/tests/regression/apparmor/Makefile
@@ -103,9 +103,9 @@ CHANGEHAT_FLAGS=$(shell if [ ! -f /usr/include/sys/apparmor.h ] ; then \
 	  			fi ;\
 			fi )
 
-LIBIMMUNIX:=$(shell	if [ -f /usr/lib/libapparmor.so -o -f /usr/lib64/libapparmor.so ] ; then \
+LIBIMMUNIX:=$(shell	if ldconfig -p | grep -q libapparmor\.so ; then \
 				echo -lapparmor ; \
-			elif [ -f /lib/libimmunix.so.1 -o -f /lib64/libimmunix.so ] ; then \
+			elif ldconfig -p | grep -q libimmunix\.so ; then \
 				echo -limmunix ; \
 			fi )
 
-- 
1.8.3.2




More information about the AppArmor mailing list