Index: libpolys/coeffs/Makefile.am
===================================================================
--- libpolys/coeffs/Makefile.am	(revision b4a67673772d5a7cfc2943ead5595830109dc818)
+++ libpolys/coeffs/Makefile.am	(revision 4bc0ab9a99c6b2bc95e41d5541864a736e382642)
@@ -4,4 +4,6 @@
 CXXTEMPLFLAGS =  
 ## -fno-implicit-templates
+
+AM_CPPFLAGS = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/.. -I${srcdir} -I${top_srcdir}/../factory/include -I${top_builddir}/../factory/include ${FACTORY_CFLAGS} ${GMP_CFLAGS} ${NTL_CFLAGS}
 
 libcoeffs_la_CFLAGS   = -O3 -fomit-frame-pointer ${PIPE}
@@ -12,6 +14,6 @@
 # -fdiagnostics-show-option 
 
-libcoeffs_la_CPPFLAGS   = -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
-libcoeffs_g_la_CPPFLAGS = -DHAVE_CONFIG_H
+libcoeffs_la_CPPFLAGS   = ${AM_CPPFLAGS} -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
+libcoeffs_g_la_CPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H
 
 
@@ -21,6 +23,4 @@
 #	mpr_complex.h mpr_global.h
 
-
-INCLUDES = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/.. -I${srcdir} -I${top_srcdir}/../factory/include -I${top_builddir}/../factory/include ${FACTORY_CFLAGS} ${GMP_CFLAGS} ${NTL_CFLAGS}
 
 SOURCES = \
@@ -86,9 +86,10 @@
 
 
-test_s_r_CPPFLAGS = -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
-test_s_g_CPPFLAGS = -DHAVE_CONFIG_H
+test_s_r_CPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
+test_s_g_CPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H
 
-test_d_r_CPPFLAGS = -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
-test_d_g_CPPFLAGS = -DHAVE_CONFIG_H
+test_d_r_CPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
+test_d_g_CPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H
+
 
 
Index: libpolys/misc/Makefile.am
===================================================================
--- libpolys/misc/Makefile.am	(revision b4a67673772d5a7cfc2943ead5595830109dc818)
+++ libpolys/misc/Makefile.am	(revision 4bc0ab9a99c6b2bc95e41d5541864a736e382642)
@@ -1,6 +1,9 @@
+CXXTEMPLFLAGS      =  
+## -fno-implicit-templates
 noinst_LTLIBRARIES = libmisc.la libmisc_g.la
 # libmiscdir = $(libdir)/singular
 
-CXXTEMPLFLAGS      =  ## -fno-implicit-templates
+AM_CPPFLAGS = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/..
+
 
 libmisc_la_CFLAGS   = -O3 -fomit-frame-pointer ${PIPE}
@@ -11,8 +14,6 @@
 # -fdiagnostics-show-option 
 
-libmisc_la_CPPFLAGS   = -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
-libmisc_g_la_CPPFLAGS = -DHAVE_CONFIG_H
-
-INCLUDES = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/..
+libmisc_la_CPPFLAGS   = ${AM_CPPFLAGS} -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
+libmisc_g_la_CPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H
 
 SOURCES  = intvec.cc int64vec.cc options.c
Index: libpolys/polys/Makefile.am
===================================================================
--- libpolys/polys/Makefile.am	(revision b4a67673772d5a7cfc2943ead5595830109dc818)
+++ libpolys/polys/Makefile.am	(revision 4bc0ab9a99c6b2bc95e41d5541864a736e382642)
@@ -10,6 +10,7 @@
 AM_CXXFLAGS	= ${PIPE} ${CXXTEMPLFLAGS}
 
-INCLUDES	= -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/.. -I${srcdir} -I${top_srcdir}/../factory/include -I${top_builddir}/../factory/include ${GMP_CFLAGS}
 AM_LDFLAGS	= -L${abs_top_builddir}/coeffs -L${abs_top_builddir}/reporter -L${abs_top_builddir}/../omalloc -L${abs_builddir}
+AM_CPPFLAGS	= -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/.. -I${srcdir} -I${top_srcdir}/../factory/include -I${top_builddir}/../factory/include ${GMP_CFLAGS}
+
 
 if ENABLE_P_PROCS_STATIC
@@ -64,5 +65,5 @@
 	templates/p_Merge_q__T.cc templates/p_Add_q__T.cc templates/p_Neg__T.cc
 
-P_PROCS_CPPFLAGS_COMMON = -DDYNAMIC_VERSION 
+P_PROCS_CPPFLAGS_COMMON = ${AM_CPPFLAGS} -DDYNAMIC_VERSION 
 
 p_Procs_FieldGeneral_la_CPPFLAGS = -Dp_Procs_FieldGeneral ${P_PROCS_CPPFLAGS_COMMON} ${NODEBUGDEFS}
@@ -133,5 +134,5 @@
 
 libpolys_g_la_CXXFLAGS = ${DEBUGCXXFLAGS}
-libpolys_la_CPPFLAGS = ${NODEBUGDEFS}
+libpolys_la_CPPFLAGS = ${NODEBUGDEFS} ${AM_CPPFLAGS}
 
 
@@ -149,5 +150,5 @@
 templates_p_Procs_Generate_CFLAGS   = ${NODEBUGCFLAGS}
 templates_p_Procs_Generate_CXXFLAGS = ${NODEBUGCXXFLAGS}
-templates_p_Procs_Generate_CPPFLAGS = ${NODEBUGDEFS} ${USE_P_PROCS_STATIC}
+templates_p_Procs_Generate_CPPFLAGS = ${NODEBUGDEFS} ${USE_P_PROCS_STATIC} ${AM_CPPFLAGS}
 templates_p_Procs_Generate_LDADD    = -lreporter -lomalloc
 
Index: libpolys/reporter/Makefile.am
===================================================================
--- libpolys/reporter/Makefile.am	(revision b4a67673772d5a7cfc2943ead5595830109dc818)
+++ libpolys/reporter/Makefile.am	(revision 4bc0ab9a99c6b2bc95e41d5541864a736e382642)
@@ -1,6 +1,9 @@
+CXXTEMPLFLAGS =  
+## -fno-implicit-templates
 noinst_LTLIBRARIES=libreporter.la libreporter_g.la
 # libreporterdir = $(libdir)/singular
 
-CXXTEMPLFLAGS =  ## -fno-implicit-templates
+AM_CPPFLAGS = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/..
+
 
 libreporter_la_CFLAGS   = -O3 -fomit-frame-pointer ${PIPE}
@@ -11,8 +14,7 @@
 # -fdiagnostics-show-option 
 
-libreporter_la_CPPFLAGS   = -DNDEBUG -DOM_NDEBUG -DHAVE_CONFIG_H
-libreporter_g_la_CPPFLAGS = -DHAVE_CONFIG_H
+libreporter_la_CPPFLAGS   = ${AM_CPPFLAGS} -DNDEBUG -DOM_NDEBUG -DHAVE_CONFIG_H
+libreporter_g_la_CPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H
 
-INCLUDES = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/..
 
 SOURCES  = dError.c reporter.cc
Index: libpolys/tests/Makefile.am
===================================================================
--- libpolys/tests/Makefile.am	(revision b4a67673772d5a7cfc2943ead5595830109dc818)
+++ libpolys/tests/Makefile.am	(revision 4bc0ab9a99c6b2bc95e41d5541864a736e382642)
@@ -9,5 +9,5 @@
 
 
-INCLUDES = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/.. -I${srcdir} -I${top_srcdir}/../factory/include -I${top_builddir}/../factory/include ${FACTORY_CFLAGS} ${GMP_CFLAGS} ${NTL_CFLAGS} 
+AM_CPPFLAGS = -I${top_srcdir} -I${top_srcdir}/.. -I${top_builddir} -I${top_builddir}/.. -I${srcdir} -I${top_srcdir}/../factory/include -I${top_builddir}/../factory/include ${FACTORY_CFLAGS} ${GMP_CFLAGS} ${NTL_CFLAGS} 
 
 TESTS = simple_test \
@@ -41,5 +41,5 @@
 RELEASECFLAGS = -O3 -fomit-frame-pointer ${PIPE}
 RELEASECXXFLAGS = -O3 -fomit-frame-pointer ${PIPE}
-RELEASECPPFLAGS = -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
+RELEASECPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
 
 coeffs_test_s_r_CFLAGS =${RELEASECFLAGS} 
@@ -73,5 +73,5 @@
 DEBUGCFLAGS = $(AM_CFLAGS) -g -Wextra -Wall -Wno-long-long ${PIPE}
 DEBUGCXXFLAGS = $(AM_CXXFLAGS) ${DEBUGCFLAGS} ${CXXTEMPLFLAGS}
-DEBUGCPPFLAGS = -DHAVE_CONFIG_H
+DEBUGCPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H
 
 coeffs_test_s_g_CFLAGS =${DEBUGCFLAGS} 
