[SSSD] [PATCH] BUILD: Use pkg-config to detect cmocka

Lukas Slebodnik lslebodn at redhat.com
Mon Jul 1 08:46:08 UTC 2013


ehlo,

libcmocka-0.3 was released and package is available in fedore >= 18.
libcmocka-devel contains pkg-config file,
therefore it is better to use pkg-config to detect this library.

Patch is attached.

LS
-------------- next part --------------
>From 9e4bbada797b784ad1aa714e09d77b147b331f5d Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 1 Jul 2013 10:23:03 +0200
Subject: [PATCH] BUILD: Use pkg-config to detect cmocka

---
 configure.ac              |  2 +-
 src/external/libcmocka.m4 | 29 ++++++++++-------------------
 2 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index 18c2aadf91ddc32d47df295d8cd5be2ba3201041..b34ae3f4c98bd88e8f94550d4c3bdbab510602d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -277,7 +277,7 @@ AC_PATH_PROG([DOXYGEN], [doxygen], [false])
 AM_CONDITIONAL([HAVE_DOXYGEN], [test x$DOXYGEN != xfalse ])
 
 AM_CONDITIONAL([HAVE_CHECK], [test x$have_check != x])
-AM_CONDITIONAL([HAVE_CMOCKA], [test x$have_cmocka = xyes])
+AM_CHECK_CMOCKA
 
 AM_CONDITIONAL([HAVE_DEVSHM], [test -d /dev/shm])
 
diff --git a/src/external/libcmocka.m4 b/src/external/libcmocka.m4
index c57327612e2eec2411f18b640c4e2eaed2b31bc1..c3f53dd3ac1241421c9cdac95acc1af53cb24e69 100644
--- a/src/external/libcmocka.m4
+++ b/src/external/libcmocka.m4
@@ -1,19 +1,10 @@
-dnl this file will be simplified when cmocka carries a .pc file
-AC_SUBST(CMOCKA_LIBS)
-AC_SUBST(CMOCKA_CFLAGS)
-
-AC_CHECK_HEADERS(
-    [setjmp.h cmocka.h],
-    [AC_CHECK_LIB([cmocka], [_will_return],
-                  [ CMOCKA_LIBS="-lcmocka"
-                    have_cmocka="yes" ],
-                  [AC_MSG_WARN([No libcmocka library found])
-                    have_cmocka="no" ])],
-    [AC_MSG_WARN([libcmocka header files not installed])],
-    [[ #include <stdarg.h>
-     # include <stddef.h>
-     #ifdef HAVE_SETJMP_H
-     # include <setjmp.h>
-     #endif
-    ]]
-)
+dnl A macro to check presence of cmocka on the system
+AC_DEFUN([AM_CHECK_CMOCKA],
+[
+    PKG_CHECK_EXISTS(cmocka,
+                     [PKG_CHECK_MODULES([CMOCKA], [cmocka])
+                      have_cmocka="yes"],
+                     [AC_MSG_WARN([No libcmocka library found])]
+                    )
+    AM_CONDITIONAL([HAVE_CMOCKA], [test x$have_cmocka = xyes])
+])
-- 
1.8.1.4



More information about the sssd-devel mailing list