2003-10-24 Paul Jakma <paul@dishone.st>

        * configure.ac: Check for fcntl()
        * {bgpd,ospf,ospf6d,ripd,ripngd}/Makefile.am: Install conf file via
          regular automake means, not magic install incantations, see
          bug #38.
        * lib/Makefile.am: install the headers, needed to link libzebra.a
          (and hence libospf.a, OSPF-API, etc.)
diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am
index 0e549cc..3559652 100644
--- a/bgpd/Makefile.am
+++ b/bgpd/Makefile.am
@@ -26,19 +26,7 @@
 
 bgpd_LDADD = ../lib/libzebra.a @LIBCAP@
 
-sysconf_DATA = bgpd.conf.sample bgpd.conf.sample2
+dist_sysconf_DATA = bgpd.conf.sample bgpd.conf.sample2
 
-EXTRA_DIST = $(sysconf_DATA) BGP4-MIB.txt
+EXTRA_DIST = BGP4-MIB.txt
 
-install-sysconfDATA: $(sysconf_DATA)
-	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
-	@list='$(sysconf_DATA)'; for p in $$list; do \
-	  if test -f $(srcdir)/$$p; then \
-	    echo " $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  else if test -f $$p; then \
-	    echo " $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  fi; fi; \
-	done
diff --git a/configure.ac b/configure.ac
index 807cf7c..2607988 100755
--- a/configure.ac
+++ b/configure.ac
@@ -345,7 +345,8 @@
 dnl check existance of functions
 dnl ----------------------------
 AC_CHECK_FUNCS(memset memcpy strerror inet_aton daemon snprintf vsnprintf \
-               strlcat strlcpy if_nametoindex if_indextoname getifaddrs)
+               strlcat strlcpy if_nametoindex if_indextoname getifaddrs \
+	       fcntl)
 AC_CHECK_FUNCS(setproctitle, ,
   [AC_CHECK_LIB(util, setproctitle, 
      [LIBS="$LIBS -lutil"
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 2aec295..27981e5 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -16,7 +16,7 @@
 
 libzebra_a_LIBADD = @LIB_REGEX@
 
-noinst_HEADERS = \
+include_HEADERS = \
 	buffer.h command.h filter.h getopt.h hash.h if.h linklist.h log.h \
 	memory.h network.h prefix.h routemap.h distribute.h sockunion.h \
 	str.h stream.h table.h thread.h vector.h version.h vty.h zebra.h \
diff --git a/ospf6d/Makefile.am b/ospf6d/Makefile.am
index e42814a..115b819 100644
--- a/ospf6d/Makefile.am
+++ b/ospf6d/Makefile.am
@@ -30,19 +30,4 @@
 
 ospf6d_LDADD = -L../lib -lzebra @LIBCAP@
 
-sysconf_DATA = ospf6d.conf.sample
-
-EXTRA_DIST = $(sysconf_DATA)
-
-install-sysconfDATA: $(sysconf_DATA)
-	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
-	@list='$(sysconf_DATA)'; for p in $$list; do \
-	  if test -f $(srcdir)/$$p; then \
-	    echo " $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  else if test -f $$p; then \
-	    echo " $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  fi; fi; \
-	done
+dist_sysconf_DATA = ospf6d.conf.sample
diff --git a/ospfd/Makefile.am b/ospfd/Makefile.am
index 81f212c..93b80ae 100644
--- a/ospfd/Makefile.am
+++ b/ospfd/Makefile.am
@@ -30,19 +30,7 @@
 
 ospfd_LDADD = -L../lib -lzebra @LIBCAP@
 
-sysconf_DATA = ospfd.conf.sample
+EXTRA_DIST = OSPF-MIB.txt OSPF-TRAP-MIB.txt ChangeLog.opaque.txt
 
-EXTRA_DIST = $(sysconf_DATA) OSPF-MIB.txt OSPF-TRAP-MIB.txt ChangeLog.opaque.txt
+dist_sysconf_DATA = ospfd.conf.sample
 
-install-sysconfDATA: $(sysconf_DATA)
-	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
-	@list='$(sysconf_DATA)'; for p in $$list; do \
-	  if test -f $(srcdir)/$$p; then \
-	    echo " $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  else if test -f $$p; then \
-	    echo " $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  fi; fi; \
-	done
diff --git a/ripd/Makefile.am b/ripd/Makefile.am
index 2c187e8..ab63134 100644
--- a/ripd/Makefile.am
+++ b/ripd/Makefile.am
@@ -19,19 +19,7 @@
 
 ripd_LDADD = -L../lib -lzebra @LIBCAP@
 
-sysconf_DATA = ripd.conf.sample
+dist_sysconf_DATA = ripd.conf.sample
 
-EXTRA_DIST = $(sysconf_DATA) RIPv2-MIB.txt
+EXTRA_DIST = RIPv2-MIB.txt
 
-install-sysconfDATA: $(sysconf_DATA)
-	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
-	@list='$(sysconf_DATA)'; for p in $$list; do \
-	  if test -f $(srcdir)/$$p; then \
-	    echo " $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  else if test -f $$p; then \
-	    echo " $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  fi; fi; \
-	done
diff --git a/ripngd/Makefile.am b/ripngd/Makefile.am
index d9db576..2e6c677 100644
--- a/ripngd/Makefile.am
+++ b/ripngd/Makefile.am
@@ -19,19 +19,5 @@
 
 ripngd_LDADD = -L../lib -lzebra @LIBCAP@
 
-sysconf_DATA = ripngd.conf.sample
+dist_sysconf_DATA = ripngd.conf.sample
 
-EXTRA_DIST = $(sysconf_DATA)
-
-install-sysconfDATA: $(sysconf_DATA)
-	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
-	@list='$(sysconf_DATA)'; for p in $$list; do \
-	  if test -f $(srcdir)/$$p; then \
-	    echo " $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  else if test -f $$p; then \
-	    echo " $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  fi; fi; \
-	done
diff --git a/zebra/Makefile.am b/zebra/Makefile.am
index 1df72d7..d449fe1 100644
--- a/zebra/Makefile.am
+++ b/zebra/Makefile.am
@@ -32,9 +32,7 @@
 
 zebra_DEPENDENCIES = $(otherobj)
 
-sysconf_DATA = zebra.conf.sample
-
-EXTRA_DIST = $(sysconf_DATA) if_ioctl.c if_netlink.c if_proc.c if_sysctl.c \
+EXTRA_DIST = if_ioctl.c if_netlink.c if_proc.c if_sysctl.c \
 	ipforward_aix.c ipforward_ews.c ipforward_proc.c \
 	ipforward_solaris.c ipforward_sysctl.c rt_ioctl.c rt_netlink.c \
 	rt_socket.c rtread_netlink.c rtread_proc.c rtread_sysctl.c \
@@ -44,15 +42,5 @@
 #client : client_main.o ../lib/libzebra.a
 #	$(CC) -g -o client client_main.o ../lib/libzebra.a $(LIBS) $(LIB_IPV6)
 
-install-sysconfDATA: $(sysconf_DATA)
-	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
-	@list='$(sysconf_DATA)'; for p in $$list; do \
-	  if test -f $(srcdir)/$$p; then \
-	    echo " $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  else if test -f $$p; then \
-	    echo " $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p"; \
-	    $(INSTALL_SDATA) $$p $(DESTDIR)$(sysconfdir)/$$p; \
-	  fi; fi; \
-	done
+quaggaconfdir = $(sysconfdir)
+dist_quaggaconf_DATA = zebra.conf.sample