]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Build libtest even if CMOCKA is not available
authorMark Andrews <marka@isc.org>
Thu, 9 Mar 2023 04:53:42 +0000 (15:53 +1100)
committerMark Andrews <marka@isc.org>
Wed, 29 Mar 2023 02:29:18 +0000 (02:29 +0000)
Be more selective about what is not built when CMOCKA is not available
so that fuzz/dns_qp and fuzz/dns_qpkey_name can link against it.

Makefile.am
fuzz/Makefile.am
tests/Makefile.am
tests/libtest/Makefile.am

index 26c45e07361a6552db6f15849a85f726f6911420..63bb88fd7b2707d7fd337b4ad0858fe158c530a5 100644 (file)
@@ -3,9 +3,7 @@ include $(top_srcdir)/Makefile.top
 SUBDIRS = . lib doc
 
 # build libtest before fuzz/* and bin/tests
-if HAVE_CMOCKA
 SUBDIRS += tests
-endif HAVE_CMOCKA
 
 # run fuzz tests before system tests
 SUBDIRS += fuzz bin
index 05904a97dcc6fa24cd0562129144085248fa094f..d2e3931c0049f311d84d44810b11c8171fc138ca 100644 (file)
@@ -6,15 +6,19 @@ AM_CFLAGS +=                          \
 AM_CPPFLAGS +=                         \
        $(LIBISC_CFLAGS)                \
        $(LIBDNS_CFLAGS)                \
-       $(LIBUV_CFLAGS)         \
-       -DFUZZDIR=\"$(abs_srcdir)\"
+       $(LIBUV_CFLAGS)                 \
+       -DFUZZDIR=\"$(abs_srcdir)\"     \
+       -I$(top_srcdir)/lib/dns         \
+       -I$(top_srcdir)/lib/isc         \
+       -I$(top_srcdir)/tests/include
 
 AM_LDFLAGS +=                          \
        $(FUZZ_LDFLAGS)
 
-LDADD +=                               \
-       libfuzzmain.la                  \
-       $(LIBDNS_LIBS)                  \
+LDADD +=                                               \
+       libfuzzmain.la                                  \
+       $(top_builddir)/tests/libtest/libtest.la        \
+       $(LIBDNS_LIBS)                                  \
        $(LIBISC_LIBS)
 
 check_LTLIBRARIES = libfuzzmain.la
@@ -28,6 +32,8 @@ check_PROGRAMS =                      \
        dns_message_parse               \
        dns_name_fromtext_target        \
        dns_name_fromwire               \
+       dns_qp                          \
+       dns_qpkey_name                  \
        dns_rdata_fromtext              \
        dns_rdata_fromwire_text         \
        isc_lex_getmastertoken          \
@@ -51,24 +57,6 @@ dns_name_fromwire_SOURCES =          \
        old.c                           \
        old.h
 
-if HAVE_CMOCKA
-
-check_PROGRAMS +=                      \
-       dns_qp                          \
-       dns_qpkey_name
-
-AM_CPPFLAGS +=                         \
-       -I$(top_srcdir)/lib/dns         \
-       -I$(top_srcdir)/lib/isc         \
-       -I$(top_srcdir)/tests/include
-
-# libisc needs to appear after libtest
-LDADD +=                                               \
-       $(top_builddir)/tests/libtest/libtest.la        \
-       $(LIBISC_LIBS)
-
-endif HAVE_CMOCKA
-
 TESTS = $(check_PROGRAMS)
 
 if HAVE_FUZZ_LOG_COMPILER
index 3a1a0241fef2d4d13e8f9403840c9a167bfadf44..9e27f39289578903ab80c9db8357effb63eaf30d 100644 (file)
@@ -12,6 +12,10 @@ LDADD +=                     \
        $(LIBDNS_LIBS)          \
        $(LIBNS_LIBS)
 
-SUBDIRS = libtest isc dns ns isccfg irs bench
+SUBDIRS = libtest
+
+if HAVE_CMOCKA
+SUBDIRS += isc dns ns isccfg irs bench
+endif HAVE_CMOCKA
 
 check_PROGRAMS =
index 43472699a9ef2d7fe3625d5ba0da820ff9c3a573..68708d463d5b103994b30237df039b10768662e9 100644 (file)
@@ -16,13 +16,16 @@ LDADD +=                    \
 noinst_LTLIBRARIES = libtest.la
 
 libtest_la_SOURCES =                   \
-       ../include/tests/dns.h          \
        ../include/tests/isc.h          \
        ../include/tests/ns.h           \
        ../include/tests/qp.h           \
-       dns.c                           \
        isc.c                           \
        ns.c                            \
        qp.c
+if HAVE_CMOCKA
+libtest_la_SOURCES +=                  \
+       ../include/tests/dns.h          \
+        dns.c
+endif HAVE_CMOCKA
 
 include $(top_srcdir)/Makefile.tests