Add an intermediary header file k5-cmocka.h, which only includes
cmocka.h if we detected an appropriate version of cmocka at configure
time. This allows "make depend" to successfully run over cmocka test
programs when cmocka.h isn't present on the build platform.
For convenience, k5-cmocka.h also includes stdarg.h, stddef.h, and
setjmp.h, which are required to include cmocka.h.
if test "$HAVE_CMOCKA_LIB" = yes && test "$HAVE_CMOCKA_H" = yes; then
HAVE_CMOCKA=yes
CMOCKA_LIBS='-lcmocka'
+ AC_DEFINE([HAVE_CMOCKA],1,[Define if cmocka library is available.])
fi
AC_SUBST(HAVE_CMOCKA)
AC_SUBST(CMOCKA_LIBS)
--- /dev/null
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/* include/k5-cmocka.h - indirect header file for cmocka test programs */
+
+/*
+ * This header conditionally includes cmocka.h, so that "make depend" can work
+ * on cmocka test programs when cmocka isn't available. It also includes the
+ * three system headers required for cmocka.h.
+ */
+
+#include "autoconf.h"
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#ifdef HAVE_CMOCKA
+#include <cmocka.h>
+#endif
#ifndef NOCACHE
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
+#include "k5-cmocka.h"
/* For wrapping functions */
#include "k5-int.h"
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
+#include "k5-cmocka.h"
#include "kdb.h"
#define KEY(kvno) { \
*/
#include "k5-int.h"
-#include <stdarg.h>
-#include <stddef.h>
-#include <setjmp.h>
-#include <cmocka.h>
+#include "k5-cmocka.h"
#include <malloc.h>
/* Call k5_parse_host_string() and check the result against the expected code,