Index: factory/GNUmakefile.in
===================================================================
--- factory/GNUmakefile.in	(revision 06541226e172777614f7a62af88d739f6cea424c)
+++ factory/GNUmakefile.in	(revision 643b1eba3ef81d25890fada39f203bb96b71bd49)
@@ -200,5 +200,6 @@
 		bifac.cc \
 		lgs.cc \
-		singext.cc
+		singext.cc \
+		ftmpl_inst.cc
 
 useiofactorysrc := \
@@ -216,5 +217,6 @@
 factoryobj1 :=  $(factorysrc:%.cc=%.o)
 factoryobj :=   $(factoryobj1:%.y=%.o)
-factorygobj :=  $(factorysrc:%.cc=%.og)
+factorygobj1 :=  $(factorysrc:%.cc=%.og)
+factorygobj :=  $(factorygobj1:%.y=%.og)
 factorypobj :=  $(factorysrc:%.cc=%.op)
 factorydep :=	$(factorysrc:%.cc=%.d)
Index: factory/configure.in
===================================================================
--- factory/configure.in	(revision 06541226e172777614f7a62af88d739f6cea424c)
+++ factory/configure.in	(revision 643b1eba3ef81d25890fada39f203bb96b71bd49)
@@ -389,5 +389,5 @@
     
 # memory manager
-if test "x$with_memman" != xno; then
+if test "x$with_memman" = xyes; then
   alltargets="$alltargets mem"
   installtargets="$installtargets installmem"
Index: libpolys/coeffs/Makefile.am
===================================================================
--- libpolys/coeffs/Makefile.am	(revision 06541226e172777614f7a62af88d739f6cea424c)
+++ libpolys/coeffs/Makefile.am	(revision 643b1eba3ef81d25890fada39f203bb96b71bd49)
@@ -20,5 +20,5 @@
 	mpr_complex.h mpr_global.h
 
-INCLUDES = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${srcdir} ${GMP_CFLAGS}
+INCLUDES = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${srcdir} ${GMP_CFLAGS} ${NTL_CFLAGS}
 
 SOURCES = \
@@ -46,6 +46,6 @@
 test_g_SOURCES = test.cc
 
-test_LDADD   = -lcoeffs ${GMP_LIBS} -lresources -lreporter -lmisc -lsingcf -lomalloc
-test_g_LDADD = -lcoeffs_g ${GMP_LIBS} -lresources_g -lreporter_g -lmisc_g -lsingcf_g -lomalloc_debug
+test_LDADD   = -lcoeffs ${GMP_LIBS} ${NTL_LIBS} -lresources -lreporter -lmisc -lsingcf -lomalloc
+test_g_LDADD = -lcoeffs_g ${GMP_LIBS} ${NTL_LIBS} -lresources_g -lreporter_g -lmisc_g -lsingcf_g -lomalloc_debug
 
 
Index: libpolys/coeffs/test.cc
===================================================================
--- libpolys/coeffs/test.cc	(revision 06541226e172777614f7a62af88d739f6cea424c)
+++ libpolys/coeffs/test.cc	(revision 643b1eba3ef81d25890fada39f203bb96b71bd49)
@@ -18,5 +18,5 @@
 #include <coeffs/rintegers.h>
 #ifdef HAVE_FACTORY
-#include <factory/factory.h>
+int initializeGMP(){ return 1; }
 #endif
 
@@ -24,44 +24,4 @@
 
 using namespace std;
-
-// template stuff
-#ifdef HAVE_FACTORY
-  #include <factory/templates/ftmpl_list.cc>
-  #include <factory/templates/ftmpl_array.cc>
-  #include <factory/templates/ftmpl_factor.cc>
-  #include <factory/templates/ftmpl_functions.h>
-  #include <factory/templates/ftmpl_matrix.cc>
-  template class Factor<CanonicalForm>;
-  template class List<CFFactor>;
-  template class ListItem<CFFactor>;
-  template class ListItem<CanonicalForm>;
-  template class ListIterator<CFFactor>;
-  template class List<CanonicalForm>;
-  template class List<List<CanonicalForm> >;
-  template class ListIterator<CanonicalForm>;
-  template class Array<CanonicalForm>;
-  template class List<MapPair>;
-  template class ListItem<MapPair>;
-  template class ListIterator<MapPair>;
-  template class Matrix<CanonicalForm>;
-  template class SubMatrix<CanonicalForm>;
-  template class Array<REvaluation>;
-  template bool find ( const List<CanonicalForm> &, const CanonicalForm&);
-  template List<CFFactor> Union ( const List<CFFactor>&, const List<CFFactor>& );
-  template int operator == ( const Factor<CanonicalForm>&, const Factor<CanonicalForm>& );
-
-  template CanonicalForm tmax ( const CanonicalForm&, const CanonicalForm& );
-  template CanonicalForm tmin ( const CanonicalForm&, const CanonicalForm& );
-
-  template Variable tmax ( const Variable&, const Variable& );
-  template Variable tmin ( const Variable&, const Variable& );
-
-  template int tmax ( const int&, const int& );
-  template int tmin ( const int&, const int& );
-  template int tabs ( const int& );
-
-  int initializeGMP()
-  { return 1; }
-#endif
 
 #pragma GCC diagnostic ignored "-Wwrite-strings"
Index: libpolys/configure.ac
===================================================================
--- libpolys/configure.ac	(revision 06541226e172777614f7a62af88d739f6cea424c)
+++ libpolys/configure.ac	(revision 643b1eba3ef81d25890fada39f203bb96b71bd49)
@@ -20,4 +20,6 @@
 # Checks for libraries.
 LB_CHECK_GMP(3.1.1,,AC_MSG_ERROR([Unable to find GMP on your machine: please use --with-gmp=PATH_TO_DIR_CONTAINING_LIB_AND_INCLUDE (see also ./configure --help if you do not understand what we are talking about)]))
+
+LB_CHECK_NTL(5.0,,AC_MSG_WARN([Unable to find NTL (which is strongly recommended) on your machine: please use --with-ntl=PATH_TO_DIR_CONTAINING_LIB_AND_INCLUDE (see also ./configure --help if you do not understand what we are talking about)]))
 
 # Checks for library functions.
