Add support for --enable-exampledir to specify where to place example
files, defaulting to sysconfdir (matching previous behavior).

This is needed to support (cleanly) NetBSD pkgsrc, which requires that
example config files go in $(prefix)/share/examples/pkgname, rather
than in $(prefix)/etc/pkgname.
diff --git a/ChangeLog b/ChangeLog
index 1d83763..e31d0c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-12-03  Greg Troxel  <gdt@poblano.ir.bbn.com>
+
+	* configure.ac: Add --enable-exampledir to specify where example
+	config files should go, defaulting to sysconfdir.
+
+	* */Makefile.am: use exampledir instead of sysconfdif for examples
+
 2003-11-02 Paul Jakma <paul@dishone.st>
 
         * bgpd/bgp_routemap.c: Fix up 'set ip next-hop A.B.C.D|peer-address'
diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am
index 3559652..9cb3a90 100644
--- a/bgpd/Makefile.am
+++ b/bgpd/Makefile.am
@@ -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
 
diff --git a/configure.ac b/configure.ac
index 18db493..ef24dc0 100755
--- a/configure.ac
+++ b/configure.ac
@@ -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}
diff --git a/ospf6d/Makefile.am b/ospf6d/Makefile.am
index 115b819..14b87af 100644
--- a/ospf6d/Makefile.am
+++ b/ospf6d/Makefile.am
@@ -30,4 +30,5 @@
 
 ospf6d_LDADD = -L../lib -lzebra @LIBCAP@
 
-dist_sysconf_DATA = ospf6d.conf.sample
+examplesdir = $(exampledir)
+dist_examples_DATA = ospf6d.conf.sample
diff --git a/ospfd/Makefile.am b/ospfd/Makefile.am
index 93b80ae..f687ea9 100644
--- a/ospfd/Makefile.am
+++ b/ospfd/Makefile.am
@@ -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
 
diff --git a/ripd/Makefile.am b/ripd/Makefile.am
index ab63134..505f7b7 100644
--- a/ripd/Makefile.am
+++ b/ripd/Makefile.am
@@ -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
 
diff --git a/ripngd/Makefile.am b/ripngd/Makefile.am
index 2e6c677..ecd71f8 100644
--- a/ripngd/Makefile.am
+++ b/ripngd/Makefile.am
@@ -19,5 +19,6 @@
 
 ripngd_LDADD = -L../lib -lzebra @LIBCAP@
 
-dist_sysconf_DATA = ripngd.conf.sample
+examplesdir = $(exampledir)
+dist_examples_DATA = ripngd.conf.sample
 
diff --git a/vtysh/Makefile.am b/vtysh/Makefile.am
index b5f964e..95f8f7f 100644
--- a/vtysh/Makefile.am
+++ b/vtysh/Makefile.am
@@ -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
diff --git a/zebra/Makefile.am b/zebra/Makefile.am
index d449fe1..6f8e954 100644
--- a/zebra/Makefile.am
+++ b/zebra/Makefile.am
@@ -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