Index: findexec/Makefile.am
===================================================================
--- findexec/Makefile.am	(revision fca452a782a426cceaa9e98f3a95b5a5acccd04f)
+++ findexec/Makefile.am	(revision 4bc0ab9a99c6b2bc95e41d5541864a736e382642)
@@ -13,8 +13,8 @@
 # -fdiagnostics-show-option 
 
-libfindexec_la_CPPFLAGS   = -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
-libfindexec_g_la_CPPFLAGS = -DHAVE_CONFIG_H 
+AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} 
 
-INCLUDES = -I${top_srcdir} -I${top_builddir} 
+libfindexec_la_CPPFLAGS   = ${AM_CPPFLAGS} -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
+libfindexec_g_la_CPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H 
 
 SOURCES  = omFindExec.c feResource.cc feFopen.cc
Index: kernel/Makefile.am
===================================================================
--- kernel/Makefile.am	(revision fca452a782a426cceaa9e98f3a95b5a5acccd04f)
+++ kernel/Makefile.am	(revision 4bc0ab9a99c6b2bc95e41d5541864a736e382642)
@@ -23,8 +23,8 @@
 # -fdiagnostics-show-option 
 
-libkernel_la_CPPFLAGS   = -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
-libkernel_g_la_CPPFLAGS = -DHAVE_CONFIG_H 
+AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} -I${top_srcdir}/libpolys -I${top_builddir}/libpolys $(GMP_CFLAGS) -I${top_srcdir}/factory/include -I${top_builddir}/factory/include $(FACTORY_CFLAGS) $(NTL_CFLAGS)
 
-INCLUDES = -I${top_srcdir} -I${top_builddir} -I${top_srcdir}/libpolys -I${top_builddir}/libpolys $(GMP_CFLAGS) -I${top_srcdir}/factory/include -I${top_builddir}/factory/include $(FACTORY_CFLAGS) $(NTL_CFLAGS)
+libkernel_la_CPPFLAGS   = ${AM_CPPFLAGS} -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
+libkernel_g_la_CPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H 
 
 SOURCES = polys.cc febase.cc feread.cc \
@@ -103,6 +103,6 @@
 test_s_g_LDADD = -lkernel_g -lpolys_g -lcoeffs_g  -lreporter_g -lmisc_g $(FACTORY_LIBS) -lomalloc_g -lfindexec_g $(NTL_LIBS) $(GMP_LIBS) ${USEPPROCSDYNAMICLDFLAGS}  ${USEPPROCSDYNAMICLD}
 
-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_s_r_LDFLAGS = -static
@@ -122,7 +122,6 @@
 test_d_g_LDADD = -lkernel_g -lpolys_g -lcoeffs_g  -lreporter_g -lmisc_g $(FACTORY_LIBS) -lomalloc_g -lfindexec_g $(NTL_LIBS) $(GMP_LIBS) ${USEPPROCSDYNAMICLDFLAGS}  ${USEPPROCSDYNAMICLD}
 
-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/coeffs/Makefile.am
===================================================================
--- libpolys/coeffs/Makefile.am	(revision fca452a782a426cceaa9e98f3a95b5a5acccd04f)
+++ 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 fca452a782a426cceaa9e98f3a95b5a5acccd04f)
+++ 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 fca452a782a426cceaa9e98f3a95b5a5acccd04f)
+++ 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 fca452a782a426cceaa9e98f3a95b5a5acccd04f)
+++ 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 fca452a782a426cceaa9e98f3a95b5a5acccd04f)
+++ 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} 
Index: numeric/Makefile.am
===================================================================
--- numeric/Makefile.am	(revision fca452a782a426cceaa9e98f3a95b5a5acccd04f)
+++ numeric/Makefile.am	(revision 4bc0ab9a99c6b2bc95e41d5541864a736e382642)
@@ -11,8 +11,8 @@
 # -fdiagnostics-show-option 
 
-libnumeric_la_CPPFLAGS   = -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
-libnumeric_g_la_CPPFLAGS = -DHAVE_CONFIG_H 
+AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} -I${top_srcdir}/libpolys -I${top_builddir}/libpolys ${GMP_CFLAGS} -I${top_srcdir}/factory/include -I${top_builddir}/factory/include ${FACTORY_CFLAGS} ${NTL_CFLAGS}
 
-INCLUDES = -I${top_srcdir} -I${top_builddir} -I${top_srcdir}/libpolys -I${top_builddir}/libpolys ${GMP_CFLAGS} -I${top_srcdir}/factory/include -I${top_builddir}/factory/include ${FACTORY_CFLAGS} ${NTL_CFLAGS}
+libnumeric_la_CPPFLAGS   = ${AM_CPPFLAGS} -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
+libnumeric_g_la_CPPFLAGS = ${AM_CPPFLAGS} -DHAVE_CONFIG_H 
 
 SOURCES  = mpr_base.cc mpr_inout.cc mpr_numeric.cc
Index: omalloc/Makefile.am
===================================================================
--- omalloc/Makefile.am	(revision fca452a782a426cceaa9e98f3a95b5a5acccd04f)
+++ omalloc/Makefile.am	(revision 4bc0ab9a99c6b2bc95e41d5541864a736e382642)
@@ -27,5 +27,5 @@
 EXTRA_DIST = omalloc.c omtTestAlloc.c omtTest.h omMmap.c
 
-INCLUDES=-I${abs_top_srcdir}/.. -I${abs_top_builddir}/..
+AM_CPPFLAGS =-I${abs_top_srcdir}/.. -I${abs_top_builddir}/..
 
 libomalloc_la_SOURCES=$(SOURCES) $(noinst_HEADERS)
@@ -40,6 +40,6 @@
 ### libomalloc_la_CPPFLAGS= -DOM_ALLOC_INTERNAL -DHAVE_CONFIG_H -DOM_NDEBUG
 
-libomalloc_la_CPPFLAGS= -DOM_ALLOC_INTERNAL -DHAVE_CONFIG_H
-libomalloc_g_la_CPPFLAGS= -DOM_ALLOC_INTERNAL -DHAVE_CONFIG_H
+libomalloc_la_CPPFLAGS  = ${AM_CPPFLAGS} -DOM_ALLOC_INTERNAL -DHAVE_CONFIG_H
+libomalloc_g_la_CPPFLAGS= ${AM_CPPFLAGS} -DOM_ALLOC_INTERNAL -DHAVE_CONFIG_H
 
 BUILT_SOURCES = omTables.inc omTables.h
@@ -54,5 +54,5 @@
 omTables_SOURCES = omAllocPrivate.h omTables.c mylimits.h
 nodist_omTables_SOURCES = omConfig.h
-omTables_CPPFLAGS = -DOM_GENERATE_INC  -DHAVE_CONFIG_H
+omTables_CPPFLAGS = ${AM_CPPFLAGS} -DOM_GENERATE_INC  -DHAVE_CONFIG_H
 
 CLEANFILES = $(BUILT_SOURCES)
@@ -83,18 +83,18 @@
 
 omtTest_s_g_SOURCES = $(OMTTESTSSOURCES)
-omtTest_s_g_CPPFLAGS = -DHAVE_CONFIG_H
-omtTest_s_g_CFLAGS = -g -Wextra -Wall -pedantic -Wno-long-long ${PIPE}
-omtTest_s_g_LDADD = libomalloc_g.la
+omtTest_s_g_CPPFLAGS= ${AM_CPPFLAGS} -DHAVE_CONFIG_H
+omtTest_s_g_CFLAGS  = -g -Wextra -Wall -pedantic -Wno-long-long ${PIPE}
+omtTest_s_g_LDADD   = libomalloc_g.la
 omtTest_s_g_LDFLAGS = -L${abs_top_builddir}/omalloc -L${abs_top_builddir}/../omalloc -static
 
-omtTest_s_m_CPPFLAGS = -DOM_TEST_MALLOC  -DHAVE_CONFIG_H
-omtTest_s_m_SOURCES  = $(OMTTESTSSOURCES)
-omtTest_s_m_LDADD = libomalloc_g.la
+omtTest_s_m_CPPFLAGS= ${AM_CPPFLAGS} -DOM_TEST_MALLOC  -DHAVE_CONFIG_H
+omtTest_s_m_SOURCES = $(OMTTESTSSOURCES)
+omtTest_s_m_LDADD   = libomalloc_g.la
 omtTest_s_m_LDFLAGS = -L${abs_top_builddir}/omalloc -L${abs_top_builddir}/../omalloc -static
 
 omtTest_s_r_SOURCES = $(OMTTESTSSOURCES)
-omtTest_s_r_CPPFLAGS = -DOM_NDEBUG
-omtTest_s_r_CFLAGS = -O3 ${PIPE}
-omtTest_s_r_LDADD = libomalloc.la
+omtTest_s_r_CPPFLAGS= ${AM_CPPFLAGS} -DOM_NDEBUG
+omtTest_s_r_CFLAGS  = -O3 ${PIPE}
+omtTest_s_r_LDADD   = libomalloc.la
 omtTest_s_r_LDFLAGS = -L${abs_top_builddir}/omalloc -L${abs_top_builddir}/../omalloc -static
 
@@ -102,17 +102,17 @@
 
 omtTest_d_g_SOURCES = $(OMTTESTSSOURCES)
-omtTest_d_g_CPPFLAGS = -DHAVE_CONFIG_H
-omtTest_d_g_CFLAGS = -g -Wextra -Wall -pedantic -Wno-long-long ${PIPE}
-omtTest_d_g_LDADD = libomalloc_g.la
+omtTest_d_g_CPPFLAGS= ${AM_CPPFLAGS} -DHAVE_CONFIG_H
+omtTest_d_g_CFLAGS  = -g -Wextra -Wall -pedantic -Wno-long-long ${PIPE}
+omtTest_d_g_LDADD   = libomalloc_g.la
 omtTest_d_g_LDFLAGS = -L${abs_top_builddir}/omalloc -L${abs_top_builddir}/../omalloc
 
-omtTest_d_m_CPPFLAGS = -DOM_TEST_MALLOC  -DHAVE_CONFIG_H
-omtTest_d_m_SOURCES  = $(OMTTESTSSOURCES)
-omtTest_d_m_LDADD = libomalloc_g.la
+omtTest_d_m_CPPFLAGS= ${AM_CPPFLAGS} -DOM_TEST_MALLOC  -DHAVE_CONFIG_H
+omtTest_d_m_SOURCES = $(OMTTESTSSOURCES)
+omtTest_d_m_LDADD   = libomalloc_g.la
 omtTest_d_m_LDFLAGS = -L${abs_top_builddir}/omalloc -L${abs_top_builddir}/../omalloc
 
 omtTest_d_r_SOURCES = $(OMTTESTSSOURCES)
-omtTest_d_r_CPPFLAGS = -DOM_NDEBUG
-omtTest_d_r_CFLAGS = -O3 ${PIPE}
-omtTest_d_r_LDADD = libomalloc.la
+omtTest_d_r_CPPFLAGS= ${AM_CPPFLAGS} -DOM_NDEBUG
+omtTest_d_r_CFLAGS  = -O3 ${PIPE}
+omtTest_d_r_LDADD   = libomalloc.la
 omtTest_d_r_LDFLAGS = -L${abs_top_builddir}/omalloc -L${abs_top_builddir}/../omalloc
Index: xalloc/Makefile.am
===================================================================
--- xalloc/Makefile.am	(revision fca452a782a426cceaa9e98f3a95b5a5acccd04f)
+++ xalloc/Makefile.am	(revision 4bc0ab9a99c6b2bc95e41d5541864a736e382642)
@@ -10,5 +10,5 @@
 SOURCES = dummy.c
 
-INCLUDES = -I${srcdir}
+AM_CPPFLAGS = -I${srcdir}
 
 libomalloc_la_SOURCES  =$(SOURCES)
@@ -21,5 +21,5 @@
 libomalloc_g_la_CXXFLAGS= -g -Wextra -Wall -pedantic -Wno-long-long ${PIPE}
 
-libomalloc_la_CPPFLAGS  = -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
-libomalloc_g_la_CPPFLAGS= -DHAVE_CONFIG_H 
+libomalloc_la_CPPFLAGS  = ${AM_CPPFLAGS} -DHAVE_CONFIG_H -DNDEBUG -DOM_NDEBUG
+libomalloc_g_la_CPPFLAGS= ${AM_CPPFLAGS} -DHAVE_CONFIG_H 
 
