autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: config.status and /bin/sh on Solaris


From: Dimitrios Apostolou
Subject: Re: config.status and /bin/sh on Solaris
Date: Sat, 28 Jan 2017 19:13:58 +0100 (CET)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)

On Sat, 28 Jan 2017, Dimitrios Apostolou wrote:

So the configure script goes like this:

 if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null;
 then :
 else
   [ ... Almost 100 lines never executed ... ]
 fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL

Digging deeper into this, I believe this is the relevant code, file m4sh.m4, macro _AS_DETECT_BETTER_SHELL (with slight indentation edits by myself while struggling to follow logic):

[if test "x$CONFIG_SHELL" = x; then
  as_bourne_compatible="AS_ESCAPE(_m4_expand([_AS_BOURNE_COMPATIBLE]))"
  _AS_DETECT_EXPAND([as_required], [_AS_DETECT_REQUIRED_BODY])
  _AS_DETECT_EXPAND([as_suggested], [_AS_DETECT_SUGGESTED_BODY])
  AS_IF([_AS_RUN(["$as_required"])],
        [as_have_required=yes],
        [as_have_required=no])

  AS_IF([test x$as_have_required = xyes && _AS_RUN(["$as_suggested"])],
    [],
    [ ... long snippet trying various shells in various directories
          and setting CONFIG_SHELL accordingly ...
    ]
  )
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL


In my case, /usr/xpg4/bin/sh is a capable-enough shell, thus as_have_required is *yes* and _AS_RUN(["$as_suggested"]) *succeeds*, thus the long snippet that tries all shells, is skipped!

By reading this, it seems that the intent is to set SHELL to the *currently running shell interpreter*, since it passed all tests. But that one is not /bin/sh, since the script was manually executed with "sh ./configure" and a modified PATH.

A slight improvement would be to change the last line to search for the first "sh" in PATH:

SHELL=${CONFIG_SHELL-`command -v sh`}

The best solution would be to detect the currently running interpreter. But how?

Thanks,
Dimitris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]