+++ /dev/null
-AC_DEFUN([PDNS_ENABLE_PROTOBUF], [
- AC_MSG_CHECKING([whether to enable protobuf support])
- AC_ARG_ENABLE([protobuf],
- AS_HELP_STRING([--enable-protobuf],[enable protobuf support @<:@default=no@:>@]),
- [enable_protobuf=$enableval],
- [enable_protobuf=no],
- )
- AC_MSG_RESULT([$enable_protobuf])
- AS_IF([test "x$enable_protobuf" = "xyes"], [
- PKG_CHECK_MODULES([PROTOBUF], [protobuf], [HAVE_PROTOBUF=1], [AC_MSG_ERROR([Could not find protobuf])])
- ], [HAVE_PROTOBUF=0])
- AM_CONDITIONAL([HAVE_PROTOBUF], [test "$HAVE_PROTOBUF" -eq 1])
- AS_IF([test "$HAVE_PROTOBUF" -eq 1], [AC_DEFINE([HAVE_PROTOBUF], [1], [Define if using protobuf.])])
-])
--- /dev/null
+AC_DEFUN([PDNS_WITH_PROTOBUF], [
+ AC_MSG_CHECKING([if we need to link in protobuf])
+ AC_ARG_WITH([protobuf],
+ AS_HELP_STRING([--with-protobuf],[enable protobuf support @<:@default=auto@:>@]),
+ [with_protobuf=$withval],
+ [with_protobuf=auto],
+ )
+ AC_MSG_RESULT([$with_protobuf])
+
+ AS_IF([test "x$with_protobuf" != "xno"], [
+ AS_IF([test "x$with_protobuf" = "xyes" -o "x$with_protobuf" = "xauto"], [
+ PKG_CHECK_MODULES([PROTOBUF], [protobuf], [ ], [ ])
+ AC_CHECK_PROG([PROTOC], [protoc], [protoc])
+ ])
+ ])
+ AS_IF([test "x$with_protobuf" = "xyes"], [
+ AS_IF([test x"$PROTOBUF_LIBS" = "x"], [
+ AC_MSG_ERROR([Protobuf requested but libraries were not found])
+ ])
+ AS_IF([test x"$PROTOC" = "x"], [
+ AC_MSG_ERROR([Protobuf requested but the protobuf compiler was not found])
+ ])
+ ])
+ AM_CONDITIONAL([HAVE_PROTOBUF], [test x"$PROTOBUF_LIBS" != "x"])
+ AM_CONDITIONAL([HAVE_PROTOC], [test x"$PROTOC" != "x"])
+ AS_IF([test x"$PROTOBUF_LIBS" != "x"], [AC_DEFINE([HAVE_PROTOBUF], [1], [Define if using protobuf.])])
+])