1# dnstap.m4 2 3# dt_DNSTAP(default_dnstap_socket_path, [action-if-true], [action-if-false]) 4# -------------------------------------------------------------------------- 5# Check for required dnstap libraries and add dnstap configure args. 6AC_DEFUN([dt_DNSTAP], 7[ 8 AC_ARG_ENABLE([dnstap], 9 AS_HELP_STRING([--enable-dnstap], 10 [Enable dnstap support (requires protobuf-c)]), 11 [opt_dnstap=$enableval], 12 [opt_dnstap=no]) 13 14 AC_ARG_WITH([dnstap-socket-path], 15 AS_HELP_STRING([--with-dnstap-socket-path=pathname], 16 [set default dnstap socket path]), 17 [opt_dnstap_socket_path=$withval], 18 [opt_dnstap_socket_path="$1"]) 19 20 if test "x$opt_dnstap" != "xno"; then 21 AC_PATH_PROG([PROTOC_C], [protoc-c]) 22 if test -z "$PROTOC_C"; then 23 AC_MSG_ERROR([The protoc-c program was not found. Please install protobuf-c!]) 24 fi 25 AC_ARG_WITH([protobuf-c], 26 AS_HELP_STRING([--with-protobuf-c=path], [Path where protobuf-c is installed, for dnstap]), 27 [ 28 # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 29 if test -f $withval/include/google/protobuf-c/protobuf-c.h; then 30 CFLAGS="$CFLAGS -I$withval/include/google" 31 else 32 CFLAGS="$CFLAGS -I$withval/include" 33 fi 34 LDFLAGS="$LDFLAGS -L$withval/lib" 35 ], 36 [ 37 if test -n "$PKG_CONFIG"; then 38 PKG_CHECK_MODULES([PROTOBUFC], [libprotobuf-c], 39 [ 40 CFLAGS="$CFLAGS $PROTOBUFC_CFLAGS" 41 LIBS="$LIBS $PROTOBUFC_LIBS" 42 ], 43 [ 44 # pkg-config failed; try falling back to known values 45 # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 46 if test -f /usr/include/google/protobuf-c/protobuf-c.h; then 47 CFLAGS="$CFLAGS -I/usr/include/google" 48 else 49 if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then 50 CFLAGS="$CFLAGS -I/usr/local/include/google" 51 LDFLAGS="$LDFLAGS -L/usr/local/lib" 52 else 53 AC_MSG_ERROR([The protobuf-c package was not found with pkg-config. Please install protobuf-c!]) 54 fi 55 fi 56 ] 57 ) 58 else 59 # workaround for protobuf-c includes at old dir before protobuf-c-1.0.0 60 if test -f /usr/include/google/protobuf-c/protobuf-c.h; then 61 CFLAGS="$CFLAGS -I/usr/include/google" 62 else 63 if test -f /usr/local/include/google/protobuf-c/protobuf-c.h; then 64 CFLAGS="$CFLAGS -I/usr/local/include/google" 65 LDFLAGS="$LDFLAGS -L/usr/local/lib" 66 fi 67 fi 68 fi 69 ] 70 ) 71 AC_SEARCH_LIBS([protobuf_c_message_pack], [protobuf-c], [], 72 AC_MSG_ERROR([The protobuf-c library was not found. Please install the development libraries for protobuf-c!])) 73 $2 74 else 75 $3 76 fi 77]) 78