]> git.puffer.fish Git - mirror/frr.git/commitdiff
build: fix several ldpd XML-CLI build issues 82/head
authorDavid Lamparter <equinox@opensourcerouting.org>
Fri, 13 Jan 2017 14:31:04 +0000 (15:31 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 17 Jan 2017 18:00:10 +0000 (19:00 +0100)
- the location of ldp_vty_cmds.c can be either in srcdir or builddir,
  depending on whether a premade file from a dist tarball is used
- perl libxml support is only needed if that file is absent
- the actual perl script wasn't even included in the dist tarball
- the include location doesn't work when srcdir != builddir

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
configure.ac
ldpd/Makefile.am
ldpd/ldp_vty.xml
tools/Makefile.am
vtysh/Makefile.am

index fcc0de1b220e90f60c45740dde8e0e71eb1ad7f2..297e5cea55d579b1079acac53720ba603624ab0f 100755 (executable)
@@ -292,8 +292,6 @@ if test $ac_cv_lib_json_c_json_object_get = no; then
   fi
 fi
 
-AX_PROG_PERL_MODULES(XML::LibXML, , AC_MSG_ERROR(XML::LibXML perl module is needed to compile))
-
 AC_ARG_ENABLE([dev_build],
     AS_HELP_STRING([--enable-dev-build], [build for development]))
 
@@ -1163,6 +1161,14 @@ AM_CONDITIONAL(OSPFD, test "x$OSPFD" = "xospfd")
 if test "${enable_ldpd}" = "no";then
   LDPD=""
 else
+  AX_PROG_PERL_MODULES(XML::LibXML, , [
+    if test -f "${srcdir}/ldpd/ldp_vty_cmds.c"; then
+      AC_MSG_WARN([XML::LibXML perl module not found, using pregenerated ldp_vty_cmds.c])
+    else
+      AC_MSG_ERROR([XML::LibXML perl module not found and pregenerated ldp_vty_cmds.c missing])
+    fi
+  ])
+
   LDPD="ldpd"
   AC_DEFINE(HAVE_LDPD, 1, ldpd)
 fi
index e7da216a65d8b0f7ec7b3496c8d7a2d0e6723cab..6dc7c077de861ccb62c5731f3350d6db942cfedd 100644 (file)
@@ -3,6 +3,7 @@
 AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
 INSTALL_SDATA=@INSTALL@ -m 600
+EXTRA_DIST=
 
 AM_CFLAGS = $(WERROR)
 
@@ -10,6 +11,7 @@ noinst_LIBRARIES = libldp.a
 sbin_PROGRAMS = ldpd
 
 BUILT_SOURCES = ldp_vty_cmds.c
+EXTRA_DIST += ldp_vty.xml
 
 libldp_a_SOURCES = \
        accept.c address.c adjacency.c control.c hello.c init.c interface.c \
index ee5c6e4df2d8f42454903b4cd80a002bf7560edc..9103dd0898dd2757105929b0243b838d48204eae 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<file init="ldp_vty_init" cmdprefix="ldp" header="ldp_vty.h">
+<file init="ldp_vty_init" cmdprefix="ldp" header="ldpd/ldp_vty.h">
   <!-- address-family -->
   <options name="address-family">
     <option name="ipv4" help="IPv4 Address Family"/>
index 97ca27039a36dd95cb43080a1e40e0d404ba9abc..c5e8fe9c712381a7881865265e916967fa83ecfb 100644 (file)
@@ -1,6 +1,7 @@
 AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
 AM_CFLAGS = $(WERROR)
+EXTRA_DIST =
 
 bin_PROGRAMS = permutations
 permutations_SOURCES = permutations.c
@@ -8,5 +9,6 @@ permutations_LDADD = ../lib/libzebra.la
 
 sbin_SCRIPTS = frr-reload.py frr
 
-EXTRA_DIST = frr.service frr-reload.py frr
+EXTRA_DIST += frr.service frr-reload.py frr
 
+EXTRA_DIST += xml2cli.pl
index 090382b99beab5fd6cd95845e8d49708d06f3fe6..f689bae5cc2cfad1afee17eaf9e3ef44d792ae59 100644 (file)
@@ -59,10 +59,6 @@ if OSPF6D
 vtysh_scan += $(top_srcdir)/ospf6d/*.c
 endif
 
-if LDPD
-vtysh_scan += $(top_srcdir)/ldpd/ldp_vty_cmds.c
-endif
-
 if RIPD
 vtysh_scan += $(top_srcdir)/ripd/*.c
 endif
@@ -89,5 +85,22 @@ vtysh_cmd_FILES = $(vtysh_scan) \
                  $(top_srcdir)/watchfrr/watchfrr_vty.c \
                  $(BGP_VNC_RFAPI_SRC) $(BGP_VNC_RFP_SRC)
 
-vtysh_cmd.c: $(vtysh_cmd_FILES) extract.pl
-       ./extract.pl $(vtysh_cmd_FILES) > vtysh_cmd.c
+# this is slightly iffy... ldp_vty_cmds.c can be located in either
+# $srcdir or $builddir depending on whether it's coming pre-built from a
+# dist tarball or being built.  automake uses VPATH to find it, but that
+# doesn't work here...
+# so after running "make ldp_vty_cmds.c", the file can be in either of the
+# two directories.  we need to do some magic to find out which.
+vtysh_cmd_DEPS = $(vtysh_cmd_FILES)
+if LDPD
+$(top_builddir)/ldpd/ldp_vty_cmds.c:
+       make -C "$(top_builddir)/ldpd" ldp_vty_cmds.c
+vtysh_cmd_DEPS += $(top_builddir)/ldpd/ldp_vty_cmds.c
+endif
+
+vtysh_cmd.c: $(vtysh_cmd_DEPS) extract.pl
+       if test -n "${LDPD}"; then \
+               ldpcmds="$(top_srcdir)/ldpd/ldp_vty_cmds.c"; \
+               test -f "$(top_builddir)/ldpd/ldp_vty_cmds.c" && ldpcmds="$(top_builddir)/ldpd/ldp_vty_cmds.c"; \
+       fi; \
+       ./extract.pl $(vtysh_cmd_FILES) $${ldpcmds} > vtysh_cmd.c