]> granicus.if.org Git - pdns/commitdiff
add --disable-lua-records option
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Mon, 16 Apr 2018 15:36:29 +0000 (17:36 +0200)
committerCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Mon, 16 Apr 2018 15:36:29 +0000 (17:36 +0200)
configure.ac
m4/libcurl.m4 [new file with mode: 0644]
m4/pdns_with_lua_records.m4 [new file with mode: 0644]
pdns/Makefile.am
pdns/common_startup.cc
pdns/dnsrecords.cc
pdns/dnsrecords.hh
pdns/lua-record.cc
pdns/packethandler.cc

index f28e57d62c4c88991008d0a751525b2d55ad5e95..f1372952ec5d5175abc7945543bddb2cc7a33580 100644 (file)
@@ -227,6 +227,7 @@ AM_CONDITIONAL([TOOLS], [test "x$enable_tools" != "xno"])
 
 PDNS_WITH_PROTOBUF
 
+PDNS_WITH_LUA_RECORDS
 
 AM_CONDITIONAL([ORACLE], [test "x$needoracle" = "xyes"])
 
diff --git a/m4/libcurl.m4 b/m4/libcurl.m4
new file mode 100644 (file)
index 0000000..53d694d
--- /dev/null
@@ -0,0 +1,272 @@
+#***************************************************************************
+#                                  _   _ ____  _
+#  Project                     ___| | | |  _ \| |
+#                             / __| | | | |_) | |
+#                            | (__| |_| |  _ <| |___
+#                             \___|\___/|_| \_\_____|
+#
+# Copyright (C) 2006, David Shaw <dshaw@jabberwocky.com>
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+###########################################################################
+# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
+#                       [ACTION-IF-YES], [ACTION-IF-NO])
+# ----------------------------------------------------------
+#      David Shaw <dshaw@jabberwocky.com>   May-09-2006
+#
+# Checks for libcurl.  DEFAULT-ACTION is the string yes or no to
+# specify whether to default to --with-libcurl or --without-libcurl.
+# If not supplied, DEFAULT-ACTION is yes.  MINIMUM-VERSION is the
+# minimum version of libcurl to accept.  Pass the version as a regular
+# version number like 7.10.1. If not supplied, any version is
+# accepted.  ACTION-IF-YES is a list of shell commands to run if
+# libcurl was successfully found and passed the various tests.
+# ACTION-IF-NO is a list of shell commands that are run otherwise.
+# Note that using --without-libcurl does run ACTION-IF-NO.
+#
+# This macro #defines HAVE_LIBCURL if a working libcurl setup is
+# found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary
+# values.  Other useful defines are LIBCURL_FEATURE_xxx where xxx are
+# the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
+# where yyy are the various protocols supported by libcurl.  Both xxx
+# and yyy are capitalized.  See the list of AH_TEMPLATEs at the top of
+# the macro for the complete list of possible defines.  Shell
+# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also
+# defined to 'yes' for those features and protocols that were found.
+# Note that xxx and yyy keep the same capitalization as in the
+# curl-config list (e.g. it's "HTTP" and not "http").
+#
+# Users may override the detected values by doing something like:
+# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure
+#
+# For the sake of sanity, this macro assumes that any libcurl that is
+# found is after version 7.7.2, the first version that included the
+# curl-config script.  Note that it is very important for people
+# packaging binary versions of libcurl to include this script!
+# Without curl-config, we can only guess what protocols are available,
+# or use curl_version_info to figure it out at runtime.
+
+AC_DEFUN([LIBCURL_CHECK_CONFIG],
+[
+  AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL])
+  AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4])
+  AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6])
+  AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz])
+  AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS])
+  AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN])
+  AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI])
+  AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM])
+
+  AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_RTSP],[Defined if libcurl supports RTSP])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_POP3],[Defined if libcurl supports POP3])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_IMAP],[Defined if libcurl supports IMAP])
+  AH_TEMPLATE([LIBCURL_PROTOCOL_SMTP],[Defined if libcurl supports SMTP])
+
+  AC_ARG_WITH(libcurl,
+     AS_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]),
+     [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])])
+
+  if test "$_libcurl_with" != "no" ; then
+
+     AC_PROG_AWK
+
+     _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'"
+
+     _libcurl_try_link=yes
+
+     if test -d "$_libcurl_with" ; then
+        LIBCURL_CPPFLAGS="-I$withval/include"
+        _libcurl_ldflags="-L$withval/lib"
+        AC_PATH_PROG([_libcurl_config],[curl-config],[],
+                     ["$withval/bin"])
+     else
+        AC_PATH_PROG([_libcurl_config],[curl-config],[],[$PATH])
+     fi
+
+     if test x$_libcurl_config != "x" ; then
+        AC_CACHE_CHECK([for the version of libcurl],
+           [libcurl_cv_lib_curl_version],
+           [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`])
+
+        _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
+        _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse`
+
+        if test $_libcurl_wanted -gt 0 ; then
+           AC_CACHE_CHECK([for libcurl >= version $2],
+              [libcurl_cv_lib_version_ok],
+              [
+              if test $_libcurl_version -ge $_libcurl_wanted ; then
+                 libcurl_cv_lib_version_ok=yes
+              else
+                 libcurl_cv_lib_version_ok=no
+              fi
+              ])
+        fi
+
+        if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
+           if test x"$LIBCURL_CPPFLAGS" = "x" ; then
+              LIBCURL_CPPFLAGS=`$_libcurl_config --cflags`
+           fi
+           if test x"$LIBCURL" = "x" ; then
+              LIBCURL=`$_libcurl_config --libs`
+
+              # This is so silly, but Apple actually has a bug in their
+              # curl-config script.  Fixed in Tiger, but there are still
+              # lots of Panther installs around.
+              case "${host}" in
+                 powerpc-apple-darwin7*)
+                    LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'`
+                 ;;
+              esac
+           fi
+
+           # All curl-config scripts support --feature
+           _libcurl_features=`$_libcurl_config --feature`
+
+           # Is it modern enough to have --protocols? (7.12.4)
+           if test $_libcurl_version -ge 461828 ; then
+              _libcurl_protocols=`$_libcurl_config --protocols`
+           fi
+        else
+           _libcurl_try_link=no
+        fi
+
+        unset _libcurl_wanted
+     fi
+
+     if test $_libcurl_try_link = yes ; then
+
+        # we didn't find curl-config, so let's see if the user-supplied
+        # link line (or failing that, "-lcurl") is enough.
+        LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"}
+
+        AC_CACHE_CHECK([whether libcurl is usable],
+           [libcurl_cv_lib_curl_usable],
+           [
+           _libcurl_save_cppflags=$CPPFLAGS
+           CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
+           _libcurl_save_libs=$LIBS
+           LIBS="$LIBCURL $LIBS"
+
+           AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <curl/curl.h>]],[[
+/* Try and use a few common options to force a failure if we are
+   missing symbols or can't link. */
+int x;
+curl_easy_setopt(NULL,CURLOPT_URL,NULL);
+x=CURL_ERROR_SIZE;
+x=CURLOPT_WRITEFUNCTION;
+x=CURLOPT_WRITEDATA;
+x=CURLOPT_ERRORBUFFER;
+x=CURLOPT_STDERR;
+x=CURLOPT_VERBOSE;
+if (x) {;}
+]])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no)
+
+           CPPFLAGS=$_libcurl_save_cppflags
+           LIBS=$_libcurl_save_libs
+           unset _libcurl_save_cppflags
+           unset _libcurl_save_libs
+           ])
+
+        if test $libcurl_cv_lib_curl_usable = yes ; then
+
+           # Does curl_free() exist in this version of libcurl?
+           # If not, fake it with free()
+
+           _libcurl_save_cppflags=$CPPFLAGS
+           CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
+           _libcurl_save_libs=$LIBS
+           LIBS="$LIBS $LIBCURL"
+
+           AC_CHECK_FUNC(curl_free,,
+              AC_DEFINE(curl_free,free,
+                [Define curl_free() as free() if our version of curl lacks curl_free.]))
+
+           CPPFLAGS=$_libcurl_save_cppflags
+           LIBS=$_libcurl_save_libs
+           unset _libcurl_save_cppflags
+           unset _libcurl_save_libs
+
+           AC_DEFINE(HAVE_LIBCURL,1,
+             [Define to 1 if you have a functional curl library.])
+           AC_SUBST(LIBCURL_CPPFLAGS)
+           AC_SUBST(LIBCURL)
+
+           for _libcurl_feature in $_libcurl_features ; do
+              AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1])
+              eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes
+           done
+
+           if test "x$_libcurl_protocols" = "x" ; then
+
+              # We don't have --protocols, so just assume that all
+              # protocols are available
+              _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP"
+
+              if test x$libcurl_feature_SSL = xyes ; then
+                 _libcurl_protocols="$_libcurl_protocols HTTPS"
+
+                 # FTPS wasn't standards-compliant until version
+                 # 7.11.0 (0x070b00 == 461568)
+                 if test $_libcurl_version -ge 461568; then
+                    _libcurl_protocols="$_libcurl_protocols FTPS"
+                 fi
+              fi
+
+              # RTSP, IMAP, POP3 and SMTP were added in
+              # 7.20.0 (0x071400 == 463872)
+              if test $_libcurl_version -ge 463872; then
+                 _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP"
+              fi
+           fi
+
+           for _libcurl_protocol in $_libcurl_protocols ; do
+              AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1])
+              eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes
+           done
+        else
+           unset LIBCURL
+           unset LIBCURL_CPPFLAGS
+        fi
+     fi
+
+     unset _libcurl_try_link
+     unset _libcurl_version_parse
+     unset _libcurl_config
+     unset _libcurl_feature
+     unset _libcurl_features
+     unset _libcurl_protocol
+     unset _libcurl_protocols
+     unset _libcurl_version
+     unset _libcurl_ldflags
+  fi
+
+  if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
+     # This is the IF-NO path
+     ifelse([$4],,:,[$4])
+  else
+     # This is the IF-YES path
+     ifelse([$3],,:,[$3])
+  fi
+
+  unset _libcurl_with
+])dnl
diff --git a/m4/pdns_with_lua_records.m4 b/m4/pdns_with_lua_records.m4
new file mode 100644 (file)
index 0000000..d3c8500
--- /dev/null
@@ -0,0 +1,16 @@
+AC_DEFUN([PDNS_WITH_LUA_RECORDS], [
+  AC_MSG_CHECKING([whether we will enable LUA records])
+
+  AC_ARG_ENABLE([lua-records],
+    [AS_HELP_STRING([--disable-lua-records], [disable LUA records support @<:@default=no@:>@])],
+    [enable_lua_records=$enableval],
+    [enable_lua_records=yes]
+  )
+  AC_MSG_RESULT([$enable_lua_records])
+
+  AS_IF([test "x$enable_lua_records" != "xno"], [
+    LIBCURL_CHECK_CONFIG("yes", "7.21.3")
+    AC_DEFINE([HAVE_LUA_RECORDS], [1], [Define if enabling LUA records.])
+  ])
+  AM_CONDITIONAL([HAVE_LUA_RECORDS], [test "x$enable_lua_records" != "xno"])
+])
index cfd721e18ad8a98f223b4f24bb6eb94b0ae292b1..2bda458259ea63994da4932de1bd8a0c2707bed9 100644 (file)
@@ -184,8 +184,6 @@ pdns_server_SOURCES = \
        logger.cc logger.hh \
        lua-base4.cc lua-base4.hh \
        lua-auth4.cc lua-auth4.hh \
-       lua-record.cc \
-       minicurl.cc minicurl.hh \
        mastercommunicator.cc \
        md5.hh \
        misc.cc misc.hh \
@@ -236,7 +234,12 @@ pdns_server_LDADD = \
        $(YAHTTP_LIBS) \
        $(JSON11_LIBS) \
        $(LIBCRYPTO_LIBS) \
-       $(SYSTEMD_LIBS) -lcurl
+       $(SYSTEMD_LIBS)
+
+if HAVE_LUA_RECORDS
+pdns_server_SOURCES += lua-record.cc minicurl.cc minicurl.hh
+pdns_server_LDADD += $(LIBCURL)
+endif
 
 if BOTAN
 pdns_server_SOURCES += botansigners.cc
index 465171c3190815841c54e3063cb51d6467ea6999..5854e0e7a276622c58bd89d64e43710e8e544660 100644 (file)
@@ -36,7 +36,9 @@
 
 bool g_anyToTcp;
 bool g_8bitDNS;
+#ifdef HAVE_LUA_RECORDS
 bool g_doLuaRecord;
+#endif
 typedef Distributor<DNSPacket,DNSPacket,PacketHandler> DNSDistributor;
 
 ArgvMap theArg;
@@ -489,7 +491,9 @@ void mainthread()
    
    g_anyToTcp = ::arg().mustDo("any-to-tcp");
    g_8bitDNS = ::arg().mustDo("8bit-dns");
+#ifdef HAVE_LUA_RECORDS
    g_doLuaRecord = ::arg().mustDo("enable-lua-record");
+#endif
 
    DNSPacket::s_udpTruncationThreshold = std::max(512, ::arg().asNum("udp-truncation-threshold"));
    DNSPacket::s_doEDNSSubnetProcessing = ::arg().mustDo("edns-subnet-processing");
index 9155cf4a27bc59df1a05e796bda632ce1b392879..457a78331a526dab274eb738a481b6787fd98473 100644 (file)
@@ -144,7 +144,9 @@ boilerplate_conv(MG, QType::MG, conv.xfrName(d_mgmname, true));
 boilerplate_conv(MR, QType::MR, conv.xfrName(d_alias, true));
 boilerplate_conv(MINFO, QType::MINFO, conv.xfrName(d_rmailbx, true); conv.xfrName(d_emailbx, true));
 boilerplate_conv(TXT, QType::TXT, conv.xfrText(d_text, true));
+#ifdef HAVE_LUA_RECORDS
 boilerplate_conv(LUA, QType::LUA, conv.xfrType(d_type); conv.xfrText(d_code, true));
+#endif
 boilerplate_conv(ENT, 0, );
 boilerplate_conv(SPF, 99, conv.xfrText(d_text, true));
 boilerplate_conv(HINFO, QType::HINFO,  conv.xfrText(d_cpu);   conv.xfrText(d_host));
@@ -159,6 +161,7 @@ boilerplate_conv(OPT, QType::OPT,
                    conv.xfrBlob(d_data)
                  );
 
+#ifdef HAVE_LUA_RECORDS
 string LUARecordContent::getCode()
 {
   // in d_code, series of "part1" "part2"
@@ -171,6 +174,7 @@ string LUARecordContent::getCode()
   }
   return ret;
 }
+#endif
 
 void OPTRecordContent::getData(vector<pair<uint16_t, string> >& options)
 {
@@ -597,7 +601,9 @@ void reportBasicTypes()
   PTRRecordContent::report();
   DNSRecordContent::regist(QClass::CHAOS, QType::TXT, &TXTRecordContent::make, &TXTRecordContent::make, "TXT");
   TXTRecordContent::report();
+#ifdef HAVE_LUA_RECORDS
   LUARecordContent::report();
+#endif
   DNSRecordContent::regist(QClass::IN, QType::ANY, 0, 0, "ANY");
   DNSRecordContent::regist(QClass::IN, QType::AXFR, 0, 0, "AXFR");
   DNSRecordContent::regist(QClass::IN, QType::IXFR, 0, 0, "IXFR");
index c4cacb4ee6d05ccfe2c96be60780a3db576ba45f..ebbd553dc10d824fe86d3d15af968b6985f36ae2 100644 (file)
 #ifndef PDNS_DNSRECORDS_HH
 #define PDNS_DNSRECORDS_HH
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "dnsparser.hh"
 #include "dnswriter.hh"
 #include "rcpgenerator.hh"
@@ -186,6 +190,7 @@ public:
   string d_text;
 };
 
+#ifdef HAVE_LUA_RECORDS
 class LUARecordContent : public DNSRecordContent
 {
 public:
@@ -194,7 +199,7 @@ public:
   uint16_t d_type;
   string d_code;
 };
-
+#endif
 
 class ENTRecordContent : public DNSRecordContent
 {
index 5f29c3ff311eaca06ade492deef1c19641ba9b61..ead2dc599be4c1a2e1b06cab13c3cd78e52d7f9b 100644 (file)
@@ -6,6 +6,7 @@
 #include "minicurl.hh"
 #include "ueberbackend.hh"
 #include <boost/format.hpp>
+#include "dnsrecords.hh"
 
 #include "../modules/geoipbackend/geoipinterface.hh" // only for the enum
 
index ca4cc619726f7234756f6b23b09de873eace6e8e..06d052630265a384d1b2c15045b16dfcb3856510 100644 (file)
@@ -356,13 +356,14 @@ bool PacketHandler::getBestWildcard(DNSPacket *p, SOAData& sd, const DNSName &ta
   DNSName subdomain(target);
   bool haveSomething=false;
 
+#ifdef HAVE_LUA_RECORDS
   bool doLua=g_doLuaRecord;
   if(!doLua) {
     string val;
     d_dk.getFromMeta(sd.qname, "ENABLE-LUA-RECORD", val);
     doLua = (val=="1");
   }
-
+#endif
   
   wildcard=subdomain;
   while( subdomain.chopOff() && !haveSomething )  {
@@ -372,6 +373,7 @@ bool PacketHandler::getBestWildcard(DNSPacket *p, SOAData& sd, const DNSName &ta
       B.lookup(QType(QType::ANY), g_wildcarddnsname+subdomain, p, sd.domain_id);
     }
     while(B.get(rr)) {
+#ifdef HAVE_LUA_RECORDS
       if(rr.dr.d_type == QType::LUA) {
         if(!doLua) {
           DLOG(g_log<<"Have a wildcard LUA match, but not doing LUA record for this zone"<<endl);
@@ -398,8 +400,11 @@ bool PacketHandler::getBestWildcard(DNSPacket *p, SOAData& sd, const DNSName &ta
           }
         }
       }
-      else if(rr.dr.d_type == p->qtype.getCode() || rr.dr.d_type == QType::CNAME || (p->qtype.getCode() == QType::ANY && rr.dr.d_type != QType::RRSIG))
+      else
+#endif
+      if(rr.dr.d_type == p->qtype.getCode() || rr.dr.d_type == QType::CNAME || (p->qtype.getCode() == QType::ANY && rr.dr.d_type != QType::RRSIG)) {
         ret->push_back(rr);
+      }
       
       wildcard=g_wildcarddnsname+subdomain;
       haveSomething=true;
@@ -501,9 +506,12 @@ void PacketHandler::emitNSEC(DNSPacket *r, const SOAData& sd, const DNSName& nam
 
   B.lookup(QType(QType::ANY), name, NULL, sd.domain_id);
   while(B.get(rr)) {
+#ifdef HAVE_LUA_RECORDS   
     if(rr.dr.d_type == QType::LUA)
       nrc.d_set.insert(getRR<LUARecordContent>(rr.dr)->d_type);
-    else if(rr.dr.d_type == QType::NS || rr.auth)
+    else
+#endif
+      if(rr.dr.d_type == QType::NS || rr.auth)
       nrc.d_set.insert(rr.dr.d_type);
   }
 
@@ -545,9 +553,12 @@ void PacketHandler::emitNSEC3(DNSPacket *r, const SOAData& sd, const NSEC3PARAMR
 
     B.lookup(QType(QType::ANY), name, NULL, sd.domain_id);
     while(B.get(rr)) {
+#ifdef HAVE_LUA_RECORDS
       if(rr.dr.d_type == QType::LUA)
         n3rc.d_set.insert(getRR<LUARecordContent>(rr.dr)->d_type);
-      else if(rr.dr.d_type && (rr.dr.d_type == QType::NS || rr.auth)) // skip empty non-terminals
+      else
+#endif
+        if(rr.dr.d_type && (rr.dr.d_type == QType::NS || rr.auth)) // skip empty non-terminals
         n3rc.d_set.insert(rr.dr.d_type);
     }
   }
@@ -1111,7 +1122,10 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
 
   DNSPacket *r=0;
   bool noCache=false;
+
+#ifdef HAVE_LUA_RECORDS
   bool doLua=g_doLuaRecord;
+#endif
   
   if(p->d.qr) { // QR bit from dns packet (thanks RA from N)
     if(d_logDNSDetails)
@@ -1333,13 +1347,16 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
     weDone = weRedirected = weHaveUnauth =  false;
 
 
+#ifdef HAVE_LUA_RECORDS
     if(!doLua) {
       string val;
       d_dk.getFromMeta(sd.qname, "ENABLE-LUA-RECORD", val);
       doLua = (val=="1");
     }
+#endif
     
     while(B.get(rr)) {
+#ifdef HAVE_LUA_RECORDS
       if(rr.dr.d_type == QType::LUA) {
         if(!doLua)
           continue;
@@ -1369,6 +1386,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
           }
         }
       }
+#endif
       //cerr<<"got content: ["<<rr.content<<"]"<<endl;
       if (p->qtype.getCode() == QType::ANY && !p->d_dnssecOk && (rr.dr.d_type == QType:: DNSKEY || rr.dr.d_type == QType::NSEC3PARAM))
         continue; // Don't send dnssec info to non validating resolvers.
@@ -1479,9 +1497,10 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
     else if(weDone) {
       bool haveRecords = false;
       for(const auto& loopRR: rrset) {
+#ifdef HAVE_LUA_RECORDS
         if(loopRR.dr.d_type == QType::LUA)
             continue;
-
+#endif
         if((p->qtype.getCode() == QType::ANY || loopRR.dr.d_type == p->qtype.getCode()) && loopRR.dr.d_type && loopRR.dr.d_type != QType::ALIAS && loopRR.auth) {
           r->addRecord(loopRR);
           haveRecords = true;