build: fix some cross-compilation issues

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2017-06-14 10:26:07 +02:00
parent 645bb0b10e
commit 92e5026146
3 changed files with 30 additions and 5 deletions

View file

@ -123,6 +123,28 @@ AC_DEFUN([AC_C_FLAG], [{
AC_LANG_POP(C)
}])
AC_DEFUN([AC_LINK_IFELSE_FLAGS], [{
AC_LANG_PUSH(C)
ac_cflags_save="$CFLAGS"
ac_libs_save="$LIBS"
CFLAGS="$CFLAGS $1"
LIBS="$LIBS $2"
AC_LINK_IFELSE(
[$3],
[
AC_MSG_RESULT([yes])
CFLAGS="$ac_cflags_save"
LIBS="$ac_libs_save"
$5
], [
AC_MSG_RESULT([no])
CFLAGS="$ac_cflags_save"
LIBS="$ac_libs_save"
$4
])
AC_LANG_POP(C)
}])
dnl ICC won't bail on unknown options without -diag-error 10006
dnl need to do this first so we get useful results for the other options
AC_C_FLAG([-diag-error 10006])
@ -1430,7 +1452,9 @@ dnl ------------------
dnl check C-Ares library
dnl ------------------
if test "${NHRPD}" != ""; then
PKG_CHECK_MODULES([CARES], [libcares])
PKG_CHECK_MODULES([CARES], [libcares], , [
AC_MSG_ERROR([trying to build nhrpd, but libcares not found. install c-ares and its -dev headers.])
])
fi
@ -1445,15 +1469,14 @@ if test "${enable_snmp}" != ""; then
SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`"
SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`"
AC_MSG_CHECKING([whether we can link to Net-SNMP])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
AC_LINK_IFELSE_FLAGS([$SNMP_CFLAGS], [$SNMP_LIBS], [AC_LANG_PROGRAM([
int main(void);
],
[
{
return 0;
}
])],[AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
])], [
AC_MSG_ERROR([--enable-snmp given but not usable])])
case "${enable_snmp}" in
yes)

View file

@ -44,6 +44,8 @@
* struct parser_ctx is needed for the bison forward decls.
*/
%code requires {
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

View file

@ -76,10 +76,10 @@ zebra_fpm_la_SOURCES += zebra_fpm_netlink.c
endif
if HAVE_PROTOBUF
zebra_fpm_la_SOURCES += zebra_fpm_protobuf.c
endif
if DEV_BUILD
zebra_fpm_la_SOURCES += zebra_fpm_dt.c
endif
endif
EXTRA_DIST = if_ioctl.c if_ioctl_solaris.c if_netlink.c \