summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2019-11-05 21:36:09 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2019-11-05 21:36:09 (GMT)
commit2dd5bbfe167e3e9b6b6ee657a882e24072de4aeb (patch)
treeb4605ad55c3c2b82218a915fc2322d0f75a4f880
parentafd4b291315e39e3966eadaf8ae9894b30e9504e (diff)
parent0b721858e46a317c370a24115032d5be41688f67 (diff)
downloadhdf5-2dd5bbfe167e3e9b6b6ee657a882e24072de4aeb.zip
hdf5-2dd5bbfe167e3e9b6b6ee657a882e24072de4aeb.tar.gz
hdf5-2dd5bbfe167e3e9b6b6ee657a882e24072de4aeb.tar.bz2
Merge pull request #1984 in HDFFV/hdf5 from ~DYOUNG/netbsd:develop to develop
* commit '0b721858e46a317c370a24115032d5be41688f67': Make these scripts relocatable again: derive a relative path for the original installation prefix from the examples prefix. Use that relative path to locate the current installation prefix, always. Fall back to an absolute installation prefix if the relative path cannot be derived. Get the path to prefix right: needs a ../ to back out of subdirectory c/. Make this script relocatable again: derive a relative path for the original installation prefix from the examples prefix. Use that relative path to locate the current installation prefix, always. Fall back to an absolute installation prefix if the relative path cannot be derived. Let us override the examples directory using --with-examplesdir=DIR. This is handy for NetBSD where HDF5 examples are installed by convention in $prefix/share/examples/hdf5/ rather than in ${prefix}/share/hdf5_examples/, which is the HDF5 default. Follow longstanding execv convention for compatibility with NetBSD. Under the examples directories, always find the installed HDF5 executables and scripts using @prefix@ instead of a relative path, because the number of ../ in the relative path will be different on NetBSD than on other systems. Make the HDF5 configure script grok NetBSD. For portability, insulate the HDF5 library from some system macros. Not every system has perl installed in /usr/bin/, so change the shebang (#!) line to `/usr/bin/env perl` to locate perl on the PATH. For portability, use the POSIX sh(1) string-comparison operator `=` instead of `==`.
-rwxr-xr-xbin/checkapi4
-rwxr-xr-xbin/checkposix3
-rwxr-xr-xbin/debug-ohdr2
-rwxr-xr-xbin/dependencies4
-rwxr-xr-xbin/distdep5
-rwxr-xr-xbin/errors3
-rwxr-xr-xbin/iostats2
-rwxr-xr-xbin/make_err3
-rwxr-xr-xbin/make_overflow3
-rwxr-xr-xbin/make_vers3
-rwxr-xr-xbin/runbkgprog3
-rwxr-xr-xbin/trace3
-rw-r--r--c++/examples/Makefile.am4
-rw-r--r--c++/examples/run-c++-ex.sh.in27
-rw-r--r--config/netbsd56
-rw-r--r--configure.ac25
-rw-r--r--examples/Makefile.am4
-rw-r--r--examples/run-c-ex.sh.in29
-rw-r--r--fortran/examples/Makefile.am4
-rw-r--r--fortran/examples/run-fortran-ex.sh.in27
-rw-r--r--hl/c++/examples/Makefile.am4
-rw-r--r--hl/c++/examples/run-hlc++-ex.sh.in28
-rw-r--r--hl/examples/Makefile.am4
-rw-r--r--hl/examples/run-hlc-ex.sh.in27
-rw-r--r--hl/fortran/examples/Makefile.am4
-rw-r--r--hl/fortran/examples/run-hlfortran-ex.sh.in4
-rw-r--r--src/H5private.h19
-rw-r--r--test/accum.c8
-rw-r--r--tools/test/h5jam/testh5jam.sh.in4
29 files changed, 275 insertions, 41 deletions
diff --git a/bin/checkapi b/bin/checkapi
index 6882dea..f5dcacc 100755
--- a/bin/checkapi
+++ b/bin/checkapi
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
@@ -13,6 +13,8 @@
#
require 5.003;
+use warnings;
+
# Purpose: insures that API functions aren't called internally.
# Usage: checkapi H5*.c
my $filename = "";
diff --git a/bin/checkposix b/bin/checkposix
index 30128e3..233d15c 100755
--- a/bin/checkposix
+++ b/bin/checkposix
@@ -1,5 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
require 5.003;
+use warnings;
#
# Copyright by The HDF Group.
diff --git a/bin/debug-ohdr b/bin/debug-ohdr
index 5b0a4b3..1363456 100755
--- a/bin/debug-ohdr
+++ b/bin/debug-ohdr
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
diff --git a/bin/dependencies b/bin/dependencies
index 82247da..367351a 100755
--- a/bin/dependencies
+++ b/bin/dependencies
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
@@ -11,6 +11,8 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
+use warnings;
+
my $depend_file;
my $new_depend_file;
my $srcdir;
diff --git a/bin/distdep b/bin/distdep
index 4643700..cd310e0 100755
--- a/bin/distdep
+++ b/bin/distdep
@@ -1,4 +1,7 @@
-#!/usr/bin/perl -p
+#!/bin/sh
+#! -*-perl-*-
+eval 'exec perl -p -x -S $0 ${1+"$@"}'
+ if 0;
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
diff --git a/bin/errors b/bin/errors
index 3c99fdc..107bb9c 100755
--- a/bin/errors
+++ b/bin/errors
@@ -1,5 +1,6 @@
-#!/usr/local/bin/perl -w
+#!/usr/bin/env perl
require 5.003;
+use warnings;
use Text::Tabs;
# NOTE: THE FORMAT OF HRETURN_ERROR AND HGOTO_ERROR MACROS HAS
diff --git a/bin/iostats b/bin/iostats
index f054b9c..e389992 100755
--- a/bin/iostats
+++ b/bin/iostats
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
diff --git a/bin/make_err b/bin/make_err
index 623c1b6..7f38591 100755
--- a/bin/make_err
+++ b/bin/make_err
@@ -1,6 +1,7 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
require 5.003;
$indent=4;
+use warnings;
#
# Copyright by The HDF Group.
diff --git a/bin/make_overflow b/bin/make_overflow
index ccd640e..cee0126 100755
--- a/bin/make_overflow
+++ b/bin/make_overflow
@@ -1,6 +1,7 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
require 5.003;
use strict;
+use warnings;
# Global settings
diff --git a/bin/make_vers b/bin/make_vers
index 1ea1402..c6d2c04 100755
--- a/bin/make_vers
+++ b/bin/make_vers
@@ -1,5 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
require 5.003;
+use warnings;
# Global settings
# (The max_idx parameter is the only thing that needs to be changed when adding
diff --git a/bin/runbkgprog b/bin/runbkgprog
index 69fa2d0..f04ea89 100755
--- a/bin/runbkgprog
+++ b/bin/runbkgprog
@@ -1,5 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
require 5.003;
+use warnings;
$indent=4;
#
diff --git a/bin/trace b/bin/trace
index 3cae0a4..34bcd3a 100755
--- a/bin/trace
+++ b/bin/trace
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
##
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
@@ -12,6 +12,7 @@
# help@hdfgroup.org.
##
require 5.003;
+use warnings;
$Source = "";
##############################################################################
diff --git a/c++/examples/Makefile.am b/c++/examples/Makefile.am
index 51ab8e3..0648504 100644
--- a/c++/examples/Makefile.am
+++ b/c++/examples/Makefile.am
@@ -49,8 +49,8 @@ CXX_API=yes
# Where to install examples
# 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)
# How to build programs using h5c++
$(EXTRA_PROG): $(H5CPP)
diff --git a/c++/examples/run-c++-ex.sh.in b/c++/examples/run-c++-ex.sh.in
index d975924..08e9633 100644
--- a/c++/examples/run-c++-ex.sh.in
+++ b/c++/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 h5c++. The #
+# installed in @examplesdir@/c++ using h5c++. 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 #
@@ -30,9 +30,32 @@
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 -E '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}}"
AR="@AR@"
RANLIB="@RANLIB@"
H5TOOL="h5c++" # The tool name
diff --git a/config/netbsd b/config/netbsd
new file mode 100644
index 0000000..9a9348b
--- /dev/null
+++ b/config/netbsd
@@ -0,0 +1,56 @@
+# -*- shell-script -*-
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+
+
+# This file is part of the HDF5 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compile modes.
+#
+# See BlankForm in this directory for details.
+
+# The default compiler is `gcc'
+if test "X-" = "X-$CC"; then
+ CC=gcc
+ CC_BASENAME=gcc
+fi
+
+# Figure out C compiler flags
+. $srcdir/config/gnu-flags
+
+# Figure out Intel C compiler flags
+. $srcdir/config/intel-flags
+
+# The default Fortran 90 compiler
+if test "X-" = "X-$FC"; then
+ case $CC_BASENAME in
+ gcc*|pgcc*)
+ FC=gfortran
+ FC_BASENAME=gfortran
+ ;;
+ icc*)
+ FC=ifort
+ FC_BASENAME=ifort
+ ;;
+ mpicc*)
+ FC=mpif90
+ FC_BASENAME=mpif90
+ ;;
+ esac
+fi
+
+# Figure out FORTRAN compiler flags
+. $srcdir/config/gnu-fflags
+
+# Figure out Intel F90 compiler flags
+. $srcdir/config/intel-fflags
+
diff --git a/configure.ac b/configure.ac
index 2ffbf0f..0eada60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -232,6 +232,9 @@ case $host_os in
freebsd*)
host_os_novers=freebsd
;;
+ netbsd*)
+ host_os_novers=netbsd
+ ;;
solaris*)
host_os_novers=solaris
;;
@@ -2964,6 +2967,28 @@ fi
AC_CACHE_SAVE
## ----------------------------------------------------------------------
+## Use custom examples path.
+##
+AC_MSG_CHECKING([for custom examples path definition])
+AC_ARG_WITH([examplesdir],
+ [AS_HELP_STRING([--with-examplesdir=location],
+ [Specify path for examples
+ [default="DATAROOTDIR/hdf5_examples"]])],,
+ withval="${datarootdir}/hdf5_examples")
+
+if test "X$withval" = "X"; then
+ AC_MSG_RESULT([default])
+ examplesdir="${datarootdir}/hdf5_examples"
+else
+ AC_MSG_RESULT([$withval])
+ examplesdir=$withval
+fi
+
+AC_SUBST([examplesdir])
+AC_DEFINE_UNQUOTED([EXAMPLESDIR], ["$examplesdir"],
+ [Define the examples directory])
+
+## ----------------------------------------------------------------------
## Enable custom plugin default path for library. It requires SHARED support.
##
AC_MSG_CHECKING([for custom plugin default path definition])
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 131842c..5b428cd 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -86,8 +86,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/run-c-ex.sh.in b/examples/run-c-ex.sh.in
index a70117f..b561617 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 -E '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/fortran/examples/Makefile.am b/fortran/examples/Makefile.am
index 6bf2edb..fb510bc 100644
--- a/fortran/examples/Makefile.am
+++ b/fortran/examples/Makefile.am
@@ -74,8 +74,8 @@ endif
# Tell automake how to install examples
# Note: no '/' after DESTDIR. Explanation in commence.am
-EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/fortran
-EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples
+EXAMPLEDIR=$(examplesdir)/fortran
+EXAMPLETOPDIR=$(examplesdir)
# List dependencies for each example. Normally, automake would take
# care of this for us, but if we tell automake about the programs it
diff --git a/fortran/examples/run-fortran-ex.sh.in b/fortran/examples/run-fortran-ex.sh.in
index aa17f89..e2b444f 100644
--- a/fortran/examples/run-fortran-ex.sh.in
+++ b/fortran/examples/run-fortran-ex.sh.in
@@ -18,7 +18,7 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# This script will compile and run the fortran examples from source files #
-# installed in .../share/hdf5_examples/fortran using h5fc or h5pfc. The #
+# installed in @examplesdir@/fortran using h5fc or h5pfc. 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 #
@@ -30,9 +30,32 @@
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 -E '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/hl/c++/examples/Makefile.am b/hl/c++/examples/Makefile.am
index ce719f5..592e8da 100644
--- a/hl/c++/examples/Makefile.am
+++ b/hl/c++/examples/Makefile.am
@@ -33,8 +33,8 @@ CXX_API=yes
# Where to install examples
# Note: no '/' after DESTDIR. Explanation in commence.am
-EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/c++
-EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl
+EXAMPLEDIR=$(examplesdir)/hl/c++
+EXAMPLETOPDIR=$(examplesdir)/hl
# How to build programs using h5c++
$(EXTRA_PROG): $(H5CPP)
diff --git a/hl/c++/examples/run-hlc++-ex.sh.in b/hl/c++/examples/run-hlc++-ex.sh.in
index eb688a1..e46534a 100644
--- a/hl/c++/examples/run-hlc++-ex.sh.in
+++ b/hl/c++/examples/run-hlc++-ex.sh.in
@@ -18,7 +18,7 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# This script will compile and run the c++ examples from source files #
-# installed in .../share/hdf5_examples/hl/c++ using h5c++. The #
+# installed in @examplesdir@/hl/c++ using h5c++. 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 #
@@ -29,9 +29,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 -E '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}}"
AR="@AR@"
RANLIB="@RANLIB@"
H5TOOL="h5c++" # The tool name
diff --git a/hl/examples/Makefile.am b/hl/examples/Makefile.am
index 29e1a48..cc2d671 100644
--- a/hl/examples/Makefile.am
+++ b/hl/examples/Makefile.am
@@ -25,8 +25,8 @@ endif
# Example directory
# Note: no '/' after DESTDIR. Explanation in commence.am
-EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/c
-EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl
+EXAMPLEDIR=$(examplesdir)/hl/c
+EXAMPLETOPDIR=$(examplesdir)/hl
INSTALL_SCRIPT_FILES = run-hlc-ex.sh
INSTALL_TOP_SCRIPT_FILES = run-hl-ex.sh
diff --git a/hl/examples/run-hlc-ex.sh.in b/hl/examples/run-hlc-ex.sh.in
index f51b165..ceb77dd 100644
--- a/hl/examples/run-hlc-ex.sh.in
+++ b/hl/examples/run-hlc-ex.sh.in
@@ -18,7 +18,7 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# This script will compile and run the c examples from source files installed #
-# in .../share/hdf5_examples/hl/c using h5cc or h5pc. The order for running #
+# in @examplesdir@/hl/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. #
@@ -29,9 +29,32 @@
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 -E '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/hl/fortran/examples/Makefile.am b/hl/fortran/examples/Makefile.am
index d383f9a..b81cc6f 100644
--- a/hl/fortran/examples/Makefile.am
+++ b/hl/fortran/examples/Makefile.am
@@ -51,8 +51,8 @@ endif
# Tell automake how to install examples
# Note: no '/' after DESTDIR. Explanation in commence.am
-EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/fortran
-EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl
+EXAMPLEDIR=$(examplesdir)/hl/fortran
+EXAMPLETOPDIR=$(examplesdir)/hl
# List dependencies for each example. Normally, automake would take
# care of this for us, but if we tell automake about the programs it
diff --git a/hl/fortran/examples/run-hlfortran-ex.sh.in b/hl/fortran/examples/run-hlfortran-ex.sh.in
index 5f12ef0..d7de8e3 100644
--- a/hl/fortran/examples/run-hlfortran-ex.sh.in
+++ b/hl/fortran/examples/run-hlfortran-ex.sh.in
@@ -18,7 +18,7 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# This script will compile and run the fortran examples from source files #
-# installed in .../share/hdf5_examples/hl/fortran using h5fc or h5pfc. The #
+# installed in @examplesdir@/hl/fortran using h5fc or h5pfc. 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 #
@@ -32,7 +32,7 @@ EXIT_FAILURE=1
# Where the tool is installed.
# default is relative path to installed location of the tools
-prefix="${prefix:-../../../..}"
+prefix="${prefix:-@prefix@}"
PARALLEL=@PARALLEL@ # Am I in parallel mode?
AR="@AR@"
RANLIB="@RANLIB@"
diff --git a/src/H5private.h b/src/H5private.h
index 0bfc91b..b5ee984 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -345,6 +345,14 @@
#define FAIL (-1)
#define UFAIL (unsigned)(-1)
+/* The HDF5 library uses the symbol `ERR` frequently. So do
+ * header files for libraries such as curses(3), terminfo(3), etc.
+ * Remove its definition here to avoid clashes with HDF5.
+ */
+#ifdef ERR
+#undef ERR
+#endif
+
/* number of members in an array */
#ifndef NELMTS
# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
@@ -1645,9 +1653,18 @@ extern char *strdup(const char *s);
/* Assign a variable to one of a different size (think safer dst = (dsttype)src").
* The code generated by the macro checks for overflows.
+ *
+ * Use w##x##y##z instead of H5_GLUE4(w, x, y, z) because srctype
+ * or dsttype on some systems (e.g., NetBSD 8 and earlier) may
+ * supply some standard types using a macro---e.g.,
+ * #defineĀ uint8_tĀ __uint8_t. The preprocessor will expand the
+ * macros before it evaluates H5_GLUE4(), and that will generate
+ * an unexpected name such as ASSIGN___uint8_t_TO___uint16_t.
+ * The preprocessor does not expand macros in w##x##y##z, so
+ * that will always generate the expected name.
*/
#define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) \
- H5_GLUE4(ASSIGN_,srctype,_TO_,dsttype)(dst,dsttype,src,srctype)\
+ ASSIGN_##srctype##_TO_##dsttype(dst,dsttype,src,srctype)\
#else /* NDEBUG */
#define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) \
diff --git a/test/accum.c b/test/accum.c
index 91acf0f..f7d02fd 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -1838,7 +1838,6 @@ test_swmr_write_big(hbool_t newest_format)
pid_t pid; /* Process ID */
#endif /* H5_HAVE_UNISTD_H */
int status; /* Status returned from child process */
- char *new_argv[] = {NULL};
char *driver = NULL; /* VFD string (from env variable) */
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
@@ -1968,6 +1967,13 @@ test_swmr_write_big(hbool_t newest_format)
FAIL_STACK_ERROR;
}
else if(0 == pid) { /* Child process */
+ /* By convention, argv[0] tells the name of program invoked.
+ *
+ * execv on NetBSD 8 will actually return EFAULT if there is a
+ * NULL at argv[0], so we follow the convention unconditionally.
+ */
+ char swmr_reader[] = SWMR_READER;
+ char * const new_argv[] = {swmr_reader, NULL};
/* Run the reader */
status = HDexecv(SWMR_READER, new_argv);
HDprintf("errno from execv = %s\n", strerror(errno));
diff --git a/tools/test/h5jam/testh5jam.sh.in b/tools/test/h5jam/testh5jam.sh.in
index 3ae180b..bf705b4 100644
--- a/tools/test/h5jam/testh5jam.sh.in
+++ b/tools/test/h5jam/testh5jam.sh.in
@@ -474,9 +474,9 @@ UNJAMTEST () {
#
TOOLTEST_OUTPUT() {
- if [ "$1" == "JAM" ]; then
+ if [ "$1" = "JAM" ]; then
TOOLCMD=$JAM_BIN/$JAM
- elif [ "$1" == "UNJAM" ]; then
+ elif [ "$1" = "UNJAM" ]; then
TOOLCMD=$JAM_BIN/$UNJAM
fi
shift