* configure.ac: Add --enable-isis-topology to enable isisd topology
	  generator code.
	* isisd/Makefile.am: Variables to handle conditonal compiling of
	  topology generator code.
	* isisd/isis_lsp.c: lsppdu_realloc() is used by topology generator.
	* isisd/isisd.c: Rename show_isis_topology_cmd to not conflict the one
	  in the isis_spf.c.
	* isisd/isisd.h: Remove TOPOLOGY_GENERATE define, it will be defined in
	  toplevel config.h if topology generator is enabled.
	* isisd/topology/Makefile.am: Handle the libtoolized Quagga libraries.
diff --git a/ChangeLog b/ChangeLog
index 4e86d2d..3ddc9b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-02 Hasso Tepper <hasso at quagga.net>
+
+	* configure.ac: Add --enable-isis-topology to enable isisd topology
+	  generator code.
+
 2005-04-02 Paul Jakma <paul@dishone.st>
 
 	* INSTALL.quagga.txt: Add note about additional CVS build
diff --git a/configure.ac b/configure.ac
index ccb02a0..7c6258a 100755
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@
 ##  Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
 ##  Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st>
 ##
-## $Id: configure.ac,v 1.95 2005/04/02 16:01:05 ajs Exp $
+## $Id: configure.ac,v 1.96 2005/04/02 19:03:39 hasso Exp $
 AC_PREREQ(2.53)
 
 AC_INIT(Quagga, 0.99.0, [http://bugzilla.quagga.net])
@@ -180,6 +180,8 @@
 [  --disable-rtadv               disable IPV6 router advertisement feature])
 AC_ARG_ENABLE(irdp,
 [  --enable-irdp                 enable IRDP server support in zebra])
+AC_ARG_ENABLE(isis_topology,
+[  --enable-isis-topology        enable IS-IS topology generator])
 AC_ARG_ENABLE(capabilities,
 [  --disable-capabilities        disable using POSIX capabilities])
 AC_ARG_ENABLE(gcc_ultra_verbose,
@@ -233,6 +235,17 @@
   AC_DEFINE(HAVE_IRDP,, IRDP )
 fi
 
+if test "${enable_isisd}" = "yes" && test "${enable_isis_topology}" = yes; then
+  AC_DEFINE(TOPOLOGY_GENERATE,,Enable IS-IS topology generator code)
+  ISIS_TOPOLOGY_INCLUDES="-I./topology"
+  ISIS_TOPOLOGY_DIR="topology"
+  ISIS_TOPOLOGY_LIB="./topology/libtopology.a"
+fi
+
+AC_SUBST(ISIS_TOPOLOGY_INCLUDES)
+AC_SUBST(ISIS_TOPOLOGY_DIR)
+AC_SUBST(ISIS_TOPOLOGY_LIB)
+
 if test "${enable_user}" = "yes" || test x"${enable_user}" = x""; then
   enable_user="quagga"
 elif test "${enable_user}" = "no"; then
@@ -1266,6 +1279,7 @@
 	  redhat/quagga.spec 
 	  lib/version.h
 	  doc/defines.texi
+	  isisd/topology/Makefile
 	  pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh
 	  pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh])
 AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
diff --git a/isisd/ChangeLog b/isisd/ChangeLog
index 6f4f395..f333901 100644
--- a/isisd/ChangeLog
+++ b/isisd/ChangeLog
@@ -1,3 +1,14 @@
+2005-04-02 Hasso Tepper <hasso at quagga.net>
+
+	* Makefile.am: Variables to handle conditonal compiling of topology
+	  generator code.
+	* isis_lsp.c: lsppdu_realloc() is used by topology generator.
+	* isisd.c: Rename show_isis_topology_cmd to not conflict the one in
+	  the isis_spf.c.
+	* isisd.h: Remove TOPOLOGY_GENERATE define, it will be defined in
+	  toplevel config.h if topology generator is enabled.
+	* topology/Makefile.am: Handle the libtoolized Quagga libraries.
+
 2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
 	* isis_zebra.c: (isis_zebra_if_del) Call if_delete_retain instead
diff --git a/isisd/Makefile.am b/isisd/Makefile.am
index 7993643..ceb948c 100644
--- a/isisd/Makefile.am
+++ b/isisd/Makefile.am
@@ -1,12 +1,13 @@
 ## Process this file with automake to produce Makefile.in.
 
-# INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -Itopology
-INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib
+INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib \
+	   @ISIS_TOPOLOGY_INCLUDES@
 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
 INSTALL_SDATA=@INSTALL@ -m 600
 LIBS = @LIBS@ 
 noinst_LIBRARIES = libisis.a
 sbin_PROGRAMS = isisd 
+SUBDIRS = @ISIS_TOPOLOGY_DIR@
 
 libisis_a_SOURCES = \
 	isis_adjacency.c isis_lsp.c dict.c isis_circuit.c isis_pdu.c \
@@ -25,7 +26,7 @@
 isisd_SOURCES = \
 	isis_main.c $(libisis_a_SOURCES)
 
-isisd_LDADD = ../lib/libzebra.la @LIBCAP@
+isisd_LDADD = @ISIS_TOPOLOGY_LIB@ ../lib/libzebra.la @LIBCAP@
 
 examplesdir = $(exampledir)
 dist_examples_DATA = isisd.conf.sample
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 52d8884..987a9b3 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -913,7 +913,6 @@
   return lsp_count;
 }
 
-#if 0 /* Seems to be old code */
 /* this function reallocate memory to an lsp pdu, with an additional
  * size of memory, it scans the lsp and moves all pointers the
  * way they should */
@@ -940,7 +939,6 @@
   return STREAM_DATA (lsp->pdu) + (lsp->lsp_header->pdu_len - size);
 #endif /* LSP_MEMORY_PREASSIGN */
 }
-#endif /* 0 */
 
 #if 0				/* Saving the old one just in case :) */
 /*
diff --git a/isisd/isisd.c b/isisd/isisd.c
index e4d73c3..229f135 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -1595,9 +1595,9 @@
   return CMD_SUCCESS;
 }
 
-DEFUN (show_isis_topology,
-       show_isis_topology_cmd,
-       "show isis topology",
+DEFUN (show_isis_generated_topology,
+       show_isis_generated_topology_cmd,
+       "show isis generated-topology",
        SHOW_STR
        "clns network information\n"
        "CLNS neighbor adjacencies\n")
@@ -2138,8 +2138,8 @@
   install_element (ISIS_NODE, &topology_generate_grid_cmd);
   install_element (ISIS_NODE, &topology_baseis_cmd);
   install_element (ISIS_NODE, &no_topology_baseis_cmd);
-  install_element (VIEW_NODE, &show_isis_topology_cmd);
-  install_element (ENABLE_NODE, &show_isis_topology_cmd);
+  install_element (VIEW_NODE, &show_isis_generated_topology_cmd);
+  install_element (ENABLE_NODE, &show_isis_generated_topology_cmd);
 #endif /* TOPOLOGY_GENERATE */
 
   isis_new (0);
diff --git a/isisd/isisd.h b/isisd/isisd.h
index c347bf0..77de12e 100644
--- a/isisd/isisd.h
+++ b/isisd/isisd.h
@@ -29,9 +29,6 @@
 /* #define EXTREME_DEBUG  */
 /* #define EXTREME_TLV_DEBUG */
 
-/* If you want topology stuff compiled in */
-/* #define TOPOLOGY_GENERATE */
-
 struct rmap
 {
   char *name;
diff --git a/isisd/topology/Makefile.am b/isisd/topology/Makefile.am
index 045c15c..ae6fa82 100644
--- a/isisd/topology/Makefile.am
+++ b/isisd/topology/Makefile.am
@@ -10,7 +10,7 @@
 
 libtopology_a_DEPENDENCIES = @LIB_REGEX@
 
-libtopology_a_LIBADD = @LIB_REGEX@ ../../lib/libzebra.a
+libtopology_a_LIBADD = @LIB_REGEX@ ../../lib/libzebra.la
 
 noinst_HEADERS = \
 	spgrid.h