make HAVE_CPP_DD a 0/1/undef mirtoconf value like the others

XXX maybe generalise the logic from there and ac_testn
XXX offer the user to give list of known signal names (and NSIG? or ignore?)
This commit is contained in:
tg 2007-06-30 19:58:51 +00:00
parent af5c570143
commit 360c956b10
1 changed files with 23 additions and 10 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# $MirOS: src/bin/mksh/Build.sh,v 1.218 2007/06/30 19:48:04 tg Exp $ # $MirOS: src/bin/mksh/Build.sh,v 1.219 2007/06/30 19:58:51 tg Exp $
#- #-
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS # Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM # CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM
@ -740,14 +740,27 @@ test 1 = $HAVE_PERSISTENT_HISTORY || \
# #
# Compiler: Praeprocessor (only if needed) # Compiler: Praeprocessor (only if needed)
# #
HAVE_CPP_DD=yes
if test 0 = $HAVE_SYS_SIGNAME; then if test 0 = $HAVE_SYS_SIGNAME; then
$e ... checking if the C Preprocessor supports -dD fd='checking if the C Preprocessor supports -dD'
eval '( echo "#define foo bar" | v "$CC -dD -E - >x" ) 2>&'$h | \ if test 0 = "$HAVE_CPP_DD"; then
sed 's/^/] /' $e "$bi==> $fd...$ao ${ui}no$ao (cached)"
grep '#define foo bar' x >/dev/null 2>&1 || HAVE_CPP_DD=no elif test 1 = "$HAVE_CPP_DD"; then
$e "$bi==> checking if the C Preprocessor supports -dD...$ao $ui$HAVE_CPP_DD$ao" $e "$bi==> $fd...$ao ${ui}yes$ao (cached)"
rm -f x else
$e ... $fd
eval '( echo "#define foo bar" | \
v "$CC -dD -E - >x" ) 2>&'$h | \
sed 's/^/] /'
if grep '#define foo bar' x >/dev/null 2>&1; then
HAVE_CPP_DD=1
fv=yes
else
HAVE_CPP_DD=0
fv=no
fi
rm -f x
$e "$bi==> $fd...$ao $ui$fv$ao"
fi
fi fi
# #
@ -763,7 +776,7 @@ ed x <x 2>/dev/null | grep 3 >/dev/null 2>&1 && \
rm -f x rm -f x
if test 0 = $HAVE_SYS_SIGNAME; then if test 0 = $HAVE_SYS_SIGNAME; then
if test $HAVE_CPP_DD = yes; then if test 1 = $HAVE_CPP_DD; then
$e Generating list of signal names... $e Generating list of signal names...
else else
$e No list of signal names available via cpp. Falling back... $e No list of signal names available via cpp. Falling back...
@ -778,7 +791,7 @@ if test 0 = $HAVE_SYS_SIGNAME; then
esac esac
NSIG=`printf %d "$NSIG" 2>/dev/null` NSIG=`printf %d "$NSIG" 2>/dev/null`
test $h = 1 && printf "NSIG=$NSIG ... " test $h = 1 && printf "NSIG=$NSIG ... "
if test $HAVE_CPP_DD = yes && test $NSIG -gt 1; then if test 1 = $HAVE_CPP_DD && test $NSIG -gt 1; then
signames=`echo '#include <signal.h>' | \ signames=`echo '#include <signal.h>' | \
vq "$CC $CPPFLAGS -dD -E -" | \ vq "$CC $CPPFLAGS -dD -E -" | \
grep '[ ]SIG[A-Z0-9]*[ ]' | \ grep '[ ]SIG[A-Z0-9]*[ ]' | \