git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Lattarini <stefano.lattarini@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com
Subject: [PATCH] configure: allow user to prevent $PATH "sanitization" on Solaris
Date: Fri,  9 Mar 2012 13:43:55 +0100	[thread overview]
Message-ID: <a706eaa1e1cd5e13a8cd98362fe09bba628789d1.1331296220.git.stefano.lattarini@gmail.com> (raw)
In-Reply-To: <7vhay6etqc.fsf@alter.siamese.dyndns.org>

On a Solaris 10 system with Solaris make installed as '/usr/xpg4/bin/make',
GNU make installed as '/usr/local/bin/make', and with '/usr/local/bin'
appearing in $PATH *before* '/usr/xpg4/bin', I was seeing errors like this
upon invoking "make all":

        SUBDIR perl
    make: Warning: Ignoring DistributedMake -o option
    Usage : make [ -f makefile ][ -K statefile ]...
    make: Fatal error: Unknown option `-C'

This happened because the Git's Makefile, when running on Solaris,
automatically "sanitizes" $PATH by prepending '/usr/xpg6/bin' and
'/usr/xpg4/bin' to it, and in the setup described above such a behaviour
has the unintended consequence of forcing the use of Solaris make
in recursive make invocations -- even if the $(MAKE) macro is being
correctly used in them!

For developers that don't use the autoconf machinery, the best and easier
fix in such a situation is to properly override $(SANE_TOOL_PATH) in
config.mak.  But a developer using the autoconf-generated configure script
to set up its Git source tree's configuration wouldn't expect to also have
to provide such an override *by hand* after having run configure; he would
either expect:

  1) that the issue is automatically detected and transparently worked
     around by configure; or at least

  2) that a configure-time override telling how (and if) PATH is to be
     sanitized is provided.

This change implements the second approach, which is less-ambitious but
also much less fragile.  Note that, even if we should decide to implement
the first approach in the future, the code added by the present change
still be useful, allowing  the user the possibility to override the
configure's choices in case they turn out wrong (in true autotools
spirit).
---

 Hi Junio, sorry for the delay.  Here is a simpler approach that worked
 out well enough for me; the commit message should explain the rationales
 and motivations for it in detail.

 Regards,
   Stefano

 configure.ac |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8bb0f44..72f7958 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,6 +137,23 @@ if test -n "$1"; then
 fi
 ])
 
+# Directories holding "saner" versions of common or POSIX binaries.
+AC_ARG_WITH([sane-tool-path],
+  [AS_HELP_STRING(
+    [--with-sane-tool-path=DIR-1[[:DIR-2...:DIR-n]]],
+    [Directories to prepend to PATH in build system and generated scripts])],
+  [if test "$withval" = "no"; then
+    withval=''
+  else
+    AC_MSG_NOTICE([Setting SANE_TOOL_PATH to '$withval'])
+  fi
+  GIT_CONF_APPEND_LINE([SANE_TOOL_PATH=$withval])],
+  [# If the "--with-sane-tool-path" option was not given, don't touch
+   # SANE_TOOL_PATH here, but let defaults in Makefile take care of it.
+   # This should minimize spurious differences in the behaviour of the
+   # Git build system when configure is used w.r.t. when it is not.
+   :])
+
 ## Site configuration related to programs (before tests)
 ## --with-PACKAGE[=ARG] and --without-PACKAGE
 #
-- 
1.7.9

  parent reply	other threads:[~2012-03-09 12:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02  9:13 [RFC/PATCH] build: avoid possible confusion between GNU/XPG4 make on Solaris Stefano Lattarini
2012-03-02  9:34 ` Thomas Rast
2012-03-02  9:41   ` Stefano Lattarini
2012-03-02 10:18     ` [PATCH v2] " Stefano Lattarini
2012-03-02 18:35 ` [RFC/PATCH] " Junio C Hamano
2012-03-02 19:00   ` Stefano Lattarini
2012-03-02 19:46     ` Junio C Hamano
2012-03-09 12:43   ` Stefano Lattarini [this message]
2012-03-09 16:29     ` [PATCH] configure: allow user to prevent $PATH "sanitization" " Junio C Hamano
2012-03-09 19:46     ` Junio C Hamano
2012-03-09 21:46       ` Stefano Lattarini
2012-03-09 21:59         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a706eaa1e1cd5e13a8cd98362fe09bba628789d1.1331296220.git.stefano.lattarini@gmail.com \
    --to=stefano.lattarini@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).