mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-28 21:20:48 +00:00
build: HAVE_LUA -> HAVE_SCRIPTING
And also guard all scripting-related stuff with HAVE_SCRIPTING. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
This commit is contained in:
parent
b4becb063f
commit
fa22080d22
@ -507,7 +507,9 @@ int main(int argc, char **argv)
|
||||
/* Initializations. */
|
||||
bgp_vrf_init();
|
||||
|
||||
#ifdef HAVE_SCRIPTING
|
||||
bgp_script_init();
|
||||
#endif
|
||||
|
||||
hook_register(routing_conf_event,
|
||||
routing_control_plane_protocols_name_validate);
|
||||
|
@ -338,7 +338,7 @@ static const struct route_map_rule_cmd route_match_peer_cmd = {
|
||||
route_match_peer_free
|
||||
};
|
||||
|
||||
#if defined(HAVE_LUA)
|
||||
#ifdef HAVE_SCRIPTING
|
||||
|
||||
enum frrlua_rm_status {
|
||||
/*
|
||||
@ -468,7 +468,8 @@ static const struct route_map_rule_cmd route_match_script_cmd = {
|
||||
route_match_script_compile,
|
||||
route_match_script_free
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_SCRIPTING */
|
||||
|
||||
/* `match ip address IP_ACCESS_LIST' */
|
||||
|
||||
@ -4134,7 +4135,7 @@ DEFUN (no_match_peer,
|
||||
RMAP_EVENT_MATCH_DELETED);
|
||||
}
|
||||
|
||||
#if defined(HAVE_LUA)
|
||||
#ifdef HAVE_SCRIPTING
|
||||
DEFUN (match_script,
|
||||
match_script_cmd,
|
||||
"[no] match script WORD",
|
||||
@ -4156,7 +4157,7 @@ DEFUN (match_script,
|
||||
RMAP_EVENT_FILTER_ADDED);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_SCRIPTING */
|
||||
|
||||
/* match probability */
|
||||
DEFUN (match_probability,
|
||||
@ -5670,7 +5671,7 @@ void bgp_route_map_init(void)
|
||||
|
||||
route_map_install_match(&route_match_peer_cmd);
|
||||
route_map_install_match(&route_match_local_pref_cmd);
|
||||
#if defined(HAVE_LUA)
|
||||
#ifdef HAVE_SCRIPTING
|
||||
route_map_install_match(&route_match_script_cmd);
|
||||
#endif
|
||||
route_map_install_match(&route_match_ip_address_cmd);
|
||||
@ -5835,7 +5836,7 @@ void bgp_route_map_init(void)
|
||||
install_element(RMAP_NODE, &no_set_ipv6_nexthop_prefer_global_cmd);
|
||||
install_element(RMAP_NODE, &set_ipv6_nexthop_peer_cmd);
|
||||
install_element(RMAP_NODE, &no_set_ipv6_nexthop_peer_cmd);
|
||||
#if defined(HAVE_LUA)
|
||||
#ifdef HAVE_SCRIPTING
|
||||
install_element(RMAP_NODE, &match_script_cmd);
|
||||
#endif
|
||||
}
|
||||
|
@ -19,7 +19,8 @@
|
||||
*/
|
||||
|
||||
#include <zebra.h>
|
||||
#include <lua.h>
|
||||
|
||||
#ifdef HAVE_SCRIPTING
|
||||
|
||||
#include "bgpd.h"
|
||||
#include "bgp_script.h"
|
||||
@ -27,6 +28,7 @@
|
||||
#include "bgp_aspath.h"
|
||||
#include "frratomic.h"
|
||||
#include "frrscript.h"
|
||||
#include "frrlua.h"
|
||||
|
||||
static void lua_pushpeer(lua_State *L, const struct peer *peer)
|
||||
{
|
||||
@ -186,3 +188,5 @@ void bgp_script_init(void)
|
||||
{
|
||||
frrscript_register_type_codecs(frrscript_codecs_bgpd);
|
||||
}
|
||||
|
||||
#endif /* HAVE_SCRIPTING */
|
||||
|
@ -17,10 +17,18 @@
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
#ifndef __BGP_SCRIPT__
|
||||
#define __BGP_SCRIPT__
|
||||
|
||||
#include <zebra.h>
|
||||
|
||||
#ifdef HAVE_SCRIPTING
|
||||
|
||||
/*
|
||||
* Initialize scripting stuff.
|
||||
*/
|
||||
void bgp_script_init(void);
|
||||
|
||||
#endif /* HAVE_SCRIPTING */
|
||||
|
||||
#endif /* __BGP_SCRIPT__ */
|
||||
|
24
configure.ac
24
configure.ac
@ -274,24 +274,22 @@ if test "$enable_clang_coverage" = "yes"; then
|
||||
])
|
||||
fi
|
||||
|
||||
if test "$enable_scripting" = "yes"; then
|
||||
AX_PROG_LUA([5.3])
|
||||
AX_LUA_HEADERS
|
||||
AX_LUA_LIBS([
|
||||
AC_DEFINE([HAVE_SCRIPTING], [1], [Have support for scripting])
|
||||
LIBS="$LIBS $LUA_LIB"
|
||||
])
|
||||
fi
|
||||
|
||||
if test "$enable_dev_build" = "yes"; then
|
||||
AC_DEFINE([DEV_BUILD], [1], [Build for development])
|
||||
if test "$orig_cflags" = ""; then
|
||||
AC_C_FLAG([-g3])
|
||||
AC_C_FLAG([-O0])
|
||||
fi
|
||||
if test "$enable_lua" = "yes"; then
|
||||
AX_PROG_LUA([5.3])
|
||||
AX_LUA_HEADERS
|
||||
AX_LUA_LIBS([
|
||||
AC_DEFINE([HAVE_LUA], [1], [Have support for Lua interpreter])
|
||||
LIBS="$LIBS $LUA_LIB"
|
||||
])
|
||||
fi
|
||||
else
|
||||
if test "$enable_lua" = "yes"; then
|
||||
AC_MSG_ERROR([Lua is not meant to be built/used outside of development at this time])
|
||||
fi
|
||||
if test "$orig_cflags" = ""; then
|
||||
AC_C_FLAG([-g])
|
||||
AC_C_FLAG([-O2])
|
||||
@ -693,8 +691,8 @@ fi
|
||||
AC_ARG_ENABLE([dev_build],
|
||||
AS_HELP_STRING([--enable-dev-build], [build for development]))
|
||||
|
||||
AC_ARG_ENABLE([lua],
|
||||
AS_HELP_STRING([--enable-lua], [Build Lua scripting]))
|
||||
AC_ARG_ENABLE([scripting],
|
||||
AS_HELP_STRING([--enable-scripting], [Build with scripting support]))
|
||||
|
||||
if test "$enable_time_check" != "no" ; then
|
||||
if test "$enable_time_check" = "yes" -o "$enable_time_check" = "" ; then
|
||||
|
@ -2281,7 +2281,7 @@ done:
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef DEV_BUILD
|
||||
#if defined(DEV_BUILD) && defined(HAVE_SCRIPTING)
|
||||
DEFUN(script,
|
||||
script_cmd,
|
||||
"script SCRIPT",
|
||||
@ -2399,7 +2399,7 @@ void cmd_init(int terminal)
|
||||
install_element(VIEW_NODE, &echo_cmd);
|
||||
install_element(VIEW_NODE, &autocomplete_cmd);
|
||||
install_element(VIEW_NODE, &find_cmd);
|
||||
#ifdef DEV_BUILD
|
||||
#if defined(DEV_BUILD) && defined(HAVE_SCRIPTING)
|
||||
install_element(VIEW_NODE, &script_cmd);
|
||||
#endif
|
||||
|
||||
|
@ -19,9 +19,11 @@
|
||||
* with this program; see the file COPYING; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <zebra.h>
|
||||
|
||||
#if defined(HAVE_LUA)
|
||||
#ifdef HAVE_SCRIPTING
|
||||
|
||||
#include "prefix.h"
|
||||
#include "frrlua.h"
|
||||
#include "log.h"
|
||||
@ -371,4 +373,4 @@ char *frrlua_stackdump(lua_State *L)
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* HAVE_SCRIPTING */
|
||||
|
@ -19,7 +19,9 @@
|
||||
#ifndef __FRRLUA_H__
|
||||
#define __FRRLUA_H__
|
||||
|
||||
#if defined(HAVE_LUA)
|
||||
#include <zebra.h>
|
||||
|
||||
#ifdef HAVE_SCRIPTING
|
||||
|
||||
#include <lua.h>
|
||||
#include <lualib.h>
|
||||
@ -166,5 +168,6 @@ char *frrlua_stackdump(lua_State *L);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_LUA */
|
||||
#endif /* HAVE_SCRIPTING */
|
||||
|
||||
#endif /* __FRRLUA_H__ */
|
||||
|
@ -16,8 +16,10 @@
|
||||
* with this program; see the file COPYING; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <zebra.h>
|
||||
|
||||
#ifdef HAVE_SCRIPTING
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <lua.h>
|
||||
|
||||
@ -27,6 +29,7 @@
|
||||
#include "hash.h"
|
||||
#include "log.h"
|
||||
|
||||
|
||||
DEFINE_MTYPE_STATIC(LIB, SCRIPT, "Scripting");
|
||||
|
||||
/* Codecs */
|
||||
@ -267,3 +270,5 @@ void frrscript_init()
|
||||
/* Register core library types */
|
||||
frrscript_register_type_codecs(frrscript_codecs_lib);
|
||||
}
|
||||
|
||||
#endif /* HAVE_SCRIPTING */
|
||||
|
@ -19,6 +19,10 @@
|
||||
#ifndef __FRRSCRIPT_H__
|
||||
#define __FRRSCRIPT_H__
|
||||
|
||||
#include <zebra.h>
|
||||
|
||||
#ifdef HAVE_SCRIPTING
|
||||
|
||||
#include <lua.h>
|
||||
#include "frrlua.h"
|
||||
|
||||
@ -128,4 +132,6 @@ void *frrscript_get_result(struct frrscript *fs,
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* HAVE_SCRIPTING */
|
||||
|
||||
#endif /* __FRRSCRIPT_H__ */
|
||||
|
@ -718,7 +718,9 @@ struct thread_master *frr_init(void)
|
||||
lib_cmd_init();
|
||||
|
||||
frr_pthread_init();
|
||||
#ifdef HAVE_SCRIPTING
|
||||
frrscript_init();
|
||||
#endif
|
||||
|
||||
log_ref_init();
|
||||
log_ref_vty_init();
|
||||
|
Loading…
Reference in New Issue
Block a user