Am 2021-08-17 um 15:11 schrieb Chet Ramey:
On 8/17/21 6:36 AM, Osipov, Michael (LDA IT PLM) wrote:
Folks,
+if test -n "$want_auto_cflags" ; then
+ AUTO_CFLAGS="-g ${GCC+-O2}"
+ STYLE_CFLAGS="${GCC+-Wno-parentheses} ${GCC+-Wno-format-security}"
+fi
This hunks seems not to be POSIX shell compliant.
It's absolutely POSIX shell compliant.
Both vars are set for me
on HP-UX because the expansion is incomplete.
The expansion is not incomplete. The gcc-specific options will be set if
the GCC variable has a value.
According to [1] it has to be
$(GCC:+..} and not $(GCC+..}.
POSIX does not say that. What it says is:
"In the parameter expansions shown previously, use of the <colon> in the
format shall result in a test for a parameter that is unset or null;
omission of the <colon> shall result in a test for a parameter that is only
unset. "
I have changed ./configure locally and it
works with /bin/sh.
It sounds like you've found a bug in the HP-UX sh.
I assume that this should also work on any other POSIX compliant shell.
It doesn't mean the same thing. Maybe you should try adding a space between
the `+' and `-' to get around the sh bug.
Darn! Chet, you are absolutely right. According to the manpage of sh(1)
on HP-Ux is is supposed to be POSIX compliant:
${parameter:+word}
If parameter is set and is nonnull, substitute word;
otherwise, substitute nothing.
...
If the colon (:) is omitted from the above expressions, the shell only
checks to determine whether or not parameter is set.
But is still logically doesn't add up. From ./configure:
if test $ac_compiler_gnu = yes; then
GCC=yes
else
GCC=
fi
So the variable is *always* set. Thus word is always substituted. I
would expect no else branch in the if clause then I would competely
agree with Chet. Removing the else block makes the sript works as expected.
What am I missing here?
Michael