mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 21:47:15 +02:00
build: gcc -fplugin=frr-format support
Try to find the plugin and add it to CFLAGS if successful. Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
2537f690c3
commit
ac92fc9e9f
44
configure.ac
44
configure.ac
|
@ -182,13 +182,13 @@ dnl - specifically, options to control warnings
|
||||||
|
|
||||||
AC_USE_SYSTEM_EXTENSIONS
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
AC_DEFUN([AC_C_FLAG], [{
|
AC_DEFUN([AC_C_FLAG], [{
|
||||||
m4_pushdef([cachename],[m4_translit([frr_cv_$1],[ =-+],[____])])
|
m4_pushdef([cachename],[m4_translit([frr_cv_$1],[ =-+/{}$],[________])])
|
||||||
AC_CACHE_CHECK([[whether $CC supports $1]], cachename, [
|
AC_CACHE_CHECK([[whether $CC supports $1]], cachename, [
|
||||||
AC_LANG_PUSH([C])
|
AC_LANG_PUSH([C])
|
||||||
ac_c_flag_save="$CFLAGS"
|
ac_c_flag_save="$CFLAGS"
|
||||||
CFLAGS="$CFLAGS $1"
|
CFLAGS="$CFLAGS $1"
|
||||||
AC_COMPILE_IFELSE(
|
AC_COMPILE_IFELSE(
|
||||||
[AC_LANG_PROGRAM([[]])],
|
[AC_LANG_PROGRAM([[$4]])],
|
||||||
[
|
[
|
||||||
cachename=yes
|
cachename=yes
|
||||||
], [
|
], [
|
||||||
|
@ -354,6 +354,44 @@ if test "$enable_undefined_sanitizer" = "yes"; then
|
||||||
fi
|
fi
|
||||||
AC_SUBST([SAN_FLAGS])
|
AC_SUBST([SAN_FLAGS])
|
||||||
|
|
||||||
|
dnl frr-format.so
|
||||||
|
if test "$with_frr_format" != "no" -a "$with_frr_format" != "yes" -a -n "$with_frr_format"; then
|
||||||
|
AC_C_FLAG([-fplugin=${with_frr_format}], [
|
||||||
|
AC_MSG_ERROR([specified frr-format plugin ($with_frr_format) does not work])
|
||||||
|
],,[
|
||||||
|
#ifndef _FRR_ATTRIBUTE_PRINTFRR
|
||||||
|
#error plugin not loaded
|
||||||
|
#endif
|
||||||
|
#if _FRR_ATTRIBUTE_PRINTFRR < 0x10000
|
||||||
|
#error plugin too old
|
||||||
|
#endif
|
||||||
|
])
|
||||||
|
elif test "$with_frr_format" = "no"; then
|
||||||
|
: #nothing
|
||||||
|
else
|
||||||
|
AC_C_FLAG([-fplugin=tools/gcc-plugins/frr-format.so],[
|
||||||
|
AC_C_FLAG([-fplugin=frr-format],[
|
||||||
|
if test "$with_frr_format" = "yes"; then
|
||||||
|
AC_MSG_ERROR([frr-format plugin requested but not found])
|
||||||
|
fi
|
||||||
|
],,[
|
||||||
|
#ifndef _FRR_ATTRIBUTE_PRINTFRR
|
||||||
|
#error plugin not loaded
|
||||||
|
#endif
|
||||||
|
#if _FRR_ATTRIBUTE_PRINTFRR < 0x10000
|
||||||
|
#error plugin too old
|
||||||
|
#endif
|
||||||
|
])
|
||||||
|
],,[
|
||||||
|
#ifndef _FRR_ATTRIBUTE_PRINTFRR
|
||||||
|
#error plugin not loaded
|
||||||
|
#endif
|
||||||
|
#if _FRR_ATTRIBUTE_PRINTFRR < 0x10000
|
||||||
|
#error plugin too old
|
||||||
|
#endif
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
dnl ----------
|
dnl ----------
|
||||||
dnl Essentials
|
dnl Essentials
|
||||||
dnl ----------
|
dnl ----------
|
||||||
|
@ -600,6 +638,8 @@ AC_ARG_ENABLE([undefined-sanitizer],
|
||||||
AS_HELP_STRING([--undefined-sanitizer], [enable UndefinedBehaviorSanitizer support for detecting undefined behavior]))
|
AS_HELP_STRING([--undefined-sanitizer], [enable UndefinedBehaviorSanitizer support for detecting undefined behavior]))
|
||||||
AC_ARG_WITH([crypto],
|
AC_ARG_WITH([crypto],
|
||||||
AS_HELP_STRING([--with-crypto=<internal|openssl>], [choose between different implementations of cryptographic functions(default value is --with-crypto=internal)]))
|
AS_HELP_STRING([--with-crypto=<internal|openssl>], [choose between different implementations of cryptographic functions(default value is --with-crypto=internal)]))
|
||||||
|
AC_ARG_WITH([frr-format],
|
||||||
|
AS_HELP_STRING([--with-frr-format[=<.../frr-format.so>]], [use frr-format GCC plugin]))
|
||||||
|
|
||||||
#if openssl, else use the internal
|
#if openssl, else use the internal
|
||||||
AS_IF([test "$with_crypto" = "openssl"], [
|
AS_IF([test "$with_crypto" = "openssl"], [
|
||||||
|
|
Loading…
Reference in a new issue