changeset 22468:6f5cde55e225

build: ensure GNU sed is used in mk-octave-config-h.sh * mk-octave-config-h.sh: Define and use the $SED environment variable from the build system.
author Mike Miller <mtmiller@octave.org>
date Fri, 09 Sep 2016 15:19:28 -0700
parents c61467fc0d3a
children 8e1462b17969
files build-aux/mk-octave-config-h.sh
diffstat 1 files changed, 17 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/build-aux/mk-octave-config-h.sh	Sun Sep 11 13:24:08 2016 -0700
+++ b/build-aux/mk-octave-config-h.sh	Fri Sep 09 15:19:28 2016 -0700
@@ -22,6 +22,8 @@
 # autoconf-generated config.h file.  See the notes at the top of the
 # generated octave-config.h file for more details.
 
+SED=${SED:-sed}
+
 if [ $# -ne 1 ]; then
   echo "usage: mk-octave-config-h.sh CONFIG-FILE" 1>&2
   exit 1
@@ -144,7 +146,7 @@
 #  define OCTINTERP_API OCTAVE_IMPORT
 EOF
 
-octave_idx_type="`sed -n 's/#define OCTAVE_IDX_TYPE \([_a-zA-Z][_a-zA-Z0-9]*\)/\1/p' $config_h_file`"
+octave_idx_type="`$SED -n 's/#define OCTAVE_IDX_TYPE \([_a-zA-Z][_a-zA-Z0-9]*\)/\1/p' $config_h_file`"
 
 if test -z "$octave_idx_type"; then
   echo "mk-octave-config-h.sh: failed to find OCTAVE_IDX_TYPE in $config_h_file" 1>&2
@@ -165,20 +167,20 @@
 
 echo ""
 
-sed -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_64.*$\)/#  \1/p' $config_h_file
-sed -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_ATOMIC_REFCOUNT.*$\)/#  \1/p' $config_h_file
-sed -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_BOUNDS_CHECK.*$\)/#  \1/p' $config_h_file
-sed -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_OPENMP.*$\)/#  \1/p' $config_h_file
-sed -n 's/#\(\(undef\|define\) OCTAVE_HAVE_FAST_INT_OPS.*$\)/#  \1/p' $config_h_file
-sed -n 's/#\(\(undef\|define\) OCTAVE_HAVE_LONG_LONG_INT.*$\)/#  \1/p' $config_h_file
-sed -n 's/#\(\(undef\|define\) OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT.*$\)/#  \1/p' $config_h_file
-sed -n 's/#\(\(undef\|define\) OCTAVE_HAVE_OVERLOAD_CHAR_INT8_TYPES.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_64.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_ATOMIC_REFCOUNT.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_BOUNDS_CHECK.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) OCTAVE_ENABLE_OPENMP.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) OCTAVE_HAVE_FAST_INT_OPS.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) OCTAVE_HAVE_LONG_LONG_INT.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) OCTAVE_HAVE_OVERLOAD_CHAR_INT8_TYPES.*$\)/#  \1/p' $config_h_file
 
 echo ""
 
-sed -n 's/#\(\(undef\|define\) gid_t.*$\)/#  \1/p' $config_h_file
-sed -n 's/#\(\(undef\|define\) uid_t.*$\)/#  \1/p' $config_h_file
-sed -n 's/#\(\(undef\|define\) nlink_t.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) gid_t.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) uid_t.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) nlink_t.*$\)/#  \1/p' $config_h_file
 
 if grep "#undef HAVE_DEV_T" $config_h_file > /dev/null; then
   cat << EOF
@@ -207,7 +209,7 @@
   have_roundl=yes
 fi
 
-sizeof_long_double="`sed -n 's/#define SIZEOF_LONG_DOUBLE \([0-9]*\)/\1/p' $config_h_file`"
+sizeof_long_double="`$SED -n 's/#define SIZEOF_LONG_DOUBLE \([0-9]*\)/\1/p' $config_h_file`"
 
 if test -z "$sizeof_long_double"; then
   echo "mk-octave-config-h.sh: failed to find SIZEOF_LONG_DOUBLE in $config_h_file" 1>&2
@@ -236,11 +238,11 @@
 
 echo ""
 
-sed -n 's/#\(\(undef\|define\) F77_USES_.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) F77_USES_.*$\)/#  \1/p' $config_h_file
 
 echo ""
 
-sed -n 's/#\(\(undef\|define\) F77_FUNC.*$\)/#  \1/p' $config_h_file
+$SED -n 's/#\(\(undef\|define\) F77_FUNC.*$\)/#  \1/p' $config_h_file
 
 cat << EOF