diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am | 4 | ||||
-rw-r--r-- | examples/Makefile.in | 8 | ||||
-rw-r--r-- | examples/README | 2 | ||||
-rw-r--r-- | examples/run-c-ex.sh.in | 29 | ||||
-rw-r--r-- | examples/testh5cc.sh.in | 3 |
5 files changed, 35 insertions, 11 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am index f737814..4a48b30 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -80,8 +80,8 @@ CHECK_CLEANFILES+=$(EXTLINK_DIRS) # Example directory # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/c -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples +EXAMPLEDIR=$(examplesdir)/c +EXAMPLETOPDIR=$(examplesdir) # List dependencies for each program. Normally, automake would take # care of this for us, but if we tell automake about the programs it diff --git a/examples/Makefile.in b/examples/Makefile.in index 979a2f9..e0d1d9b 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -353,7 +353,7 @@ AMTAR = @AMTAR@ # AM_CFLAGS is an automake construct which should be used by Makefiles # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. -AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ +AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ @@ -415,6 +415,7 @@ GREP = @GREP@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ +H5_ECFLAGS = @H5_ECFLAGS@ H5_FCFLAGS = @H5_FCFLAGS@ H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@ H5_LDFLAGS = @H5_LDFLAGS@ @@ -534,6 +535,7 @@ docdir = $(exec_prefix)/doc dvidir = @dvidir@ enable_shared = @enable_shared@ enable_static = @enable_static@ +examplesdir = @examplesdir@ exec_prefix = @exec_prefix@ fortran_linux_linker_option = @fortran_linux_linker_option@ host = @host@ @@ -652,8 +654,8 @@ EXTLINK_DIRS = red blue u2w # Example directory # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR = ${DESTDIR}$(exec_prefix)/share/hdf5_examples/c -EXAMPLETOPDIR = ${DESTDIR}$(exec_prefix)/share/hdf5_examples +EXAMPLEDIR = $(examplesdir)/c +EXAMPLETOPDIR = $(examplesdir) @BUILD_SHARED_SZIP_CONDITIONAL_TRUE@LD_LIBRARY_PATH = $(LL_PATH) # Assume that all tests in this directory are examples, and tell diff --git a/examples/README b/examples/README index 0550b15..e0a3364 100644 --- a/examples/README +++ b/examples/README @@ -2,7 +2,7 @@ This directory contains example programs for the installed APIs and scripts to compile and run them. Examples in the c and hl/c subdirectories are always -installed, and those in fortan, hl/fortran, c++ and hl/c++ will be installed +installed, and those in fortran, hl/fortran, c++ and hl/c++ will be installed when fortran or c++ are enabled. Running the run-all-ex.sh script in this directory will run the scripts and in diff --git a/examples/run-c-ex.sh.in b/examples/run-c-ex.sh.in index a684a38..0bbe7bb 100644 --- a/examples/run-c-ex.sh.in +++ b/examples/run-c-ex.sh.in @@ -18,7 +18,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script will compile and run the c examples from source files installed # -# in .../share/hdf5_examples/c using h5cc or h5pc. The order for running # +# in @examplesdir@/c using h5cc or h5pc. The order for running # # programs with RunTest in the MAIN section below is taken from the Makefile. # # The order is important since some of the test programs use data files created # # by earlier test programs. Any future additions should be placed accordingly. # @@ -28,10 +28,33 @@ # Initializations EXIT_SUCCESS=0 EXIT_FAILURE=1 - + +# +# Try to derive the path to the installation $prefix established +# by ./configure relative to the examples directory established by +# ./configure. If successful, set `prefix_relto_examplesdir` to the +# relative path. Otherwise, set `prefix_relto_examplesdir` to the +# absolute installation $prefix. +# +# This script uses the value of `prefix` in the user's environment, if +# it is set, below. The content of $() is evaluated in a sub-shell, so +# if `prefix` is set in the user's environment, the shell statements in +# $() won't clobbered it. +# +prefix_relto_examplesdir=$( +prefix=@prefix@ +examplesdir=@examplesdir@ +if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then + echo $(echo ${examplesdir##${prefix}/} | \ + sed 's,[^/][^/]*,..,g') +else + echo $prefix +fi +) + # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-../../../}" +prefix="${prefix:-../${prefix_relto_examplesdir}}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 4e898c1..800d4d4 100644 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -29,8 +29,7 @@ EXIT_SUCCESS=0 EXIT_FAILURE=1 # Where the tool is installed. -# Note: no '/' after DESTDIR. Explanation in commence.am -prefix="${prefix:-${DESTDIR}@prefix@}" +prefix="${prefix:-@prefix@}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" |