Skip to content

Commit

Permalink
configure: Add test for whether protoc matches protobuf
Browse files Browse the repository at this point in the history
Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Oct 3, 2019
1 parent feced59 commit 0cc492d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit 0cc492d

Please sign in to comment.