Add missing file to last commit.
[pspp] / gnulib-tool
index 4f254b4a783a1c750a5be6d97042e8ea98f0228f..68531a5e987f027c0eacef32944bdb70e883b2cf 100755 (executable)
@@ -63,28 +63,37 @@ if test -z "${AUTOPOINT}" || test -n "${GETTEXTPATH}"; then
   AUTOPOINT="${GETTEXTPATH}autopoint"
 fi
 
-# Disabled because "sed --posix" is buggy in GNU sed 4.1.5, see
+# You can set MAKE.
+if test -z "${MAKE}"; then
+  MAKE=make
+fi
+
+# When using GNU sed, turn off as many GNU extensions as possible,
+# to minimize the risk of accidentally using non-portable features.
+# However, do this only for gnulib-tool itself, not for the code that
+# gnulib-tool generates, since we don't want "sed --posix" to leak
+# into makefiles. And do it only for sed versions 4.2 or newer,
+# because "sed --posix" is buggy in GNU sed 4.1.5, see
 # <http://lists.gnu.org/archive/html/bug-gnulib/2009-02/msg00225.html>.
-if false; then
-  # When using GNU sed, turn off as many GNU extensions as possible,
-  # to minimize the risk of accidentally using non-portable features.
-  # However, do this only for gnulib-tool itself, not for the code that
-  # gnulib-tool generates, since we don't want "sed --posix" to leak
-  # into makefiles.
-  if (alias) > /dev/null 2>&1 && echo | sed --posix -e d >/dev/null 2>&1; then
-    # Define sed as an alias.
-    # It is not always possible to use aliases. Aliases are guaranteed to work
-    # if the executing shell is bash and either it is invoked as /bin/sh or
-    # is a version >= 2.0, supporting shopt. This is the common case.
-    # Two other approaches (use of a variable $sed or of a function func_sed
-    # instead of an alias) require massive, fragile code changes.
-    # An other approach (use of function sed) requires `which sed` - but
-    # 'which' is hard to emulate, due to missing "test -x" on some platforms.
-    if test -n "$BASH_VERSION"; then
-      shopt -s expand_aliases >/dev/null 2>&1
-    fi
-    alias sed='sed --posix'
+if (alias) > /dev/null 2>&1 \
+   && echo | sed --posix -e d >/dev/null 2>&1 \
+   && case `sed --version | sed -e 's/^[^0-9]*//' -e 1q` in \
+        [1-3]* | 4.[01]*) false;; \
+        *) true;; \
+      esac \
+   ; then
+  # Define sed as an alias.
+  # It is not always possible to use aliases. Aliases are guaranteed to work
+  # if the executing shell is bash and either it is invoked as /bin/sh or
+  # is a version >= 2.0, supporting shopt. This is the common case.
+  # Two other approaches (use of a variable $sed or of a function func_sed
+  # instead of an alias) require massive, fragile code changes.
+  # An other approach (use of function sed) requires `which sed` - but
+  # 'which' is hard to emulate, due to missing "test -x" on some platforms.
+  if test -n "$BASH_VERSION"; then
+    shopt -s expand_aliases >/dev/null 2>&1
   fi
+  alias sed='sed --posix'
 fi
 
 # sed_noop is a sed expression that does nothing.
@@ -1397,7 +1406,7 @@ func_get_filelist ()
 # Processing: removed_prefix and removed_suffix are removed from each element,
 # added_prefix and added_suffix are added to each element.
 # removed_prefix, removed_suffix should not contain the characters "$`\{}[]^|.
-# added_prefix, added_suffix should not contain the characters \|.
+# added_prefix, added_suffix should not contain the characters \|&.
 func_filter_filelist ()
 {
   if test "$2" != "$nl" \
@@ -1928,6 +1937,7 @@ func_emit_lib_Makefile_am ()
   if test -z "$makefile_name"; then
     echo
     echo "AM_CPPFLAGS ="
+    echo "AM_CFLAGS ="
   fi
   echo
   if LC_ALL=C grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *+\{0,1\}= *$libname\\.$libext\$" allsnippets.tmp > /dev/null; then
@@ -4188,9 +4198,9 @@ func_create_testdir ()
      ./configure || func_exit 1
        cd "$sourcebase"
        echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
-       make built_sources || func_exit 1
+       $MAKE built_sources || func_exit 1
        cd ..
-     make distclean || func_exit 1
+     $MAKE distclean || func_exit 1
     ) || func_exit 1
   fi
 }
@@ -4243,6 +4253,7 @@ func_create_megatestdir ()
                    -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'`
   (echo '#!/bin/sh'
    echo "CVSDATE=$cvsdate"
+   echo ": \${MAKE=make}"
    echo "test -d logs || mkdir logs"
    echo "for module in $megasubdirs; do"
    echo "  echo \"Working on module \$module...\""
@@ -4254,7 +4265,7 @@ func_create_megatestdir ()
    echo "   : autobuild revision... cvs-\$CVSDATE-000000"
    echo "   : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`"
    echo "   : autobuild hostname... \`hostname\`"
-   echo "   cd \$module && ./configure \$CONFIGURE_OPTIONS && make && make check && make distclean"
+   echo "   cd \$module && ./configure \$CONFIGURE_OPTIONS && \$MAKE && \$MAKE check && \$MAKE distclean"
    echo "   echo rc=\$?"
    echo "  ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
    echo "done"
@@ -4466,9 +4477,9 @@ case $mode in
       mkdir build
       cd build
         ../configure || func_exit 1
-        make || func_exit 1
-        make check || func_exit 1
-        make distclean || func_exit 1
+        $MAKE || func_exit 1
+        $MAKE check || func_exit 1
+        $MAKE distclean || func_exit 1
         remaining=`find . -type f -print`
         if test -n "$remaining"; then
           echo "Remaining files:" $remaining 1>&2
@@ -4489,9 +4500,9 @@ case $mode in
       mkdir build
       cd build
         ../configure
-        make
-        make check
-        make distclean
+        $MAKE
+        $MAKE check
+        $MAKE distclean
         remaining=`find . -type f -print`
         if test -n "$remaining"; then
           echo "Remaining files:" $remaining 1>&2