diff --git a/configure.ac b/configure.ac index fa5fb7384..de52d7caa 100644 --- a/configure.ac +++ b/configure.ac @@ -489,6 +489,24 @@ AS_IF([test "$enable_static_protobuf" = yes], AS_IF([test "$enable_static_libgcc" = yes], [AC_MSG_ERROR([--enable-static-libgcc requires --enable-static-protobuf])])]) +AC_MSG_CHECKING([whether protoc matches protobuf]) +cat > conftest.proto <<'EOF' +syntax = "proto2"; +option optimize_for = LITE_RUNTIME; +EOF +AS_IF([$PROTOC --cpp_out=. conftest.proto], + [old_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $protobuf_CFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "conftest.pb.h"]], [[]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + cat conftest.err + AC_MSG_FAILURE([Could not build output generated by protoc ($PROTOC). +Check that protoc matches the installed protobuf headers and libraries.])]) + CPPFLAGS="$old_CPPFLAGS"], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Could not run protoc ($PROTOC).])]) + # Bash completion needs to ask where it goes if >= 2.0 is installed. AS_IF([test "$install_completion" != no], [PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],