Mailing List Archive

patch: configurable example directory
In NetBSD pkgsrc, the rules call for examples to be in
/usr/pkg/share/examples/pkgname, rather than the configuration
directory. I realize that this is a judgement call and also that
other systems have differing conventions, so I'm not interested in
arguing about what's right.

My point is that quagga should be able to support these differing
conventions, so that package maintainers can easily select the locally
correct behavior. Recent cleanup of Makefile.am to use
dist_sysconf_DATA make the NetBSD pkgsrc patches to move where the
example files go no longer apply, and adding first-class support for
selecting the example directory separately seemed like the least
kludgy solution.

I enclose a patch that adds a new configure option to set the example
directory, and installs example files in the example directory. It
defaults to setting the example directory to the config directory, so
that it results in no behavior change if the option is not given.

I ran configure like this:

./configure --prefix=/usr/quagga --sysconfdir=/etc/zebra \
--localstatedir=/var/run/zebra \
--enable-exampledir=/usr/quagga/share/examples/zebra

and got /usr/quagga/share/examples/zebra populated.
With this:

./configure --prefix=/usr/quagga --sysconfdir=/etc/zebra \
--localstatedir=/var/run/zebra

I got example files in /etc/zebra.

This is slightly unclean, but autoconf does not seem to have a way to
add a new --foodir option beyond the builtin list. So I used enable,
which is a bit ugly but straightforward enough.

With this, all but one of the patches to quagga in NetBSD pkgsrc could
be removed.

Paul: let me know if you'll take this, or what's wrong - I may be able
to make it more palatable.

--- quagga-0.96.4/configure.ac Sat Nov 1 23:12:19 2003
+++ quagga-0.96.4-exampledir/configure.ac Fri Nov 21 11:46:29 2003
@@ -12,6 +12,15 @@
AM_INIT_AUTOMAKE()
AM_CONFIG_HEADER(config.h)

+dnl default is to match previous behavior
+exampledir='${sysconfdir}'
+AC_ARG_ENABLE([exampledir],
+ AC_HELP_STRING([--enable-exampledir],
+ [specify alternate directory for examples]),
+ exampledir="$enableval",)
+dnl XXX hook into argument processing
+AC_SUBST(exampledir)
+
dnl -----------------------------------
dnl Get hostname and other information.
dnl -----------------------------------
@@ -1056,6 +1065,7 @@
linker flags : ${LDFLAGS} ${LIBS}
state file directory : ${quagga_statedir}
config file directory : `eval echo \`echo ${sysconfdir}\``
+example directory : `eval echo \`echo ${exampledir}\``
user to run as : ${enable_user}
group to run as : ${enable_group}
group for vty sockets : ${enable_vty_group}
--- quagga-0.96.4/bgpd/Makefile.am Thu Oct 23 22:42:33 2003
+++ quagga-0.96.4-exampledir/bgpd/Makefile.am Fri Nov 21 11:38:16 2003
@@ -26,7 +26,8 @@

bgpd_LDADD = ../lib/libzebra.a @LIBCAP@

-dist_sysconf_DATA = bgpd.conf.sample bgpd.conf.sample2
+examplesdir = $(exampledir)
+dist_examples_DATA = bgpd.conf.sample bgpd.conf.sample2

EXTRA_DIST = BGP4-MIB.txt

--- quagga-0.96.4/ospf6d/Makefile.am Thu Oct 23 22:43:17 2003
+++ quagga-0.96.4-exampledir/ospf6d/Makefile.am Fri Nov 21 11:39:32 2003
@@ -30,4 +30,5 @@

ospf6d_LDADD = -L../lib -lzebra @LIBCAP@

-dist_sysconf_DATA = ospf6d.conf.sample
+examplesdir = $(exampledir)
+dist_examples_DATA = ospf6d.conf.sample
--- quagga-0.96.4/ospfd/Makefile.am Thu Oct 23 22:57:03 2003
+++ quagga-0.96.4-exampledir/ospfd/Makefile.am Fri Nov 21 11:38:35 2003
@@ -32,5 +32,6 @@

EXTRA_DIST = OSPF-MIB.txt OSPF-TRAP-MIB.txt ChangeLog.opaque.txt

-dist_sysconf_DATA = ospfd.conf.sample
+examplesdir = $(exampledir)
+dist_examples_DATA = ospfd.conf.sample

--- quagga-0.96.4/ripd/Makefile.am Thu Oct 23 22:43:53 2003
+++ quagga-0.96.4-exampledir/ripd/Makefile.am Fri Nov 21 11:42:11 2003
@@ -19,7 +19,8 @@

ripd_LDADD = -L../lib -lzebra @LIBCAP@

-dist_sysconf_DATA = ripd.conf.sample
+examplesdir = $(exampledir)
+dist_examples_DATA = ripd.conf.sample

EXTRA_DIST = RIPv2-MIB.txt

--- quagga-0.96.4/ripngd/Makefile.am Thu Oct 23 22:43:36 2003
+++ quagga-0.96.4-exampledir/ripngd/Makefile.am Fri Nov 21 11:38:48 2003
@@ -19,5 +19,6 @@

ripngd_LDADD = -L../lib -lzebra @LIBCAP@

-dist_sysconf_DATA = ripngd.conf.sample
+examplesdir = $(exampledir)
+dist_examples_DATA = ripngd.conf.sample

--- quagga-0.96.4/zebra/Makefile.am Thu Oct 23 21:59:35 2003
+++ quagga-0.96.4-exampledir/zebra/Makefile.am Fri Nov 21 11:38:04 2003
@@ -43,4 +43,6 @@
# $(CC) -g -o client client_main.o ../lib/libzebra.a $(LIBS) $(LIB_IPV6)

quaggaconfdir = $(sysconfdir)
-dist_quaggaconf_DATA = zebra.conf.sample
+
+examplesdir = $(exampledir)
+dist_examples_DATA = zebra.conf.sample
--- quagga-0.96.4/vtysh/Makefile.am Fri Oct 24 00:37:33 2003
+++ quagga-0.96.4-exampledir/vtysh/Makefile.am Fri Nov 21 11:41:58 2003
@@ -12,9 +12,10 @@
noinst_HEADERS = vtysh.h vtysh_user.h
vtysh_LDADD = ../lib/libzebra.a @LIBCAP@

-sysconf_DATA = vtysh.conf.sample
+examplesdir = $(exampledir)
+dist_examples_DATA = vtysh.conf.sample

-EXTRA_DIST = extract.pl vtysh.conf.sample
+EXTRA_DIST = extract.pl

rebuild4:
./extract.pl $(top_srcdir)/zebra/*.c $(top_srcdir)/ripd/*.c $(top_srcdir)/ospfd/*.c $(top_srcdir)/bgpd/*.c $(top_srcdir)/lib/keychain.c $(top_srcdir)/lib/routemap.c $(top_srcdir)/lib/filter.c $(top_srcdir)/lib/plist.c $(top_srcdir)/lib/distribute.c $(top_srcdir)/lib/if_rmap.c > vtysh_cmd.c