]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix "make depend" when cmocka.h not present
authorGreg Hudson <ghudson@mit.edu>
Wed, 5 Oct 2016 14:51:52 +0000 (10:51 -0400)
committerGreg Hudson <ghudson@mit.edu>
Tue, 25 Oct 2016 14:41:09 +0000 (10:41 -0400)
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.

src/configure.in
src/include/k5-cmocka.h [new file with mode: 0644]
src/kdc/t_replay.c
src/lib/kdb/t_sort_key_data.c
src/lib/krb5/krb/t_parse_host_string.c

index fde09a1ef3538172d654cf66e040cd7fffeeeea6..63c7469efdafa43168fece47bcc6330eb7514a16 100644 (file)
@@ -1131,6 +1131,7 @@ AC_CHECK_LIB(cmocka, _cmocka_run_group_tests, [HAVE_CMOCKA_LIB=yes])
 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)
diff --git a/src/include/k5-cmocka.h b/src/include/k5-cmocka.h
new file mode 100644 (file)
index 0000000..c35b10b
--- /dev/null
@@ -0,0 +1,16 @@
+/* -*- 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
index 1442e0e8ceeead319ea4359043034630f98d4eaa..87dbbc642031fc1c445a7eef1ae554c3a9295c81 100644 (file)
 
 #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"
index d03d507a1c33442cde95ef9192a71b283a2ee33f..ffd1a156ac3d758d0e134bdae9534c54ae3579a0 100644 (file)
  * 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) {                                             \
index 76dd20f817b05ae42c64321e4104cf3a840e428f..001b77389555c9f4052c477c56003c278f6d794f 100644 (file)
  */
 
 #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,