2005-05-23 18:48:52 +02:00
|
|
|
|
#!/bin/sh
|
2017-04-12 20:33:23 +02:00
|
|
|
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.716 2017/04/12 18:33:22 tg Exp $'
|
2009-05-16 18:59:42 +02:00
|
|
|
|
#-
|
2012-01-03 01:58:09 +01:00
|
|
|
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
2017-03-18 00:47:05 +01:00
|
|
|
|
# 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
2015-10-05 19:59:00 +02:00
|
|
|
|
# mirabilos <m@mirbsd.org>
|
2009-05-16 18:59:42 +02:00
|
|
|
|
#
|
|
|
|
|
# Provided that these terms and disclaimer and all copyright notices
|
|
|
|
|
# are retained or reproduced in an accompanying document, permission
|
|
|
|
|
# is granted to deal in this work without restriction, including un-
|
|
|
|
|
# limited rights to use, publicly perform, distribute, sell, modify,
|
|
|
|
|
# merge, give away, or sublicence.
|
|
|
|
|
#
|
|
|
|
|
# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
|
|
|
|
|
# the utmost extent permitted by applicable law, neither express nor
|
|
|
|
|
# implied; without malicious intent or gross negligence. In no event
|
|
|
|
|
# may a licensor, author or contributor be held liable for indirect,
|
|
|
|
|
# direct, other damage, loss, or other issues arising in any way out
|
|
|
|
|
# of dealing in the work, even if advised of the possibility of such
|
|
|
|
|
# damage or existence of a defect, except proven that it results out
|
|
|
|
|
# of said person's immediate fault when using the work as intended.
|
2005-05-23 18:56:22 +02:00
|
|
|
|
#-
|
2010-02-17 00:53:28 +01:00
|
|
|
|
# People analysing the output must whitelist conftest.c for any kind
|
|
|
|
|
# of compiler warning checks (mirtoconf is by design not quiet).
|
|
|
|
|
#
|
2011-12-02 23:55:49 +01:00
|
|
|
|
# Used environment documentation is at the end of this file.
|
2005-05-23 18:48:52 +02:00
|
|
|
|
|
2008-05-04 02:55:18 +02:00
|
|
|
|
LC_ALL=C
|
|
|
|
|
export LC_ALL
|
|
|
|
|
|
2012-09-18 16:18:59 +02:00
|
|
|
|
case $ZSH_VERSION:$VERSION in
|
|
|
|
|
:zsh*) ZSH_VERSION=2 ;;
|
|
|
|
|
esac
|
|
|
|
|
|
2012-04-01 04:35:33 +02:00
|
|
|
|
if test -n "${ZSH_VERSION+x}" && (emulate sh) >/dev/null 2>&1; then
|
|
|
|
|
emulate sh
|
|
|
|
|
NULLCMD=:
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if test -d /usr/xpg4/bin/. >/dev/null 2>&1; then
|
|
|
|
|
# Solaris: some of the tools have weird behaviour, use portable ones
|
|
|
|
|
PATH=/usr/xpg4/bin:$PATH
|
|
|
|
|
export PATH
|
|
|
|
|
fi
|
|
|
|
|
|
2013-11-30 16:42:19 +01:00
|
|
|
|
nl='
|
|
|
|
|
'
|
|
|
|
|
safeIFS=' '
|
|
|
|
|
safeIFS=" $safeIFS$nl"
|
|
|
|
|
IFS=$safeIFS
|
|
|
|
|
allu=QWERTYUIOPASDFGHJKLZXCVBNM
|
|
|
|
|
alll=qwertyuiopasdfghjklzxcvbnm
|
|
|
|
|
alln=0123456789
|
|
|
|
|
alls=______________________________________________________________
|
|
|
|
|
|
|
|
|
|
genopt_die() {
|
|
|
|
|
if test -n "$1"; then
|
|
|
|
|
echo >&2 "E: $*"
|
|
|
|
|
echo >&2 "E: in '$srcfile': '$line'"
|
|
|
|
|
else
|
|
|
|
|
echo >&2 "E: invalid input in '$srcfile': '$line'"
|
|
|
|
|
fi
|
|
|
|
|
rm -f "$bn.gen"
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
genopt_soptc() {
|
|
|
|
|
optc=`echo "$line" | sed 's/^[<>]\(.\).*$/\1/'`
|
|
|
|
|
test x"$optc" = x'|' && return
|
|
|
|
|
optclo=`echo "$optc" | tr $allu $alll`
|
|
|
|
|
if test x"$optc" = x"$optclo"; then
|
|
|
|
|
islo=1
|
|
|
|
|
else
|
|
|
|
|
islo=0
|
|
|
|
|
fi
|
|
|
|
|
sym=`echo "$line" | sed 's/^[<>]/|/'`
|
|
|
|
|
o_str=$o_str$nl"<$optclo$islo$sym"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
genopt_scond() {
|
|
|
|
|
case x$cond in
|
|
|
|
|
x)
|
|
|
|
|
cond=
|
|
|
|
|
;;
|
|
|
|
|
x*' '*)
|
|
|
|
|
cond=`echo "$cond" | sed 's/^ //'`
|
|
|
|
|
cond="#if $cond"
|
|
|
|
|
;;
|
|
|
|
|
x'!'*)
|
|
|
|
|
cond=`echo "$cond" | sed 's/^!//'`
|
|
|
|
|
cond="#ifndef $cond"
|
|
|
|
|
;;
|
|
|
|
|
x*)
|
|
|
|
|
cond="#ifdef $cond"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
do_genopt() {
|
|
|
|
|
srcfile=$1
|
|
|
|
|
test -f "$srcfile" || genopt_die Source file \$srcfile not set.
|
|
|
|
|
bn=`basename "$srcfile" | sed 's/.opt$//'`
|
2015-12-12 23:25:15 +01:00
|
|
|
|
o_hdr='/* +++ GENERATED FILE +++ DO NOT EDIT +++ */'
|
2013-11-30 16:42:19 +01:00
|
|
|
|
o_gen=
|
|
|
|
|
o_str=
|
|
|
|
|
o_sym=
|
|
|
|
|
ddefs=
|
|
|
|
|
state=0
|
|
|
|
|
exec <"$srcfile"
|
|
|
|
|
IFS=
|
2013-12-02 20:47:33 +01:00
|
|
|
|
while IFS= read line; do
|
2013-11-30 16:42:19 +01:00
|
|
|
|
IFS=$safeIFS
|
|
|
|
|
case $state:$line in
|
|
|
|
|
2:'|'*)
|
|
|
|
|
# end of input
|
|
|
|
|
o_sym=`echo "$line" | sed 's/^.//'`
|
|
|
|
|
o_gen=$o_gen$nl"#undef F0"
|
|
|
|
|
o_gen=$o_gen$nl"#undef FN"
|
|
|
|
|
o_gen=$o_gen$ddefs
|
|
|
|
|
state=3
|
|
|
|
|
;;
|
|
|
|
|
1:@@)
|
2016-09-01 14:59:12 +02:00
|
|
|
|
# start of data block
|
2013-11-30 16:42:19 +01:00
|
|
|
|
o_gen=$o_gen$nl"#endif"
|
|
|
|
|
o_gen=$o_gen$nl"#ifndef F0"
|
|
|
|
|
o_gen=$o_gen$nl"#define F0 FN"
|
|
|
|
|
o_gen=$o_gen$nl"#endif"
|
|
|
|
|
state=2
|
|
|
|
|
;;
|
|
|
|
|
*:@@*)
|
|
|
|
|
genopt_die ;;
|
2015-12-12 23:25:15 +01:00
|
|
|
|
0:/\*-|0:\ \**|0:)
|
|
|
|
|
o_hdr=$o_hdr$nl$line
|
|
|
|
|
;;
|
2013-11-30 16:42:19 +01:00
|
|
|
|
0:@*|1:@*)
|
2016-09-01 14:59:12 +02:00
|
|
|
|
# start of a definition block
|
2013-11-30 16:42:19 +01:00
|
|
|
|
sym=`echo "$line" | sed 's/^@//'`
|
|
|
|
|
if test $state = 0; then
|
|
|
|
|
o_gen=$o_gen$nl"#if defined($sym)"
|
|
|
|
|
else
|
|
|
|
|
o_gen=$o_gen$nl"#elif defined($sym)"
|
|
|
|
|
fi
|
|
|
|
|
ddefs="$ddefs$nl#undef $sym"
|
|
|
|
|
state=1
|
|
|
|
|
;;
|
|
|
|
|
0:*|3:*)
|
|
|
|
|
genopt_die ;;
|
|
|
|
|
1:*)
|
|
|
|
|
# definition line
|
|
|
|
|
o_gen=$o_gen$nl$line
|
|
|
|
|
;;
|
|
|
|
|
2:'<'*'|'*)
|
|
|
|
|
genopt_soptc
|
|
|
|
|
;;
|
|
|
|
|
2:'>'*'|'*)
|
|
|
|
|
genopt_soptc
|
|
|
|
|
cond=`echo "$line" | sed 's/^[^|]*|//'`
|
|
|
|
|
genopt_scond
|
|
|
|
|
case $optc in
|
|
|
|
|
'|') optc=0 ;;
|
|
|
|
|
*) optc=\'$optc\' ;;
|
|
|
|
|
esac
|
2013-12-02 20:47:33 +01:00
|
|
|
|
IFS= read line || genopt_die Unexpected EOF
|
2013-11-30 16:42:19 +01:00
|
|
|
|
IFS=$safeIFS
|
|
|
|
|
test -n "$cond" && o_gen=$o_gen$nl"$cond"
|
|
|
|
|
o_gen=$o_gen$nl"$line, $optc)"
|
|
|
|
|
test -n "$cond" && o_gen=$o_gen$nl"#endif"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
case $state:$o_sym in
|
|
|
|
|
3:) genopt_die Expected optc sym at EOF ;;
|
|
|
|
|
3:*) ;;
|
|
|
|
|
*) genopt_die Missing EOF marker ;;
|
|
|
|
|
esac
|
2013-12-02 20:47:33 +01:00
|
|
|
|
echo "$o_str" | sort | while IFS='|' read x opts cond; do
|
2013-11-30 16:42:19 +01:00
|
|
|
|
IFS=$safeIFS
|
|
|
|
|
test -n "$x" || continue
|
|
|
|
|
genopt_scond
|
|
|
|
|
test -n "$cond" && echo "$cond"
|
|
|
|
|
echo "\"$opts\""
|
|
|
|
|
test -n "$cond" && echo "#endif"
|
|
|
|
|
done | {
|
2015-12-12 23:25:15 +01:00
|
|
|
|
echo "$o_hdr"
|
2013-11-30 16:42:19 +01:00
|
|
|
|
echo "#ifndef $o_sym$o_gen"
|
|
|
|
|
echo "#else"
|
|
|
|
|
cat
|
|
|
|
|
echo "#undef $o_sym"
|
|
|
|
|
echo "#endif"
|
|
|
|
|
} >"$bn.gen"
|
|
|
|
|
IFS=$safeIFS
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if test x"$BUILDSH_RUN_GENOPT" = x"1"; then
|
|
|
|
|
set x -G "$srcfile"
|
|
|
|
|
shift
|
|
|
|
|
fi
|
|
|
|
|
if test x"$1" = x"-G"; then
|
|
|
|
|
do_genopt "$2"
|
|
|
|
|
exit $?
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "For the build logs, demonstrate that /dev/null and /dev/tty exist:"
|
|
|
|
|
ls -l /dev/null /dev/tty
|
|
|
|
|
|
2007-06-30 22:57:55 +02:00
|
|
|
|
v() {
|
2006-08-28 03:30:37 +02:00
|
|
|
|
$e "$*"
|
|
|
|
|
eval "$@"
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-03 20:40:08 +01:00
|
|
|
|
vv() {
|
|
|
|
|
_c=$1
|
|
|
|
|
shift
|
2008-09-30 19:34:25 +02:00
|
|
|
|
$e "\$ $*" 2>&1
|
2010-01-01 19:27:42 +01:00
|
|
|
|
eval "$@" >vv.out 2>&1
|
|
|
|
|
sed "s^${_c} " <vv.out
|
2008-03-03 20:40:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-06-30 22:57:55 +02:00
|
|
|
|
vq() {
|
2007-01-12 03:01:48 +01:00
|
|
|
|
eval "$@"
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf() {
|
|
|
|
|
for _f in "$@"; do
|
2012-06-26 21:33:33 +02:00
|
|
|
|
case $_f in
|
2013-11-30 16:42:19 +01:00
|
|
|
|
Build.sh|check.pl|check.t|dot.mkshrc|*.1|*.c|*.h|*.ico|*.opt) ;;
|
2012-06-26 21:33:33 +02:00
|
|
|
|
*) rm -f "$_f" ;;
|
2010-02-23 23:02:19 +01:00
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-10 20:19:12 +01:00
|
|
|
|
tcfn=no
|
2007-06-30 22:57:55 +02:00
|
|
|
|
bi=
|
|
|
|
|
ui=
|
|
|
|
|
ao=
|
|
|
|
|
fx=
|
|
|
|
|
me=`basename "$0"`
|
2007-06-30 23:34:23 +02:00
|
|
|
|
orig_CFLAGS=$CFLAGS
|
2008-03-05 20:59:27 +01:00
|
|
|
|
phase=x
|
2008-11-08 18:36:35 +01:00
|
|
|
|
oldish_ed=stdout-ed,no-stderr-ed
|
2007-01-18 16:50:32 +01:00
|
|
|
|
|
2007-06-30 22:57:55 +02:00
|
|
|
|
if test -t 1; then
|
|
|
|
|
bi='[1m'
|
|
|
|
|
ui='[4m'
|
|
|
|
|
ao='[0m'
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
upper() {
|
2008-02-29 17:38:41 +01:00
|
|
|
|
echo :"$@" | sed 's/^://' | tr $alll $allu
|
2006-11-09 01:01:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-06-30 22:57:55 +02:00
|
|
|
|
# clean up after ac_testrun()
|
|
|
|
|
ac_testdone() {
|
|
|
|
|
eval HAVE_$fu=$fv
|
|
|
|
|
fr=no
|
|
|
|
|
test 0 = $fv || fr=yes
|
|
|
|
|
$e "$bi==> $fd...$ao $ui$fr$ao$fx"
|
|
|
|
|
fx=
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# ac_cache label: sets f, fu, fv?=0
|
|
|
|
|
ac_cache() {
|
2006-11-09 00:38:28 +01:00
|
|
|
|
f=$1
|
2006-11-09 01:06:33 +01:00
|
|
|
|
fu=`upper $f`
|
2007-06-30 22:57:55 +02:00
|
|
|
|
eval fv=\$HAVE_$fu
|
|
|
|
|
case $fv in
|
|
|
|
|
0|1)
|
|
|
|
|
fx=' (cached)'
|
|
|
|
|
return 0
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
fv=0
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# ac_testinit label [!] checkif[!]0 [setlabelifcheckis[!]0] useroutput
|
|
|
|
|
# returns 1 if value was cached/implied, 0 otherwise: call ac_testdone
|
|
|
|
|
ac_testinit() {
|
|
|
|
|
if ac_cache $1; then
|
2007-07-01 23:47:08 +02:00
|
|
|
|
test x"$2" = x"!" && shift
|
|
|
|
|
test x"$2" = x"" || shift
|
2007-09-09 20:30:04 +02:00
|
|
|
|
fd=${3-$f}
|
2007-06-30 22:57:55 +02:00
|
|
|
|
ac_testdone
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
Clean up the signal mess, saves 172 Bytes:
* 'sigseen' in Build.sh goes away
* Signal name existence is checked in this order:
have our own¹ -> sys_signame[] -> _sys_signame[] -> build our own²
* Signal description existence is checked in this order:
sys_siglist[] -> _sys_siglist[] -> strsignal() -> NULL³
¹ Predefined list of items, for operating systems where we
cannot build² them, i.e. Plan 9 and Minix 3 (e.g. no $CPP -dD)
² The usual cpp(1) stuff
³ Changed later, see below
* Make $CPP test dependent on $NEED_MKSH_SIGNAME (others can
be added here, this is not absolute)
* Make signal name list generation² dependent on $NEED_MKSH_SIGNAME
* Fix check if the generation worked
* Guarantee that sigtraps[*].name and sigtraps[*].mess are valid
C strings; this makes the code shorter *and* removes a few pos-
sible nil pointer dereferences
* Embed autoconf'd usages of sys_sig* / strsignal / mksh_sigpairs
into inittraps()
* Check for each signal 0<=i<=NSIG that
name is not NULL or "" -> replace with ("%d", i)
mess is not NULL or "" -> replace with ("Signal %d", i)
name does not start (case-insensitive) with "SIG" -> name += 3
* In gettrap(), fix check if signal name starts, case-sensitive
or case-insensitive, depending on need, with "SIG" (bug from millert@)
Other changes:
* Build.sh: ac_test[n]() are documented
* Build.sh: ac_test[n]() can have negative prereqs as well now
* Build.sh: use <<-'EOF' consistently
* bump patchlevel to today
2007-01-12 01:25:40 +01:00
|
|
|
|
fc=0
|
2006-11-09 00:38:28 +01:00
|
|
|
|
if test x"$2" = x""; then
|
|
|
|
|
ft=1
|
|
|
|
|
else
|
Clean up the signal mess, saves 172 Bytes:
* 'sigseen' in Build.sh goes away
* Signal name existence is checked in this order:
have our own¹ -> sys_signame[] -> _sys_signame[] -> build our own²
* Signal description existence is checked in this order:
sys_siglist[] -> _sys_siglist[] -> strsignal() -> NULL³
¹ Predefined list of items, for operating systems where we
cannot build² them, i.e. Plan 9 and Minix 3 (e.g. no $CPP -dD)
² The usual cpp(1) stuff
³ Changed later, see below
* Make $CPP test dependent on $NEED_MKSH_SIGNAME (others can
be added here, this is not absolute)
* Make signal name list generation² dependent on $NEED_MKSH_SIGNAME
* Fix check if the generation worked
* Guarantee that sigtraps[*].name and sigtraps[*].mess are valid
C strings; this makes the code shorter *and* removes a few pos-
sible nil pointer dereferences
* Embed autoconf'd usages of sys_sig* / strsignal / mksh_sigpairs
into inittraps()
* Check for each signal 0<=i<=NSIG that
name is not NULL or "" -> replace with ("%d", i)
mess is not NULL or "" -> replace with ("Signal %d", i)
name does not start (case-insensitive) with "SIG" -> name += 3
* In gettrap(), fix check if signal name starts, case-sensitive
or case-insensitive, depending on need, with "SIG" (bug from millert@)
Other changes:
* Build.sh: ac_test[n]() are documented
* Build.sh: ac_test[n]() can have negative prereqs as well now
* Build.sh: use <<-'EOF' consistently
* bump patchlevel to today
2007-01-12 01:25:40 +01:00
|
|
|
|
if test x"$2" = x"!"; then
|
|
|
|
|
fc=1
|
|
|
|
|
shift
|
|
|
|
|
fi
|
2006-11-09 23:56:09 +01:00
|
|
|
|
eval ft=\$HAVE_`upper $2`
|
2006-11-09 23:51:49 +01:00
|
|
|
|
shift
|
2006-11-09 00:38:28 +01:00
|
|
|
|
fi
|
2007-09-09 20:30:04 +02:00
|
|
|
|
fd=${3-$f}
|
Clean up the signal mess, saves 172 Bytes:
* 'sigseen' in Build.sh goes away
* Signal name existence is checked in this order:
have our own¹ -> sys_signame[] -> _sys_signame[] -> build our own²
* Signal description existence is checked in this order:
sys_siglist[] -> _sys_siglist[] -> strsignal() -> NULL³
¹ Predefined list of items, for operating systems where we
cannot build² them, i.e. Plan 9 and Minix 3 (e.g. no $CPP -dD)
² The usual cpp(1) stuff
³ Changed later, see below
* Make $CPP test dependent on $NEED_MKSH_SIGNAME (others can
be added here, this is not absolute)
* Make signal name list generation² dependent on $NEED_MKSH_SIGNAME
* Fix check if the generation worked
* Guarantee that sigtraps[*].name and sigtraps[*].mess are valid
C strings; this makes the code shorter *and* removes a few pos-
sible nil pointer dereferences
* Embed autoconf'd usages of sys_sig* / strsignal / mksh_sigpairs
into inittraps()
* Check for each signal 0<=i<=NSIG that
name is not NULL or "" -> replace with ("%d", i)
mess is not NULL or "" -> replace with ("Signal %d", i)
name does not start (case-insensitive) with "SIG" -> name += 3
* In gettrap(), fix check if signal name starts, case-sensitive
or case-insensitive, depending on need, with "SIG" (bug from millert@)
Other changes:
* Build.sh: ac_test[n]() are documented
* Build.sh: ac_test[n]() can have negative prereqs as well now
* Build.sh: use <<-'EOF' consistently
* bump patchlevel to today
2007-01-12 01:25:40 +01:00
|
|
|
|
if test $fc = "$ft"; then
|
2006-11-10 08:18:58 +01:00
|
|
|
|
fv=$2
|
2007-06-30 22:57:55 +02:00
|
|
|
|
fx=' (implied)'
|
|
|
|
|
ac_testdone
|
|
|
|
|
return 1
|
2006-11-09 00:38:28 +01:00
|
|
|
|
fi
|
2006-11-09 00:45:47 +01:00
|
|
|
|
$e ... $fd
|
2007-06-30 22:57:55 +02:00
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# pipe .c | ac_test[n] [!] label [!] checkif[!]0 [setlabelifcheckis[!]0] useroutput
|
2011-12-31 03:04:18 +01:00
|
|
|
|
ac_testnnd() {
|
2007-06-30 22:57:55 +02:00
|
|
|
|
if test x"$1" = x"!"; then
|
2007-06-30 23:34:23 +02:00
|
|
|
|
fr=1
|
2007-06-30 22:57:55 +02:00
|
|
|
|
shift
|
|
|
|
|
else
|
2007-06-30 23:34:23 +02:00
|
|
|
|
fr=0
|
2007-06-30 22:57:55 +02:00
|
|
|
|
fi
|
2012-02-17 14:59:56 +01:00
|
|
|
|
ac_testinit "$@" || return 1
|
2010-01-25 13:16:04 +01:00
|
|
|
|
cat >conftest.c
|
2010-02-17 00:53:28 +01:00
|
|
|
|
vv ']' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN conftest.c $LIBS $ccpr"
|
2008-03-05 18:52:43 +01:00
|
|
|
|
test $tcfn = no && test -f a.out && tcfn=a.out
|
|
|
|
|
test $tcfn = no && test -f a.exe && tcfn=a.exe
|
2015-07-09 21:19:10 +02:00
|
|
|
|
test $tcfn = no && test -f conftest.exe && tcfn=conftest.exe
|
2010-01-25 13:16:04 +01:00
|
|
|
|
test $tcfn = no && test -f conftest && tcfn=conftest
|
2007-03-10 20:19:12 +01:00
|
|
|
|
if test -f $tcfn; then
|
2007-09-11 19:47:25 +02:00
|
|
|
|
test 1 = $fr || fv=1
|
2007-05-24 11:22:58 +02:00
|
|
|
|
else
|
2007-09-11 19:47:25 +02:00
|
|
|
|
test 0 = $fr || fv=1
|
2006-11-09 00:38:28 +01:00
|
|
|
|
fi
|
2010-01-01 19:27:42 +01:00
|
|
|
|
vscan=
|
|
|
|
|
if test $phase = u; then
|
|
|
|
|
test $ct = gcc && vscan='unrecogni[sz]ed'
|
|
|
|
|
test $ct = hpcc && vscan='unsupported'
|
|
|
|
|
test $ct = pcc && vscan='unsupported'
|
2010-03-30 15:29:03 +02:00
|
|
|
|
test $ct = sunpro && vscan='-e ignored -e turned.off'
|
2010-01-01 19:27:42 +01:00
|
|
|
|
fi
|
2010-03-30 15:29:03 +02:00
|
|
|
|
test -n "$vscan" && grep $vscan vv.out >/dev/null 2>&1 && fv=$fr
|
2012-02-17 14:59:56 +01:00
|
|
|
|
return 0
|
2011-12-31 03:04:18 +01:00
|
|
|
|
}
|
|
|
|
|
ac_testn() {
|
2012-02-17 14:59:56 +01:00
|
|
|
|
ac_testnnd "$@" || return
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf conftest.c conftest.o ${tcfn}* vv.out
|
2007-06-30 22:57:55 +02:00
|
|
|
|
ac_testdone
|
2006-11-09 23:56:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
2009-07-19 16:59:40 +02:00
|
|
|
|
# ac_ifcpp cppexpr [!] label [!] checkif[!]0 [setlabelifcheckis[!]0] useroutput
|
|
|
|
|
ac_ifcpp() {
|
|
|
|
|
expr=$1; shift
|
|
|
|
|
ac_testn "$@" <<-EOF
|
2014-01-05 22:57:29 +01:00
|
|
|
|
#include <unistd.h>
|
2013-05-22 20:56:50 +02:00
|
|
|
|
extern int thiswillneverbedefinedIhope(void);
|
2014-01-05 22:57:29 +01:00
|
|
|
|
int main(void) { return (isatty(0) +
|
2009-07-19 16:59:40 +02:00
|
|
|
|
#$expr
|
|
|
|
|
0
|
|
|
|
|
#else
|
|
|
|
|
/* force a failure: expr is false */
|
|
|
|
|
thiswillneverbedefinedIhope()
|
|
|
|
|
#endif
|
|
|
|
|
); }
|
|
|
|
|
EOF
|
|
|
|
|
test x"$1" = x"!" && shift
|
|
|
|
|
f=$1
|
|
|
|
|
fu=`upper $f`
|
|
|
|
|
eval fv=\$HAVE_$fu
|
|
|
|
|
test x"$fv" = x"1"
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags() {
|
|
|
|
|
CPPFLAGS="$CPPFLAGS $*"
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_cppflags() {
|
|
|
|
|
test x"$1" = x"" || fu=$1
|
|
|
|
|
fv=$2
|
|
|
|
|
test x"$2" = x"" && eval fv=\$HAVE_$fu
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -DHAVE_$fu=$fv
|
2007-06-30 23:34:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
2007-06-30 22:57:55 +02:00
|
|
|
|
ac_test() {
|
2006-11-09 23:56:09 +01:00
|
|
|
|
ac_testn "$@"
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_cppflags
|
2006-08-26 22:48:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-05 20:16:19 +02:00
|
|
|
|
# ac_flags [-] add varname cflags [text] [ldflags]
|
2007-06-30 22:57:55 +02:00
|
|
|
|
ac_flags() {
|
2007-06-04 22:00:50 +02:00
|
|
|
|
if test x"$1" = x"-"; then
|
|
|
|
|
shift
|
|
|
|
|
hf=1
|
|
|
|
|
else
|
|
|
|
|
hf=0
|
|
|
|
|
fi
|
2007-01-17 17:57:41 +01:00
|
|
|
|
fa=$1
|
|
|
|
|
vn=$2
|
|
|
|
|
f=$3
|
|
|
|
|
ft=$4
|
2011-06-05 20:16:19 +02:00
|
|
|
|
fl=$5
|
2007-01-17 17:39:55 +01:00
|
|
|
|
test x"$ft" = x"" && ft="if $f can be used"
|
|
|
|
|
save_CFLAGS=$CFLAGS
|
|
|
|
|
CFLAGS="$CFLAGS $f"
|
2011-06-05 20:16:19 +02:00
|
|
|
|
if test -n "$fl"; then
|
|
|
|
|
save_LDFLAGS=$LDFLAGS
|
|
|
|
|
LDFLAGS="$LDFLAGS $fl"
|
|
|
|
|
fi
|
2007-09-11 19:47:25 +02:00
|
|
|
|
if test 1 = $hf; then
|
2007-06-04 22:00:50 +02:00
|
|
|
|
ac_testn can_$vn '' "$ft"
|
|
|
|
|
else
|
|
|
|
|
ac_testn can_$vn '' "$ft" <<-'EOF'
|
2009-10-15 18:50:21 +02:00
|
|
|
|
/* evil apo'stroph in comment test */
|
2014-01-05 22:57:29 +01:00
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) { return (isatty(0)); }
|
2007-06-04 22:00:50 +02:00
|
|
|
|
EOF
|
|
|
|
|
fi
|
2007-01-17 17:44:19 +01:00
|
|
|
|
eval fv=\$HAVE_CAN_`upper $vn`
|
2011-06-05 20:16:19 +02:00
|
|
|
|
if test -n "$fl"; then
|
|
|
|
|
test 11 = $fa$fv || LDFLAGS=$save_LDFLAGS
|
|
|
|
|
fi
|
2007-01-17 17:57:41 +01:00
|
|
|
|
test 11 = $fa$fv || CFLAGS=$save_CFLAGS
|
2007-01-17 17:39:55 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-09-09 13:04:30 +02:00
|
|
|
|
# ac_header [!] header [prereq ...]
|
2007-06-30 22:57:55 +02:00
|
|
|
|
ac_header() {
|
2007-09-09 13:04:30 +02:00
|
|
|
|
if test x"$1" = x"!"; then
|
|
|
|
|
na=1
|
|
|
|
|
shift
|
|
|
|
|
else
|
|
|
|
|
na=0
|
|
|
|
|
fi
|
2007-01-18 16:50:32 +01:00
|
|
|
|
hf=$1; shift
|
2008-02-29 17:38:41 +01:00
|
|
|
|
hv=`echo "$hf" | tr -d '\012\015' | tr -c $alll$allu$alln $alls`
|
2012-04-01 04:35:33 +02:00
|
|
|
|
echo "/* NeXTstep bug workaround */" >x
|
2007-01-18 16:50:32 +01:00
|
|
|
|
for i
|
|
|
|
|
do
|
2012-12-17 22:55:06 +01:00
|
|
|
|
case $i in
|
|
|
|
|
_time)
|
|
|
|
|
echo '#if HAVE_BOTH_TIME_H' >>x
|
|
|
|
|
echo '#include <sys/time.h>' >>x
|
|
|
|
|
echo '#include <time.h>' >>x
|
|
|
|
|
echo '#elif HAVE_SYS_TIME_H' >>x
|
|
|
|
|
echo '#include <sys/time.h>' >>x
|
|
|
|
|
echo '#elif HAVE_TIME_H' >>x
|
|
|
|
|
echo '#include <time.h>' >>x
|
|
|
|
|
echo '#endif' >>x
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
echo "#include <$i>" >>x
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2007-01-18 16:50:32 +01:00
|
|
|
|
done
|
|
|
|
|
echo "#include <$hf>" >>x
|
2014-01-05 22:57:29 +01:00
|
|
|
|
echo '#include <unistd.h>' >>x
|
|
|
|
|
echo 'int main(void) { return (isatty(0)); }' >>x
|
2007-09-09 13:04:30 +02:00
|
|
|
|
ac_testn "$hv" "" "<$hf>" <x
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf x
|
2007-09-11 19:47:25 +02:00
|
|
|
|
test 1 = $na || ac_cppflags
|
2007-01-18 16:50:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2007-06-30 22:57:55 +02:00
|
|
|
|
addsrcs() {
|
2009-07-30 21:11:12 +02:00
|
|
|
|
if test x"$1" = x"!"; then
|
|
|
|
|
fr=0
|
|
|
|
|
shift
|
|
|
|
|
else
|
|
|
|
|
fr=1
|
|
|
|
|
fi
|
2006-11-09 00:38:28 +01:00
|
|
|
|
eval i=\$$1
|
2009-07-30 21:11:12 +02:00
|
|
|
|
test $fr = "$i" && case " $SRCS " in
|
2006-11-09 00:38:28 +01:00
|
|
|
|
*\ $2\ *) ;;
|
|
|
|
|
*) SRCS="$SRCS $2" ;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
|
2013-11-17 23:21:18 +01:00
|
|
|
|
curdir=`pwd` srcdir=`dirname "$0" 2>/dev/null`
|
|
|
|
|
case x$srcdir in
|
2013-11-20 22:14:50 +01:00
|
|
|
|
x)
|
|
|
|
|
srcdir=.
|
|
|
|
|
;;
|
|
|
|
|
*\ *|*" "*|*"$nl"*)
|
|
|
|
|
echo >&2 Source directory should not contain space or tab or newline.
|
|
|
|
|
echo >&2 Errors may occur.
|
|
|
|
|
;;
|
|
|
|
|
*"'"*)
|
|
|
|
|
echo Source directory must not contain single quotes.
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
2013-11-17 23:21:18 +01:00
|
|
|
|
esac
|
|
|
|
|
dstversion=`sed -n '/define MKSH_VERSION/s/^.*"\([^"]*\)".*$/\1/p' "$srcdir/sh.h"`
|
2012-03-28 01:13:42 +02:00
|
|
|
|
add_cppflags -DMKSH_BUILDSH
|
2006-08-12 20:48:39 +02:00
|
|
|
|
|
2005-06-09 00:42:31 +02:00
|
|
|
|
e=echo
|
|
|
|
|
r=0
|
2007-05-28 15:47:09 +02:00
|
|
|
|
eq=0
|
2007-10-09 16:29:42 +02:00
|
|
|
|
pm=0
|
2009-10-16 20:45:31 +02:00
|
|
|
|
cm=normal
|
2010-05-13 20:41:13 +02:00
|
|
|
|
optflags=-std-compile-opts
|
2013-11-17 23:21:18 +01:00
|
|
|
|
check_categories=
|
2010-05-13 20:41:13 +02:00
|
|
|
|
last=
|
2012-06-24 22:47:07 +02:00
|
|
|
|
tfn=
|
2012-06-25 18:05:10 +02:00
|
|
|
|
legacy=0
|
2017-04-02 16:14:08 +02:00
|
|
|
|
textmode=0
|
2005-06-09 00:42:31 +02:00
|
|
|
|
|
2006-08-12 22:19:36 +02:00
|
|
|
|
for i
|
|
|
|
|
do
|
2010-05-13 20:41:13 +02:00
|
|
|
|
case $last:$i in
|
2011-06-05 20:16:19 +02:00
|
|
|
|
c:combine|c:dragonegg|c:llvm|c:lto)
|
2010-05-13 20:41:13 +02:00
|
|
|
|
cm=$i
|
|
|
|
|
last=
|
|
|
|
|
;;
|
|
|
|
|
c:*)
|
|
|
|
|
echo "$me: Unknown option -c '$i'!" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
o:*)
|
|
|
|
|
optflags=$i
|
|
|
|
|
last=
|
2007-10-09 16:29:42 +02:00
|
|
|
|
;;
|
2012-06-24 22:46:07 +02:00
|
|
|
|
t:*)
|
|
|
|
|
tfn=$i
|
|
|
|
|
last=
|
|
|
|
|
;;
|
2010-05-13 20:41:13 +02:00
|
|
|
|
:-c)
|
|
|
|
|
last=c
|
|
|
|
|
;;
|
2013-11-30 16:42:19 +01:00
|
|
|
|
:-G)
|
|
|
|
|
echo "$me: Do not call me with '-G'!" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
2010-05-13 20:41:13 +02:00
|
|
|
|
:-g)
|
|
|
|
|
# checker, debug, valgrind build
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -DDEBUG
|
2010-05-13 20:41:13 +02:00
|
|
|
|
CFLAGS="$CFLAGS -g3 -fno-builtin"
|
|
|
|
|
;;
|
|
|
|
|
:-j)
|
|
|
|
|
pm=1
|
|
|
|
|
;;
|
2012-06-25 18:05:10 +02:00
|
|
|
|
:-L)
|
|
|
|
|
legacy=1
|
|
|
|
|
;;
|
|
|
|
|
:+L)
|
|
|
|
|
legacy=0
|
|
|
|
|
;;
|
2010-05-13 20:41:13 +02:00
|
|
|
|
:-M)
|
2009-10-16 20:45:31 +02:00
|
|
|
|
cm=makefile
|
|
|
|
|
;;
|
2010-05-13 20:41:13 +02:00
|
|
|
|
:-O)
|
|
|
|
|
optflags=-std-compile-opts
|
|
|
|
|
;;
|
|
|
|
|
:-o)
|
|
|
|
|
last=o
|
|
|
|
|
;;
|
|
|
|
|
:-Q)
|
2007-05-28 15:47:09 +02:00
|
|
|
|
eq=1
|
|
|
|
|
;;
|
2010-05-13 20:41:13 +02:00
|
|
|
|
:-r)
|
2005-06-09 00:42:31 +02:00
|
|
|
|
r=1
|
|
|
|
|
;;
|
2017-04-02 16:14:08 +02:00
|
|
|
|
:-T)
|
|
|
|
|
textmode=1
|
|
|
|
|
;;
|
|
|
|
|
:+T)
|
|
|
|
|
textmode=0
|
|
|
|
|
;;
|
2012-06-24 22:46:07 +02:00
|
|
|
|
:-t)
|
|
|
|
|
last=t
|
|
|
|
|
;;
|
2010-05-13 20:41:13 +02:00
|
|
|
|
:-v)
|
|
|
|
|
echo "Build.sh $srcversion"
|
|
|
|
|
echo "for mksh $dstversion"
|
|
|
|
|
exit 0
|
2010-01-28 18:03:22 +01:00
|
|
|
|
;;
|
2010-05-13 20:41:13 +02:00
|
|
|
|
:*)
|
2007-06-30 22:57:55 +02:00
|
|
|
|
echo "$me: Unknown option '$i'!" >&2
|
2005-06-09 00:42:31 +02:00
|
|
|
|
exit 1
|
|
|
|
|
;;
|
2010-05-13 20:41:13 +02:00
|
|
|
|
*)
|
|
|
|
|
echo "$me: Unknown option -'$last' '$i'!" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
2005-06-09 00:42:31 +02:00
|
|
|
|
esac
|
|
|
|
|
done
|
2010-05-13 20:41:13 +02:00
|
|
|
|
if test -n "$last"; then
|
|
|
|
|
echo "$me: Option -'$last' not followed by argument!" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2005-05-23 18:48:52 +02:00
|
|
|
|
|
2012-06-25 18:05:10 +02:00
|
|
|
|
test -z "$tfn" && if test $legacy = 0; then
|
|
|
|
|
tfn=mksh
|
|
|
|
|
else
|
|
|
|
|
tfn=lksh
|
|
|
|
|
fi
|
2012-06-24 22:46:07 +02:00
|
|
|
|
if test -d $tfn || test -d $tfn.exe; then
|
|
|
|
|
echo "$me: Error: ./$tfn is a directory!" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2015-07-09 21:28:21 +02:00
|
|
|
|
rmf a.exe* a.out* conftest.c conftest.exe* *core core.* ${tfn}* *.bc *.dbg \
|
2016-11-12 00:31:39 +01:00
|
|
|
|
*.ll *.o *.gen *.cat1 Rebuild.sh lft no signames.inc test.sh x vv.out
|
2012-06-24 22:46:07 +02:00
|
|
|
|
|
2017-02-18 03:33:15 +01:00
|
|
|
|
SRCS="lalloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c jobs.c"
|
2012-06-25 18:05:10 +02:00
|
|
|
|
SRCS="$SRCS lex.c main.c misc.c shf.c syn.c tree.c var.c"
|
|
|
|
|
|
|
|
|
|
if test $legacy = 0; then
|
2012-06-28 22:17:39 +02:00
|
|
|
|
check_categories="$check_categories shell:legacy-no int:32"
|
2012-06-25 18:05:10 +02:00
|
|
|
|
else
|
|
|
|
|
check_categories="$check_categories shell:legacy-yes"
|
|
|
|
|
add_cppflags -DMKSH_LEGACY_MODE
|
|
|
|
|
fi
|
2005-05-23 18:48:52 +02:00
|
|
|
|
|
2017-04-02 16:14:08 +02:00
|
|
|
|
if test $textmode = 0; then
|
|
|
|
|
check_categories="$check_categories shell:textmode-no shell:binmode-yes"
|
|
|
|
|
else
|
|
|
|
|
check_categories="$check_categories shell:textmode-yes shell:binmode-no"
|
|
|
|
|
add_cppflags -DMKSH_WITH_TEXTMODE
|
|
|
|
|
fi
|
|
|
|
|
|
2007-06-04 22:22:08 +02:00
|
|
|
|
if test x"$srcdir" = x"."; then
|
|
|
|
|
CPPFLAGS="-I. $CPPFLAGS"
|
|
|
|
|
else
|
|
|
|
|
CPPFLAGS="-I. -I'$srcdir' $CPPFLAGS"
|
|
|
|
|
fi
|
2012-04-06 17:03:42 +02:00
|
|
|
|
test -n "$LDSTATIC" && if test -n "$LDFLAGS"; then
|
|
|
|
|
LDFLAGS="$LDFLAGS $LDSTATIC"
|
|
|
|
|
else
|
|
|
|
|
LDFLAGS=$LDSTATIC
|
|
|
|
|
fi
|
2007-01-17 18:57:31 +01:00
|
|
|
|
|
2012-05-04 23:37:08 +02:00
|
|
|
|
if test -z "$TARGET_OS"; then
|
|
|
|
|
x=`uname -s 2>/dev/null || uname`
|
|
|
|
|
test x"$x" = x"`uname -n 2>/dev/null`" || TARGET_OS=$x
|
|
|
|
|
fi
|
|
|
|
|
if test -z "$TARGET_OS"; then
|
2011-08-26 12:24:51 +02:00
|
|
|
|
echo "$me: Set TARGET_OS, your uname is broken!" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2009-07-19 16:59:40 +02:00
|
|
|
|
oswarn=
|
2007-07-01 23:27:03 +02:00
|
|
|
|
ccpc=-Wc,
|
|
|
|
|
ccpl=-Wl,
|
2007-07-01 21:04:53 +02:00
|
|
|
|
tsts=
|
2013-11-30 16:42:19 +01:00
|
|
|
|
ccpr='|| for _f in ${tcfn}*; do case $_f in Build.sh|check.pl|check.t|dot.mkshrc|*.1|*.c|*.h|*.ico|*.opt) ;; *) rm -f "$_f" ;; esac; done'
|
2009-06-07 16:50:58 +02:00
|
|
|
|
|
2011-03-16 21:26:36 +01:00
|
|
|
|
# Evil hack
|
|
|
|
|
if test x"$TARGET_OS" = x"Android"; then
|
2011-03-28 23:15:05 +02:00
|
|
|
|
check_categories="$check_categories android"
|
2011-03-16 21:26:36 +01:00
|
|
|
|
TARGET_OS=Linux
|
|
|
|
|
fi
|
|
|
|
|
|
2012-03-03 22:30:13 +01:00
|
|
|
|
# Evil OS
|
|
|
|
|
if test x"$TARGET_OS" = x"Minix"; then
|
|
|
|
|
echo >&2 "
|
|
|
|
|
WARNING: additional checks before running Build.sh required!
|
|
|
|
|
You can avoid these by calling Build.sh correctly, see below.
|
|
|
|
|
"
|
|
|
|
|
cat >conftest.c <<'EOF'
|
|
|
|
|
#include <sys/types.h>
|
2012-03-31 19:37:03 +02:00
|
|
|
|
const char *
|
2012-03-03 22:30:13 +01:00
|
|
|
|
#ifdef _NETBSD_SOURCE
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="Ninix3"
|
2012-03-03 22:30:13 +01:00
|
|
|
|
#else
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="Minix3"
|
2012-03-03 22:30:13 +01:00
|
|
|
|
#endif
|
2012-03-31 19:37:03 +02:00
|
|
|
|
;
|
2012-03-03 22:30:13 +01:00
|
|
|
|
EOF
|
|
|
|
|
ct=unknown
|
|
|
|
|
vv ']' "${CC-cc} -E $CFLAGS $CPPFLAGS $NOWARN conftest.c | grep ct= | tr -d \\\\015 >x"
|
|
|
|
|
sed 's/^/[ /' x
|
|
|
|
|
eval `cat x`
|
|
|
|
|
rmf x vv.out
|
|
|
|
|
case $ct in
|
|
|
|
|
Minix3|Ninix3)
|
|
|
|
|
echo >&2 "
|
|
|
|
|
Warning: you set TARGET_OS to $TARGET_OS but that is ambiguous.
|
|
|
|
|
Please set it to either Minix3 or Ninix3, whereas the latter is
|
|
|
|
|
all versions of Minix with even partial NetBSD(R) userland. The
|
|
|
|
|
value determined from your compiler for the current compilation
|
|
|
|
|
(which may be wrong) is: $ct
|
|
|
|
|
"
|
|
|
|
|
TARGET_OS=$ct
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
echo >&2 "
|
|
|
|
|
Warning: you set TARGET_OS to $TARGET_OS but that is ambiguous.
|
|
|
|
|
Please set it to either Minix3 or Ninix3, whereas the latter is
|
|
|
|
|
all versions of Minix with even partial NetBSD(R) userland. The
|
|
|
|
|
proper value couldn't be determined, continue at your own risk.
|
|
|
|
|
"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
fi
|
|
|
|
|
|
2009-06-07 16:50:58 +02:00
|
|
|
|
# Configuration depending on OS revision, on OSes that need them
|
|
|
|
|
case $TARGET_OS in
|
2012-04-01 06:57:24 +02:00
|
|
|
|
NEXTSTEP)
|
2012-05-06 17:40:31 +02:00
|
|
|
|
test x"$TARGET_OSREV" = x"" && TARGET_OSREV=`hostinfo 2>&1 | \
|
|
|
|
|
grep 'NeXT Mach [0-9][0-9.]*:' | \
|
|
|
|
|
sed 's/^.*NeXT Mach \([0-9][0-9.]*\):.*$/\1/'`
|
2012-04-01 06:57:24 +02:00
|
|
|
|
;;
|
2012-03-27 23:01:55 +02:00
|
|
|
|
QNX|SCO_SV)
|
2009-06-07 16:50:58 +02:00
|
|
|
|
test x"$TARGET_OSREV" = x"" && TARGET_OSREV=`uname -r`
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
# Configuration depending on OS name
|
2007-01-11 01:57:56 +01:00
|
|
|
|
case $TARGET_OS in
|
2012-04-14 16:11:07 +02:00
|
|
|
|
386BSD)
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_CAN_OTWO=0}"
|
2012-04-14 16:11:07 +02:00
|
|
|
|
add_cppflags -DMKSH_NO_SIGSETJMP
|
|
|
|
|
add_cppflags -DMKSH_TYPEDEF_SIG_ATOMIC_T=int
|
|
|
|
|
;;
|
2007-04-23 22:17:58 +02:00
|
|
|
|
AIX)
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -D_ALL_SOURCE
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2007-04-23 22:17:58 +02:00
|
|
|
|
;;
|
2010-03-14 12:58:33 +01:00
|
|
|
|
BeOS)
|
2012-04-01 18:55:16 +02:00
|
|
|
|
case $KSH_VERSION in
|
|
|
|
|
*MIRBSD\ KSH*)
|
|
|
|
|
oswarn="; it has minor issues"
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
oswarn="; you must recompile mksh with"
|
|
|
|
|
oswarn="$oswarn${nl}itself in a second stage"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2012-04-06 14:57:53 +02:00
|
|
|
|
# BeOS has no real tty either
|
|
|
|
|
add_cppflags -DMKSH_UNEMPLOYED
|
2012-05-05 19:37:44 +02:00
|
|
|
|
add_cppflags -DMKSH_DISABLE_TTY_WARNING
|
2012-05-04 23:57:38 +02:00
|
|
|
|
# BeOS doesn't have different UIDs and GIDs
|
|
|
|
|
add_cppflags -DMKSH__NO_SETEUGID
|
2008-10-26 22:57:47 +01:00
|
|
|
|
;;
|
2009-04-05 15:07:06 +02:00
|
|
|
|
BSD/OS)
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2009-04-05 15:07:06 +02:00
|
|
|
|
;;
|
2012-05-04 23:42:51 +02:00
|
|
|
|
Coherent)
|
|
|
|
|
oswarn="; it has major issues"
|
2012-05-05 00:05:02 +02:00
|
|
|
|
add_cppflags -DMKSH__NO_SYMLINK
|
2012-05-04 23:42:51 +02:00
|
|
|
|
check_categories="$check_categories nosymlink"
|
2012-05-04 23:57:38 +02:00
|
|
|
|
add_cppflags -DMKSH__NO_SETEUGID
|
2012-05-05 19:37:44 +02:00
|
|
|
|
add_cppflags -DMKSH_DISABLE_TTY_WARNING
|
2012-05-04 23:42:51 +02:00
|
|
|
|
;;
|
2006-08-02 12:41:03 +02:00
|
|
|
|
CYGWIN*)
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2006-08-02 12:41:03 +02:00
|
|
|
|
;;
|
2005-10-25 22:54:29 +02:00
|
|
|
|
Darwin)
|
2012-08-03 20:16:43 +02:00
|
|
|
|
add_cppflags -D_DARWIN_C_SOURCE
|
2005-10-25 22:54:29 +02:00
|
|
|
|
;;
|
2007-01-17 18:46:18 +01:00
|
|
|
|
DragonFly)
|
|
|
|
|
;;
|
|
|
|
|
FreeBSD)
|
|
|
|
|
;;
|
2011-02-27 20:29:20 +01:00
|
|
|
|
FreeMiNT)
|
|
|
|
|
oswarn="; it has minor issues"
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -D_GNU_SOURCE
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2011-02-27 20:29:20 +01:00
|
|
|
|
;;
|
2007-02-13 13:26:46 +01:00
|
|
|
|
GNU)
|
2011-06-05 21:55:22 +02:00
|
|
|
|
case $CC in
|
|
|
|
|
*tendracc*) ;;
|
2011-10-07 21:51:44 +02:00
|
|
|
|
*) add_cppflags -D_GNU_SOURCE ;;
|
2011-06-05 21:55:22 +02:00
|
|
|
|
esac
|
2016-01-02 21:11:31 +01:00
|
|
|
|
add_cppflags -DSETUID_CAN_FAIL_WITH_EAGAIN
|
2012-05-05 19:37:44 +02:00
|
|
|
|
# define MKSH__NO_PATH_MAX to use Hurd-only functions
|
|
|
|
|
add_cppflags -DMKSH__NO_PATH_MAX
|
2007-02-13 13:26:46 +01:00
|
|
|
|
;;
|
2007-01-28 21:05:29 +01:00
|
|
|
|
GNU/kFreeBSD)
|
2011-06-05 21:55:22 +02:00
|
|
|
|
case $CC in
|
|
|
|
|
*tendracc*) ;;
|
2011-10-07 21:51:44 +02:00
|
|
|
|
*) add_cppflags -D_GNU_SOURCE ;;
|
2011-06-05 21:55:22 +02:00
|
|
|
|
esac
|
2016-01-02 21:11:31 +01:00
|
|
|
|
add_cppflags -DSETUID_CAN_FAIL_WITH_EAGAIN
|
2007-01-28 21:05:29 +01:00
|
|
|
|
;;
|
2010-03-14 12:58:33 +01:00
|
|
|
|
Haiku)
|
2012-01-03 02:40:15 +01:00
|
|
|
|
add_cppflags -DMKSH_ASSUME_UTF8; HAVE_ISSET_MKSH_ASSUME_UTF8=1
|
2010-03-14 12:58:33 +01:00
|
|
|
|
;;
|
2016-11-12 00:31:39 +01:00
|
|
|
|
Harvey)
|
|
|
|
|
add_cppflags -D_POSIX_SOURCE
|
|
|
|
|
add_cppflags -D_LIMITS_EXTENSION
|
|
|
|
|
add_cppflags -D_BSD_EXTENSION
|
|
|
|
|
add_cppflags -D_SUSV2_SOURCE
|
|
|
|
|
add_cppflags -D_GNU_SOURCE
|
|
|
|
|
add_cppflags -DMKSH_ASSUME_UTF8; HAVE_ISSET_MKSH_ASSUME_UTF8=1
|
|
|
|
|
add_cppflags -DMKSH_NO_CMDLINE_EDITING
|
|
|
|
|
add_cppflags -DMKSH__NO_SETEUGID
|
|
|
|
|
oswarn=' and will currently not work'
|
|
|
|
|
add_cppflags -DMKSH_UNEMPLOYED
|
|
|
|
|
# these taken from Harvey-OS github and need re-checking
|
|
|
|
|
add_cppflags -D_setjmp=setjmp -D_longjmp=longjmp
|
|
|
|
|
: "${HAVE_CAN_NO_EH_FRAME=0}"
|
|
|
|
|
: "${HAVE_CAN_FNOSTRICTALIASING=0}"
|
|
|
|
|
: "${HAVE_CAN_FSTACKPROTECTORSTRONG=0}"
|
|
|
|
|
;;
|
2007-04-23 14:13:03 +02:00
|
|
|
|
HP-UX)
|
|
|
|
|
;;
|
2006-03-19 19:06:32 +01:00
|
|
|
|
Interix)
|
2007-07-01 23:27:03 +02:00
|
|
|
|
ccpc='-X '
|
|
|
|
|
ccpl='-Y '
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -D_ALL_SOURCE
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${LIBS=-lcrypt}"
|
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2006-03-19 19:06:32 +01:00
|
|
|
|
;;
|
2008-03-27 14:08:37 +01:00
|
|
|
|
IRIX*)
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2008-03-27 14:08:37 +01:00
|
|
|
|
;;
|
2005-06-08 23:51:22 +02:00
|
|
|
|
Linux)
|
2011-06-05 21:55:22 +02:00
|
|
|
|
case $CC in
|
|
|
|
|
*tendracc*) ;;
|
2011-10-07 21:51:44 +02:00
|
|
|
|
*) add_cppflags -D_GNU_SOURCE ;;
|
2011-06-05 21:55:22 +02:00
|
|
|
|
esac
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -DSETUID_CAN_FAIL_WITH_EAGAIN
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_REVOKE=0}"
|
2005-10-25 21:46:11 +02:00
|
|
|
|
;;
|
2012-04-07 01:10:50 +02:00
|
|
|
|
LynxOS)
|
|
|
|
|
oswarn="; it has minor issues"
|
|
|
|
|
;;
|
2007-07-27 00:38:31 +02:00
|
|
|
|
MidnightBSD)
|
|
|
|
|
;;
|
2012-12-17 22:55:06 +01:00
|
|
|
|
Minix-vmd)
|
|
|
|
|
add_cppflags -DMKSH__NO_SETEUGID
|
|
|
|
|
add_cppflags -DMKSH_UNEMPLOYED
|
|
|
|
|
add_cppflags -D_MINIX_SOURCE
|
|
|
|
|
oldish_ed=no-stderr-ed # no /bin/ed, maybe see below
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2012-12-17 22:55:06 +01:00
|
|
|
|
;;
|
2012-03-03 22:30:13 +01:00
|
|
|
|
Minix3)
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -DMKSH_UNEMPLOYED
|
|
|
|
|
add_cppflags -DMKSH_NO_LIMITS
|
|
|
|
|
add_cppflags -D_POSIX_SOURCE -D_POSIX_1_SOURCE=2 -D_MINIX
|
2009-04-05 14:35:32 +02:00
|
|
|
|
oldish_ed=no-stderr-ed # /usr/bin/ed(!) is broken
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2007-03-04 05:45:36 +01:00
|
|
|
|
;;
|
2007-01-17 18:46:18 +01:00
|
|
|
|
MirBSD)
|
|
|
|
|
;;
|
2011-01-15 22:56:36 +01:00
|
|
|
|
MSYS_*)
|
2012-01-03 02:40:15 +01:00
|
|
|
|
add_cppflags -DMKSH_ASSUME_UTF8=0; HAVE_ISSET_MKSH_ASSUME_UTF8=1
|
2011-11-06 00:39:02 +01:00
|
|
|
|
# almost same as CYGWIN* (from RT|Chatzilla)
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2011-11-06 00:39:02 +01:00
|
|
|
|
# broken on this OE (from ir0nh34d)
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_STDINT_H=0}"
|
2011-01-15 22:56:36 +01:00
|
|
|
|
;;
|
2007-01-17 18:46:18 +01:00
|
|
|
|
NetBSD)
|
|
|
|
|
;;
|
2012-03-31 20:33:16 +02:00
|
|
|
|
NEXTSTEP)
|
2012-04-01 06:57:24 +02:00
|
|
|
|
add_cppflags -D_NEXT_SOURCE
|
|
|
|
|
add_cppflags -D_POSIX_SOURCE
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${AWK=gawk}"
|
|
|
|
|
: "${CC=cc -posix}"
|
2012-04-14 16:07:47 +02:00
|
|
|
|
add_cppflags -DMKSH_NO_SIGSETJMP
|
2012-04-01 06:57:24 +02:00
|
|
|
|
# NeXTstep cannot get a controlling tty
|
|
|
|
|
add_cppflags -DMKSH_UNEMPLOYED
|
|
|
|
|
case $TARGET_OSREV in
|
|
|
|
|
4.2*)
|
|
|
|
|
# OpenStep 4.2 is broken by default
|
|
|
|
|
oswarn="; it needs libposix.a"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2012-03-31 20:33:16 +02:00
|
|
|
|
;;
|
2012-03-03 22:30:13 +01:00
|
|
|
|
Ninix3)
|
|
|
|
|
# similar to Minix3
|
|
|
|
|
add_cppflags -DMKSH_UNEMPLOYED
|
|
|
|
|
add_cppflags -DMKSH_NO_LIMITS
|
|
|
|
|
# but no idea what else could be needed
|
|
|
|
|
oswarn="; it has unknown issues"
|
|
|
|
|
;;
|
2007-01-17 18:46:18 +01:00
|
|
|
|
OpenBSD)
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2007-01-17 18:46:18 +01:00
|
|
|
|
;;
|
2015-07-09 21:04:28 +02:00
|
|
|
|
OS/2)
|
2017-04-03 04:08:57 +02:00
|
|
|
|
add_cppflags -DMKSH_ASSUME_UTF8=0; HAVE_ISSET_MKSH_ASSUME_UTF8=1
|
2015-07-10 19:16:23 +02:00
|
|
|
|
HAVE_TERMIOS_H=0
|
2015-07-09 21:28:21 +02:00
|
|
|
|
HAVE_MKNOD=0 # setmode() incompatible
|
2017-04-02 17:00:45 +02:00
|
|
|
|
oswarn="; it is being ported"
|
2015-07-09 21:28:21 +02:00
|
|
|
|
check_categories="$check_categories nosymlink"
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${CC=gcc}"
|
|
|
|
|
: "${SIZE=: size}"
|
2015-05-07 05:59:55 +02:00
|
|
|
|
SRCS="$SRCS os2.c"
|
2015-07-09 21:46:43 +02:00
|
|
|
|
add_cppflags -DMKSH_UNEMPLOYED
|
|
|
|
|
add_cppflags -DMKSH_NOPROSPECTOFWORK
|
2016-11-12 00:31:39 +01:00
|
|
|
|
add_cppflags -DMKSH_NO_LIMITS
|
2017-04-02 16:14:08 +02:00
|
|
|
|
add_cppflags -DMKSH_DOSPATH
|
|
|
|
|
if test $textmode = 0; then
|
|
|
|
|
x='dis'
|
|
|
|
|
y='standard OS/2 tools'
|
|
|
|
|
else
|
|
|
|
|
x='en'
|
|
|
|
|
y='standard Unix mksh and other tools'
|
|
|
|
|
fi
|
|
|
|
|
echo >&2 "
|
|
|
|
|
OS/2 Note: mksh can be built with or without 'textmode'.
|
|
|
|
|
Without 'textmode' it will behave like a standard Unix utility,
|
|
|
|
|
compatible to mksh on all other platforms, using only ASCII LF
|
|
|
|
|
(0x0A) as line ending character. This is supported by the mksh
|
|
|
|
|
upstream developer.
|
|
|
|
|
With 'textmode', mksh will be modified to behave more like other
|
|
|
|
|
OS/2 utilities, supporting ASCII CR+LF (0x0D 0x0A) as line ending
|
|
|
|
|
at the cost of deviation from standard mksh. This is supported by
|
|
|
|
|
the mksh-os2 porter.
|
|
|
|
|
|
|
|
|
|
] You are currently compiling with textmode ${x}abled, introducing
|
|
|
|
|
] incompatibilities with $y.
|
|
|
|
|
"
|
2015-07-09 21:04:28 +02:00
|
|
|
|
;;
|
2007-09-09 21:24:58 +02:00
|
|
|
|
OSF1)
|
2008-03-05 19:21:45 +01:00
|
|
|
|
HAVE_SIG_T=0 # incompatible
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -D_OSF_SOURCE
|
|
|
|
|
add_cppflags -D_POSIX_C_SOURCE=200112L
|
|
|
|
|
add_cppflags -D_XOPEN_SOURCE=600
|
|
|
|
|
add_cppflags -D_XOPEN_SOURCE_EXTENDED
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2007-09-09 21:24:58 +02:00
|
|
|
|
;;
|
2007-07-24 23:54:46 +02:00
|
|
|
|
Plan9)
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -D_POSIX_SOURCE
|
|
|
|
|
add_cppflags -D_LIMITS_EXTENSION
|
|
|
|
|
add_cppflags -D_BSD_EXTENSION
|
|
|
|
|
add_cppflags -D_SUSV2_SOURCE
|
2012-01-03 02:40:15 +01:00
|
|
|
|
add_cppflags -DMKSH_ASSUME_UTF8; HAVE_ISSET_MKSH_ASSUME_UTF8=1
|
2012-05-05 19:37:44 +02:00
|
|
|
|
add_cppflags -DMKSH_NO_CMDLINE_EDITING
|
2013-07-25 17:43:59 +02:00
|
|
|
|
add_cppflags -DMKSH__NO_SETEUGID
|
2009-07-19 16:59:40 +02:00
|
|
|
|
oswarn=' and will currently not work'
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -DMKSH_UNEMPLOYED
|
2013-07-25 17:43:59 +02:00
|
|
|
|
# this is for detecting kencc
|
|
|
|
|
add_cppflags -DMKSH_MAYBE_KENCC
|
2007-07-24 23:54:46 +02:00
|
|
|
|
;;
|
2007-07-24 23:47:14 +02:00
|
|
|
|
PW32*)
|
2008-03-05 19:21:45 +01:00
|
|
|
|
HAVE_SIG_T=0 # incompatible
|
2009-07-19 16:59:40 +02:00
|
|
|
|
oswarn=' and will currently not work'
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2007-07-24 23:47:14 +02:00
|
|
|
|
;;
|
2008-11-03 00:06:36 +01:00
|
|
|
|
QNX)
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -D__NO_EXT_QNX
|
2012-12-27 16:52:47 +01:00
|
|
|
|
add_cppflags -D__EXT_UNIX_MISC
|
2009-06-07 16:50:58 +02:00
|
|
|
|
case $TARGET_OSREV in
|
|
|
|
|
[012345].*|6.[0123].*|6.4.[01])
|
|
|
|
|
oldish_ed=no-stderr-ed # oldish /bin/ed is broken
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2008-11-03 00:06:36 +01:00
|
|
|
|
;;
|
2012-03-26 21:54:54 +02:00
|
|
|
|
SCO_SV)
|
2012-03-27 23:01:55 +02:00
|
|
|
|
case $TARGET_OSREV in
|
|
|
|
|
3.2*)
|
|
|
|
|
# SCO OpenServer 5
|
|
|
|
|
add_cppflags -DMKSH_UNEMPLOYED
|
|
|
|
|
;;
|
|
|
|
|
5*)
|
|
|
|
|
# SCO OpenServer 6
|
|
|
|
|
;;
|
|
|
|
|
*)
|
2012-03-28 01:13:42 +02:00
|
|
|
|
oswarn='; this is an unknown version of'
|
|
|
|
|
oswarn="$oswarn$nl$TARGET_OS ${TARGET_OSREV}, please tell me what to do"
|
2012-03-27 23:01:55 +02:00
|
|
|
|
;;
|
|
|
|
|
esac
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SYS_SIGLIST=0}${HAVE__SYS_SIGLIST=0}"
|
2012-03-26 21:54:54 +02:00
|
|
|
|
;;
|
2012-02-17 10:49:45 +01:00
|
|
|
|
skyos)
|
|
|
|
|
oswarn="; it has minor issues"
|
|
|
|
|
;;
|
2005-10-25 21:46:11 +02:00
|
|
|
|
SunOS)
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -D_BSD_SOURCE
|
|
|
|
|
add_cppflags -D__EXTENSIONS__
|
2005-06-08 23:51:22 +02:00
|
|
|
|
;;
|
2008-03-14 22:34:55 +01:00
|
|
|
|
syllable)
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -D_GNU_SOURCE
|
2012-05-10 01:20:42 +02:00
|
|
|
|
add_cppflags -DMKSH_NO_SIGSUSPEND
|
2009-07-19 16:59:40 +02:00
|
|
|
|
oswarn=' and will currently not work'
|
2008-03-14 22:34:55 +01:00
|
|
|
|
;;
|
2008-03-25 22:34:45 +01:00
|
|
|
|
ULTRIX)
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${CC=cc -YPOSIX}"
|
2012-04-14 16:02:40 +02:00
|
|
|
|
add_cppflags -DMKSH_TYPEDEF_SSIZE_T=int
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2008-03-25 22:34:45 +01:00
|
|
|
|
;;
|
2012-03-27 23:01:55 +02:00
|
|
|
|
UnixWare|UNIX_SV)
|
|
|
|
|
# SCO UnixWare
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SYS_SIGLIST=0}${HAVE__SYS_SIGLIST=0}"
|
2012-03-27 23:01:55 +02:00
|
|
|
|
;;
|
2007-07-01 18:47:05 +02:00
|
|
|
|
UWIN*)
|
2007-07-01 23:27:03 +02:00
|
|
|
|
ccpc='-Yc,'
|
|
|
|
|
ccpl='-Yl,'
|
2007-07-01 21:04:53 +02:00
|
|
|
|
tsts=" 3<>/dev/tty"
|
2009-07-19 16:59:40 +02:00
|
|
|
|
oswarn="; it will compile, but the target"
|
|
|
|
|
oswarn="$oswarn${nl}platform itself is very flakey/unreliable"
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_SETLOCALE_CTYPE=0}"
|
2007-07-01 18:47:05 +02:00
|
|
|
|
;;
|
2012-05-07 19:03:03 +02:00
|
|
|
|
_svr4)
|
|
|
|
|
# generic target for SVR4 Unix with uname -s = uname -n
|
|
|
|
|
# this duplicates the * target below
|
|
|
|
|
oswarn='; it may or may not work'
|
|
|
|
|
test x"$TARGET_OSREV" = x"" && TARGET_OSREV=`uname -r`
|
|
|
|
|
;;
|
2007-01-17 18:46:18 +01:00
|
|
|
|
*)
|
2009-07-19 16:59:40 +02:00
|
|
|
|
oswarn='; it may or may not work'
|
2012-03-28 01:01:51 +02:00
|
|
|
|
test x"$TARGET_OSREV" = x"" && TARGET_OSREV=`uname -r`
|
2007-01-17 18:46:18 +01:00
|
|
|
|
;;
|
2005-06-08 23:51:22 +02:00
|
|
|
|
esac
|
2005-05-23 18:48:52 +02:00
|
|
|
|
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_MKNOD=0}"
|
2010-10-08 19:56:57 +02:00
|
|
|
|
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${AWK=awk}${CC=cc}${NROFF=nroff}${SIZE=size}"
|
2008-07-21 23:00:25 +02:00
|
|
|
|
test 0 = $r && echo | $NROFF -v 2>&1 | grep GNU >/dev/null 2>&1 && \
|
2015-04-29 22:13:47 +02:00
|
|
|
|
echo | $NROFF -c >/dev/null 2>&1 && NROFF="$NROFF -c"
|
2007-01-17 18:42:22 +01:00
|
|
|
|
|
2008-03-01 16:07:50 +01:00
|
|
|
|
# this aids me in tracing FTBFSen without access to the buildd
|
2008-03-03 20:40:08 +01:00
|
|
|
|
$e "Hi from$ao $bi$srcversion$ao on:"
|
|
|
|
|
case $TARGET_OS in
|
2011-05-29 18:31:42 +02:00
|
|
|
|
AIX)
|
|
|
|
|
vv '|' "oslevel >&2"
|
|
|
|
|
vv '|' "uname -a >&2"
|
|
|
|
|
;;
|
2008-03-03 20:40:08 +01:00
|
|
|
|
Darwin)
|
2008-06-22 22:51:31 +02:00
|
|
|
|
vv '|' "hwprefs machine_type os_type os_class >&2"
|
2014-05-27 15:41:53 +02:00
|
|
|
|
vv '|' "sw_vers >&2"
|
|
|
|
|
vv '|' "system_profiler SPSoftwareDataType SPHardwareDataType >&2"
|
|
|
|
|
vv '|' "/bin/sh --version >&2"
|
|
|
|
|
vv '|' "xcodebuild -version >&2"
|
2008-03-03 20:40:08 +01:00
|
|
|
|
vv '|' "uname -a >&2"
|
2014-05-27 15:41:53 +02:00
|
|
|
|
vv '|' "sysctl kern.version hw.machine hw.model hw.memsize hw.availcpu hw.cpufrequency hw.byteorder hw.cpu64bit_capable >&2"
|
2008-03-03 20:40:08 +01:00
|
|
|
|
;;
|
2008-03-27 23:17:01 +01:00
|
|
|
|
IRIX*)
|
|
|
|
|
vv '|' "uname -a >&2"
|
|
|
|
|
vv '|' "hinv -v >&2"
|
|
|
|
|
;;
|
2008-03-06 19:02:33 +01:00
|
|
|
|
OSF1)
|
|
|
|
|
vv '|' "uname -a >&2"
|
2008-07-10 20:49:22 +02:00
|
|
|
|
vv '|' "/usr/sbin/sizer -v >&2"
|
2008-03-06 19:02:33 +01:00
|
|
|
|
;;
|
2012-03-27 23:01:55 +02:00
|
|
|
|
SCO_SV|UnixWare|UNIX_SV)
|
|
|
|
|
vv '|' "uname -a >&2"
|
|
|
|
|
vv '|' "uname -X >&2"
|
|
|
|
|
;;
|
2008-03-03 20:40:08 +01:00
|
|
|
|
*)
|
|
|
|
|
vv '|' "uname -a >&2"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2009-07-19 16:59:40 +02:00
|
|
|
|
test -z "$oswarn" || echo >&2 "
|
|
|
|
|
Warning: mksh has not yet been ported to or tested on your
|
|
|
|
|
operating system '$TARGET_OS'$oswarn. If you can provide
|
|
|
|
|
a shell account to the developer, this may improve; please
|
|
|
|
|
drop us a success or failure notice or even send in diffs.
|
|
|
|
|
"
|
2012-03-26 22:14:58 +02:00
|
|
|
|
$e "$bi$me: Building the MirBSD Korn Shell$ao $ui$dstversion$ao on $TARGET_OS ${TARGET_OSREV}..."
|
2008-03-01 16:07:50 +01:00
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
2016-09-01 14:59:12 +02:00
|
|
|
|
# Start of mirtoconf checks
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
2007-06-30 22:57:55 +02:00
|
|
|
|
$e $bi$me: Scanning for functions... please ignore any errors.$ao
|
2006-08-26 22:30:27 +02:00
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
2007-06-21 17:53:14 +02:00
|
|
|
|
# Compiler: which one?
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
2007-06-21 17:43:33 +02:00
|
|
|
|
# notes:
|
2009-05-16 20:40:09 +02:00
|
|
|
|
# - ICC defines __GNUC__ too
|
|
|
|
|
# - GCC defines __hpux too
|
2008-06-29 20:18:56 +02:00
|
|
|
|
# - LLVM+clang defines __GNUC__ too
|
2008-10-30 18:11:14 +01:00
|
|
|
|
# - nwcc defines __GNUC__ too
|
2007-07-31 12:17:52 +02:00
|
|
|
|
CPP="$CC -E"
|
2007-10-25 16:18:56 +02:00
|
|
|
|
$e ... which compiler seems to be used
|
2010-01-25 13:16:04 +01:00
|
|
|
|
cat >conftest.c <<'EOF'
|
2012-03-31 19:37:03 +02:00
|
|
|
|
const char *
|
2009-08-01 23:51:24 +02:00
|
|
|
|
#if defined(__ICC) || defined(__INTEL_COMPILER)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="icc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__xlC__) || defined(__IBMC__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="xlc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__SUNPRO_C)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="sunpro"
|
2009-04-03 11:42:37 +02:00
|
|
|
|
#elif defined(__ACK__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="ack"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__BORLANDC__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="bcc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__WATCOMC__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="watcom"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__MWERKS__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="metrowerks"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__HP_cc)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="hpcc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__DECC) || (defined(__osf__) && !defined(__GNUC__))
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="dec"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__PGI)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="pgi"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__DMC__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="dmc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(_MSC_VER)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="msc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="adsp"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__IAR_SYSTEMS_ICC__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="iar"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(SDCC)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="sdcc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__PCC__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="pcc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__TenDRA__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="tendra"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__TINYC__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="tcc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__llvm__) && defined(__clang__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="clang"
|
2008-10-30 18:11:14 +01:00
|
|
|
|
#elif defined(__NWCC__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="nwcc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__GNUC__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="gcc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(_COMPILER_VERSION)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="mipspro"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__sgi)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="mipspro"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__hpux) || defined(__hpua)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="hpcc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__ultrix)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="ucode"
|
2012-03-28 13:15:04 +02:00
|
|
|
|
#elif defined(__USLC__)
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="uslc"
|
2012-05-17 20:54:28 +02:00
|
|
|
|
#elif defined(__LCC__)
|
|
|
|
|
ct="lcc"
|
2013-07-25 17:43:59 +02:00
|
|
|
|
#elif defined(MKSH_MAYBE_KENCC)
|
|
|
|
|
/* and none of the above matches */
|
|
|
|
|
ct="kencc"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#else
|
2012-03-31 19:37:03 +02:00
|
|
|
|
ct="unknown"
|
2009-08-01 23:51:24 +02:00
|
|
|
|
#endif
|
2012-03-31 19:37:03 +02:00
|
|
|
|
;
|
2012-05-17 21:14:07 +02:00
|
|
|
|
const char *
|
2015-07-09 21:59:14 +02:00
|
|
|
|
#if defined(__KLIBC__) && !defined(__OS2__)
|
2012-05-17 21:14:07 +02:00
|
|
|
|
et="klibc"
|
|
|
|
|
#else
|
|
|
|
|
et="unknown"
|
|
|
|
|
#endif
|
|
|
|
|
;
|
2009-08-01 23:51:24 +02:00
|
|
|
|
EOF
|
2012-04-01 04:35:33 +02:00
|
|
|
|
ct=untested
|
2012-05-17 21:14:07 +02:00
|
|
|
|
et=untested
|
|
|
|
|
vv ']' "$CPP $CFLAGS $CPPFLAGS $NOWARN conftest.c | \
|
2012-12-24 18:50:10 +01:00
|
|
|
|
sed -n '/^ *[ce]t *= */s/^ *\([ce]t\) *= */\1=/p' | tr -d \\\\015 >x"
|
2008-09-30 19:34:25 +02:00
|
|
|
|
sed 's/^/[ /' x
|
2007-06-05 21:48:47 +02:00
|
|
|
|
eval `cat x`
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf x vv.out
|
2014-01-05 22:57:29 +01:00
|
|
|
|
cat >conftest.c <<'EOF'
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) { return (isatty(0)); }
|
|
|
|
|
EOF
|
2007-05-31 23:25:25 +02:00
|
|
|
|
case $ct in
|
2009-04-03 11:42:37 +02:00
|
|
|
|
ack)
|
2009-05-16 20:40:09 +02:00
|
|
|
|
# work around "the famous ACK const bug"
|
2009-04-06 10:37:42 +02:00
|
|
|
|
CPPFLAGS="-Dconst= $CPPFLAGS"
|
2009-04-03 11:42:37 +02:00
|
|
|
|
;;
|
2008-03-27 23:44:17 +01:00
|
|
|
|
adsp)
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo >&2 'Warning: Analog Devices C++ compiler for Blackfin, TigerSHARC
|
|
|
|
|
and SHARC (21000) DSPs detected. This compiler has not yet
|
|
|
|
|
been tested for compatibility with mksh. Continue at your
|
|
|
|
|
own risk, please report success/failure to the developers.'
|
2008-03-27 23:44:17 +01:00
|
|
|
|
;;
|
|
|
|
|
bcc)
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo >&2 "Warning: Borland C++ Builder detected. This compiler might
|
|
|
|
|
produce broken executables. Continue at your own risk,
|
|
|
|
|
please report success/failure to the developers."
|
2008-03-05 18:00:33 +01:00
|
|
|
|
;;
|
2008-06-29 20:18:56 +02:00
|
|
|
|
clang)
|
|
|
|
|
# does not work with current "ccc" compiler driver
|
2009-08-28 19:37:47 +02:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -version"
|
2011-12-31 01:31:25 +01:00
|
|
|
|
# one of these two works, for now
|
2008-11-10 21:25:04 +01:00
|
|
|
|
vv '|' "${CLANG-clang} -version"
|
2011-12-31 01:31:25 +01:00
|
|
|
|
vv '|' "${CLANG-clang} --version"
|
2008-11-10 21:25:04 +01:00
|
|
|
|
# ensure compiler and linker are in sync unless overridden
|
|
|
|
|
case $CCC_CC:$CCC_LD in
|
|
|
|
|
:*) ;;
|
|
|
|
|
*:) CCC_LD=$CCC_CC; export CCC_LD ;;
|
|
|
|
|
esac
|
2016-07-25 02:04:48 +02:00
|
|
|
|
: "${HAVE_STRING_POOLING=i1}"
|
2008-06-29 20:18:56 +02:00
|
|
|
|
;;
|
2008-03-05 18:00:33 +01:00
|
|
|
|
dec)
|
2009-08-28 19:37:47 +02:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -V"
|
2010-01-25 13:16:04 +01:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -Wl,-V conftest.c $LIBS"
|
2008-03-05 18:00:33 +01:00
|
|
|
|
;;
|
|
|
|
|
dmc)
|
2008-03-27 23:44:17 +01:00
|
|
|
|
echo >&2 "Warning: Digital Mars Compiler detected. When running under"
|
|
|
|
|
echo >&2 " UWIN, mksh tends to be unstable due to the limitations"
|
|
|
|
|
echo >&2 " of this platform. Continue at your own risk,"
|
|
|
|
|
echo >&2 " please report success/failure to the developers."
|
2008-03-03 20:40:08 +01:00
|
|
|
|
;;
|
|
|
|
|
gcc)
|
2010-01-25 13:16:04 +01:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS"
|
2009-08-28 19:37:47 +02:00
|
|
|
|
vv '|' 'echo `$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS \
|
|
|
|
|
-dumpmachine` gcc`$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN \
|
|
|
|
|
$LIBS -dumpversion`'
|
2016-07-25 02:04:48 +02:00
|
|
|
|
: "${HAVE_STRING_POOLING=i2}"
|
2008-03-03 20:40:08 +01:00
|
|
|
|
;;
|
2008-03-27 23:17:01 +01:00
|
|
|
|
hpcc)
|
2010-01-25 13:16:04 +01:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -V conftest.c $LIBS"
|
2008-03-27 23:17:01 +01:00
|
|
|
|
;;
|
|
|
|
|
iar)
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo >&2 'Warning: IAR Systems (http://www.iar.com) compiler for embedded
|
|
|
|
|
systems detected. This unsupported compiler has not yet
|
|
|
|
|
been tested for compatibility with mksh. Continue at your
|
|
|
|
|
own risk, please report success/failure to the developers.'
|
2008-03-27 23:17:01 +01:00
|
|
|
|
;;
|
|
|
|
|
icc)
|
2009-08-28 19:37:47 +02:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -V"
|
2008-03-03 20:40:08 +01:00
|
|
|
|
;;
|
2013-07-25 17:43:59 +02:00
|
|
|
|
kencc)
|
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS"
|
|
|
|
|
;;
|
2012-05-18 03:38:04 +02:00
|
|
|
|
lcc)
|
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS"
|
|
|
|
|
add_cppflags -D__inline__=__inline
|
|
|
|
|
;;
|
2008-03-27 23:44:17 +01:00
|
|
|
|
metrowerks)
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo >&2 'Warning: Metrowerks C compiler detected. This has not yet
|
|
|
|
|
been tested for compatibility with mksh. Continue at your
|
|
|
|
|
own risk, please report success/failure to the developers.'
|
2008-03-27 23:44:17 +01:00
|
|
|
|
;;
|
2008-03-27 23:17:01 +01:00
|
|
|
|
mipspro)
|
2009-08-28 19:37:47 +02:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -version"
|
2008-03-27 23:17:01 +01:00
|
|
|
|
;;
|
2008-03-03 20:40:08 +01:00
|
|
|
|
msc)
|
2008-03-05 19:21:45 +01:00
|
|
|
|
ccpr= # errorlevels are not reliable
|
2008-03-06 19:12:58 +01:00
|
|
|
|
case $TARGET_OS in
|
|
|
|
|
Interix)
|
|
|
|
|
if [[ -n $C89_COMPILER ]]; then
|
2008-03-25 22:34:45 +01:00
|
|
|
|
C89_COMPILER=`ntpath2posix -c "$C89_COMPILER"`
|
2008-03-06 19:12:58 +01:00
|
|
|
|
else
|
|
|
|
|
C89_COMPILER=CL.EXE
|
|
|
|
|
fi
|
|
|
|
|
if [[ -n $C89_LINKER ]]; then
|
2008-03-25 22:34:45 +01:00
|
|
|
|
C89_LINKER=`ntpath2posix -c "$C89_LINKER"`
|
2008-03-06 19:12:58 +01:00
|
|
|
|
else
|
|
|
|
|
C89_LINKER=LINK.EXE
|
|
|
|
|
fi
|
|
|
|
|
vv '|' "$C89_COMPILER /HELP >&2"
|
|
|
|
|
vv '|' "$C89_LINKER /LINK >&2"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2008-03-03 20:40:08 +01:00
|
|
|
|
;;
|
2008-10-30 18:11:14 +01:00
|
|
|
|
nwcc)
|
2009-08-28 19:37:47 +02:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -version"
|
2008-10-30 18:11:14 +01:00
|
|
|
|
;;
|
2008-03-27 23:17:01 +01:00
|
|
|
|
pcc)
|
2009-08-28 19:37:47 +02:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -v"
|
2008-03-27 23:17:01 +01:00
|
|
|
|
;;
|
2008-03-27 23:44:17 +01:00
|
|
|
|
pgi)
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo >&2 'Warning: PGI detected. This unknown compiler has not yet
|
|
|
|
|
been tested for compatibility with mksh. Continue at your
|
|
|
|
|
own risk, please report success/failure to the developers.'
|
2008-03-27 23:44:17 +01:00
|
|
|
|
;;
|
|
|
|
|
sdcc)
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo >&2 'Warning: sdcc (http://sdcc.sourceforge.net), the small devices
|
|
|
|
|
C compiler for embedded systems detected. This has not yet
|
|
|
|
|
been tested for compatibility with mksh. Continue at your
|
|
|
|
|
own risk, please report success/failure to the developers.'
|
2008-03-27 23:44:17 +01:00
|
|
|
|
;;
|
|
|
|
|
sunpro)
|
2010-01-25 13:16:04 +01:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -V conftest.c $LIBS"
|
2008-03-27 23:17:01 +01:00
|
|
|
|
;;
|
2008-03-27 23:44:17 +01:00
|
|
|
|
tcc)
|
2009-08-28 19:37:47 +02:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -v"
|
2008-03-03 20:40:08 +01:00
|
|
|
|
;;
|
|
|
|
|
tendra)
|
2009-08-28 19:37:47 +02:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -V 2>&1 | \
|
2015-12-08 21:59:33 +01:00
|
|
|
|
grep -F -i -e version -e release"
|
2008-03-03 20:40:08 +01:00
|
|
|
|
;;
|
2008-03-25 22:34:45 +01:00
|
|
|
|
ucode)
|
2009-08-28 19:37:47 +02:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -V"
|
2010-01-25 13:16:04 +01:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -Wl,-V conftest.c $LIBS"
|
2008-03-25 22:34:45 +01:00
|
|
|
|
;;
|
2012-03-27 23:01:55 +02:00
|
|
|
|
uslc)
|
|
|
|
|
case $TARGET_OS:$TARGET_OSREV in
|
|
|
|
|
SCO_SV:3.2*)
|
|
|
|
|
# SCO OpenServer 5
|
|
|
|
|
CFLAGS="$CFLAGS -g"
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_CAN_OTWO=0}${HAVE_CAN_OPTIMISE=0}"
|
2012-03-27 23:01:55 +02:00
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -V conftest.c $LIBS"
|
|
|
|
|
;;
|
2008-03-27 23:44:17 +01:00
|
|
|
|
watcom)
|
2012-12-28 05:58:13 +01:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS"
|
2008-03-27 23:17:01 +01:00
|
|
|
|
;;
|
2008-03-03 20:40:08 +01:00
|
|
|
|
xlc)
|
2011-05-29 18:31:42 +02:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -qversion"
|
2009-08-28 19:37:47 +02:00
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN $LIBS -qversion=verbose"
|
2008-10-10 23:57:16 +02:00
|
|
|
|
vv '|' "ld -V"
|
2008-03-03 20:40:08 +01:00
|
|
|
|
;;
|
|
|
|
|
*)
|
2012-04-01 04:35:33 +02:00
|
|
|
|
test x"$ct" = x"untested" && $e "!!! detecting preprocessor failed"
|
2008-03-03 20:40:08 +01:00
|
|
|
|
ct=unknown
|
2012-03-28 01:01:51 +02:00
|
|
|
|
vv "$CC --version"
|
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -v conftest.c $LIBS"
|
|
|
|
|
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -V conftest.c $LIBS"
|
2008-03-03 20:40:08 +01:00
|
|
|
|
;;
|
2007-05-31 23:25:25 +02:00
|
|
|
|
esac
|
2010-05-13 20:41:13 +02:00
|
|
|
|
case $cm in
|
|
|
|
|
dragonegg|llvm)
|
|
|
|
|
vv '|' "llc -version"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2015-12-31 22:16:20 +01:00
|
|
|
|
etd=" on $et"
|
2012-05-17 21:14:07 +02:00
|
|
|
|
case $et in
|
|
|
|
|
klibc)
|
|
|
|
|
add_cppflags -DMKSH_NO_LIMITS
|
|
|
|
|
;;
|
|
|
|
|
unknown)
|
|
|
|
|
# nothing special detected, don’t worry
|
2015-12-31 22:16:20 +01:00
|
|
|
|
etd=
|
2012-05-17 21:14:07 +02:00
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
# huh?
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2015-12-31 22:16:20 +01:00
|
|
|
|
$e "$bi==> which compiler seems to be used...$ao $ui$ct$etd$ao"
|
2015-07-09 21:28:21 +02:00
|
|
|
|
rmf conftest.c conftest.o conftest a.out* a.exe* conftest.exe* vv.out
|
2007-05-31 23:25:25 +02:00
|
|
|
|
|
2007-06-21 17:53:14 +02:00
|
|
|
|
#
|
|
|
|
|
# Compiler: works as-is, with -Wno-error and -Werror
|
|
|
|
|
#
|
|
|
|
|
save_NOWARN=$NOWARN
|
|
|
|
|
NOWARN=
|
2007-07-01 17:45:58 +02:00
|
|
|
|
DOWARN=
|
2007-06-21 17:53:14 +02:00
|
|
|
|
ac_flags 0 compiler_works '' 'if the compiler works'
|
|
|
|
|
test 1 = $HAVE_CAN_COMPILER_WORKS || exit 1
|
2007-07-31 12:17:52 +02:00
|
|
|
|
HAVE_COMPILER_KNOWN=0
|
|
|
|
|
test $ct = unknown || HAVE_COMPILER_KNOWN=1
|
2009-07-19 16:59:40 +02:00
|
|
|
|
if ac_ifcpp 'if 0' compiler_fails '' \
|
|
|
|
|
'if the compiler does not fail correctly'; then
|
2007-07-01 23:27:03 +02:00
|
|
|
|
save_CFLAGS=$CFLAGS
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_CAN_DELEXE=x}"
|
2013-07-25 17:54:33 +02:00
|
|
|
|
case $ct in
|
|
|
|
|
dec)
|
2008-10-24 21:55:35 +02:00
|
|
|
|
CFLAGS="$CFLAGS ${ccpl}-non_shared"
|
|
|
|
|
ac_testn can_delexe compiler_fails 0 'for the -non_shared linker option' <<-EOF
|
2014-01-05 22:57:29 +01:00
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) { return (isatty(0)); }
|
2008-10-24 21:55:35 +02:00
|
|
|
|
EOF
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
dmc)
|
|
|
|
|
CFLAGS="$CFLAGS ${ccpl}/DELEXECUTABLE"
|
|
|
|
|
ac_testn can_delexe compiler_fails 0 'for the /DELEXECUTABLE linker option' <<-EOF
|
2014-01-05 22:57:29 +01:00
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) { return (isatty(0)); }
|
2013-07-25 17:54:33 +02:00
|
|
|
|
EOF
|
|
|
|
|
;;
|
|
|
|
|
*)
|
2008-03-05 20:14:19 +01:00
|
|
|
|
exit 1
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
esac
|
2008-10-24 21:55:35 +02:00
|
|
|
|
test 1 = $HAVE_CAN_DELEXE || CFLAGS=$save_CFLAGS
|
2007-07-01 23:27:03 +02:00
|
|
|
|
ac_testn compiler_still_fails '' 'if the compiler still does not fail correctly' <<-EOF
|
|
|
|
|
EOF
|
2007-09-11 19:47:25 +02:00
|
|
|
|
test 1 = $HAVE_COMPILER_STILL_FAILS && exit 1
|
2007-07-01 23:27:03 +02:00
|
|
|
|
fi
|
2009-07-19 16:59:40 +02:00
|
|
|
|
if ac_ifcpp 'ifdef __TINYC__' couldbe_tcc '!' compiler_known 0 \
|
|
|
|
|
'if this could be tcc'; then
|
2008-03-28 14:55:11 +01:00
|
|
|
|
ct=tcc
|
|
|
|
|
CPP='cpp -D__TINYC__'
|
2012-04-01 04:35:33 +02:00
|
|
|
|
HAVE_COMPILER_KNOWN=1
|
|
|
|
|
fi
|
2007-06-21 17:53:14 +02:00
|
|
|
|
|
2013-07-25 17:54:33 +02:00
|
|
|
|
case $ct in
|
|
|
|
|
bcc)
|
|
|
|
|
save_NOWARN="${ccpc}-w"
|
|
|
|
|
DOWARN="${ccpc}-w!"
|
|
|
|
|
;;
|
|
|
|
|
dec)
|
|
|
|
|
# -msg_* flags not used yet, or is -w2 correct?
|
|
|
|
|
;;
|
|
|
|
|
dmc)
|
|
|
|
|
save_NOWARN="${ccpc}-w"
|
|
|
|
|
DOWARN="${ccpc}-wx"
|
|
|
|
|
;;
|
|
|
|
|
hpcc)
|
2007-06-21 17:43:33 +02:00
|
|
|
|
save_NOWARN=
|
2007-07-01 17:45:58 +02:00
|
|
|
|
DOWARN=+We
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
kencc)
|
|
|
|
|
save_NOWARN=
|
|
|
|
|
DOWARN=
|
|
|
|
|
;;
|
|
|
|
|
mipspro)
|
2008-03-27 23:17:01 +01:00
|
|
|
|
save_NOWARN=
|
|
|
|
|
DOWARN="-diag_error 1-10000"
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
msc)
|
2007-07-01 23:27:03 +02:00
|
|
|
|
save_NOWARN="${ccpc}/w"
|
|
|
|
|
DOWARN="${ccpc}/WX"
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
sunpro)
|
|
|
|
|
test x"$save_NOWARN" = x"" && save_NOWARN='-errwarn=%none'
|
|
|
|
|
ac_flags 0 errwarnnone "$save_NOWARN"
|
|
|
|
|
test 1 = $HAVE_CAN_ERRWARNNONE || save_NOWARN=
|
|
|
|
|
ac_flags 0 errwarnall "-errwarn=%all"
|
|
|
|
|
test 1 = $HAVE_CAN_ERRWARNALL && DOWARN="-errwarn=%all"
|
|
|
|
|
;;
|
|
|
|
|
tendra)
|
2007-07-31 12:04:46 +02:00
|
|
|
|
save_NOWARN=-w
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
ucode)
|
2008-03-25 22:34:45 +01:00
|
|
|
|
save_NOWARN=
|
|
|
|
|
DOWARN=-w2
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
watcom)
|
2012-12-28 05:58:13 +01:00
|
|
|
|
save_NOWARN=
|
|
|
|
|
DOWARN=-Wc,-we
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
xlc)
|
|
|
|
|
save_NOWARN=-qflag=i:e
|
|
|
|
|
DOWARN=-qflag=i:i
|
|
|
|
|
;;
|
|
|
|
|
*)
|
2007-07-01 23:52:20 +02:00
|
|
|
|
test x"$save_NOWARN" = x"" && save_NOWARN=-Wno-error
|
2007-05-31 23:25:25 +02:00
|
|
|
|
ac_flags 0 wnoerror "$save_NOWARN"
|
|
|
|
|
test 1 = $HAVE_CAN_WNOERROR || save_NOWARN=
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_flags 0 werror -Werror
|
2007-07-01 17:45:58 +02:00
|
|
|
|
test 1 = $HAVE_CAN_WERROR && DOWARN=-Werror
|
2013-07-25 17:54:33 +02:00
|
|
|
|
test $ct = icc && DOWARN="$DOWARN -wd1419"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2007-01-17 17:57:41 +01:00
|
|
|
|
NOWARN=$save_NOWARN
|
2007-01-12 02:49:29 +01:00
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# Compiler: extra flags (-O2 -f* -W* etc.)
|
|
|
|
|
#
|
2008-02-29 17:38:41 +01:00
|
|
|
|
i=`echo :"$orig_CFLAGS" | sed 's/^://' | tr -c -d $alll$allu$alln`
|
2007-06-30 23:34:23 +02:00
|
|
|
|
# optimisation: only if orig_CFLAGS is empty
|
2013-07-25 17:54:33 +02:00
|
|
|
|
test x"$i" = x"" && case $ct in
|
|
|
|
|
hpcc)
|
|
|
|
|
phase=u
|
|
|
|
|
ac_flags 1 otwo +O2
|
|
|
|
|
phase=x
|
|
|
|
|
;;
|
|
|
|
|
kencc|tcc|tendra)
|
|
|
|
|
# no special optimisation
|
|
|
|
|
;;
|
|
|
|
|
sunpro)
|
2007-06-30 23:34:23 +02:00
|
|
|
|
cat >x <<-'EOF'
|
2014-01-05 22:57:29 +01:00
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) { return (isatty(0)); }
|
2007-06-30 23:34:23 +02:00
|
|
|
|
#define __IDSTRING_CONCAT(l,p) __LINTED__ ## l ## _ ## p
|
|
|
|
|
#define __IDSTRING_EXPAND(l,p) __IDSTRING_CONCAT(l,p)
|
|
|
|
|
#define pad void __IDSTRING_EXPAND(__LINE__,x)(void) { }
|
|
|
|
|
EOF
|
|
|
|
|
yes pad | head -n 256 >>x
|
|
|
|
|
ac_flags - 1 otwo -xO2 <x
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf x
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
xlc)
|
2007-07-22 15:34:52 +02:00
|
|
|
|
ac_flags 1 othree "-O3 -qstrict"
|
|
|
|
|
test 1 = $HAVE_CAN_OTHREE || ac_flags 1 otwo -O2
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
*)
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_flags 1 otwo -O2
|
|
|
|
|
test 1 = $HAVE_CAN_OTWO || ac_flags 1 optimise -O
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
esac
|
2007-06-30 23:34:23 +02:00
|
|
|
|
# other flags: just add them if they are supported
|
|
|
|
|
i=0
|
2013-07-25 17:54:33 +02:00
|
|
|
|
case $ct in
|
|
|
|
|
bcc)
|
|
|
|
|
ac_flags 1 strpool "${ccpc}-d" 'if string pooling can be enabled'
|
|
|
|
|
;;
|
|
|
|
|
clang)
|
|
|
|
|
i=1
|
|
|
|
|
;;
|
|
|
|
|
dec)
|
|
|
|
|
ac_flags 0 verb -verbose
|
|
|
|
|
ac_flags 1 rodata -readonly_strings
|
|
|
|
|
;;
|
|
|
|
|
dmc)
|
|
|
|
|
ac_flags 1 decl "${ccpc}-r" 'for strict prototype checks'
|
|
|
|
|
ac_flags 1 schk "${ccpc}-s" 'for stack overflow checking'
|
|
|
|
|
;;
|
|
|
|
|
gcc)
|
2008-10-28 15:32:43 +01:00
|
|
|
|
# The following tests run with -Werror (gcc only) if possible
|
|
|
|
|
NOWARN=$DOWARN; phase=u
|
2013-05-22 21:24:32 +02:00
|
|
|
|
ac_flags 1 wnodeprecateddecls -Wno-deprecated-declarations
|
2012-12-05 20:38:05 +01:00
|
|
|
|
# mksh is not written in CFrustFrust!
|
|
|
|
|
ac_flags 1 no_eh_frame -fno-asynchronous-unwind-tables
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_flags 1 fnostrictaliasing -fno-strict-aliasing
|
2014-06-29 12:56:08 +02:00
|
|
|
|
ac_flags 1 fstackprotectorstrong -fstack-protector-strong
|
|
|
|
|
test 1 = $HAVE_CAN_FSTACKPROTECTORSTRONG || \
|
|
|
|
|
ac_flags 1 fstackprotectorall -fstack-protector-all
|
2011-06-05 20:23:43 +02:00
|
|
|
|
test $cm = dragonegg && case " $CC $CFLAGS $LDFLAGS " in
|
|
|
|
|
*\ -fplugin=*dragonegg*) ;;
|
|
|
|
|
*) ac_flags 1 fplugin_dragonegg -fplugin=dragonegg ;;
|
|
|
|
|
esac
|
2013-07-25 17:54:33 +02:00
|
|
|
|
case $cm in
|
|
|
|
|
combine)
|
2011-06-05 20:16:19 +02:00
|
|
|
|
fv=0
|
|
|
|
|
checks='7 8'
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
lto)
|
|
|
|
|
fv=0
|
|
|
|
|
checks='1 2 3 4 5 6 7 8'
|
|
|
|
|
;;
|
|
|
|
|
*)
|
2011-06-05 20:16:19 +02:00
|
|
|
|
fv=1
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
esac
|
2011-06-05 20:16:19 +02:00
|
|
|
|
test $fv = 1 || for what in $checks; do
|
|
|
|
|
test $fv = 1 && break
|
|
|
|
|
case $what in
|
|
|
|
|
1) t_cflags='-flto=jobserver'
|
|
|
|
|
t_ldflags='-fuse-linker-plugin'
|
|
|
|
|
t_use=1 t_name=fltojs_lp ;;
|
|
|
|
|
2) t_cflags='-flto=jobserver' t_ldflags=''
|
|
|
|
|
t_use=1 t_name=fltojs_nn ;;
|
|
|
|
|
3) t_cflags='-flto=jobserver'
|
|
|
|
|
t_ldflags='-fno-use-linker-plugin -fwhole-program'
|
|
|
|
|
t_use=1 t_name=fltojs_np ;;
|
|
|
|
|
4) t_cflags='-flto'
|
|
|
|
|
t_ldflags='-fuse-linker-plugin'
|
|
|
|
|
t_use=1 t_name=fltons_lp ;;
|
|
|
|
|
5) t_cflags='-flto' t_ldflags=''
|
|
|
|
|
t_use=1 t_name=fltons_nn ;;
|
|
|
|
|
6) t_cflags='-flto'
|
|
|
|
|
t_ldflags='-fno-use-linker-plugin -fwhole-program'
|
|
|
|
|
t_use=1 t_name=fltons_np ;;
|
|
|
|
|
7) t_cflags='-fwhole-program --combine' t_ldflags=''
|
|
|
|
|
t_use=0 t_name=combine cm=combine ;;
|
|
|
|
|
8) fv=1 cm=normal ;;
|
|
|
|
|
esac
|
|
|
|
|
test $fv = 1 && break
|
|
|
|
|
ac_flags $t_use $t_name "$t_cflags" \
|
|
|
|
|
"if gcc supports $t_cflags $t_ldflags" "$t_ldflags"
|
|
|
|
|
done
|
2016-08-24 22:50:11 +02:00
|
|
|
|
ac_flags 1 data_abi_align -malign-data=abi
|
2007-06-30 23:34:23 +02:00
|
|
|
|
i=1
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
hpcc)
|
2009-12-12 23:27:10 +01:00
|
|
|
|
phase=u
|
2011-12-18 03:20:09 +01:00
|
|
|
|
# probably not needed
|
|
|
|
|
#ac_flags 1 agcc -Agcc 'for support of GCC extensions'
|
2009-12-12 23:27:10 +01:00
|
|
|
|
phase=x
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
icc)
|
|
|
|
|
ac_flags 1 fnobuiltinsetmode -fno-builtin-setmode
|
|
|
|
|
ac_flags 1 fnostrictaliasing -fno-strict-aliasing
|
|
|
|
|
ac_flags 1 fstacksecuritycheck -fstack-security-check
|
|
|
|
|
i=1
|
|
|
|
|
;;
|
|
|
|
|
mipspro)
|
2008-03-27 23:17:01 +01:00
|
|
|
|
ac_flags 1 fullwarn -fullwarn 'for remark output support'
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
msc)
|
2007-10-25 16:18:56 +02:00
|
|
|
|
ac_flags 1 strpool "${ccpc}/GF" 'if string pooling can be enabled'
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo 'int main(void) { char test[64] = ""; return (*test); }' >x
|
2007-10-25 16:18:56 +02:00
|
|
|
|
ac_flags - 1 stackon "${ccpc}/GZ" 'if stack checks can be enabled' <x
|
2007-07-01 23:27:03 +02:00
|
|
|
|
ac_flags - 1 stckall "${ccpc}/Ge" 'stack checks for all functions' <x
|
|
|
|
|
ac_flags - 1 secuchk "${ccpc}/GS" 'for compiler security checks' <x
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf x
|
2007-07-01 23:27:03 +02:00
|
|
|
|
ac_flags 1 wall "${ccpc}/Wall" 'to enable all warnings'
|
|
|
|
|
ac_flags 1 wp64 "${ccpc}/Wp64" 'to enable 64-bit warnings'
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
nwcc)
|
|
|
|
|
#broken# ac_flags 1 ssp -stackprotect
|
2016-11-07 17:55:51 +01:00
|
|
|
|
i=1
|
|
|
|
|
;;
|
|
|
|
|
pcc)
|
|
|
|
|
ac_flags 1 fstackprotectorall -fstack-protector-all
|
|
|
|
|
i=1
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
sunpro)
|
|
|
|
|
phase=u
|
|
|
|
|
ac_flags 1 v -v
|
|
|
|
|
ac_flags 1 ipo -xipo 'for cross-module optimisation'
|
|
|
|
|
phase=x
|
|
|
|
|
;;
|
|
|
|
|
tcc)
|
|
|
|
|
: #broken# ac_flags 1 boundschk -b
|
|
|
|
|
;;
|
|
|
|
|
tendra)
|
|
|
|
|
ac_flags 0 ysystem -Ysystem
|
|
|
|
|
test 1 = $HAVE_CAN_YSYSTEM && CPPFLAGS="-Ysystem $CPPFLAGS"
|
|
|
|
|
ac_flags 1 extansi -Xa
|
|
|
|
|
;;
|
|
|
|
|
xlc)
|
2007-07-22 15:34:52 +02:00
|
|
|
|
ac_flags 1 rodata "-qro -qroconst -qroptr"
|
|
|
|
|
ac_flags 1 rtcheck -qcheck=all
|
2013-01-12 03:25:01 +01:00
|
|
|
|
#ac_flags 1 rtchkc -qextchk # reported broken
|
2007-07-22 15:34:52 +02:00
|
|
|
|
ac_flags 1 wformat "-qformat=all -qformat=nozln"
|
|
|
|
|
#ac_flags 1 wp64 -qwarn64 # too verbose for now
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
esac
|
2008-10-28 15:32:43 +01:00
|
|
|
|
# flags common to a subset of compilers (run with -Werror on gcc)
|
2007-06-30 23:34:23 +02:00
|
|
|
|
if test 1 = $i; then
|
|
|
|
|
ac_flags 1 wall -Wall
|
2012-04-08 22:02:33 +02:00
|
|
|
|
ac_flags 1 fwrapv -fwrapv
|
2007-03-10 19:51:59 +01:00
|
|
|
|
fi
|
2007-01-17 18:31:59 +01:00
|
|
|
|
|
2016-07-25 02:04:48 +02:00
|
|
|
|
# “on demand” means: GCC version >= 4
|
|
|
|
|
fd='if to rely on compiler for string pooling'
|
|
|
|
|
ac_cache string_pooling || case $HAVE_STRING_POOLING in
|
|
|
|
|
2) fx=' (on demand, cached)' ;;
|
|
|
|
|
i1) fv=1 ;;
|
|
|
|
|
i2) fv=2; fx=' (on demand)' ;;
|
|
|
|
|
esac
|
|
|
|
|
ac_testdone
|
2016-07-25 23:05:25 +02:00
|
|
|
|
test x"$HAVE_STRING_POOLING" = x"0" || ac_cppflags
|
2016-07-25 02:04:48 +02:00
|
|
|
|
|
2011-06-05 20:16:19 +02:00
|
|
|
|
phase=x
|
2008-10-28 15:32:43 +01:00
|
|
|
|
# The following tests run with -Werror or similar (all compilers) if possible
|
2007-06-21 18:11:37 +02:00
|
|
|
|
NOWARN=$DOWARN
|
2010-01-01 19:27:42 +01:00
|
|
|
|
test $ct = pcc && phase=u
|
2007-06-21 18:11:37 +02:00
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Compiler: check for stuff that only generates warnings
|
|
|
|
|
#
|
2011-04-09 23:01:03 +02:00
|
|
|
|
ac_test attribute_bounded '' 'for __attribute__((__bounded__))' <<-'EOF'
|
2011-06-05 21:55:22 +02:00
|
|
|
|
#if defined(__TenDRA__) || (defined(__GNUC__) && (__GNUC__ < 2))
|
2013-05-22 20:56:50 +02:00
|
|
|
|
extern int thiswillneverbedefinedIhope(void);
|
2011-06-05 21:55:22 +02:00
|
|
|
|
/* force a failure: TenDRA and gcc 1.42 have false positive here */
|
2008-03-28 14:55:11 +01:00
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
#else
|
2007-06-21 18:11:37 +02:00
|
|
|
|
#include <string.h>
|
|
|
|
|
#undef __attribute__
|
|
|
|
|
int xcopy(const void *, void *, size_t)
|
2013-10-31 21:05:39 +01:00
|
|
|
|
__attribute__((__bounded__(__buffer__, 1, 3)))
|
|
|
|
|
__attribute__((__bounded__(__buffer__, 2, 3)));
|
2007-06-21 18:11:37 +02:00
|
|
|
|
int main(int ac, char *av[]) { return (xcopy(av[0], av[--ac], 1)); }
|
|
|
|
|
int xcopy(const void *s, void *d, size_t n) {
|
2012-12-17 23:14:27 +01:00
|
|
|
|
/*
|
|
|
|
|
* if memmove does not exist, we are not on a system
|
|
|
|
|
* with GCC with __bounded__ attribute either so poo
|
|
|
|
|
*/
|
2009-05-27 11:58:24 +02:00
|
|
|
|
memmove(d, s, n); return ((int)n);
|
2007-06-21 18:11:37 +02:00
|
|
|
|
}
|
2009-12-12 23:27:10 +01:00
|
|
|
|
#endif
|
2007-06-21 18:11:37 +02:00
|
|
|
|
EOF
|
2011-04-09 23:01:03 +02:00
|
|
|
|
ac_test attribute_format '' 'for __attribute__((__format__))' <<-'EOF'
|
2011-06-05 21:55:22 +02:00
|
|
|
|
#if defined(__TenDRA__) || (defined(__GNUC__) && (__GNUC__ < 2))
|
2013-05-22 20:56:50 +02:00
|
|
|
|
extern int thiswillneverbedefinedIhope(void);
|
2011-06-05 21:55:22 +02:00
|
|
|
|
/* force a failure: TenDRA and gcc 1.42 have false positive here */
|
2009-12-12 23:27:10 +01:00
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
#else
|
2011-03-16 21:03:21 +01:00
|
|
|
|
#define fprintf printfoo
|
2009-12-12 23:27:10 +01:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#undef __attribute__
|
2011-03-16 21:03:21 +01:00
|
|
|
|
#undef fprintf
|
|
|
|
|
extern int fprintf(FILE *, const char *format, ...)
|
2013-10-31 21:05:39 +01:00
|
|
|
|
__attribute__((__format__(__printf__, 2, 3)));
|
2011-03-16 21:03:21 +01:00
|
|
|
|
int main(int ac, char **av) { return (fprintf(stderr, "%s%d", *av, ac)); }
|
2009-12-12 23:27:10 +01:00
|
|
|
|
#endif
|
|
|
|
|
EOF
|
2011-04-09 23:01:03 +02:00
|
|
|
|
ac_test attribute_noreturn '' 'for __attribute__((__noreturn__))' <<-'EOF'
|
2011-06-05 21:55:22 +02:00
|
|
|
|
#if defined(__TenDRA__) || (defined(__GNUC__) && (__GNUC__ < 2))
|
2013-05-22 20:56:50 +02:00
|
|
|
|
extern int thiswillneverbedefinedIhope(void);
|
2011-06-05 21:55:22 +02:00
|
|
|
|
/* force a failure: TenDRA and gcc 1.42 have false positive here */
|
2009-12-12 23:27:10 +01:00
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
#else
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#undef __attribute__
|
2011-04-09 23:01:03 +02:00
|
|
|
|
void fnord(void) __attribute__((__noreturn__));
|
2009-12-12 23:27:10 +01:00
|
|
|
|
int main(void) { fnord(); }
|
|
|
|
|
void fnord(void) { exit(0); }
|
|
|
|
|
#endif
|
|
|
|
|
EOF
|
2014-01-05 22:57:29 +01:00
|
|
|
|
ac_test attribute_pure '' 'for __attribute__((__pure__))' <<-'EOF'
|
|
|
|
|
#if defined(__TenDRA__) || (defined(__GNUC__) && (__GNUC__ < 2))
|
|
|
|
|
extern int thiswillneverbedefinedIhope(void);
|
|
|
|
|
/* force a failure: TenDRA and gcc 1.42 have false positive here */
|
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
#else
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#undef __attribute__
|
|
|
|
|
int foo(const char *) __attribute__((__pure__));
|
|
|
|
|
int main(int ac, char **av) { return (foo(av[ac - 1]) + isatty(0)); }
|
|
|
|
|
int foo(const char *s) { return ((int)s[0]); }
|
|
|
|
|
#endif
|
|
|
|
|
EOF
|
2011-04-09 23:01:03 +02:00
|
|
|
|
ac_test attribute_unused '' 'for __attribute__((__unused__))' <<-'EOF'
|
2011-06-05 21:55:22 +02:00
|
|
|
|
#if defined(__TenDRA__) || (defined(__GNUC__) && (__GNUC__ < 2))
|
2013-05-22 20:56:50 +02:00
|
|
|
|
extern int thiswillneverbedefinedIhope(void);
|
2011-06-05 21:55:22 +02:00
|
|
|
|
/* force a failure: TenDRA and gcc 1.42 have false positive here */
|
2009-12-12 23:27:10 +01:00
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
#else
|
2014-01-05 22:57:29 +01:00
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#undef __attribute__
|
2011-04-09 23:01:03 +02:00
|
|
|
|
int main(int ac __attribute__((__unused__)), char **av
|
2014-01-05 22:57:29 +01:00
|
|
|
|
__attribute__((__unused__))) { return (isatty(0)); }
|
2009-12-12 23:27:10 +01:00
|
|
|
|
#endif
|
|
|
|
|
EOF
|
2011-04-09 23:01:03 +02:00
|
|
|
|
ac_test attribute_used '' 'for __attribute__((__used__))' <<-'EOF'
|
2011-06-05 21:55:22 +02:00
|
|
|
|
#if defined(__TenDRA__) || (defined(__GNUC__) && (__GNUC__ < 2))
|
2013-05-22 20:56:50 +02:00
|
|
|
|
extern int thiswillneverbedefinedIhope(void);
|
2011-06-05 21:55:22 +02:00
|
|
|
|
/* force a failure: TenDRA and gcc 1.42 have false positive here */
|
2009-12-12 23:27:10 +01:00
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
#else
|
2014-01-05 22:57:29 +01:00
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#undef __attribute__
|
2011-04-09 23:01:03 +02:00
|
|
|
|
static const char fnord[] __attribute__((__used__)) = "42";
|
2014-01-05 22:57:29 +01:00
|
|
|
|
int main(void) { return (isatty(0)); }
|
2009-12-12 23:27:10 +01:00
|
|
|
|
#endif
|
2007-06-21 18:11:37 +02:00
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
# End of tests run with -Werror
|
|
|
|
|
NOWARN=$save_NOWARN
|
2010-01-01 19:27:42 +01:00
|
|
|
|
phase=x
|
2007-06-21 18:11:37 +02:00
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# mksh: flavours (full/small mksh, omit certain stuff)
|
|
|
|
|
#
|
2009-07-19 16:59:40 +02:00
|
|
|
|
if ac_ifcpp 'ifdef MKSH_SMALL' isset_MKSH_SMALL '' \
|
|
|
|
|
"if a reduced-feature mksh is requested"; then
|
2015-07-09 22:11:45 +02:00
|
|
|
|
: "${HAVE_NICE=0}"
|
|
|
|
|
: "${HAVE_PERSISTENT_HISTORY=0}"
|
2011-03-28 23:15:05 +02:00
|
|
|
|
check_categories="$check_categories smksh"
|
2006-11-10 00:04:34 +01:00
|
|
|
|
fi
|
2013-05-02 22:21:45 +02:00
|
|
|
|
ac_ifcpp 'if defined(MKSH_BINSHPOSIX) || defined(MKSH_BINSHREDUCED)' \
|
|
|
|
|
isset_MKSH_BINSH '' 'if invoking as sh should be handled specially' && \
|
2011-03-28 23:15:05 +02:00
|
|
|
|
check_categories="$check_categories binsh"
|
2009-07-25 22:52:41 +02:00
|
|
|
|
ac_ifcpp 'ifdef MKSH_UNEMPLOYED' isset_MKSH_UNEMPLOYED '' \
|
|
|
|
|
"if mksh will be built without job control" && \
|
2011-03-28 23:15:05 +02:00
|
|
|
|
check_categories="$check_categories arge"
|
2011-01-30 02:35:35 +01:00
|
|
|
|
ac_ifcpp 'ifdef MKSH_NOPROSPECTOFWORK' isset_MKSH_NOPROSPECTOFWORK '' \
|
|
|
|
|
"if mksh will be built without job signals" && \
|
2011-03-28 23:15:05 +02:00
|
|
|
|
check_categories="$check_categories arge nojsig"
|
2009-07-25 22:18:13 +02:00
|
|
|
|
ac_ifcpp 'ifdef MKSH_ASSUME_UTF8' isset_MKSH_ASSUME_UTF8 '' \
|
2015-07-09 22:11:45 +02:00
|
|
|
|
'if the default UTF-8 mode is specified' && : "${HAVE_SETLOCALE_CTYPE=0}"
|
2012-04-07 13:19:53 +02:00
|
|
|
|
#ac_ifcpp 'ifdef MKSH_DISABLE_DEPRECATED' isset_MKSH_DISABLE_DEPRECATED '' \
|
|
|
|
|
# "if deprecated features are to be omitted" && \
|
|
|
|
|
# check_categories="$check_categories nodeprecated"
|
2012-11-30 21:19:16 +01:00
|
|
|
|
#ac_ifcpp 'ifdef MKSH_DISABLE_EXPERIMENTAL' isset_MKSH_DISABLE_EXPERIMENTAL '' \
|
|
|
|
|
# "if experimental features are to be omitted" && \
|
|
|
|
|
# check_categories="$check_categories noexperimental"
|
2013-02-19 19:45:22 +01:00
|
|
|
|
ac_ifcpp 'ifdef MKSH_MIDNIGHTBSD01ASH_COMPAT' isset_MKSH_MIDNIGHTBSD01ASH_COMPAT '' \
|
|
|
|
|
'if the MidnightBSD 0.1 ash compatibility mode is requested' && \
|
|
|
|
|
check_categories="$check_categories mnbsdash"
|
2006-11-10 00:04:34 +01:00
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# Environment: headers
|
|
|
|
|
#
|
2012-12-17 22:55:06 +01:00
|
|
|
|
ac_header sys/time.h sys/types.h
|
|
|
|
|
ac_header time.h sys/types.h
|
|
|
|
|
test "11" = "$HAVE_SYS_TIME_H$HAVE_TIME_H" || HAVE_BOTH_TIME_H=0
|
|
|
|
|
ac_test both_time_h '' 'whether <sys/time.h> and <time.h> can both be included' <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
#include <time.h>
|
2014-01-05 22:57:29 +01:00
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) { struct tm tm; return ((int)sizeof(tm) + isatty(0)); }
|
2012-12-17 22:55:06 +01:00
|
|
|
|
EOF
|
2011-02-09 20:32:26 +01:00
|
|
|
|
ac_header sys/bsdtypes.h
|
2011-01-30 03:18:20 +01:00
|
|
|
|
ac_header sys/file.h sys/types.h
|
2008-03-27 18:55:31 +01:00
|
|
|
|
ac_header sys/mkdev.h sys/types.h
|
2007-03-04 05:36:45 +01:00
|
|
|
|
ac_header sys/mman.h sys/types.h
|
2011-02-09 20:32:26 +01:00
|
|
|
|
ac_header sys/param.h
|
2012-12-17 22:55:06 +01:00
|
|
|
|
ac_header sys/resource.h sys/types.h _time
|
2011-02-09 20:32:26 +01:00
|
|
|
|
ac_header sys/select.h sys/types.h
|
2007-01-18 16:50:32 +01:00
|
|
|
|
ac_header sys/sysmacros.h
|
2011-02-09 20:32:26 +01:00
|
|
|
|
ac_header bstring.h
|
2010-08-24 17:19:54 +02:00
|
|
|
|
ac_header grp.h sys/types.h
|
2015-07-09 22:52:43 +02:00
|
|
|
|
ac_header io.h
|
2007-01-18 16:50:32 +01:00
|
|
|
|
ac_header libgen.h
|
2008-10-04 21:13:22 +02:00
|
|
|
|
ac_header libutil.h sys/types.h
|
2007-01-18 16:50:32 +01:00
|
|
|
|
ac_header paths.h
|
2010-08-24 17:19:54 +02:00
|
|
|
|
ac_header stdint.h stdarg.h
|
2011-02-09 20:32:26 +01:00
|
|
|
|
# include strings.h only if compatible with string.h
|
|
|
|
|
ac_header strings.h sys/types.h string.h
|
2012-05-05 00:18:27 +02:00
|
|
|
|
ac_header termios.h
|
2008-07-15 22:54:47 +02:00
|
|
|
|
ac_header ulimit.h sys/types.h
|
2007-01-18 16:50:32 +01:00
|
|
|
|
ac_header values.h
|
2007-01-17 23:51:47 +01:00
|
|
|
|
|
2007-03-19 23:58:19 +01:00
|
|
|
|
#
|
|
|
|
|
# Environment: definitions
|
|
|
|
|
#
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo '#include <sys/types.h>
|
2014-01-05 22:57:29 +01:00
|
|
|
|
#include <unistd.h>
|
2008-10-24 23:35:21 +02:00
|
|
|
|
/* check that off_t can represent 2^63-1 correctly, thx FSF */
|
2014-03-28 13:08:25 +01:00
|
|
|
|
#define LARGE_OFF_T ((((off_t)1 << 31) << 31) - 1 + (((off_t)1 << 31) << 31))
|
2008-10-24 23:35:21 +02:00
|
|
|
|
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 &&
|
|
|
|
|
LARGE_OFF_T % 2147483647 == 1) ? 1 : -1];
|
2014-01-05 22:57:29 +01:00
|
|
|
|
int main(void) { return (isatty(0)); }' >lft.c
|
2007-10-25 16:18:56 +02:00
|
|
|
|
ac_testn can_lfs '' "for large file support" <lft.c
|
2007-03-19 23:58:19 +01:00
|
|
|
|
save_CPPFLAGS=$CPPFLAGS
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -D_FILE_OFFSET_BITS=64
|
2007-03-19 23:58:19 +01:00
|
|
|
|
ac_testn can_lfs_sus '!' can_lfs 0 "... with -D_FILE_OFFSET_BITS=64" <lft.c
|
2007-07-09 13:19:55 +02:00
|
|
|
|
if test 0 = $HAVE_CAN_LFS_SUS; then
|
2011-10-07 21:51:44 +02:00
|
|
|
|
CPPFLAGS=$save_CPPFLAGS
|
|
|
|
|
add_cppflags -D_LARGE_FILES=1
|
2007-07-09 13:19:55 +02:00
|
|
|
|
ac_testn can_lfs_aix '!' can_lfs 0 "... with -D_LARGE_FILES=1" <lft.c
|
|
|
|
|
test 1 = $HAVE_CAN_LFS_AIX || CPPFLAGS=$save_CPPFLAGS
|
|
|
|
|
fi
|
2015-04-12 01:28:21 +02:00
|
|
|
|
rm -f lft.c
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf lft* # end of large file support test
|
2007-03-19 23:58:19 +01:00
|
|
|
|
|
2007-01-18 00:18:55 +01:00
|
|
|
|
#
|
|
|
|
|
# Environment: types
|
|
|
|
|
#
|
2010-08-24 17:19:54 +02:00
|
|
|
|
ac_test can_inttypes '!' stdint_h 1 "for standard 32-bit integer types" <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
2010-08-24 17:46:06 +02:00
|
|
|
|
#include <stddef.h>
|
2014-11-25 21:00:39 +01:00
|
|
|
|
int main(int ac, char **av) { return ((uint32_t)(size_t)*av + (int32_t)ac); }
|
2010-08-24 17:19:54 +02:00
|
|
|
|
EOF
|
|
|
|
|
ac_test can_ucbints '!' can_inttypes 1 "for UCB 32-bit integer types" <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
2010-08-24 17:46:06 +02:00
|
|
|
|
#include <stddef.h>
|
2014-11-25 21:00:39 +01:00
|
|
|
|
int main(int ac, char **av) { return ((u_int32_t)(size_t)*av + (int32_t)ac); }
|
2010-08-24 17:19:54 +02:00
|
|
|
|
EOF
|
|
|
|
|
ac_test can_int8type '!' stdint_h 1 "for standard 8-bit integer type" <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
2010-08-24 17:46:06 +02:00
|
|
|
|
#include <stddef.h>
|
2014-11-25 21:00:39 +01:00
|
|
|
|
int main(int ac, char **av) { return ((uint8_t)(size_t)av[ac]); }
|
2010-08-24 17:19:54 +02:00
|
|
|
|
EOF
|
|
|
|
|
ac_test can_ucbint8 '!' can_int8type 1 "for UCB 8-bit integer type" <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
2010-08-24 17:46:06 +02:00
|
|
|
|
#include <stddef.h>
|
2014-11-25 21:00:39 +01:00
|
|
|
|
int main(int ac, char **av) { return ((u_int8_t)(size_t)av[ac]); }
|
2010-08-24 17:19:54 +02:00
|
|
|
|
EOF
|
|
|
|
|
|
2007-01-18 00:18:55 +01:00
|
|
|
|
ac_test rlim_t <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
2012-12-17 22:55:06 +01:00
|
|
|
|
#if HAVE_BOTH_TIME_H
|
2007-01-18 00:18:55 +01:00
|
|
|
|
#include <sys/time.h>
|
2012-12-17 22:55:06 +01:00
|
|
|
|
#include <time.h>
|
|
|
|
|
#elif HAVE_SYS_TIME_H
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
#elif HAVE_TIME_H
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#endif
|
|
|
|
|
#if HAVE_SYS_RESOURCE_H
|
2007-01-18 00:18:55 +01:00
|
|
|
|
#include <sys/resource.h>
|
2012-12-17 22:55:06 +01:00
|
|
|
|
#endif
|
2007-01-18 00:18:55 +01:00
|
|
|
|
#include <unistd.h>
|
2014-01-05 22:57:29 +01:00
|
|
|
|
int main(void) { return (((int)(rlim_t)0) + isatty(0)); }
|
2007-01-18 00:18:55 +01:00
|
|
|
|
EOF
|
|
|
|
|
|
2007-01-18 01:16:26 +01:00
|
|
|
|
# only testn: added later below
|
2007-01-18 00:54:39 +01:00
|
|
|
|
ac_testn sig_t <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <signal.h>
|
2008-07-18 13:42:52 +02:00
|
|
|
|
#include <stddef.h>
|
2013-06-04 00:27:15 +02:00
|
|
|
|
volatile sig_t foo = (sig_t)0;
|
|
|
|
|
int main(void) { return (foo == (sig_t)0); }
|
2007-01-18 00:54:39 +01:00
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
ac_testn sighandler_t '!' sig_t 0 <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <signal.h>
|
2008-07-18 13:42:52 +02:00
|
|
|
|
#include <stddef.h>
|
2013-06-04 00:27:15 +02:00
|
|
|
|
volatile sighandler_t foo = (sighandler_t)0;
|
|
|
|
|
int main(void) { return (foo == (sighandler_t)0); }
|
2007-01-18 00:54:39 +01:00
|
|
|
|
EOF
|
|
|
|
|
if test 1 = $HAVE_SIGHANDLER_T; then
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -Dsig_t=sighandler_t
|
2007-01-18 00:54:39 +01:00
|
|
|
|
HAVE_SIG_T=1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
ac_testn __sighandler_t '!' sig_t 0 <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <signal.h>
|
2008-07-18 13:42:52 +02:00
|
|
|
|
#include <stddef.h>
|
2013-06-04 00:27:15 +02:00
|
|
|
|
volatile __sighandler_t foo = (__sighandler_t)0;
|
|
|
|
|
int main(void) { return (foo == (__sighandler_t)0); }
|
2007-01-18 00:54:39 +01:00
|
|
|
|
EOF
|
2007-01-18 01:16:26 +01:00
|
|
|
|
if test 1 = $HAVE___SIGHANDLER_T; then
|
2011-10-07 21:51:44 +02:00
|
|
|
|
add_cppflags -Dsig_t=__sighandler_t
|
2007-01-18 00:54:39 +01:00
|
|
|
|
HAVE_SIG_T=1
|
|
|
|
|
fi
|
|
|
|
|
|
2011-10-07 21:51:44 +02:00
|
|
|
|
test 1 = $HAVE_SIG_T || add_cppflags -Dsig_t=nosig_t
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_cppflags SIG_T
|
2007-01-18 01:10:16 +01:00
|
|
|
|
|
2012-01-03 01:58:09 +01:00
|
|
|
|
#
|
|
|
|
|
# check whether whatever we use for the final link will succeed
|
|
|
|
|
#
|
|
|
|
|
if test $cm = makefile; then
|
|
|
|
|
: nothing to check
|
|
|
|
|
else
|
|
|
|
|
HAVE_LINK_WORKS=x
|
|
|
|
|
ac_testinit link_works '' 'checking if the final link command may succeed'
|
|
|
|
|
fv=1
|
2015-04-12 01:28:21 +02:00
|
|
|
|
cat >conftest.c <<-EOF
|
2012-01-03 01:58:09 +01:00
|
|
|
|
#define EXTERN
|
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
2015-04-12 01:28:21 +02:00
|
|
|
|
__RCSID("$srcversion");
|
|
|
|
|
int main(void) { printf("Hello, World!\\n"); return (isatty(0)); }
|
2012-01-03 01:58:09 +01:00
|
|
|
|
EOF
|
|
|
|
|
case $cm in
|
|
|
|
|
llvm)
|
|
|
|
|
v "$CC $CFLAGS $CPPFLAGS $NOWARN -emit-llvm -c conftest.c" || fv=0
|
2012-06-24 22:46:07 +02:00
|
|
|
|
rmf $tfn.s
|
|
|
|
|
test $fv = 0 || v "llvm-link -o - conftest.o | opt $optflags | llc -o $tfn.s" || fv=0
|
|
|
|
|
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn $tfn.s $LIBS $ccpr"
|
2012-01-03 01:58:09 +01:00
|
|
|
|
;;
|
|
|
|
|
dragonegg)
|
|
|
|
|
v "$CC $CFLAGS $CPPFLAGS $NOWARN -S -flto conftest.c" || fv=0
|
|
|
|
|
test $fv = 0 || v "mv conftest.s conftest.ll"
|
|
|
|
|
test $fv = 0 || v "llvm-as conftest.ll" || fv=0
|
2012-06-24 22:46:07 +02:00
|
|
|
|
rmf $tfn.s
|
|
|
|
|
test $fv = 0 || v "llvm-link -o - conftest.bc | opt $optflags | llc -o $tfn.s" || fv=0
|
|
|
|
|
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn $tfn.s $LIBS $ccpr"
|
2012-01-03 01:58:09 +01:00
|
|
|
|
;;
|
|
|
|
|
combine)
|
|
|
|
|
v "$CC $CFLAGS $CPPFLAGS $LDFLAGS -fwhole-program --combine $NOWARN -o $tcfn conftest.c $LIBS $ccpr"
|
|
|
|
|
;;
|
|
|
|
|
lto|normal)
|
|
|
|
|
cm=normal
|
|
|
|
|
v "$CC $CFLAGS $CPPFLAGS $NOWARN -c conftest.c" || fv=0
|
|
|
|
|
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn conftest.o $LIBS $ccpr"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
test -f $tcfn || fv=0
|
|
|
|
|
ac_testdone
|
|
|
|
|
test $fv = 1 || exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
2012-12-18 00:31:30 +01:00
|
|
|
|
# Environment: errors and signals
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
2007-04-23 13:33:26 +02:00
|
|
|
|
test x"NetBSD" = x"$TARGET_OS" && $e Ignore the compatibility warning.
|
|
|
|
|
|
2012-12-18 00:31:30 +01:00
|
|
|
|
ac_testn sys_errlist '' "the sys_errlist[] array and sys_nerr" <<-'EOF'
|
2012-12-28 04:20:35 +01:00
|
|
|
|
extern const int sys_nerr;
|
2012-12-28 03:28:39 +01:00
|
|
|
|
extern const char * const sys_errlist[];
|
2014-01-05 22:57:29 +01:00
|
|
|
|
extern int isatty(int);
|
|
|
|
|
int main(void) { return (*sys_errlist[sys_nerr - 1] + isatty(0)); }
|
2012-12-18 00:31:30 +01:00
|
|
|
|
EOF
|
|
|
|
|
ac_testn _sys_errlist '!' sys_errlist 0 "the _sys_errlist[] array and _sys_nerr" <<-'EOF'
|
2012-12-28 04:20:35 +01:00
|
|
|
|
extern const int _sys_nerr;
|
2012-12-28 03:28:39 +01:00
|
|
|
|
extern const char * const _sys_errlist[];
|
2014-01-05 22:57:29 +01:00
|
|
|
|
extern int isatty(int);
|
|
|
|
|
int main(void) { return (*_sys_errlist[_sys_nerr - 1] + isatty(0)); }
|
2012-12-18 00:31:30 +01:00
|
|
|
|
EOF
|
|
|
|
|
if test 1 = "$HAVE__SYS_ERRLIST"; then
|
|
|
|
|
add_cppflags -Dsys_nerr=_sys_nerr
|
|
|
|
|
add_cppflags -Dsys_errlist=_sys_errlist
|
|
|
|
|
HAVE_SYS_ERRLIST=1
|
|
|
|
|
fi
|
|
|
|
|
ac_cppflags SYS_ERRLIST
|
|
|
|
|
|
2007-06-05 23:47:49 +02:00
|
|
|
|
for what in name list; do
|
|
|
|
|
uwhat=`upper $what`
|
|
|
|
|
ac_testn sys_sig$what '' "the sys_sig${what}[] array" <<-EOF
|
2012-12-28 03:28:39 +01:00
|
|
|
|
extern const char * const sys_sig${what}[];
|
2014-01-05 22:57:29 +01:00
|
|
|
|
extern int isatty(int);
|
|
|
|
|
int main(void) { return (sys_sig${what}[0][0] + isatty(0)); }
|
2007-06-05 23:47:49 +02:00
|
|
|
|
EOF
|
|
|
|
|
ac_testn _sys_sig$what '!' sys_sig$what 0 "the _sys_sig${what}[] array" <<-EOF
|
2012-12-28 03:28:39 +01:00
|
|
|
|
extern const char * const _sys_sig${what}[];
|
2014-01-05 22:57:29 +01:00
|
|
|
|
extern int isatty(int);
|
|
|
|
|
int main(void) { return (_sys_sig${what}[0][0] + isatty(0)); }
|
2007-06-05 23:47:49 +02:00
|
|
|
|
EOF
|
2011-10-07 21:51:44 +02:00
|
|
|
|
eval uwhat_v=\$HAVE__SYS_SIG$uwhat
|
|
|
|
|
if test 1 = "$uwhat_v"; then
|
|
|
|
|
add_cppflags -Dsys_sig$what=_sys_sig$what
|
|
|
|
|
eval HAVE_SYS_SIG$uwhat=1
|
2007-06-05 23:47:49 +02:00
|
|
|
|
fi
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_cppflags SYS_SIG$uwhat
|
2007-06-05 23:47:49 +02:00
|
|
|
|
done
|
Clean up the signal mess, saves 172 Bytes:
* 'sigseen' in Build.sh goes away
* Signal name existence is checked in this order:
have our own¹ -> sys_signame[] -> _sys_signame[] -> build our own²
* Signal description existence is checked in this order:
sys_siglist[] -> _sys_siglist[] -> strsignal() -> NULL³
¹ Predefined list of items, for operating systems where we
cannot build² them, i.e. Plan 9 and Minix 3 (e.g. no $CPP -dD)
² The usual cpp(1) stuff
³ Changed later, see below
* Make $CPP test dependent on $NEED_MKSH_SIGNAME (others can
be added here, this is not absolute)
* Make signal name list generation² dependent on $NEED_MKSH_SIGNAME
* Fix check if the generation worked
* Guarantee that sigtraps[*].name and sigtraps[*].mess are valid
C strings; this makes the code shorter *and* removes a few pos-
sible nil pointer dereferences
* Embed autoconf'd usages of sys_sig* / strsignal / mksh_sigpairs
into inittraps()
* Check for each signal 0<=i<=NSIG that
name is not NULL or "" -> replace with ("%d", i)
mess is not NULL or "" -> replace with ("Signal %d", i)
name does not start (case-insensitive) with "SIG" -> name += 3
* In gettrap(), fix check if signal name starts, case-sensitive
or case-insensitive, depending on need, with "SIG" (bug from millert@)
Other changes:
* Build.sh: ac_test[n]() are documented
* Build.sh: ac_test[n]() can have negative prereqs as well now
* Build.sh: use <<-'EOF' consistently
* bump patchlevel to today
2007-01-12 01:25:40 +01:00
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# Environment: library functions
|
|
|
|
|
#
|
2012-03-28 00:36:53 +02:00
|
|
|
|
ac_test flock <<-'EOF'
|
2012-10-14 16:02:10 +02:00
|
|
|
|
#include <sys/types.h>
|
2007-01-18 17:05:05 +01:00
|
|
|
|
#include <fcntl.h>
|
2012-03-28 00:41:17 +02:00
|
|
|
|
#undef flock
|
2012-10-14 16:02:10 +02:00
|
|
|
|
#if HAVE_SYS_FILE_H
|
|
|
|
|
#include <sys/file.h>
|
|
|
|
|
#endif
|
2012-03-28 00:36:53 +02:00
|
|
|
|
int main(void) { return (flock(0, LOCK_EX | LOCK_UN)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
ac_test lock_fcntl '!' flock 1 'whether we can lock files with fcntl' <<-'EOF'
|
|
|
|
|
#include <fcntl.h>
|
2012-03-28 00:41:17 +02:00
|
|
|
|
#undef flock
|
2012-03-28 00:36:53 +02:00
|
|
|
|
int main(void) {
|
|
|
|
|
struct flock lks;
|
|
|
|
|
lks.l_type = F_WRLCK | F_UNLCK;
|
|
|
|
|
return (fcntl(0, F_SETLKW, &lks));
|
|
|
|
|
}
|
2007-01-18 17:05:05 +01:00
|
|
|
|
EOF
|
|
|
|
|
|
2009-04-03 11:39:07 +02:00
|
|
|
|
ac_test getrusage <<-'EOF'
|
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
|
|
|
|
int main(void) {
|
|
|
|
|
struct rusage ru;
|
2009-05-27 11:58:24 +02:00
|
|
|
|
return (getrusage(RUSAGE_SELF, &ru) +
|
|
|
|
|
getrusage(RUSAGE_CHILDREN, &ru));
|
2009-04-03 11:39:07 +02:00
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
|
2013-11-30 18:41:35 +01:00
|
|
|
|
ac_test getsid <<-'EOF'
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) { return ((int)getsid(0)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
2012-11-20 19:50:46 +01:00
|
|
|
|
ac_test gettimeofday <<-'EOF'
|
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
2012-12-03 14:07:11 +01:00
|
|
|
|
int main(void) { struct timeval tv; return (gettimeofday(&tv, NULL)); }
|
2012-11-20 19:50:46 +01:00
|
|
|
|
EOF
|
|
|
|
|
|
2009-06-08 22:34:40 +02:00
|
|
|
|
ac_test killpg <<-'EOF'
|
|
|
|
|
#include <signal.h>
|
2009-06-10 23:25:39 +02:00
|
|
|
|
int main(int ac, char *av[]) { return (av[0][killpg(123, ac)]); }
|
2009-06-08 22:34:40 +02:00
|
|
|
|
EOF
|
|
|
|
|
|
2012-12-17 23:14:27 +01:00
|
|
|
|
ac_test memmove <<-'EOF'
|
2012-12-22 01:03:42 +01:00
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <stddef.h>
|
2012-12-17 23:14:27 +01:00
|
|
|
|
#include <string.h>
|
|
|
|
|
#if HAVE_STRINGS_H
|
|
|
|
|
#include <strings.h>
|
|
|
|
|
#endif
|
|
|
|
|
int main(int ac, char *av[]) {
|
2014-01-05 22:57:29 +01:00
|
|
|
|
return (*(int *)(void *)memmove(av[0], av[1], (size_t)ac));
|
2012-12-17 23:14:27 +01:00
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
|
2007-10-25 16:18:56 +02:00
|
|
|
|
ac_test mknod '' 'if to use mknod(), makedev() and friends' <<-'EOF'
|
2007-07-31 13:11:25 +02:00
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
|
|
|
|
int main(int ac, char *av[]) {
|
|
|
|
|
dev_t dv;
|
2009-08-08 15:08:53 +02:00
|
|
|
|
dv = makedev((unsigned int)ac, (unsigned int)av[0][0]);
|
|
|
|
|
return (mknod(av[0], (mode_t)0, dv) ? (int)major(dv) :
|
|
|
|
|
(int)minor(dv));
|
2007-07-31 13:11:25 +02:00
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
|
2012-03-28 00:36:53 +02:00
|
|
|
|
ac_test mmap lock_fcntl 0 'for mmap and munmap' <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#if HAVE_SYS_FILE_H
|
|
|
|
|
#include <sys/file.h>
|
|
|
|
|
#endif
|
|
|
|
|
#if HAVE_SYS_MMAN_H
|
|
|
|
|
#include <sys/mman.h>
|
|
|
|
|
#endif
|
2012-04-14 16:04:13 +02:00
|
|
|
|
#include <stddef.h>
|
2012-03-28 00:36:53 +02:00
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
int main(void) { return ((void *)mmap(NULL, (size_t)0,
|
|
|
|
|
PROT_READ, MAP_PRIVATE, 0, (off_t)0) == (void *)NULL ? 1 :
|
|
|
|
|
munmap(NULL, 0)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
2008-10-28 15:32:43 +01:00
|
|
|
|
ac_test nice <<-'EOF'
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) { return (nice(4)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
2009-06-08 00:26:00 +02:00
|
|
|
|
ac_test revoke <<-'EOF'
|
2009-04-10 18:09:53 +02:00
|
|
|
|
#include <sys/types.h>
|
2007-07-01 23:47:08 +02:00
|
|
|
|
#if HAVE_LIBUTIL_H
|
|
|
|
|
#include <libutil.h>
|
|
|
|
|
#endif
|
2007-01-18 00:27:47 +01:00
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(int ac, char *av[]) { return (ac + revoke(av[0])); }
|
|
|
|
|
EOF
|
|
|
|
|
|
2008-10-28 15:32:43 +01:00
|
|
|
|
ac_test setlocale_ctype '' 'setlocale(LC_CTYPE, "")' <<-'EOF'
|
|
|
|
|
#include <locale.h>
|
|
|
|
|
#include <stddef.h>
|
2014-11-25 21:00:39 +01:00
|
|
|
|
int main(void) { return ((int)(size_t)(void *)setlocale(LC_CTYPE, "")); }
|
2008-10-28 15:32:43 +01:00
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
ac_test langinfo_codeset setlocale_ctype 0 'nl_langinfo(CODESET)' <<-'EOF'
|
|
|
|
|
#include <langinfo.h>
|
|
|
|
|
#include <stddef.h>
|
2014-11-25 21:00:39 +01:00
|
|
|
|
int main(void) { return ((int)(size_t)(void *)nl_langinfo(CODESET)); }
|
2008-10-28 15:32:43 +01:00
|
|
|
|
EOF
|
|
|
|
|
|
2011-02-09 20:32:26 +01:00
|
|
|
|
ac_test select <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
2012-12-17 22:55:06 +01:00
|
|
|
|
#if HAVE_BOTH_TIME_H
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#elif HAVE_SYS_TIME_H
|
2011-02-09 20:32:26 +01:00
|
|
|
|
#include <sys/time.h>
|
2012-12-17 22:55:06 +01:00
|
|
|
|
#elif HAVE_TIME_H
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#endif
|
2011-02-09 20:32:26 +01:00
|
|
|
|
#if HAVE_SYS_BSDTYPES_H
|
|
|
|
|
#include <sys/bsdtypes.h>
|
|
|
|
|
#endif
|
|
|
|
|
#if HAVE_SYS_SELECT_H
|
|
|
|
|
#include <sys/select.h>
|
|
|
|
|
#endif
|
|
|
|
|
#if HAVE_BSTRING_H
|
|
|
|
|
#include <bstring.h>
|
|
|
|
|
#endif
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#if HAVE_STRINGS_H
|
|
|
|
|
#include <strings.h>
|
|
|
|
|
#endif
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) {
|
|
|
|
|
struct timeval tv = { 1, 200000 };
|
|
|
|
|
fd_set fds; FD_ZERO(&fds); FD_SET(0, &fds);
|
|
|
|
|
return (select(FD_SETSIZE, &fds, NULL, NULL, &tv));
|
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
|
2006-11-12 13:56:10 +01:00
|
|
|
|
ac_test setresugid <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <unistd.h>
|
2013-05-08 13:30:45 +02:00
|
|
|
|
int main(void) { return (setresuid(0,0,0) + setresgid(0,0,0)); }
|
2006-11-12 13:56:10 +01:00
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
ac_test setgroups setresugid 0 <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
2007-01-18 16:50:32 +01:00
|
|
|
|
#if HAVE_GRP_H
|
2006-11-12 14:35:29 +01:00
|
|
|
|
#include <grp.h>
|
2007-01-18 16:50:32 +01:00
|
|
|
|
#endif
|
2006-11-12 13:56:10 +01:00
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) { gid_t gid = 0; return (setgroups(0, &gid)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
2012-05-17 21:36:41 +02:00
|
|
|
|
if test x"$et" = x"klibc"; then
|
|
|
|
|
|
|
|
|
|
ac_testn __rt_sigsuspend '' 'whether klibc uses RT signals' <<-'EOF'
|
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
|
|
|
|
extern int __rt_sigsuspend(const sigset_t *, size_t);
|
|
|
|
|
int main(void) { return (__rt_sigsuspend(NULL, 0)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
# no? damn! legacy crap ahead!
|
|
|
|
|
|
|
|
|
|
ac_testn __sigsuspend_s '!' __rt_sigsuspend 1 \
|
|
|
|
|
'whether sigsuspend is usable (1/2)' <<-'EOF'
|
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
|
|
|
|
extern int __sigsuspend_s(sigset_t);
|
|
|
|
|
int main(void) { return (__sigsuspend_s(0)); }
|
|
|
|
|
EOF
|
|
|
|
|
ac_testn __sigsuspend_xxs '!' __sigsuspend_s 1 \
|
|
|
|
|
'whether sigsuspend is usable (2/2)' <<-'EOF'
|
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
|
|
|
|
extern int __sigsuspend_xxs(int, int, sigset_t);
|
|
|
|
|
int main(void) { return (__sigsuspend_xxs(0, 0, 0)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
if test "000" = "$HAVE___RT_SIGSUSPEND$HAVE___SIGSUSPEND_S$HAVE___SIGSUSPEND_XXS"; then
|
|
|
|
|
# no usable sigsuspend(), use pause() *ugh*
|
|
|
|
|
add_cppflags -DMKSH_NO_SIGSUSPEND
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2012-12-18 00:31:30 +01:00
|
|
|
|
ac_test strerror '!' sys_errlist 0 <<-'EOF'
|
2012-12-17 23:14:27 +01:00
|
|
|
|
extern char *strerror(int);
|
|
|
|
|
int main(int ac, char *av[]) { return (*strerror(*av[ac])); }
|
|
|
|
|
EOF
|
|
|
|
|
|
2012-12-18 00:31:30 +01:00
|
|
|
|
ac_test strsignal '!' sys_siglist 0 <<-'EOF'
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
int main(void) { return (strsignal(1)[0]); }
|
2012-12-18 00:18:11 +01:00
|
|
|
|
EOF
|
|
|
|
|
|
2006-11-09 00:38:28 +01:00
|
|
|
|
ac_test strlcpy <<-'EOF'
|
|
|
|
|
#include <string.h>
|
2009-08-08 15:08:53 +02:00
|
|
|
|
int main(int ac, char *av[]) { return (strlcpy(*av, av[1],
|
|
|
|
|
(size_t)ac)); }
|
2006-11-09 00:38:28 +01:00
|
|
|
|
EOF
|
2006-11-09 00:23:41 +01:00
|
|
|
|
|
2007-04-23 22:37:16 +02:00
|
|
|
|
#
|
2007-04-24 12:44:58 +02:00
|
|
|
|
# check headers for declarations
|
2007-04-23 22:37:16 +02:00
|
|
|
|
#
|
2013-02-17 08:06:15 +01:00
|
|
|
|
ac_test flock_decl flock 1 'for declaration of flock()' <<-'EOF'
|
2008-03-05 19:49:15 +01:00
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
2012-10-14 16:02:10 +02:00
|
|
|
|
#if HAVE_SYS_FILE_H
|
|
|
|
|
#include <sys/file.h>
|
|
|
|
|
#endif
|
2013-02-17 08:06:15 +01:00
|
|
|
|
int main(void) { return ((flock)(0, 0)); }
|
2008-03-05 19:49:15 +01:00
|
|
|
|
EOF
|
2013-02-17 08:06:15 +01:00
|
|
|
|
ac_test revoke_decl revoke 1 'for declaration of revoke()' <<-'EOF'
|
2008-03-05 18:06:50 +01:00
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
2013-02-17 08:06:15 +01:00
|
|
|
|
int main(void) { return ((revoke)("")); }
|
2008-03-05 18:06:50 +01:00
|
|
|
|
EOF
|
2012-12-18 00:18:11 +01:00
|
|
|
|
ac_test sys_errlist_decl sys_errlist 0 "for declaration of sys_errlist[] and sys_nerr" <<-'EOF'
|
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
2014-01-05 22:57:29 +01:00
|
|
|
|
int main(void) { return (*sys_errlist[sys_nerr - 1] + isatty(0)); }
|
2012-12-18 00:18:11 +01:00
|
|
|
|
EOF
|
2012-12-28 03:28:39 +01:00
|
|
|
|
ac_test sys_siglist_decl sys_siglist 0 'for declaration of sys_siglist[]' <<-'EOF'
|
2007-04-23 22:37:16 +02:00
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
2014-01-05 22:57:29 +01:00
|
|
|
|
int main(void) { return (sys_siglist[0][0] + isatty(0)); }
|
2007-04-23 22:37:16 +02:00
|
|
|
|
EOF
|
|
|
|
|
|
2007-01-17 22:42:23 +01:00
|
|
|
|
#
|
|
|
|
|
# other checks
|
|
|
|
|
#
|
2007-06-30 22:57:55 +02:00
|
|
|
|
fd='if to use persistent history'
|
2012-03-28 13:14:20 +02:00
|
|
|
|
ac_cache PERSISTENT_HISTORY || case $HAVE_MMAP$HAVE_FLOCK$HAVE_LOCK_FCNTL in
|
2012-03-28 00:36:53 +02:00
|
|
|
|
11*|101) fv=1 ;;
|
|
|
|
|
esac
|
2011-03-28 23:15:05 +02:00
|
|
|
|
test 1 = $fv || check_categories="$check_categories no-histfile"
|
2007-06-30 22:57:55 +02:00
|
|
|
|
ac_testdone
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_cppflags
|
2007-03-03 22:36:08 +01:00
|
|
|
|
|
2012-06-28 22:17:39 +02:00
|
|
|
|
#
|
|
|
|
|
# extra checks for legacy mksh
|
|
|
|
|
#
|
|
|
|
|
if test $legacy = 1; then
|
|
|
|
|
ac_test long_32bit '' 'whether long is 32 bit wide' <<-'EOF'
|
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
|
|
|
|
#ifndef CHAR_BIT
|
|
|
|
|
#define CHAR_BIT 0
|
|
|
|
|
#endif
|
|
|
|
|
struct ctasserts {
|
|
|
|
|
#define cta(name, assertion) char name[(assertion) ? 1 : -1]
|
|
|
|
|
cta(char_is_8_bits, (CHAR_BIT) == 8);
|
|
|
|
|
cta(long_is_32_bits, sizeof(long) == 4);
|
|
|
|
|
};
|
|
|
|
|
int main(void) { return (sizeof(struct ctasserts)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
ac_test long_64bit '!' long_32bit 0 'whether long is 64 bit wide' <<-'EOF'
|
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
|
|
|
|
#ifndef CHAR_BIT
|
|
|
|
|
#define CHAR_BIT 0
|
|
|
|
|
#endif
|
|
|
|
|
struct ctasserts {
|
|
|
|
|
#define cta(name, assertion) char name[(assertion) ? 1 : -1]
|
|
|
|
|
cta(char_is_8_bits, (CHAR_BIT) == 8);
|
|
|
|
|
cta(long_is_64_bits, sizeof(long) == 8);
|
|
|
|
|
};
|
|
|
|
|
int main(void) { return (sizeof(struct ctasserts)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
case $HAVE_LONG_32BIT$HAVE_LONG_64BIT in
|
|
|
|
|
10) check_categories="$check_categories int:32" ;;
|
|
|
|
|
01) check_categories="$check_categories int:64" ;;
|
|
|
|
|
*) check_categories="$check_categories int:u" ;;
|
|
|
|
|
esac
|
|
|
|
|
fi
|
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# Compiler: Praeprocessor (only if needed)
|
|
|
|
|
#
|
2007-06-30 22:57:55 +02:00
|
|
|
|
test 0 = $HAVE_SYS_SIGNAME && if ac_testinit cpp_dd '' \
|
|
|
|
|
'checking if the C Preprocessor supports -dD'; then
|
2010-01-25 13:16:04 +01:00
|
|
|
|
echo '#define foo bar' >conftest.c
|
2010-03-01 09:57:45 +01:00
|
|
|
|
vv ']' "$CPP $CFLAGS $CPPFLAGS $NOWARN -dD conftest.c >x"
|
2007-06-30 22:57:55 +02:00
|
|
|
|
grep '#define foo bar' x >/dev/null 2>&1 && fv=1
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf conftest.c x vv.out
|
2007-06-30 22:57:55 +02:00
|
|
|
|
ac_testdone
|
2007-01-11 03:37:40 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# End of mirtoconf checks
|
|
|
|
|
#
|
2006-08-26 22:30:27 +02:00
|
|
|
|
$e ... done.
|
2007-01-11 03:41:53 +01:00
|
|
|
|
|
2007-01-18 02:10:55 +01:00
|
|
|
|
# Some operating systems have ancient versions of ed(1) writing
|
|
|
|
|
# the character count to standard output; cope for that
|
|
|
|
|
echo wq >x
|
|
|
|
|
ed x <x 2>/dev/null | grep 3 >/dev/null 2>&1 && \
|
2011-03-28 23:15:05 +02:00
|
|
|
|
check_categories="$check_categories $oldish_ed"
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf x vv.out
|
2007-01-17 18:42:22 +01:00
|
|
|
|
|
2007-06-05 23:47:49 +02:00
|
|
|
|
if test 0 = $HAVE_SYS_SIGNAME; then
|
2007-06-30 21:58:51 +02:00
|
|
|
|
if test 1 = $HAVE_CPP_DD; then
|
2007-06-05 23:10:52 +02:00
|
|
|
|
$e Generating list of signal names...
|
|
|
|
|
else
|
|
|
|
|
$e No list of signal names available via cpp. Falling back...
|
|
|
|
|
fi
|
2012-04-01 18:40:26 +02:00
|
|
|
|
sigseenone=:
|
|
|
|
|
sigseentwo=:
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo '#include <signal.h>
|
2015-04-29 22:44:37 +02:00
|
|
|
|
#if defined(NSIG_MAX)
|
|
|
|
|
#define cfg_NSIG NSIG_MAX
|
|
|
|
|
#elif defined(NSIG)
|
|
|
|
|
#define cfg_NSIG NSIG
|
|
|
|
|
#elif defined(_NSIG)
|
|
|
|
|
#define cfg_NSIG _NSIG
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(SIGMAX)
|
2015-04-29 22:44:37 +02:00
|
|
|
|
#define cfg_NSIG (SIGMAX + 1)
|
2012-12-28 04:35:34 +01:00
|
|
|
|
#elif defined(_SIGMAX)
|
2015-04-29 22:44:37 +02:00
|
|
|
|
#define cfg_NSIG (_SIGMAX + 1)
|
2014-06-09 15:25:53 +02:00
|
|
|
|
#else
|
2015-04-29 22:44:37 +02:00
|
|
|
|
/*XXX better error out, see sh.h */
|
|
|
|
|
#define cfg_NSIG 64
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#endif
|
2012-03-31 19:42:58 +02:00
|
|
|
|
int
|
2015-04-29 22:44:37 +02:00
|
|
|
|
mksh_cfg= cfg_NSIG
|
2012-03-31 19:42:58 +02:00
|
|
|
|
;' >conftest.c
|
2012-04-16 19:49:40 +02:00
|
|
|
|
# GNU sed 2.03 segfaults when optimising this to sed -n
|
2010-03-01 09:57:45 +01:00
|
|
|
|
NSIG=`vq "$CPP $CFLAGS $CPPFLAGS $NOWARN conftest.c" | \
|
2014-11-25 22:13:31 +01:00
|
|
|
|
grep -v '^#' | \
|
|
|
|
|
sed '/mksh_cfg.*= *$/{
|
|
|
|
|
N
|
|
|
|
|
s/\n/ /
|
|
|
|
|
}' | \
|
2012-12-24 18:50:10 +01:00
|
|
|
|
grep '^ *mksh_cfg *=' | \
|
|
|
|
|
sed 's/^ *mksh_cfg *=[ ]*\([()0-9x+-][()0-9x+ -]*\).*$/\1/'`
|
2007-04-23 22:57:50 +02:00
|
|
|
|
case $NSIG in
|
2012-05-06 17:40:31 +02:00
|
|
|
|
*mksh_cfg*) $e "Error: NSIG='$NSIG'"; NSIG=0 ;;
|
2012-05-04 23:34:12 +02:00
|
|
|
|
*[\ \(\)+-]*) NSIG=`"$AWK" "BEGIN { print $NSIG }" </dev/null` ;;
|
2007-04-23 22:57:50 +02:00
|
|
|
|
esac
|
2008-03-25 22:34:45 +01:00
|
|
|
|
printf=printf
|
2008-10-24 21:55:06 +02:00
|
|
|
|
(printf hallo) >/dev/null 2>&1 || printf=echo
|
2012-12-01 15:22:09 +01:00
|
|
|
|
test $printf = echo || test "`printf %d 42`" = 42 || printf=echo
|
2008-03-25 22:34:45 +01:00
|
|
|
|
test $printf = echo || NSIG=`printf %d "$NSIG" 2>/dev/null`
|
2008-09-30 19:34:25 +02:00
|
|
|
|
$printf "NSIG=$NSIG ... "
|
2014-06-09 15:25:53 +02:00
|
|
|
|
sigs="ABRT FPE ILL INT SEGV TERM ALRM BUS CHLD CONT HUP KILL PIPE QUIT"
|
|
|
|
|
sigs="$sigs STOP TSTP TTIN TTOU USR1 USR2 POLL PROF SYS TRAP URG VTALRM"
|
2015-05-01 18:08:26 +02:00
|
|
|
|
sigs="$sigs XCPU XFSZ INFO WINCH EMT IO DIL LOST PWR SAK CLD IOT STKFLT"
|
|
|
|
|
sigs="$sigs ABND DCE DUMP IOERR TRACE DANGER THCONT THSTOP RESV UNUSED"
|
2008-03-25 22:34:45 +01:00
|
|
|
|
test 1 = $HAVE_CPP_DD && test $NSIG -gt 1 && sigs="$sigs "`vq \
|
2010-03-01 09:57:45 +01:00
|
|
|
|
"$CPP $CFLAGS $CPPFLAGS $NOWARN -dD conftest.c" | \
|
2012-05-06 17:40:31 +02:00
|
|
|
|
grep '[ ]SIG[A-Z0-9][A-Z0-9]*[ ]' | \
|
|
|
|
|
sed 's/^.*[ ]SIG\([A-Z0-9][A-Z0-9]*\)[ ].*$/\1/' | sort`
|
2008-03-25 22:34:45 +01:00
|
|
|
|
test $NSIG -gt 1 || sigs=
|
|
|
|
|
for name in $sigs; do
|
2012-04-01 18:40:26 +02:00
|
|
|
|
case $sigseenone in
|
|
|
|
|
*:$name:*) continue ;;
|
|
|
|
|
esac
|
|
|
|
|
sigseenone=$sigseenone$name:
|
2010-01-25 13:16:04 +01:00
|
|
|
|
echo '#include <signal.h>' >conftest.c
|
2012-03-31 19:42:58 +02:00
|
|
|
|
echo int >>conftest.c
|
|
|
|
|
echo mksh_cfg= SIG$name >>conftest.c
|
|
|
|
|
echo ';' >>conftest.c
|
2012-04-16 19:49:40 +02:00
|
|
|
|
# GNU sed 2.03 croaks on optimising this, too
|
2010-03-01 09:57:45 +01:00
|
|
|
|
vq "$CPP $CFLAGS $CPPFLAGS $NOWARN conftest.c" | \
|
2014-11-25 22:13:31 +01:00
|
|
|
|
grep -v '^#' | \
|
|
|
|
|
sed '/mksh_cfg.*= *$/{
|
|
|
|
|
N
|
|
|
|
|
s/\n/ /
|
|
|
|
|
}' | \
|
2012-12-24 18:50:10 +01:00
|
|
|
|
grep '^ *mksh_cfg *=' | \
|
|
|
|
|
sed 's/^ *mksh_cfg *=[ ]*\([0-9][0-9x]*\).*$/:\1 '$name/
|
2012-05-06 17:40:31 +02:00
|
|
|
|
done | sed -n '/^:[^ ]/s/^://p' | while read nr name; do
|
2008-03-25 22:34:45 +01:00
|
|
|
|
test $printf = echo || nr=`printf %d "$nr" 2>/dev/null`
|
2015-04-29 22:44:37 +02:00
|
|
|
|
test $nr -gt 0 && test $nr -lt $NSIG || continue
|
2012-04-01 18:40:26 +02:00
|
|
|
|
case $sigseentwo in
|
2007-01-11 03:41:53 +01:00
|
|
|
|
*:$nr:*) ;;
|
2009-04-07 20:41:37 +02:00
|
|
|
|
*) echo " { \"$name\", $nr },"
|
2012-04-01 18:40:26 +02:00
|
|
|
|
sigseentwo=$sigseentwo$nr:
|
2008-09-30 19:34:25 +02:00
|
|
|
|
$printf "$name=$nr " >&2
|
2007-01-11 03:41:53 +01:00
|
|
|
|
;;
|
|
|
|
|
esac
|
2007-01-12 03:12:16 +01:00
|
|
|
|
done 2>&1 >signames.inc
|
2012-04-01 06:57:24 +02:00
|
|
|
|
rmf conftest.c
|
2007-01-11 04:03:34 +01:00
|
|
|
|
$e done.
|
2007-01-11 03:41:53 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2014-01-05 22:57:29 +01:00
|
|
|
|
addsrcs '!' HAVE_STRLCPY strlcpy.c
|
2009-07-30 21:11:12 +02:00
|
|
|
|
addsrcs USE_PRINTF_BUILTIN printf.c
|
2011-10-07 21:51:44 +02:00
|
|
|
|
test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN
|
2008-03-05 19:25:57 +01:00
|
|
|
|
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
|
2017-04-12 20:33:23 +02:00
|
|
|
|
add_cppflags -DMKSH_BUILD_R=551
|
2006-08-26 22:30:27 +02:00
|
|
|
|
|
2010-01-25 13:16:04 +01:00
|
|
|
|
$e $bi$me: Finished configuration testing, now producing output.$ao
|
2010-01-19 15:26:24 +01:00
|
|
|
|
|
2009-10-16 20:45:31 +02:00
|
|
|
|
files=
|
2007-06-04 22:14:34 +02:00
|
|
|
|
objs=
|
2009-10-16 20:45:31 +02:00
|
|
|
|
sp=
|
2012-01-03 02:30:16 +01:00
|
|
|
|
case $tcfn in
|
2015-07-09 21:28:21 +02:00
|
|
|
|
a.exe|conftest.exe)
|
|
|
|
|
mkshexe=$tfn.exe
|
|
|
|
|
add_cppflags -DMKSH_EXE_EXT
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
mkshexe=$tfn
|
|
|
|
|
;;
|
2012-01-03 02:30:16 +01:00
|
|
|
|
esac
|
2007-07-22 15:08:54 +02:00
|
|
|
|
case $curdir in
|
2012-04-01 04:35:33 +02:00
|
|
|
|
*\ *) mkshshebang="#!./$mkshexe" ;;
|
|
|
|
|
*) mkshshebang="#!$curdir/$mkshexe" ;;
|
2007-07-22 15:08:54 +02:00
|
|
|
|
esac
|
2012-04-01 04:35:33 +02:00
|
|
|
|
cat >test.sh <<-EOF
|
|
|
|
|
$mkshshebang
|
2008-07-14 16:40:47 +02:00
|
|
|
|
LC_ALL=C PATH='$PATH'; export LC_ALL PATH
|
|
|
|
|
test -n "\$KSH_VERSION" || exit 1
|
2011-03-28 23:15:05 +02:00
|
|
|
|
set -A check_categories -- $check_categories
|
2012-01-03 02:30:16 +01:00
|
|
|
|
pflag='$curdir/$mkshexe'
|
2011-03-28 23:15:05 +02:00
|
|
|
|
sflag='$srcdir/check.t'
|
2013-02-11 17:27:56 +01:00
|
|
|
|
usee=0 Pflag=0 Sflag=0 uset=0 vflag=1 xflag=0
|
|
|
|
|
while getopts "C:e:fPp:QSs:t:v" ch; do case \$ch {
|
2011-03-28 23:15:05 +02:00
|
|
|
|
(C) check_categories[\${#check_categories[*]}]=\$OPTARG ;;
|
|
|
|
|
(e) usee=1; eflag=\$OPTARG ;;
|
2011-11-26 00:29:31 +01:00
|
|
|
|
(f) check_categories[\${#check_categories[*]}]=fastbox ;;
|
2011-03-28 23:15:05 +02:00
|
|
|
|
(P) Pflag=1 ;;
|
2013-02-11 17:27:56 +01:00
|
|
|
|
(+P) Pflag=0 ;;
|
2011-03-28 23:15:05 +02:00
|
|
|
|
(p) pflag=\$OPTARG ;;
|
2013-02-11 17:27:56 +01:00
|
|
|
|
(Q) vflag=0 ;;
|
|
|
|
|
(+Q) vflag=1 ;;
|
2012-05-04 23:28:06 +02:00
|
|
|
|
(S) Sflag=1 ;;
|
2013-02-11 17:27:56 +01:00
|
|
|
|
(+S) Sflag=0 ;;
|
2011-03-28 23:15:05 +02:00
|
|
|
|
(s) sflag=\$OPTARG ;;
|
|
|
|
|
(t) uset=1; tflag=\$OPTARG ;;
|
|
|
|
|
(v) vflag=1 ;;
|
2013-02-11 17:27:56 +01:00
|
|
|
|
(+v) vflag=0 ;;
|
2011-03-28 23:15:05 +02:00
|
|
|
|
(*) xflag=1 ;;
|
|
|
|
|
}
|
|
|
|
|
done
|
|
|
|
|
shift \$((OPTIND - 1))
|
2012-05-04 23:28:06 +02:00
|
|
|
|
set -A args -- '$srcdir/check.pl' -p "\$pflag"
|
2011-03-28 23:15:05 +02:00
|
|
|
|
x=
|
|
|
|
|
for y in "\${check_categories[@]}"; do
|
|
|
|
|
x=\$x,\$y
|
|
|
|
|
done
|
|
|
|
|
if [[ -n \$x ]]; then
|
|
|
|
|
args[\${#args[*]}]=-C
|
|
|
|
|
args[\${#args[*]}]=\${x#,}
|
|
|
|
|
fi
|
|
|
|
|
if (( usee )); then
|
|
|
|
|
args[\${#args[*]}]=-e
|
|
|
|
|
args[\${#args[*]}]=\$eflag
|
|
|
|
|
fi
|
|
|
|
|
(( Pflag )) && args[\${#args[*]}]=-P
|
|
|
|
|
if (( uset )); then
|
|
|
|
|
args[\${#args[*]}]=-t
|
|
|
|
|
args[\${#args[*]}]=\$tflag
|
|
|
|
|
fi
|
|
|
|
|
(( vflag )) && args[\${#args[*]}]=-v
|
|
|
|
|
(( xflag )) && args[\${#args[*]}]=-x # force usage by synerr
|
2014-02-08 21:20:17 +01:00
|
|
|
|
if [[ -n \$TMPDIR && -d \$TMPDIR/. ]]; then
|
|
|
|
|
args[\${#args[*]}]=-T
|
|
|
|
|
args[\${#args[*]}]=\$TMPDIR
|
|
|
|
|
fi
|
2008-04-01 19:13:49 +02:00
|
|
|
|
print Testing mksh for conformance:
|
2015-12-08 21:59:33 +01:00
|
|
|
|
grep -F -e Mir''OS: -e MIRBSD "\$sflag"
|
2008-04-01 19:13:49 +02:00
|
|
|
|
print "This shell is actually:\\n\\t\$KSH_VERSION"
|
|
|
|
|
print 'test.sh built for mksh $dstversion'
|
2008-07-14 17:06:02 +02:00
|
|
|
|
cstr='\$os = defined \$^O ? \$^O : "unknown";'
|
|
|
|
|
cstr="\$cstr"'print \$os . ", Perl version " . \$];'
|
2008-07-14 16:59:20 +02:00
|
|
|
|
for perli in \$PERL perl5 perl no; do
|
2011-12-08 23:16:42 +01:00
|
|
|
|
if [[ \$perli = no ]]; then
|
|
|
|
|
print Cannot find a working Perl interpreter, aborting.
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
print "Trying Perl interpreter '\$perli'..."
|
|
|
|
|
perlos=\$(\$perli -e "\$cstr")
|
|
|
|
|
rv=\$?
|
|
|
|
|
print "Errorlevel \$rv, running on '\$perlos'"
|
2011-12-10 15:16:09 +01:00
|
|
|
|
if (( rv )); then
|
|
|
|
|
print "=> not using"
|
|
|
|
|
continue
|
|
|
|
|
fi
|
|
|
|
|
if [[ -n \$perlos ]]; then
|
|
|
|
|
print "=> using it"
|
|
|
|
|
break
|
|
|
|
|
fi
|
2008-07-14 16:59:20 +02:00
|
|
|
|
done
|
2012-06-28 22:17:39 +02:00
|
|
|
|
(( Sflag )) || echo + \$perli "\${args[@]}" -s "\$sflag" "\$@"
|
2012-05-04 23:28:06 +02:00
|
|
|
|
(( Sflag )) || exec \$perli "\${args[@]}" -s "\$sflag" "\$@"$tsts
|
|
|
|
|
# use of the -S option for check.t split into multiple chunks
|
|
|
|
|
rv=0
|
|
|
|
|
for s in "\$sflag".*; do
|
2012-06-28 22:17:39 +02:00
|
|
|
|
echo + \$perli "\${args[@]}" -s "\$s" "\$@"
|
2012-05-04 23:28:06 +02:00
|
|
|
|
\$perli "\${args[@]}" -s "\$s" "\$@"$tsts
|
|
|
|
|
rc=\$?
|
|
|
|
|
(( rv = rv ? rv : rc ))
|
|
|
|
|
done
|
|
|
|
|
exit \$rv
|
2008-04-01 19:13:49 +02:00
|
|
|
|
EOF
|
2007-07-22 15:08:54 +02:00
|
|
|
|
chmod 755 test.sh
|
2013-07-25 17:54:33 +02:00
|
|
|
|
case $cm in
|
|
|
|
|
dragonegg)
|
2010-05-13 20:41:13 +02:00
|
|
|
|
emitbc="-S -flto"
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
llvm)
|
|
|
|
|
emitbc="-emit-llvm -c"
|
|
|
|
|
;;
|
|
|
|
|
*)
|
2009-10-16 20:45:31 +02:00
|
|
|
|
emitbc=-c
|
2013-07-25 17:54:33 +02:00
|
|
|
|
;;
|
|
|
|
|
esac
|
2012-05-06 17:40:31 +02:00
|
|
|
|
echo ": # work around NeXTstep bug" >Rebuild.sh
|
2014-12-08 13:20:40 +01:00
|
|
|
|
cd "$srcdir"
|
|
|
|
|
optfiles=`echo *.opt`
|
|
|
|
|
cd "$curdir"
|
|
|
|
|
for file in $optfiles; do
|
2013-11-30 16:42:19 +01:00
|
|
|
|
echo "echo + Running genopt on '$file'..."
|
2014-12-08 13:20:40 +01:00
|
|
|
|
echo "(srcfile='$srcdir/$file'; BUILDSH_RUN_GENOPT=1; . '$srcdir/Build.sh')"
|
2013-11-20 22:14:50 +01:00
|
|
|
|
done >>Rebuild.sh
|
2012-04-01 04:35:33 +02:00
|
|
|
|
echo set -x >>Rebuild.sh
|
2007-06-04 22:14:34 +02:00
|
|
|
|
for file in $SRCS; do
|
2010-05-13 20:41:13 +02:00
|
|
|
|
op=`echo x"$file" | sed 's/^x\(.*\)\.c$/\1./'`
|
2007-07-22 15:08:54 +02:00
|
|
|
|
test -f $file || file=$srcdir/$file
|
2009-10-16 20:45:31 +02:00
|
|
|
|
files="$files$sp$file"
|
|
|
|
|
sp=' '
|
2008-11-10 21:25:04 +01:00
|
|
|
|
echo "$CC $CFLAGS $CPPFLAGS $emitbc $file || exit 1" >>Rebuild.sh
|
2010-05-13 20:41:13 +02:00
|
|
|
|
if test $cm = dragonegg; then
|
|
|
|
|
echo "mv ${op}s ${op}ll" >>Rebuild.sh
|
|
|
|
|
echo "llvm-as ${op}ll || exit 1" >>Rebuild.sh
|
|
|
|
|
objs="$objs$sp${op}bc"
|
|
|
|
|
else
|
|
|
|
|
objs="$objs$sp${op}o"
|
|
|
|
|
fi
|
2007-07-22 15:08:54 +02:00
|
|
|
|
done
|
2010-05-13 20:41:13 +02:00
|
|
|
|
case $cm in
|
|
|
|
|
dragonegg|llvm)
|
2012-06-24 22:46:07 +02:00
|
|
|
|
echo "rm -f $tfn.s" >>Rebuild.sh
|
|
|
|
|
echo "llvm-link -o - $objs | opt $optflags | llc -o $tfn.s" >>Rebuild.sh
|
|
|
|
|
lobjs=$tfn.s
|
2010-05-13 20:41:13 +02:00
|
|
|
|
;;
|
|
|
|
|
*)
|
2009-10-16 20:45:31 +02:00
|
|
|
|
lobjs=$objs
|
2010-05-13 20:41:13 +02:00
|
|
|
|
;;
|
|
|
|
|
esac
|
2009-10-16 20:45:31 +02:00
|
|
|
|
echo tcfn=$mkshexe >>Rebuild.sh
|
2008-11-10 21:25:04 +01:00
|
|
|
|
echo "$CC $CFLAGS $LDFLAGS -o \$tcfn $lobjs $LIBS $ccpr" >>Rebuild.sh
|
2013-07-08 12:12:45 +02:00
|
|
|
|
echo "test -f \$tcfn || exit 1; $SIZE \$tcfn" >>Rebuild.sh
|
2009-10-16 20:45:31 +02:00
|
|
|
|
if test $cm = makefile; then
|
2016-07-27 02:55:27 +02:00
|
|
|
|
extras='emacsfn.h exprtok.h rlimits.opt sh.h sh_flags.opt var_spec.h'
|
2009-10-16 20:45:31 +02:00
|
|
|
|
test 0 = $HAVE_SYS_SIGNAME && extras="$extras signames.inc"
|
2013-11-20 22:14:50 +01:00
|
|
|
|
gens= genq=
|
2014-12-08 13:20:40 +01:00
|
|
|
|
for file in $optfiles; do
|
2013-11-20 22:14:50 +01:00
|
|
|
|
genf=`basename "$file" | sed 's/.opt$/.gen/'`
|
|
|
|
|
gens="$gens $genf"
|
2014-12-08 13:20:40 +01:00
|
|
|
|
genq="$genq$nl$genf: $srcdir/Build.sh $srcdir/$file
|
|
|
|
|
srcfile=$srcdir/$file; BUILDSH_RUN_GENOPT=1; . $srcdir/Build.sh"
|
2013-11-20 22:14:50 +01:00
|
|
|
|
done
|
2009-10-16 20:51:30 +02:00
|
|
|
|
cat >Makefrag.inc <<EOF
|
2009-10-16 20:45:31 +02:00
|
|
|
|
# Makefile fragment for building mksh $dstversion
|
|
|
|
|
|
|
|
|
|
PROG= $mkshexe
|
|
|
|
|
MAN= mksh.1
|
|
|
|
|
SRCS= $SRCS
|
|
|
|
|
SRCS_FP= $files
|
|
|
|
|
OBJS_BP= $objs
|
|
|
|
|
INDSRCS= $extras
|
|
|
|
|
NONSRCS_INST= dot.mkshrc \$(MAN)
|
|
|
|
|
NONSRCS_NOINST= Build.sh Makefile Rebuild.sh check.pl check.t test.sh
|
|
|
|
|
CC= $CC
|
|
|
|
|
CFLAGS= $CFLAGS
|
|
|
|
|
CPPFLAGS= $CPPFLAGS
|
|
|
|
|
LDFLAGS= $LDFLAGS
|
|
|
|
|
LIBS= $LIBS
|
|
|
|
|
|
2013-11-20 22:14:50 +01:00
|
|
|
|
.depend \$(OBJS_BP):$gens$genq
|
|
|
|
|
|
2009-10-16 20:45:31 +02:00
|
|
|
|
# not BSD make only:
|
2009-10-16 20:51:30 +02:00
|
|
|
|
#VPATH= $srcdir
|
|
|
|
|
#all: \$(PROG)
|
|
|
|
|
#\$(PROG): \$(OBJS_BP)
|
|
|
|
|
# \$(CC) \$(CFLAGS) \$(LDFLAGS) -o \$@ \$(OBJS_BP) \$(LIBS)
|
|
|
|
|
#\$(OBJS_BP): \$(SRCS_FP) \$(NONSRCS)
|
2009-10-16 20:45:31 +02:00
|
|
|
|
#.c.o:
|
2009-10-16 20:51:30 +02:00
|
|
|
|
# \$(CC) \$(CFLAGS) \$(CPPFLAGS) -c \$<
|
2009-10-16 20:45:31 +02:00
|
|
|
|
|
|
|
|
|
# for all make variants:
|
2013-02-11 17:27:56 +01:00
|
|
|
|
#REGRESS_FLAGS= -f
|
2009-10-16 20:45:31 +02:00
|
|
|
|
#regress:
|
2009-10-16 20:51:30 +02:00
|
|
|
|
# ./test.sh \$(REGRESS_FLAGS)
|
2013-02-18 23:55:40 +01:00
|
|
|
|
check_categories=$check_categories
|
2009-10-16 20:45:31 +02:00
|
|
|
|
|
|
|
|
|
# for BSD make only:
|
|
|
|
|
#.PATH: $srcdir
|
|
|
|
|
#.include <bsd.prog.mk>
|
|
|
|
|
EOF
|
|
|
|
|
$e
|
2009-10-16 20:51:30 +02:00
|
|
|
|
$e Generated Makefrag.inc successfully.
|
2009-10-16 20:45:31 +02:00
|
|
|
|
exit 0
|
|
|
|
|
fi
|
2014-12-08 13:20:40 +01:00
|
|
|
|
for file in $optfiles; do
|
2013-11-30 16:42:19 +01:00
|
|
|
|
$e "+ Running genopt on '$file'..."
|
2014-12-08 13:20:40 +01:00
|
|
|
|
do_genopt "$srcdir/$file" || exit 1
|
2013-11-20 22:14:50 +01:00
|
|
|
|
done
|
2009-10-16 20:45:31 +02:00
|
|
|
|
if test $cm = combine; then
|
|
|
|
|
objs="-o $mkshexe"
|
2008-12-20 21:39:05 +01:00
|
|
|
|
for file in $SRCS; do
|
|
|
|
|
test -f $file || file=$srcdir/$file
|
|
|
|
|
objs="$objs $file"
|
|
|
|
|
done
|
2009-10-16 20:45:31 +02:00
|
|
|
|
emitbc="-fwhole-program --combine"
|
2008-12-20 21:39:05 +01:00
|
|
|
|
v "$CC $CFLAGS $CPPFLAGS $LDFLAGS $emitbc $objs $LIBS $ccpr"
|
|
|
|
|
elif test 1 = $pm; then
|
2007-10-09 16:29:42 +02:00
|
|
|
|
for file in $SRCS; do
|
|
|
|
|
test -f $file || file=$srcdir/$file
|
2008-11-10 21:25:04 +01:00
|
|
|
|
v "$CC $CFLAGS $CPPFLAGS $emitbc $file" &
|
2007-10-09 16:29:42 +02:00
|
|
|
|
done
|
|
|
|
|
wait
|
|
|
|
|
else
|
|
|
|
|
for file in $SRCS; do
|
2010-05-13 20:41:13 +02:00
|
|
|
|
test $cm = dragonegg && \
|
|
|
|
|
op=`echo x"$file" | sed 's/^x\(.*\)\.c$/\1./'`
|
2007-10-09 16:29:42 +02:00
|
|
|
|
test -f $file || file=$srcdir/$file
|
2008-11-10 21:25:04 +01:00
|
|
|
|
v "$CC $CFLAGS $CPPFLAGS $emitbc $file" || exit 1
|
2010-05-13 20:41:13 +02:00
|
|
|
|
if test $cm = dragonegg; then
|
|
|
|
|
v "mv ${op}s ${op}ll"
|
|
|
|
|
v "llvm-as ${op}ll" || exit 1
|
|
|
|
|
fi
|
2007-10-09 16:29:42 +02:00
|
|
|
|
done
|
|
|
|
|
fi
|
2010-05-13 20:41:13 +02:00
|
|
|
|
case $cm in
|
|
|
|
|
dragonegg|llvm)
|
2012-06-24 22:46:07 +02:00
|
|
|
|
rmf $tfn.s
|
|
|
|
|
v "llvm-link -o - $objs | opt $optflags | llc -o $tfn.s"
|
2010-05-13 20:41:13 +02:00
|
|
|
|
;;
|
|
|
|
|
esac
|
2009-10-16 20:45:31 +02:00
|
|
|
|
tcfn=$mkshexe
|
|
|
|
|
test $cm = combine || v "$CC $CFLAGS $LDFLAGS -o $tcfn $lobjs $LIBS $ccpr"
|
2008-03-05 19:21:45 +01:00
|
|
|
|
test -f $tcfn || exit 1
|
2016-11-12 00:31:39 +01:00
|
|
|
|
test 1 = $r || v "$NROFF -mdoc <'$srcdir/lksh.1' >lksh.cat1" || rmf lksh.cat1
|
|
|
|
|
test 1 = $r || v "$NROFF -mdoc <'$srcdir/mksh.1' >mksh.cat1" || rmf mksh.cat1
|
2013-07-08 12:12:45 +02:00
|
|
|
|
test 0 = $eq && v $SIZE $tcfn
|
2006-08-28 03:30:37 +02:00
|
|
|
|
i=install
|
|
|
|
|
test -f /usr/ucb/$i && i=/usr/ucb/$i
|
2007-09-11 19:47:25 +02:00
|
|
|
|
test 1 = $eq && e=:
|
2005-05-26 01:44:50 +02:00
|
|
|
|
$e
|
2006-08-12 20:49:21 +02:00
|
|
|
|
$e Installing the shell:
|
2012-06-24 22:46:07 +02:00
|
|
|
|
$e "# $i -c -s -o root -g bin -m 555 $tfn /bin/$tfn"
|
2013-05-05 15:38:00 +02:00
|
|
|
|
if test $legacy = 0; then
|
|
|
|
|
$e "# grep -x /bin/$tfn /etc/shells >/dev/null || echo /bin/$tfn >>/etc/shells"
|
|
|
|
|
$e "# $i -c -o root -g bin -m 444 dot.mkshrc /usr/share/doc/mksh/examples/"
|
|
|
|
|
fi
|
2005-05-26 01:44:50 +02:00
|
|
|
|
$e
|
|
|
|
|
$e Installing the manual:
|
2016-11-12 00:31:39 +01:00
|
|
|
|
if test -f mksh.cat1; then
|
|
|
|
|
$e "# $i -c -o root -g bin -m 444 lksh.cat1" \
|
|
|
|
|
"/usr/share/man/cat1/lksh.0"
|
|
|
|
|
$e "# $i -c -o root -g bin -m 444 mksh.cat1" \
|
|
|
|
|
"/usr/share/man/cat1/mksh.0"
|
2005-05-26 01:44:50 +02:00
|
|
|
|
$e or
|
2005-05-23 18:48:52 +02:00
|
|
|
|
fi
|
2016-11-12 00:31:39 +01:00
|
|
|
|
$e "# $i -c -o root -g bin -m 444 lksh.1 mksh.1 /usr/share/man/man1/"
|
2006-08-23 00:01:59 +02:00
|
|
|
|
$e
|
|
|
|
|
$e Run the regression test suite: ./test.sh
|
2006-08-28 03:37:29 +02:00
|
|
|
|
$e Please also read the sample file dot.mkshrc and the fine manual.
|
2007-10-14 15:31:01 +02:00
|
|
|
|
exit 0
|
2011-12-02 23:55:49 +01:00
|
|
|
|
|
|
|
|
|
: <<'EOD'
|
|
|
|
|
|
|
|
|
|
=== Environment used ===
|
|
|
|
|
|
|
|
|
|
==== build environment ====
|
2012-03-30 11:27:19 +02:00
|
|
|
|
AWK default: awk
|
2011-12-02 23:55:49 +01:00
|
|
|
|
CC default: cc
|
|
|
|
|
CFLAGS if empty, defaults to -xO2 or +O2
|
|
|
|
|
or -O3 -qstrict or -O2, per compiler
|
|
|
|
|
CPPFLAGS default empty
|
|
|
|
|
LDFLAGS default empty; added before sources
|
2012-04-06 17:03:42 +02:00
|
|
|
|
LDSTATIC set this to '-static'; default unset
|
2011-12-02 23:55:49 +01:00
|
|
|
|
LIBS default empty; added after sources
|
|
|
|
|
[Interix] default: -lcrypt (XXX still needed?)
|
|
|
|
|
NOWARN -Wno-error or similar
|
|
|
|
|
NROFF default: nroff
|
|
|
|
|
TARGET_OS default: $(uname -s || uname)
|
|
|
|
|
TARGET_OSREV [QNX] default: $(uname -r)
|
|
|
|
|
|
|
|
|
|
==== feature selectors ====
|
|
|
|
|
USE_PRINTF_BUILTIN 1 to include (unsupported) printf(1) as builtin
|
|
|
|
|
===== general format =====
|
|
|
|
|
HAVE_STRLEN ac_test
|
|
|
|
|
HAVE_STRING_H ac_header
|
|
|
|
|
HAVE_CAN_FSTACKPROTECTORALL ac_flags
|
|
|
|
|
|
|
|
|
|
==== cpp definitions ====
|
2013-02-10 22:20:57 +01:00
|
|
|
|
DEBUG dont use in production, wants gcc, implies:
|
2013-02-10 19:17:30 +01:00
|
|
|
|
DEBUG_LEAKS enable freeing resources before exiting
|
2011-12-02 23:55:49 +01:00
|
|
|
|
MKSHRC_PATH "~/.mkshrc" (do not change)
|
|
|
|
|
MKSH_A4PB force use of arc4random_pushb
|
|
|
|
|
MKSH_ASSUME_UTF8 (0=disabled, 1=enabled; default: unset)
|
2013-05-02 22:21:45 +02:00
|
|
|
|
MKSH_BINSHPOSIX if */sh or */-sh, enable set -o posix
|
2011-12-02 23:55:49 +01:00
|
|
|
|
MKSH_BINSHREDUCED if */sh or */-sh, enable set -o sh
|
|
|
|
|
MKSH_CLS_STRING "\033[;H\033[J"
|
|
|
|
|
MKSH_DEFAULT_EXECSHELL "/bin/sh" (do not change)
|
2012-08-24 21:09:10 +02:00
|
|
|
|
MKSH_DEFAULT_PROFILEDIR "/etc" (do not change)
|
2011-12-02 23:55:49 +01:00
|
|
|
|
MKSH_DEFAULT_TMPDIR "/tmp" (do not change)
|
|
|
|
|
MKSH_DISABLE_DEPRECATED disable code paths scheduled for later removal
|
2012-10-22 18:53:22 +02:00
|
|
|
|
MKSH_DISABLE_EXPERIMENTAL disable code not yet comfy for (LTS) snapshots
|
2012-05-05 00:34:51 +02:00
|
|
|
|
MKSH_DISABLE_TTY_WARNING shut up warning about ctty if OS cant be fixed
|
2011-12-02 23:55:49 +01:00
|
|
|
|
MKSH_DONT_EMIT_IDSTRING omit RCS IDs from binary
|
|
|
|
|
MKSH_MIDNIGHTBSD01ASH_COMPAT set -o sh: additional compatibility quirk
|
|
|
|
|
MKSH_NOPROSPECTOFWORK disable jobs, co-processes, etc. (do not use)
|
2014-07-04 13:03:52 +02:00
|
|
|
|
MKSH_NOPWNAM skip PAM calls, for -static on glibc or Solaris
|
2012-05-04 22:49:08 +02:00
|
|
|
|
MKSH_NO_CMDLINE_EDITING disable command line editing code entirely
|
2011-12-02 23:55:49 +01:00
|
|
|
|
MKSH_NO_DEPRECATED_WARNING omit warning when deprecated stuff is run
|
|
|
|
|
MKSH_NO_LIMITS omit ulimit code
|
2012-04-14 16:07:47 +02:00
|
|
|
|
MKSH_NO_SIGSETJMP define if sigsetjmp is broken or not available
|
2012-04-27 18:16:23 +02:00
|
|
|
|
MKSH_NO_SIGSUSPEND use sigprocmask+pause instead of sigsuspend
|
2011-12-02 23:55:49 +01:00
|
|
|
|
MKSH_SMALL omit some code, optimise hard for size (slower)
|
2012-07-01 17:55:00 +02:00
|
|
|
|
MKSH_SMALL_BUT_FAST disable some hard-for-size optim. (modern sys.)
|
2012-04-14 18:07:48 +02:00
|
|
|
|
MKSH_S_NOVI=1 disable Vi editing mode (default if MKSH_SMALL)
|
2012-04-14 16:02:40 +02:00
|
|
|
|
MKSH_TYPEDEF_SIG_ATOMIC_T define to e.g. 'int' if sig_atomic_t is missing
|
|
|
|
|
MKSH_TYPEDEF_SSIZE_T define to e.g. 'long' if your OS has no ssize_t
|
2011-12-02 23:55:49 +01:00
|
|
|
|
MKSH_UNEMPLOYED disable job control (but not jobs/co-processes)
|
|
|
|
|
|
2011-12-04 20:38:36 +01:00
|
|
|
|
=== generic installation instructions ===
|
|
|
|
|
|
|
|
|
|
Set CC and possibly CFLAGS, CPPFLAGS, LDFLAGS, LIBS. If cross-compiling,
|
|
|
|
|
also set TARGET_OS. To disable tests, set e.g. HAVE_STRLCPY=0; to enable
|
|
|
|
|
them, set to a value other than 0 or 1. Ensure /bin/ed is installed. For
|
|
|
|
|
MKSH_SMALL but with Vi mode, add -DMKSH_S_NOVI=0 to CPPFLAGS as well.
|
|
|
|
|
|
|
|
|
|
Normally, the following command is what you want to run, then:
|
2013-02-11 17:27:56 +01:00
|
|
|
|
$ (sh Build.sh -r -c lto && ./test.sh -f) 2>&1 | tee log
|
2011-12-04 20:38:36 +01:00
|
|
|
|
|
|
|
|
|
Copy dot.mkshrc to /etc/skel/.mkshrc; install mksh into $prefix/bin; or
|
|
|
|
|
/bin; install the manpage, if omitting the -r flag a catmanpage is made
|
|
|
|
|
using $NROFF. Consider using a forward script as /etc/skel/.mkshrc like
|
2014-09-29 20:57:00 +02:00
|
|
|
|
http://anonscm.debian.org/cgit/collab-maint/mksh.git/plain/debian/.mkshrc
|
2011-12-04 20:38:36 +01:00
|
|
|
|
and put dot.mkshrc as /etc/mkshrc so users need not keep up their HOME.
|
|
|
|
|
|
2015-04-29 22:39:00 +02:00
|
|
|
|
You may also want to install the lksh binary (also as /bin/sh) built by:
|
|
|
|
|
$ CPPFLAGS="$CPPFLAGS -DMKSH_BINSHPOSIX" sh Build.sh -L -r -c lto
|
|
|
|
|
|
2011-12-02 23:55:49 +01:00
|
|
|
|
EOD
|