forked from Mirror/frr
build: clean up protobuf build integration
We were linking all libs and binaries against libprotobuf-c if the option was enabled... that makes no sense at all. Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
4007e3adf1
commit
2b2f275ee2
49
configure.ac
49
configure.ac
|
@ -616,27 +616,26 @@ AC_SUBST(PYTHON_LIBS)
|
|||
# Logic for protobuf support.
|
||||
#
|
||||
if test "$enable_protobuf" = "yes"; then
|
||||
have_protobuf=yes
|
||||
# Check for protoc & protoc-c
|
||||
|
||||
# Check for protoc-c
|
||||
AC_CHECK_PROG([PROTOC_C], [protoc-c], [protoc-c], [/bin/false])
|
||||
if test "x$PROTOC_C" = "x/bin/false"; then
|
||||
have_protobuf=no
|
||||
else
|
||||
found_protobuf_c=no
|
||||
PKG_CHECK_MODULES([PROTOBUF_C], libprotobuf-c >= 0.14,
|
||||
[found_protobuf_c=yes],
|
||||
[AC_MSG_RESULT([pkg-config did not find libprotobuf-c])])
|
||||
# protoc is not required, it's only for a "be nice" helper target
|
||||
AC_CHECK_PROGS([PROTOC], [protoc], [/bin/false])
|
||||
|
||||
if test "x$found_protobuf_c" = "xyes"; then
|
||||
LDFLAGS="$LDFLAGS $PROTOBUF_C_LIBS"
|
||||
CFLAGS="$CFLAGS $PROTOBUF_C_CFLAGS"
|
||||
else
|
||||
AC_CHECK_HEADER([google/protobuf-c/protobuf-c.h], [],
|
||||
[have_protobuf=no; AC_MSG_RESULT([Couldn't find google/protobuf-c.h])])
|
||||
fi
|
||||
fi
|
||||
AC_CHECK_PROGS([PROTOC_C], [protoc-c], [/bin/false])
|
||||
if test "$PROTOC_C" = "/bin/false"; then
|
||||
AC_MSG_FAILURE([protobuf requested but protoc-c not found. Install protobuf-c.])
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c >= 0.14],, [
|
||||
AC_MSG_FAILURE([protobuf requested but libprotobuf-c not found. Install protobuf-c.])
|
||||
])
|
||||
AC_CHECK_HEADER([google/protobuf-c/protobuf-c.h], [], [
|
||||
AC_MSG_FAILURE([protobuf requested but protobuf-c.h not found. Install protobuf-c.])
|
||||
])
|
||||
|
||||
AC_DEFINE(HAVE_PROTOBUF,, protobuf)
|
||||
fi
|
||||
AM_CONDITIONAL([HAVE_PROTOBUF], [test "x$enable_protobuf" = "xyes"])
|
||||
|
||||
#
|
||||
# Logic for old vpn commans support.
|
||||
|
@ -645,18 +644,6 @@ if test "$enable_oldvpn_commands" = "yes"; then
|
|||
AC_DEFINE(KEEP_OLD_VPN_COMMANDS,, [Define for compiling with old vpn commands])
|
||||
fi
|
||||
|
||||
# Fail if the user explicity enabled protobuf support and we couldn't
|
||||
# find the compiler or libraries.
|
||||
if test "x$have_protobuf" = "xno" && test "x$enable_protobuf" = "xyes"; then
|
||||
AC_MSG_ERROR([Protobuf enabled explicitly but can't find libraries/tools])
|
||||
fi
|
||||
|
||||
if test "x$have_protobuf" = "xyes"; then
|
||||
AC_DEFINE(HAVE_PROTOBUF,, protobuf)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([HAVE_PROTOBUF], [test "x$have_protobuf" = "xyes"])
|
||||
|
||||
#
|
||||
# End of logic for protobuf support.
|
||||
#
|
||||
|
@ -2057,7 +2044,7 @@ group to run as : ${enable_group}
|
|||
group for vty sockets : ${enable_vty_group}
|
||||
config file mask : ${enable_configfile_mask}
|
||||
log file mask : ${enable_logfile_mask}
|
||||
zebra protobuf enabled : ${have_protobuf:-no}
|
||||
zebra protobuf enabled : ${enable_protobuf:-no}
|
||||
|
||||
The above user and group must have read/write access to the state file
|
||||
directory and to the config files in the config file directory."
|
||||
|
|
|
@ -3,8 +3,7 @@ lib_LTLIBRARIES += fpm/libfrrfpm_pb.la
|
|||
endif
|
||||
|
||||
fpm_libfrrfpm_pb_la_LDFLAGS = -version-info 0:0:0
|
||||
fpm_libfrrfpm_pb_la_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir) -I$(top_builddir)/lib \
|
||||
$(Q_PROTOBUF_C_CLIENT_INCLUDES)
|
||||
fpm_libfrrfpm_pb_la_CPPFLAGS = $(AM_CPPFLAGS) $(PROTOBUF_C_CFLAGS)
|
||||
fpm_libfrrfpm_pb_la_SOURCES = \
|
||||
fpm/fpm.h \
|
||||
fpm/fpm_pb.h \
|
||||
|
@ -12,11 +11,14 @@ fpm_libfrrfpm_pb_la_SOURCES = \
|
|||
# end
|
||||
|
||||
if HAVE_PROTOBUF
|
||||
nodist_fpm_libfrrfpm_pb_la_SOURCES = fpm/fpm.pb-c.c
|
||||
nodist_fpm_libfrrfpm_pb_la_SOURCES = \
|
||||
fpm/fpm.pb-c.c \
|
||||
# end
|
||||
endif
|
||||
|
||||
CLEANFILES += \
|
||||
fpm/fpm.pb-c.c \
|
||||
fpm/fpm.pb-c.h \
|
||||
# end
|
||||
endif
|
||||
|
||||
EXTRA_DIST += fpm/fpm.proto
|
||||
|
|
|
@ -2,44 +2,36 @@ if HAVE_PROTOBUF
|
|||
lib_LTLIBRARIES += qpb/libfrr_pb.la
|
||||
endif
|
||||
|
||||
qpb_libfrr_pb_la_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir) -I$(top_builddir)/lib \
|
||||
$(Q_PROTOBUF_C_CLIENT_INCLUDES)
|
||||
qpb_libfrr_pb_la_CPPFLAGS = $(AM_CPPFLAGS) $(PROTOBUF_C_CFLAGS)
|
||||
qpb_libfrr_pb_la_LIBADD = $(PROTOBUF_C_LIBS)
|
||||
qpb_libfrr_pb_la_LDFLAGS = -version-info 0:0:0
|
||||
|
||||
qpb_libfrr_pb_la_SOURCES = \
|
||||
qpb/qpb.c \
|
||||
qpb/qpb_allocator.c \
|
||||
# end
|
||||
nodist_qpb_libfrr_pb_la_SOURCES = \
|
||||
qpb/qpb.pb-c.c \
|
||||
# end
|
||||
|
||||
noinst_HEADERS += \
|
||||
qpb/linear_allocator.h \
|
||||
qpb/qpb.h \
|
||||
qpb/qpb.c \
|
||||
qpb/qpb_allocator.h \
|
||||
# end
|
||||
|
||||
if HAVE_PROTOBUF
|
||||
qpb_libfrr_pb_la_SOURCES += qpb/qpb_allocator.c
|
||||
nodist_qpb_libfrr_pb_la_SOURCES = qpb/qpb.pb-c.c
|
||||
CLEANFILES += \
|
||||
qpb/qpb.pb-c.c \
|
||||
qpb/qpb.pb-c.h \
|
||||
# end
|
||||
endif
|
||||
|
||||
EXTRA_DIST += qpb/qpb.proto
|
||||
|
||||
if HAVE_PROTOBUF
|
||||
|
||||
# Uncomment to use an non-system version of libprotobuf-c.
|
||||
#
|
||||
# Q_PROTOBUF_C_CLIENT_INCLUDES = -I$(top_srcdir)/third-party/protobuf-c/src
|
||||
# Q_PROTOBUF_C_CLIENT_LDOPTS = $(top_builddir)/third-party/protobuf-c/src/libprotobuf-c.la
|
||||
|
||||
Q_PROTOBUF_C_CLIENT_INCLUDES=
|
||||
Q_PROTOBUF_C_CLIENT_LDOPTS=-lprotobuf-c
|
||||
|
||||
Q_PROTOC=protoc
|
||||
Q_PROTOC_C=protoc-c
|
||||
|
||||
# Rules
|
||||
.proto.pb.h:
|
||||
$(Q_PROTOC) -I$(top_srcdir) --cpp_out=$(top_srcdir) $(top_srcdir)/$^
|
||||
$(PROTOC) -I$(top_srcdir) --cpp_out=$(top_srcdir) $(top_srcdir)/$^
|
||||
|
||||
AM_V_PROTOC_C = $(am__v_PROTOC_C_$(V))
|
||||
am__v_PROTOC_C_ = $(am__v_PROTOC_C_$(AM_DEFAULT_VERBOSITY))
|
||||
|
@ -47,15 +39,8 @@ am__v_PROTOC_C_0 = @echo " PROTOC_C" $@;
|
|||
am__v_PROTOC_C_1 =
|
||||
|
||||
.proto.pb-c.c:
|
||||
$(AM_V_PROTOC_C)$(Q_PROTOC_C) -I$(top_srcdir) --c_out=$(top_srcdir) $(top_srcdir)/$^
|
||||
$(AM_V_PROTOC_C)$(PROTOC_C) -I$(top_srcdir) --c_out=$(top_srcdir) $(top_srcdir)/$^
|
||||
.pb-c.c.pb-c.h:
|
||||
@/bin/true
|
||||
|
||||
#
|
||||
# Information about how to link to various libraries.
|
||||
#
|
||||
Q_FRR_PB_CLIENT_LDOPTS = $(top_srcdir)/qpb/libfrr_pb.la $(Q_PROTOBUF_C_CLIENT_LDOPTS)
|
||||
|
||||
Q_FPM_PB_CLIENT_LDOPTS = $(top_srcdir)/fpm/libfrrfpm_pb.la $(Q_FRR_PB_CLIENT_LDOPTS)
|
||||
|
||||
endif # HAVE_PROTOBUF
|
||||
|
|
|
@ -149,10 +149,11 @@ zebra_zebra_snmp_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
|
|||
zebra_zebra_snmp_la_LIBADD = lib/libfrrsnmp.la
|
||||
|
||||
zebra_zebra_fpm_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
|
||||
zebra_zebra_fpm_la_LIBADD = $(Q_FPM_PB_CLIENT_LDOPTS)
|
||||
zebra_zebra_fpm_la_LIBADD =
|
||||
zebra_zebra_fpm_la_SOURCES = zebra/zebra_fpm.c
|
||||
zebra_zebra_fpm_la_SOURCES += zebra/zebra_fpm_netlink.c
|
||||
if HAVE_PROTOBUF
|
||||
zebra_zebra_fpm_la_LIBADD += fpm/libfrrfpm_pb.la qpb/libfrr_pb.la $(PROTOBUF_C_LIBS)
|
||||
zebra_zebra_fpm_la_SOURCES += zebra/zebra_fpm_protobuf.c
|
||||
if DEV_BUILD
|
||||
zebra_zebra_fpm_la_SOURCES += zebra/zebra_fpm_dt.c
|
||||
|
|
Loading…
Reference in a new issue