[PATCH 1/4] Make configure use /bin/bash instead of /bin/sh

Vladimir Marek Vladimir.Marek at Oracle.COM
Wed Apr 11 01:43:42 PDT 2012


Hi,

> >> > Posix /bin/sh is not capable of running this configure and fails.
> >> 
> >> What fails? What would it take to make this work on posix sh instead?
> >> 
> >> The tests do require bash, but generally I think it would be preferable to
> >> not depend on bash to build.
> >
> > Well I gave it a quick stab. This is not posix:
> >
> > BLAH=$( ... )
> > BLAH=$(( ... ))
> > ${option%=*}
> > ${option%%=*}
> > ${option#=*}
> > ${option##=*}
> 
> According to 
> 
> http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
> 
> all of those are part of Shell Command Language...

Hmm, you are right. The solaris /bin/sh is older revision of posix.



> Does the configure script work if you replace /bin/sh with /bin/ksh
> in your Solaris box

yes, it does work if executed by /bin/bash or /bin/ksh


> If yes, something like the following could be added to the beginning
> of 'configure'
> 
> option=option=value
> if test ! x"${option$*=}" = x"value" 2>/dev/null; then
> 	if test x"${PREVENT_LOOPING-}" = x; then
>         	PREVENT_LOOPING=true; export PREVENT_LOOPING
>                 test ! -x /bin/ksh || exec /bin/ksh "$0" "$@"
>                 test ! -x /bin/bash || exec /bin/bash "$0" "$@"
>         fi
>         echo "Cannot find compatible shell for '$0'" >&2
>         exit 1
> fi

Unfortunately, no. The /bin/sh says "bad substitution" and does not run
the script at all. I also tried

eval 'echo ${A%%1}'; echo ok

but that does not run the 'echo ok' and fails also.


I can see three possible solutions

1) use bash or ksh in the shebang line
2) rewrite the script as I gave the overview
3) declare that solaris 10 /bin/sh is not compatible with configure
script


Frankly even 3) is viable option, one just have to remember to run
'bash configure'. If everything else would work, I would be happy :)

Thank you
-- 
	Vlad


More information about the notmuch mailing list