[SSSD] [PATCH] BUILD: Use pkg-config to detect cmocka
Lukas Slebodnik
lslebodn at redhat.com
Tue Jul 2 13:12:59 UTC 2013
On (01/07/13 09:08), Stephen Gallagher wrote:
>On 07/01/2013 09:02 AM, Lukas Slebodnik wrote:
>> On (01/07/13 08:01), Stephen Gallagher wrote:
>>> On 07/01/2013 04:46 AM, Lukas Slebodnik wrote:
>>>> 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.
>>>>
>>>
>>> I'd prefer if we tried the pkg-config approach first and then
>>> fell back to the old detection form (since not all distributions
>>> will get the 0.3 release at the same rate). Removing something
>>> that works all of the time and replacing it with something that
>>> only works some of the time is a net loss.
>>>
>>
>> arch -- does not contain cmocka -- sssd is only in AUR and PKGBUILD
>> require nor check or cmocka
>>
>> debian/ubuntu does not contain cmocka
>>
>> opensuse -- has cmocka only among unstable packages -- version 0.3
>> is available
>>
>> gentoo -- has cmocka (only 0.2) -- but sssd ebuild does not require
>> it
>>
>> cmocka is only optional dependency and this dependency was
>> introduced in 1.10 development phase. I think this is the right
>> time to use only pkg-config without any fall back.
>>
>
>Ok, that's probably a fair statement.
>
>Ack.
>
I realized, that I removed check of header files required by cmocka.h
I am not sure about indentation in patch, because it seems that we don't have
any rules for autotools.
New patch attached.
LS
-------------- next part --------------
>From 02c64aa6dcdcdaef2f4a7e62a552647adff3e8f5 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 | 37 ++++++++++++++++++-------------------
2 files changed, 19 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..740d9ad254b50563d4d1cbcab3d10f5920ffd79f 100644
--- a/src/external/libcmocka.m4
+++ b/src/external/libcmocka.m4
@@ -1,19 +1,18 @@
-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,
+ [AC_CHECK_HEADERS([stdarg.h stddef.h setjmp.h],
+ [], dnl We are only intrested in action-if-not-found
+ [AC_MSG_WARN([Header files stdarg.h stddef.h setjmp.h are required by cmocka])
+ cmocka_required_headers="no"
+ ]
+ )
+ AS_IF([test x"$cmocka_required_headers" != x"no"],
+ [PKG_CHECK_MODULES([CMOCKA], [cmocka], [have_cmocka="yes"])]
+ )],
+ dnl PKG_CHECK_EXISTS ACTION-IF-NOT-FOUND
+ [AC_MSG_WARN([No libcmocka library found, cmocka tests will not be built])]
+ )
+ AM_CONDITIONAL([HAVE_CMOCKA], [test x$have_cmocka = xyes])
+])
--
1.8.1.4
More information about the sssd-devel
mailing list