]> granicus.if.org Git - xz/commitdiff
Scripts: Put /usr/xpg4/bin to the beginning of PATH on Solaris. master
authorLasse Collin <lasse.collin@tukaani.org>
Tue, 24 Sep 2019 20:02:40 +0000 (23:02 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Tue, 24 Sep 2019 20:02:40 +0000 (23:02 +0300)
This adds a configure option --enable-path-for-scripts=PREFIX
which defaults to empty except on Solaris it is /usr/xpg4/bin
to make POSIX grep and others available. The Solaris case had
been documented in INSTALL with a manual fix but it's better
to do this automatically since it is needed on most Solaris
systems anyway.

Thanks to Daniel Richard G.

INSTALL
configure.ac
src/scripts/xzdiff.in
src/scripts/xzgrep.in
src/scripts/xzless.in
src/scripts/xzmore.in

diff --git a/INSTALL b/INSTALL
index da116be4ae2d6d15f8979c5471e3ccb3f217e8ca..c29dd09131b8891e3c399c936b7951af3ce2b36e 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -123,8 +123,11 @@ XZ Utils Installation
     as an argument to the configure script.
 
     test_scripts.sh in "make check" may fail if good enough tools are
-    missing from PATH (/usr/xpg4/bin or /usr/xpg6/bin). See sections
-    4.5 and 3.2 for more information.
+    missing from PATH (/usr/xpg4/bin or /usr/xpg6/bin). Nowadays
+    /usr/xpg4/bin is added to the script PATH by default on Solaris
+    (see --enable-path-for-scripts=PREFIX in section 2), but old xz
+    releases needed extra steps. See sections 4.5 and 3.2 for more
+    information.
 
 
 1.2.6. Tru64
@@ -438,6 +441,23 @@ XZ Utils Installation
                 and should work on most systems. This has no effect on the
                 resulting binaries.
 
+    --enable-path-for-scripts=PREFIX
+                If PREFIX isn't empty, PATH=PREFIX:$PATH will be set in
+                the beginning of the scripts (xzgrep and others).
+                The default is empty except on Solaris the default is
+                /usr/xpg4/bin.
+
+                This can be useful if the default PATH doesn't contain
+                modern POSIX tools (as can be the case on Solaris) or if
+                one wants to ensure that the correct xz binary is in the
+                PATH for the scripts. Note that the latter use can break
+                "make check" if the prefixed PATH causes a wrong xz binary
+                (other than the one that was just built) to be used.
+
+                Older xz releases support a different method for setting
+                the PATH for the scripts. It is described in section 3.2
+                and is supported in this xz version too.
+
 
 2.1. Static vs. dynamic linking of liblzma
 
@@ -510,11 +530,17 @@ XZ Utils Installation
 
 3.2. PATH
 
+    The method described below is supported by older xz releases.
+    It is supported by the current version too, but the newer
+    --enable-path-for-scripts=PREFIX described in section 2 may be
+    more convenient.
+
     The scripts assume that the required tools (standard POSIX utilities,
-    mktemp, and xz) are in PATH; the scripts don't set the PATH themselves.
-    Some people like this while some think this is a bug. Those in the
-    latter group can easily patch the scripts before running the configure
-    script by taking advantage of a placeholder line in the scripts.
+    mktemp, and xz) are in PATH; the scripts don't set the PATH themselves
+    (except as described for --enable-path-for-scripts=PREFIX). Some
+    people like this while some think this is a bug. Those in the latter
+    group can easily patch the scripts before running the configure script
+    by taking advantage of a placeholder line in the scripts.
 
     For example, to make the scripts prefix /usr/bin:/bin to PATH:
 
@@ -588,8 +614,9 @@ XZ Utils Installation
     some tools are missing from the current PATH or the tools lack
     support for some POSIX features. This can happen at least on
     Solaris where the tools in /bin may be ancient but good enough
-    tools are available in /usr/xpg4/bin or /usr/xpg6/bin. One fix
-    for this problem is described in section 3.2 of this file.
+    tools are available in /usr/xpg4/bin or /usr/xpg6/bin. For possible
+    fixes, see --enable-path-for-scripts=PREFIX in section 2 and the
+    older alternative method described in section 3.2 of this file.
 
     If tests other than test_scripts.sh fail, a likely reason is that
     libtool links the test programs against an installed version of
index 5cd9ca6eb31f924db0e07e4adf0abd34cd182bbd..d14fa40d7f085c29a8d02f3af031ad1c753c50ef 100644 (file)
@@ -516,6 +516,32 @@ case $enable_sandbox in
 esac
 
 
+###########################
+# PATH prefix for scripts #
+###########################
+
+# The scripts can add a prefix to the search PATH so that POSIX tools
+# or the xz binary is always in the PATH.
+AC_ARG_ENABLE([path-for-scripts],
+       [AS_HELP_STRING([--enable-path-for-scripts=PREFIX],
+               [If PREFIX isn't empty, PATH=PREFIX:$PATH will be set in
+               the beginning of the scripts (xzgrep and others).
+               The default is empty except on Solaris the default is
+               /usr/xpg4/bin.])],
+       [], [
+               case $host_os in
+                       solaris*) enable_path_for_scripts=/usr/xpg4/bin ;;
+                       *)        enable_path_for_scripts= ;;
+               esac
+       ])
+if test -n "$enable_path_for_scripts" && test "x$enable_path_for_scripts" != xno ; then
+       enable_path_for_scripts="PATH=$enable_path_for_scripts:\$PATH"
+else
+       enable_path_for_scripts=
+fi
+AC_SUBST([enable_path_for_scripts])
+
+
 ###############################################################################
 # Checks for programs.
 ###############################################################################
index 6aa6b9896a4c1c16bdb2660b1e3d2237d5b886ef..eb7825c1dfba992359b83831bf8eb6038e8665d5 100644 (file)
@@ -15,6 +15,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+@enable_path_for_scripts@
 #SET_PATH - This line is a placeholder to ease patching this script.
 
 # Instead of unsetting XZ_OPT, just make sure that xz will use file format
index a570a905448cbc5bf63be8698b5ea196c0f366ef..9db5c3a81c21e8c1399f80037c169c33bc09bc1a 100644 (file)
@@ -18,6 +18,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+@enable_path_for_scripts@
 #SET_PATH - This line is a placeholder to ease patching this script.
 
 # Instead of unsetting XZ_OPT, just make sure that xz will use file format
index 1b85ad6f36033ce8ef31b9115c24f76113e75c64..cf61ab29b0eb93ed281e1fbf41dbee8e683fa8b1 100644 (file)
@@ -15,6 +15,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+@enable_path_for_scripts@
 #SET_PATH - This line is a placeholder to ease patching this script.
 
 # Instead of unsetting XZ_OPT, just make sure that xz will use file format
index 940d6614460d46a3fb86407a44d202d56534ef27..ea832a30840ee3d1d951a3710a711b5081c9b432 100644 (file)
@@ -15,6 +15,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
+@enable_path_for_scripts@
 #SET_PATH - This line is a placeholder to ease patching this script.
 
 # Instead of unsetting XZ_OPT, just make sure that xz will use file format