summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-07-01 10:23:03 +0200
committerStephen Gallagher <sgallagh@redhat.com>2013-07-02 11:30:18 -0400
commit1c7f25390572025baa6783ede14523e22fc73043 (patch)
tree79f77b764e30fa85af849571c8100fc8ecc6a66e
parentf138a393447aa1042f449d16dbafd75a79b9cb1e (diff)
downloadsssd-1c7f25390572025baa6783ede14523e22fc73043.tar.gz
sssd-1c7f25390572025baa6783ede14523e22fc73043.tar.xz
sssd-1c7f25390572025baa6783ede14523e22fc73043.zip
BUILD: Use pkg-config to detect cmocka
-rw-r--r--configure.ac2
-rw-r--r--src/external/libcmocka.m437
2 files changed, 19 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac
index 18c2aadf9..b34ae3f4c 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 c57327612..740d9ad25 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])
+])