From: Fred Morcos Date: Fri, 15 Apr 2022 15:21:51 +0000 (+0200) Subject: Add autoconf checks for libdecaf headers X-Git-Tag: auth-4.8.0-alpha0~125^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e59df15bedd6081757a8a4925c454dd61c16936d;p=thirdparty%2Fpdns.git Add autoconf checks for libdecaf headers This adds a few things: - Passing a user-defined header location through LIBDECAF_CFLAGS=-I... - Otherwise, check the following directories for decaf.hxx: - /usr/include - /usr/include/decaf - Add whichever one is picked to LIBDECAF_CFLAGS - Then AC_CHECK_HEADER decaf.hxx using CXXFLAGS with LIBDECAF_CFLAGS The reason for this change is that some package systems have decaf.hxx under /usr/include and others have it under /usr/include/decaf. --- diff --git a/m4/pdns_with_libdecaf.m4 b/m4/pdns_with_libdecaf.m4 index 9710366021..0c1bef3c25 100644 --- a/m4/pdns_with_libdecaf.m4 +++ b/m4/pdns_with_libdecaf.m4 @@ -19,5 +19,40 @@ AC_DEFUN([PDNS_WITH_LIBDECAF],[ AC_MSG_ERROR([Could not find libdecaf]) ]) LIBS="$save_LIBS" + + AS_IF([test "x$LIBDECAF_CFLAGS" = "x"],[ + AC_MSG_CHECKING([for libdecaf headers]) + libdecaf_header_dir="" + + header_dirs="/usr /usr/local" + for header_dir in $header_dirs; do + if test -f "$header_dir/include/decaf.hxx"; then + libdecaf_header_dir="$header_dir/include" + break + fi + + if test -f "$header_dir/include/decaf/decaf.hxx"; then + libdecaf_header_dir="$header_dir/include/decaf" + break + fi + done + + AS_IF([test "x$libdecaf_header_dir" != "x"],[ + AC_MSG_RESULT([$libdecaf_header_dir]) + LIBDECAF_CFLAGS="-I$libdecaf_header_dir" + ], + [AC_MSG_RESULT([not found])]) + ]) + + AC_SUBST([LIBDECAF_CFLAGS]) + + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $LIBDECAF_CFLAGS" + AC_CHECK_HEADERS( + [decaf.hxx], + [], + [AC_MSG_ERROR([cannot find libdecaf headers])] + ) + CXXFLAGS="$save_CXXFLAGS" ]) ]) diff --git a/pdns/Makefile.am b/pdns/Makefile.am index 0b43704881..3bb3bf077f 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -39,6 +39,10 @@ if LIBSODIUM AM_CPPFLAGS +=$(LIBSODIUM_CFLAGS) endif +if LIBDECAF +AM_CPPFLAGS += $(LIBDECAF_CFLAGS) +endif + EXTRA_DIST = \ dnslabeltext.rl \ dnslabeltext.cc \ diff --git a/pdns/recursordist/Makefile.am b/pdns/recursordist/Makefile.am index a4ce97fe25..ee57d9c9ef 100644 --- a/pdns/recursordist/Makefile.am +++ b/pdns/recursordist/Makefile.am @@ -3,6 +3,10 @@ PROBDS_LIBS = $(top_srcdir)/ext/probds/libprobds.la AM_CPPFLAGS = $(LUA_CFLAGS) $(YAHTTP_CFLAGS) $(BOOST_CPPFLAGS) $(LIBSODIUM_CFLAGS) $(NET_SNMP_CFLAGS) $(LIBCAP_CFLAGS) $(SANITIZER_FLAGS) -O3 -Wall -pthread -DSYSCONFDIR=\"${sysconfdir}\" $(SYSTEMD_CFLAGS) +if LIBDECAF +AM_CPPFLAGS += $(LIBDECAF_CFLAGS) +endif + AM_CPPFLAGS += \ -I$(top_srcdir)/ext/json11 \ -I$(top_srcdir)/ext/protozero/include \