]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add autoconf checks for libdecaf headers
authorFred Morcos <fred.morcos@open-xchange.com>
Fri, 15 Apr 2022 15:21:51 +0000 (17:21 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 20 Apr 2022 10:52:01 +0000 (12:52 +0200)
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.

m4/pdns_with_libdecaf.m4
pdns/Makefile.am
pdns/recursordist/Makefile.am

index 9710366021a852917bdd0140cd3bc875590c8286..0c1bef3c25ecbf3babb44ff2725c7cb2c6e99702 100644 (file)
@@ -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"
   ])
 ])
index 0b4370488189f286016ab5eb880b860e738d28b5..3bb3bf077fe5ec3191b39ec2c8fd39294151d047 100644 (file)
@@ -39,6 +39,10 @@ if LIBSODIUM
 AM_CPPFLAGS +=$(LIBSODIUM_CFLAGS)
 endif
 
+if LIBDECAF
+AM_CPPFLAGS += $(LIBDECAF_CFLAGS)
+endif
+
 EXTRA_DIST = \
        dnslabeltext.rl \
        dnslabeltext.cc \
index a4ce97fe25f6300b738ef003d639f7b5eae53b5f..ee57d9c9ef2a946e49e26c94dbc505e11bbabb12 100644 (file)
@@ -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 \