From: Greg Hudson Date: Wed, 5 Oct 2016 14:51:52 +0000 (-0400) Subject: Fix "make depend" when cmocka.h not present X-Git-Tag: krb5-1.16-beta1~209 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c756f3cc15ec052ac64651d703fdb8d1096a69d;p=thirdparty%2Fkrb5.git Fix "make depend" when cmocka.h not present 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. --- diff --git a/src/configure.in b/src/configure.in index fde09a1ef3..63c7469efd 100644 --- a/src/configure.in +++ b/src/configure.in @@ -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 index 0000000000..c35b10be07 --- /dev/null +++ b/src/include/k5-cmocka.h @@ -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 +#include +#include +#ifdef HAVE_CMOCKA +#include +#endif diff --git a/src/kdc/t_replay.c b/src/kdc/t_replay.c index 1442e0e8ce..87dbbc6420 100644 --- a/src/kdc/t_replay.c +++ b/src/kdc/t_replay.c @@ -36,10 +36,7 @@ #ifndef NOCACHE -#include -#include -#include -#include +#include "k5-cmocka.h" /* For wrapping functions */ #include "k5-int.h" diff --git a/src/lib/kdb/t_sort_key_data.c b/src/lib/kdb/t_sort_key_data.c index d03d507a1c..ffd1a156ac 100644 --- a/src/lib/kdb/t_sort_key_data.c +++ b/src/lib/kdb/t_sort_key_data.c @@ -30,10 +30,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include -#include +#include "k5-cmocka.h" #include "kdb.h" #define KEY(kvno) { \ diff --git a/src/lib/krb5/krb/t_parse_host_string.c b/src/lib/krb5/krb/t_parse_host_string.c index 76dd20f817..001b773895 100644 --- a/src/lib/krb5/krb/t_parse_host_string.c +++ b/src/lib/krb5/krb/t_parse_host_string.c @@ -31,10 +31,7 @@ */ #include "k5-int.h" -#include -#include -#include -#include +#include "k5-cmocka.h" #include /* Call k5_parse_host_string() and check the result against the expected code,