From b96f342722a76cf3861f0d160f71aa3e5c3b7e88 Mon Sep 17 00:00:00 2001
From: James Laird <jlaird@hdfgroup.org>
Date: Fri, 11 Feb 2005 16:32:22 -0500
Subject: [svn-r9993] Purpose: Bug fix

Description:
Arabica exhibited strange errors when linker found wrong versions of
header files.  This happened because include directories were
given to linker in the wrong order.

Solution:
Move include directories from AM_CFLAGS variable to INCLUDES
variable to put them before CPPFLAGS variable.  Trust me, it works.
This bug may also have contributed to strange errors on other platforms
(kelgia?).

Platforms tested:
copper, sleipnir, arabica.
	(h5dump broke while building on arabica, but this happened in
	a clean checkout, too).
---
 fortran/src/Makefile.am     | 2 +-
 fortran/src/Makefile.in     | 2 +-
 fortran/test/Makefile.am    | 8 ++++----
 fortran/test/Makefile.in    | 2 +-
 hl/tools/gif2h5/Makefile.am | 2 +-
 hl/tools/gif2h5/Makefile.in | 2 +-
 perform/Makefile.am         | 2 +-
 perform/Makefile.in         | 2 +-
 src/Makefile.am             | 3 ---
 src/Makefile.in             | 3 ---
 test/Makefile.am            | 2 +-
 test/Makefile.in            | 2 +-
 testpar/Makefile.am         | 2 +-
 testpar/Makefile.in         | 2 +-
 tools/gifconv/Makefile.am   | 2 +-
 tools/gifconv/Makefile.in   | 2 +-
 tools/h5diff/Makefile.am    | 2 +-
 tools/h5diff/Makefile.in    | 2 +-
 tools/h5dump/Makefile.am    | 2 +-
 tools/h5dump/Makefile.in    | 2 +-
 tools/h5import/Makefile.am  | 2 +-
 tools/h5import/Makefile.in  | 2 +-
 tools/h5jam/Makefile.am     | 2 +-
 tools/h5jam/Makefile.in     | 2 +-
 tools/h5ls/Makefile.am      | 2 +-
 tools/h5ls/Makefile.in      | 2 +-
 tools/h5repack/Makefile.am  | 2 +-
 tools/h5repack/Makefile.in  | 2 +-
 tools/lib/Makefile.am       | 2 +-
 tools/lib/Makefile.in       | 2 +-
 tools/misc/Makefile.am      | 2 +-
 tools/misc/Makefile.in      | 2 +-
 32 files changed, 33 insertions(+), 39 deletions(-)

diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am
index 9e055bc..f2ffc1b 100644
--- a/fortran/src/Makefile.am
+++ b/fortran/src/Makefile.am
@@ -21,7 +21,7 @@ include $(top_srcdir)/config/commence.am
 
 # Include src directory in both Fortran and C flags (C compiler is used
 # for linking)
-AM_CFLAGS = -I$(top_srcdir)/src
+INCLUDES = -I$(top_srcdir)/src
 AM_FFLAGS=-I$(top_srcdir)/src
 
 # This is our main target, the fortran library
diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in
index eae340e..65e67d6 100644
--- a/fortran/src/Makefile.in
+++ b/fortran/src/Makefile.in
@@ -191,7 +191,7 @@ F9XMODFLAG = @F9XMODFLAG@
 
 # Include src directory in both Fortran and C flags (C compiler is used
 # for linking)
-AM_CFLAGS = -I$(top_srcdir)/src
+INCLUDES = -I$(top_srcdir)/src
 AM_FFLAGS = -I$(top_srcdir)/src
 
 # This is our main target, the fortran library
diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am
index 2aece4e..6881f02 100644
--- a/fortran/test/Makefile.am
+++ b/fortran/test/Makefile.am
@@ -21,7 +21,7 @@ include $(top_srcdir)/config/commence.am
 
 # Include files
 AM_FFLAGS=-I$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src
-AM_CFLAGS=-I$(top_srcdir)/src
+INCLUDES=-I$(top_srcdir)/src
 
 # The Fortran test library
 lib_LTLIBRARIES=libh5test_fortran.la
@@ -56,11 +56,11 @@ LDADD=libh5test_fortran.la $(LIBH5TEST) $(LIBH5F) $(LIBHDF5)
 # Temporary files
 MOSTLYCLEANFILES=*.h5 *.tmp
 
-# Fortran dependencies must be hardcoded, unfortunately.
-#FORTLIBTEST_OBJ= fortranlib_test.lo                                    \
+## Fortran dependencies must be hardcoded, unfortunately.
+##FORTLIBTEST_OBJ= fortranlib_test.lo                                    \
         tH5F.lo tH5D.lo tH5R.lo tH5S.lo tH5T.lo tH5VL.lo tH5Z.lo       \
         tH5Sselect.lo tH5P.lo tH5A.lo tH5I.lo tH5G.lo tH5E.lo tf.lo    \
         t.lo
-#fortranlib_test$(EXEEXT): $(FORTLIBTEST_OBJ)
+##fortranlib_test$(EXEEXT): $(FORTLIBTEST_OBJ)
 
 include $(top_srcdir)/config/conclude.am
diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in
index 21bfb32..c4f226b 100644
--- a/fortran/test/Makefile.in
+++ b/fortran/test/Makefile.in
@@ -191,7 +191,7 @@ F9XMODFLAG = @F9XMODFLAG@
 
 # Include files
 AM_FFLAGS = -I$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src
-AM_CFLAGS = -I$(top_srcdir)/src
+INCLUDES = -I$(top_srcdir)/src
 
 # The Fortran test library
 lib_LTLIBRARIES = libh5test_fortran.la
diff --git a/hl/tools/gif2h5/Makefile.am b/hl/tools/gif2h5/Makefile.am
index 2ce6690..44aa189 100644
--- a/hl/tools/gif2h5/Makefile.am
+++ b/hl/tools/gif2h5/Makefile.am
@@ -20,7 +20,7 @@
 include $(top_srcdir)/config/commence.am
 
 # Include src and tools/lib directories
-AM_CFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # These are our main targets, the tools
 bin_PROGRAMS=gif2h5 h52gif
diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in
index f24e02c..f14d0f4 100644
--- a/hl/tools/gif2h5/Makefile.in
+++ b/hl/tools/gif2h5/Makefile.in
@@ -190,7 +190,7 @@ F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
 # Include src and tools/lib directories
-AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # These are our main targets, the tools
 bin_PROGRAMS = gif2h5 h52gif
diff --git a/perform/Makefile.am b/perform/Makefile.am
index bef6cf3..4213802 100644
--- a/perform/Makefile.am
+++ b/perform/Makefile.am
@@ -20,7 +20,7 @@
 
 include $(top_srcdir)/config/commence.am
 
-AM_CFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
+INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
 
 if BUILD_PARALLEL_CONDITIONAL
   TEST_PROG_PARA=h5perf
diff --git a/perform/Makefile.in b/perform/Makefile.in
index aecc74e..ade9a3c 100644
--- a/perform/Makefile.in
+++ b/perform/Makefile.in
@@ -189,7 +189,7 @@ H5FC_PP = $(bindir)/h5pfc
 F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
-AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
 
 @BUILD_PARALLEL_CONDITIONAL_TRUE@TEST_PROG_PARA = h5perf
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 3aaf85a..ae15f16 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,9 +19,6 @@
 
 include $(top_srcdir)/config/commence.am
 
-######## Add '-I.' to the C preprocessor flags
-#AM_CFLAGS=-I$(srcdir)
-
 # How to build H5detect for number format detection.
 # Use -g to force no optimization since many compilers (e.g., Intel) takes
 # a long time to compile it with any optimization on.  H5detect is used
diff --git a/src/Makefile.in b/src/Makefile.in
index cff9fa0..507bc22 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -189,9 +189,6 @@ H5FC_PP = $(bindir)/h5pfc
 F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
-######## Add '-I.' to the C preprocessor flags
-#AM_CFLAGS=-I$(srcdir)
-
 # How to build H5detect for number format detection.
 # Use -g to force no optimization since many compilers (e.g., Intel) takes
 # a long time to compile it with any optimization on.  H5detect is used
diff --git a/test/Makefile.am b/test/Makefile.am
index 06dc69e..6e03e3d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -20,7 +20,7 @@
 
 include $(top_srcdir)/config/commence.am
 
-AM_CFLAGS=-I$(top_srcdir)/src
+INCLUDES=-I$(top_srcdir)/src -I$(top_builddir)/src
 
 # Test script for error_test and err_compat
 TEST_SCRIPT = $(top_srcdir)/test/testerror.sh
diff --git a/test/Makefile.in b/test/Makefile.in
index 8388da4..1535fa8 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -189,7 +189,7 @@ H5FC_PP = $(bindir)/h5pfc
 F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
-AM_CFLAGS = -I$(top_srcdir)/src
+INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src
 
 # Test script for error_test and err_compat
 TEST_SCRIPT = $(top_srcdir)/test/testerror.sh
diff --git a/testpar/Makefile.am b/testpar/Makefile.am
index 0466a66..839a816 100644
--- a/testpar/Makefile.am
+++ b/testpar/Makefile.am
@@ -20,7 +20,7 @@
 
 include $(top_srcdir)/config/commence.am
 
-AM_CFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/test
+INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/test
 
 # Test programs and scripts.  These are our main targets.
 #
diff --git a/testpar/Makefile.in b/testpar/Makefile.in
index 250c7c0..deef59a 100644
--- a/testpar/Makefile.in
+++ b/testpar/Makefile.in
@@ -189,7 +189,7 @@ H5FC_PP = $(bindir)/h5pfc
 F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
-AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/test
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test
 
 # Test programs and scripts.  These are our main targets.
 #
diff --git a/tools/gifconv/Makefile.am b/tools/gifconv/Makefile.am
index 2ce6690..44aa189 100644
--- a/tools/gifconv/Makefile.am
+++ b/tools/gifconv/Makefile.am
@@ -20,7 +20,7 @@
 include $(top_srcdir)/config/commence.am
 
 # Include src and tools/lib directories
-AM_CFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # These are our main targets, the tools
 bin_PROGRAMS=gif2h5 h52gif
diff --git a/tools/gifconv/Makefile.in b/tools/gifconv/Makefile.in
index f24e02c..f14d0f4 100644
--- a/tools/gifconv/Makefile.in
+++ b/tools/gifconv/Makefile.in
@@ -190,7 +190,7 @@ F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
 # Include src and tools/lib directories
-AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # These are our main targets, the tools
 bin_PROGRAMS = gif2h5 h52gif
diff --git a/tools/h5diff/Makefile.am b/tools/h5diff/Makefile.am
index 4480277..afbcd05 100644
--- a/tools/h5diff/Makefile.am
+++ b/tools/h5diff/Makefile.am
@@ -20,7 +20,7 @@
 include $(top_srcdir)/config/commence.am
 
 # Include src and tools/lib directories
-AM_CFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # Always build and test h5diff but build and test ph5diff only if parallel
 # is enabled.
diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in
index f18684e..c9247dd 100644
--- a/tools/h5diff/Makefile.in
+++ b/tools/h5diff/Makefile.in
@@ -190,7 +190,7 @@ F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
 # Include src and tools/lib directories
-AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # Always build and test h5diff but build and test ph5diff only if parallel
 # is enabled.
diff --git a/tools/h5dump/Makefile.am b/tools/h5dump/Makefile.am
index 6052ec1..5c74d13 100644
--- a/tools/h5dump/Makefile.am
+++ b/tools/h5dump/Makefile.am
@@ -20,7 +20,7 @@
 include $(top_srcdir)/config/commence.am
 
 # Include files in /src directory and /tools/lib directory
-AM_CFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # Test programs and scripts
 TEST_PROG=h5dumpgentest
diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in
index c9a33f2..a6c0a20 100644
--- a/tools/h5dump/Makefile.in
+++ b/tools/h5dump/Makefile.in
@@ -190,7 +190,7 @@ F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
 # Include files in /src directory and /tools/lib directory
-AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # Test programs and scripts
 TEST_PROG = h5dumpgentest
diff --git a/tools/h5import/Makefile.am b/tools/h5import/Makefile.am
index d185092..df59068 100644
--- a/tools/h5import/Makefile.am
+++ b/tools/h5import/Makefile.am
@@ -20,7 +20,7 @@
 include $(top_srcdir)/config/commence.am
 
 # Include src and tools/lib directories
-AM_CFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # Test programs and scripts
 TEST_PROG=h5importtest
diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in
index 92d147f..2846485 100755
--- a/tools/h5import/Makefile.in
+++ b/tools/h5import/Makefile.in
@@ -190,7 +190,7 @@ F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
 # Include src and tools/lib directories
-AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # Test programs and scripts
 TEST_PROG = h5importtest
diff --git a/tools/h5jam/Makefile.am b/tools/h5jam/Makefile.am
index 9378cb7..6e54756 100644
--- a/tools/h5jam/Makefile.am
+++ b/tools/h5jam/Makefile.am
@@ -19,7 +19,7 @@
 include $(top_srcdir)/config/commence.am
 
 # Include src and tools/lib directories
-AM_CFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 bin_PROGRAMS=h5jam h5unjam
 check_PROGRAMS=tellub h5jamgentest getub
diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in
index 725a8db..1ef2a36 100644
--- a/tools/h5jam/Makefile.in
+++ b/tools/h5jam/Makefile.in
@@ -190,7 +190,7 @@ F9XMODFLAG = @F9XMODFLAG@
 #
 
 # Include src and tools/lib directories
-AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 bin_PROGRAMS = h5jam h5unjam
 check_PROGRAMS = tellub h5jamgentest getub
diff --git a/tools/h5ls/Makefile.am b/tools/h5ls/Makefile.am
index ea9a149..89a83a1 100644
--- a/tools/h5ls/Makefile.am
+++ b/tools/h5ls/Makefile.am
@@ -20,7 +20,7 @@
 include $(top_srcdir)/config/commence.am
 
 # Include src and tools/lib directories
-AM_CFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # Test programs and scripts
 TEST_SCRIPT=$(srcdir)/testh5ls.sh
diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in
index ae88008..cfa8334 100644
--- a/tools/h5ls/Makefile.in
+++ b/tools/h5ls/Makefile.in
@@ -190,7 +190,7 @@ F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
 # Include src and tools/lib directories
-AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
 
 # Test programs and scripts
 TEST_SCRIPT = $(srcdir)/testh5ls.sh
diff --git a/tools/h5repack/Makefile.am b/tools/h5repack/Makefile.am
index be595a1..130c4f2 100644
--- a/tools/h5repack/Makefile.am
+++ b/tools/h5repack/Makefile.am
@@ -20,7 +20,7 @@
 include $(top_srcdir)/config/commence.am
 
 # Include src, test, and tools/lib directories
-AM_CFLAGS=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
+INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
 
 # Test programs and scripts
 TEST_SCRIPT=h5repack.sh
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in
index dda43ed..bed3041 100644
--- a/tools/h5repack/Makefile.in
+++ b/tools/h5repack/Makefile.in
@@ -190,7 +190,7 @@ F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
 # Include src, test, and tools/lib directories
-AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
+INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
 
 # Test programs and scripts
 TEST_SCRIPT = h5repack.sh
diff --git a/tools/lib/Makefile.am b/tools/lib/Makefile.am
index a634887..4257e6a 100644
--- a/tools/lib/Makefile.am
+++ b/tools/lib/Makefile.am
@@ -20,7 +20,7 @@
 include $(top_srcdir)/config/commence.am
 
 # Include files in /src directory
-AM_CFLAGS=-I$(top_srcdir)/src
+INCLUDES=-I$(top_srcdir)/src
 
 # This is our main target, the h5tools library.  We link this library
 # statically because some systems can only link executables to a single
diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in
index cf382c1..5a7276e 100644
--- a/tools/lib/Makefile.in
+++ b/tools/lib/Makefile.in
@@ -190,7 +190,7 @@ F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
 # Include files in /src directory
-AM_CFLAGS = -I$(top_srcdir)/src
+INCLUDES = -I$(top_srcdir)/src
 
 # This is our main target, the h5tools library.  We link this library
 # statically because some systems can only link executables to a single
diff --git a/tools/misc/Makefile.am b/tools/misc/Makefile.am
index 52ee9df..914650c 100644
--- a/tools/misc/Makefile.am
+++ b/tools/misc/Makefile.am
@@ -20,7 +20,7 @@
 include $(top_srcdir)/config/commence.am
 
 # Include src directory
-AM_CFLAGS=-I$(top_srcdir)/src
+INCLUDES=-I$(top_srcdir)/src
 
 # Build pdb2hdf5 if LLNL's PDB is present (checked in configure)
 if BUILD_PDB2HDF_CONDITIONAL
diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in
index 0055272..a2922f8 100644
--- a/tools/misc/Makefile.in
+++ b/tools/misc/Makefile.in
@@ -190,7 +190,7 @@ F9XMODEXT = @F9XMODEXT@
 F9XMODFLAG = @F9XMODFLAG@
 
 # Include src directory
-AM_CFLAGS = -I$(top_srcdir)/src
+INCLUDES = -I$(top_srcdir)/src
 
 # Build pdb2hdf5 if LLNL's PDB is present (checked in configure)
 @BUILD_PDB2HDF_CONDITIONAL_TRUE@PDB2HDF = pdb2hdf5
-- 
cgit v0.12