src/utils/Makefile.inc: Add $(gnutls_CFLAGS) and $(libnghttp2_CFLAGS) where needed
The header file src/utils/common/https.h includes the external header file <nghttp2/nghttp2.h> (when nghttp2 support is enabled by the build system), and the header file src/utils/common/tls.h includes the external header file <gnutls/gnutls.h>. Those header files are included by src/utils/common/netio.h, which can in turn be included directly or indirectly by various knot components.
The nghttp2 and gnutls header files are not guaranteed to be located in the compiler's default include paths. These dependencies are detected by the build system via PKG_CHECK_MODULES, which populates the automake variables $(gnutls_CFLAGS) and $(libnghttp2_CFLAGS). These extra CFLAGS must be added to the compiler flags for any targets that include a header file that results in header file inclusions of those external dependencies. Otherwise the build will fail when those external header files cannot be located.
This commit adds $(libnghttp2_CLAGS) to the *_CPPFLAGS for kdig, khost, knsupdate, and kjournalprint, and $(gnutls_CFLAGS) to kjournalprint.
Without the $(libnghttp2_CFLAGS) fixes in this commit, the build will fail with an error like:
Making all in src
make[1]: Entering directory '/tmp/knot-3.0.0/src'
GEN contrib/dnstap/dnstap.pb-c.c
GEN contrib/dnstap/dnstap.pb-c.h
NOTE: Compilation of scanner.c can take several minutes!
make all-recursive
make[2]: Entering directory '/tmp/knot-3.0.0/src'
make[3]: Entering directory '/tmp/knot-3.0.0/src'
CC libdnssec/la-tsig.lo
CC utils/kdig/khost-kdig_exec.o
CC utils/kdig/khost-kdig_params.o
CC utils/kdig/kdig-kdig_exec.o
CC utils/kdig/kdig-kdig_main.o
CC utils/kdig/kdig-kdig_params.o
CC utils/common/libknotus_la-cert.lo
CC utils/common/libknotus_la-exec.lo
CC utils/common/libknotus_la-hex.lo
CC utils/common/libknotus_la-https.lo
CC utils/common/libknotus_la-lookup.lo
CC utils/common/libknotus_la-msg.lo
In file included from ./utils/common/netio.h:23,
from ./utils/common/exec.h:21,
from ./utils/kdig/kdig_params.h:22,
from ./utils/kdig/kdig_exec.h:19,
from utils/kdig/kdig_exec.c:22:
./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
45 | #include <nghttp2/nghttp2.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from ./utils/common/netio.h:23,
from ./utils/common/exec.h:21,
from ./utils/kdig/kdig_params.h:22,
from utils/kdig/kdig_params.c:23:
./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
45 | #include <nghttp2/nghttp2.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:5500: utils/kdig/khost-kdig_exec.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [Makefile:5514: utils/kdig/khost-kdig_params.o] Error 1
In file included from ./utils/common/netio.h:23,
from ./utils/common/exec.h:21,
from ./utils/kdig/kdig_params.h:22,
from utils/kdig/kdig_main.c:20:
./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
45 | #include <nghttp2/nghttp2.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:5416: utils/kdig/kdig-kdig_main.o] Error 1
In file included from ./utils/common/netio.h:23,
from ./utils/common/exec.h:21,
from ./utils/kdig/kdig_params.h:22,
from ./utils/kdig/kdig_exec.h:19,
from utils/kdig/kdig_exec.c:22:
./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
45 | #include <nghttp2/nghttp2.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from ./utils/common/netio.h:23,
from ./utils/common/exec.h:21,
from ./utils/kdig/kdig_params.h:22,
from utils/kdig/kdig_params.c:23:
./utils/common/https.h:45:10: fatal error: nghttp2/nghttp2.h: No such file or directory
45 | #include <nghttp2/nghttp2.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:5402: utils/kdig/kdig-kdig_exec.o] Error 1
make[3]: *** [Makefile:5430: utils/kdig/kdig-kdig_params.o] Error 1
make[3]: Leaving directory '/tmp/knot-3.0.0/src'
make[2]: *** [Makefile:5950: all-recursive] Error 1
make[2]: Leaving directory '/tmp/knot-3.0.0/src'
make[1]: *** [Makefile:2046: all] Error 2
make[1]: Leaving directory '/tmp/knot-3.0.0/src'
make: *** [Makefile:491: all-recursive] Error 1
Without the $(gnutls_CFLAGS) fix in this commit, the build will fail with an error like:
In file included from ./utils/common/https.h:47,
from ./utils/common/netio.h:23,
from ./utils/common/exec.h:21,
from utils/kjournalprint/main.c:27:
./utils/common/tls.h:20:10: fatal error: gnutls/gnutls.h: No such file or directory
20 | #include <gnutls/gnutls.h>
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:5556: utils/kjournalprint/kjournalprint-main.o] Error 1
0001-src-utils-Makefile.inc-Add-gnutls_CFLAGS-and-libnght.patch