summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-07-03 22:32:12 +0200
committerMartin Kosek <mkosek@redhat.com>2013-07-15 16:42:46 +0200
commit0fa42af840579d641ceb76974fb4c0277c9c6d6b (patch)
tree380cd23bf17a5b5b85d75e6eea10e1dc9f2e390a
parent23d3fde05960d6e47485e246e11bec701b30cb59 (diff)
downloadfreeipa-0fa42af840579d641ceb76974fb4c0277c9c6d6b.zip
freeipa-0fa42af840579d641ceb76974fb4c0277c9c6d6b.tar.gz
freeipa-0fa42af840579d641ceb76974fb4c0277c9c6d6b.tar.xz
Use pkg-config to detect cmocka
https://fedorahosted.org/freeipa/ticket/3434
-rw-r--r--daemons/configure.ac37
1 files changed, 12 insertions, 25 deletions
diff --git a/daemons/configure.ac b/daemons/configure.ac
index f0f9ea8..15ea00b 100644
--- a/daemons/configure.ac
+++ b/daemons/configure.ac
@@ -196,33 +196,20 @@ AM_CONDITIONAL([HAVE_CHECK], [test x$have_check != x])
dnl ---------------------------------------------------------------------------
dnl - Check for cmocka unit test framework http://cmocka.cryptomilk.org/
-dnl This will be simplified when cmocka carries a .pc file.
dnl ---------------------------------------------------------------------------
-AC_SUBST(CMOCKA_LIBS)
-AC_SUBST(CMOCKA_CFLAGS)
-
-AC_CHECK_HEADERS(
- [setjmp.h cmocka.h],,,
- [[ #include <stdarg.h>
- # include <stddef.h>
- #ifdef HAVE_SETJMP_H
- # include <setjmp.h>
- #endif
- ]]
+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])]
)
-
-if test "x$ac_cv_header_setjmp_h" = "xyes" && test "x$ac_cv_header_cmocka_h" = "xyes" ; then
- AC_CHECK_LIB([cmocka], [_will_return],
- [ CMOCKA_LIBS="-lcmocka"
- AC_MSG_RESULT([libcmocka available, cmocka tests will be build])
- have_cmocka="yes" ],
- [AC_MSG_WARN([No libcmocka library found, cmocka tests will not be build])
- have_cmocka="no" ])
-else
- AC_MSG_WARN([Required header files for libcmocka are missing, cmocka tests will not be build])
- have_cmocka="no"
-fi
-
AM_CONDITIONAL([HAVE_CMOCKA], [test x$have_cmocka = xyes])
dnl -- dirsrv is needed for the extdom unit tests --