configure.ac: find include path to libxml2 using xml2-config tool

This patch replaces the hard-coded `-I /usr/include/libxml2` used when
building clixon_util_regexp with the output from `xml2-config --cflags`.

To support cross-compiling, and preserve backwards compatibility with
the `--with-libxml2` option, we allow the user to pass the path to the
xml2-config tool as an optional argument.  Similar to what python-lxml,
and other packages, that rely on libxml2 do.  The argument is optional
to ensure that we default to use the hard-coded path from before.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2023-02-07 18:29:44 +01:00
parent fcb6e5cb03
commit a7693c8856
3 changed files with 27 additions and 6 deletions

View file

@ -46,7 +46,7 @@ localstatedir = @localstatedir@
sysconfdir = @sysconfdir@
HOST_VENDOR = @host_vendor@
with_restconf = @with_restconf@
HAVE_LIBXML2 = @HAVE_LIBXML2@
LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
SH_SUFFIX = @SH_SUFFIX@
@ -150,7 +150,7 @@ clixon_util_xml_mod: clixon_util_xml_mod.c $(LIBDEPS)
$(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -D__PROGRAM__=\"$@\" $(LDFLAGS) $^ $(LIBS) -o $@
clixon_util_regexp: clixon_util_regexp.c $(LIBDEPS)
$(CC) $(INCLUDES) -I /usr/include/libxml2 $(CPPFLAGS) -D__PROGRAM__=\"$@\" $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
$(CC) $(INCLUDES) $(LIBXML2_CFLAGS) $(CPPFLAGS) -D__PROGRAM__=\"$@\" $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
clixon_util_socket: clixon_util_socket.c $(LIBDEPS)
$(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -D__PROGRAM__=\"$@\" $(LDFLAGS) $^ $(LIBS) -o $@