allow bundled protobuf (#11335)
Timotej S committed
Jul 20, 2021 at 15:28 UTC
7e17ede6af3d02b6b54162bb932eab8b0bec88ea
1 file changed
+33
-2
configure.ac
+33
-2
@@ -177,6 +177,13 @@ AC_ARG_WITH(
177
[AS_HELP_STRING([--with-bundled-lws], [Use the bundled version of libwebsockets library @<:@default use system library@:>@])],
178
[with_bundled_lws="yes"], [with_bundled_lws="no"]
179
)
180
+AC_ARG_WITH(
181
+ [bundled-protobuf],
182
+ [AS_HELP_STRING([--with-bundled-protobuf],
183
+ [Uses the bundled version of Google Protocol Buffers @<:@default bundled if present@:>@])],
184
+ [with_bundled_protobuf="$withval"],
185
+ [with_bundled_protobuf="detect"]
186
+)
187
188
# -----------------------------------------------------------------------------
189
# Enforce building with C99, bail early if we can't.
@@ -642,6 +649,22 @@ AM_CONDITIONAL([ENABLE_CAPABILITY], [test "${with_libcap}" = "yes"])
649
# -----------------------------------------------------------------------------
650
# ACLK
651
652
+bundled_proto_avail="no"
653
+if test "${with_bundled_protobuf}" != "no"; then
654
+ AC_MSG_CHECKING([is bundled protobuf available])
655
+ if test -f "externaldeps/protobuf/src/protoc"; then
656
+ bundled_proto_avail="yes"
657
+ fi
658
+ AC_MSG_RESULT([${bundled_proto_avail}])
659
+ if test "${with_bundled_protobuf}" == "yes" -a "${bundled_proto_avail}" != "yes"; then
660
+ AC_MSG_ERROR([Bundled protobuf requested using --with-bundled-protobuf but it cannot be used/found])
661
+ fi
662
+ if test "${with_bundled_protobuf}" == "detect" -a "${bundled_proto_avail}" == "yes"; then
663
+ with_bundled_protobuf="yes"
664
+ fi
665
+fi
666
+
667
+if test "${with_bundled_protobuf}" != "yes"; then
668
PKG_CHECK_MODULES(
669
[PROTOBUF],
670
[protobuf >= 3],
@@ -655,6 +678,14 @@ AS_IF(
678
[have_protoc=no],
679
[have_protoc=yes]
680
)
681
+else
682
+ AC_MSG_NOTICE([using bundled protobuf])
683
+ PROTOC="\$(abs_top_srcdir)/externaldeps/protobuf/src/protoc"
684
+ PROTOBUF_CFLAGS="-I \$(abs_top_srcdir)/externaldeps/protobuf/src"
685
+ PROTOBUF_LIBS="\$(abs_top_srcdir)/externaldeps/protobuf/src/.libs/libprotobuf.a"
686
+ have_libprotobuf="yes"
687
+ have_protoc="yes"
688
+fi
689
690
AC_PATH_PROG([CXX_BINARY], [${CXX}], [no])
691
AS_IF(
@@ -1504,11 +1535,11 @@ AC_SUBST([logdir])
1535
AC_SUBST([pluginsdir])
1536
AC_SUBST([webdir])
1537
1507
-CFLAGS="${CFLAGS} ${OPTIONAL_MATH_CFLAGS} ${OPTIONAL_NFACCT_CFLAGS} ${OPTIONAL_ZLIB_CFLAGS} ${OPTIONAL_UUID_CFLAGS} \
1538
+CFLAGS="${CFLAGS} ${OPTIONAL_PROTOBUF_CFLAGS} ${OPTIONAL_MATH_CFLAGS} ${OPTIONAL_NFACCT_CFLAGS} ${OPTIONAL_ZLIB_CFLAGS} ${OPTIONAL_UUID_CFLAGS} \
1539
${OPTIONAL_LIBCAP_CFLAGS} ${OPTIONAL_IPMIMONITORING_CFLAGS} ${OPTIONAL_CUPS_CFLAGS} ${OPTIONAL_XENSTAT_FLAGS} \
1540
${OPTIONAL_KINESIS_CFLAGS} ${OPTIONAL_PUBSUB_CFLAGS} ${OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS} \
1541
${OPTIONAL_MONGOC_CFLAGS} ${LWS_CFLAGS} ${OPTIONAL_JSONC_STATIC_CFLAGS} ${OPTIONAL_BPF_CFLAGS} ${OPTIONAL_JUDY_CFLAGS} \
1511
- ${OPTIONAL_ACLK_NG_CFLAGS} ${OPTIONAL_PROTOBUF_CFLAGS}"
1542
+ ${OPTIONAL_ACLK_NG_CFLAGS}"
1543
1544
CXXFLAGS="${CFLAGS} ${CXX11FLAG}"
1545