2005-05-23 18:48:52 +02:00
|
|
|
|
#!/bin/sh
|
2011-06-12 16:37:00 +02:00
|
|
|
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.482 2011/06/12 14:37:00 tg Exp $'
|
2009-05-16 18:59:42 +02:00
|
|
|
|
#-
|
2011-01-21 21:51:56 +01:00
|
|
|
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
2009-05-16 18:59:42 +02:00
|
|
|
|
# Thorsten Glaser <tg@mirbsd.org>
|
|
|
|
|
#
|
|
|
|
|
# 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).
|
|
|
|
|
#
|
2009-06-07 16:50:58 +02:00
|
|
|
|
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF
|
|
|
|
|
# TARGET_OS TARGET_OSREV
|
2009-07-30 21:11:12 +02:00
|
|
|
|
# Feature selectors: USE_PRINTF_BUILTIN
|
2009-09-24 19:15:33 +02:00
|
|
|
|
# CPPFLAGS recognised: MKSH_ASSUME_UTF8 MKSH_BINSHREDUCED MKSH_CLS_STRING
|
2009-05-16 20:40:09 +02:00
|
|
|
|
# MKSH_CONSERVATIVE_FDS MKSH_MIDNIGHTBSD01ASH_COMPAT
|
2009-09-24 19:15:33 +02:00
|
|
|
|
# MKSH_NOPWNAM MKSH_NO_LIMITS MKSH_SMALL MKSH_S_NOVI
|
2010-03-27 21:36:26 +01:00
|
|
|
|
# MKSH_UNEMPLOYED MKSH_DEFAULT_EXECSHELL MKSHRC_PATH
|
2010-07-18 19:29:50 +02:00
|
|
|
|
# MKSH_DEFAULT_TMPDIR MKSH_CLRTOEOL_STRING MKSH_A4PB
|
2010-09-14 23:15:11 +02:00
|
|
|
|
# MKSH_NO_DEPRECATED_WARNING MKSH_DONT_EMIT_IDSTRING
|
2011-01-30 02:35:35 +01:00
|
|
|
|
# MKSH_NOPROSPECTOFWORK
|
2005-05-23 18:48:52 +02:00
|
|
|
|
|
2008-05-04 02:55:18 +02:00
|
|
|
|
LC_ALL=C
|
|
|
|
|
export LC_ALL
|
|
|
|
|
|
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
|
|
|
|
|
case ${_f} in
|
|
|
|
|
mksh.1) ;;
|
|
|
|
|
*) rm -f "${_f}" ;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-27 01:23:20 +01:00
|
|
|
|
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
|
|
|
|
|
|
2007-04-01 03:48:31 +02:00
|
|
|
|
if test -n "${ZSH_VERSION+x}" && (emulate sh) >/dev/null 2>&1; then
|
|
|
|
|
emulate sh
|
|
|
|
|
NULLCMD=:
|
|
|
|
|
fi
|
|
|
|
|
|
2007-01-18 16:50:32 +01:00
|
|
|
|
allu=QWERTYUIOPASDFGHJKLZXCVBNM
|
|
|
|
|
alll=qwertyuiopasdfghjklzxcvbnm
|
|
|
|
|
alln=0123456789
|
2007-02-27 01:31:17 +01:00
|
|
|
|
alls=______________________________________________________________
|
2007-03-04 06:03:57 +01:00
|
|
|
|
nl='
|
|
|
|
|
'
|
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
|
|
|
|
|
ac_testn() {
|
|
|
|
|
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
|
|
|
|
|
ac_testinit "$@" || return
|
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
|
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
|
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
|
|
|
|
|
int main(void) { return (
|
|
|
|
|
#$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"
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -DHAVE_$fu=$fv"
|
|
|
|
|
}
|
|
|
|
|
|
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 */
|
2007-06-04 22:00:50 +02:00
|
|
|
|
int main(void) { return (0); }
|
|
|
|
|
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`
|
2007-01-18 16:50:32 +01:00
|
|
|
|
for i
|
|
|
|
|
do
|
|
|
|
|
echo "#include <$i>" >>x
|
|
|
|
|
done
|
|
|
|
|
echo "#include <$hf>" >>x
|
|
|
|
|
echo 'int main(void) { return (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
|
|
|
|
|
2007-06-30 22:57:55 +02:00
|
|
|
|
if test -d mksh || test -d mksh.exe; then
|
|
|
|
|
echo "$me: Error: ./mksh is a directory!" >&2
|
2006-08-24 22:32:53 +02:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2010-05-13 20:41:13 +02:00
|
|
|
|
rmf a.exe* a.out* conftest.c *core lft mksh* no *.bc *.ll *.o \
|
2010-08-24 17:19:54 +02:00
|
|
|
|
Rebuild.sh signames.inc test.sh x vv.out
|
2006-08-24 22:32:53 +02:00
|
|
|
|
|
2008-06-21 21:20:15 +02:00
|
|
|
|
curdir=`pwd` srcdir=`dirname "$0"` check_categories=
|
2010-03-14 12:56:07 +01:00
|
|
|
|
test -n "$dirname" || dirname=.
|
2010-05-13 20:41:13 +02:00
|
|
|
|
dstversion=`sed -n '/define MKSH_VERSION/s/^.*"\(.*\)".*$/\1/p' $srcdir/sh.h`
|
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
|
|
|
|
|
last=
|
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
|
|
|
|
;;
|
2010-05-13 20:41:13 +02:00
|
|
|
|
:-c)
|
|
|
|
|
last=c
|
|
|
|
|
;;
|
|
|
|
|
:-combine)
|
2009-10-16 20:45:31 +02:00
|
|
|
|
cm=combine
|
2010-05-13 20:41:13 +02:00
|
|
|
|
echo "$me: Warning: '$i' is deprecated, use '-c combine' instead!" >&2
|
2008-12-20 21:39:05 +01:00
|
|
|
|
;;
|
2010-05-13 20:41:13 +02:00
|
|
|
|
:-g)
|
|
|
|
|
# checker, debug, valgrind build
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -DDEBUG"
|
|
|
|
|
CFLAGS="$CFLAGS -g3 -fno-builtin"
|
|
|
|
|
;;
|
|
|
|
|
:-j)
|
|
|
|
|
pm=1
|
|
|
|
|
;;
|
|
|
|
|
:-llvm)
|
2009-10-16 20:45:31 +02:00
|
|
|
|
cm=llvm
|
2010-05-13 20:41:13 +02:00
|
|
|
|
optflags=-std-compile-opts
|
|
|
|
|
echo "$me: Warning: '$i' is deprecated, use '-c llvm -O' instead!" >&2
|
2008-11-10 21:25:04 +01:00
|
|
|
|
;;
|
2010-05-13 20:41:13 +02:00
|
|
|
|
:-llvm=*)
|
2009-10-16 20:45:31 +02:00
|
|
|
|
cm=llvm
|
2010-05-13 20:41:13 +02:00
|
|
|
|
optflags=`echo "x$i" | sed 's/^x-llvm=//'`
|
|
|
|
|
echo "$me: Warning: '$i' is deprecated, use '-c llvm -o $llvm' instead!" >&2
|
2008-11-10 21:25:04 +01:00
|
|
|
|
;;
|
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
|
|
|
|
|
;;
|
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
|
|
|
|
|
2009-03-23 09:54:12 +01:00
|
|
|
|
SRCS="lalloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c"
|
2005-05-23 18:48:52 +02:00
|
|
|
|
SRCS="$SRCS jobs.c lex.c main.c misc.c shf.c syn.c tree.c var.c"
|
|
|
|
|
|
2007-06-04 22:22:08 +02:00
|
|
|
|
if test x"$srcdir" = x"."; then
|
|
|
|
|
CPPFLAGS="-I. $CPPFLAGS"
|
|
|
|
|
else
|
|
|
|
|
CPPFLAGS="-I. -I'$srcdir' $CPPFLAGS"
|
|
|
|
|
fi
|
2007-01-17 18:57:31 +01:00
|
|
|
|
|
2007-01-17 23:55:47 +01:00
|
|
|
|
test x"$TARGET_OS" = x"" && TARGET_OS=`uname -s 2>/dev/null || uname`
|
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=
|
2010-02-23 23:02:19 +01:00
|
|
|
|
ccpr='|| for _f in ${tcfn}*; do test x"${_f}" = x"mksh.1" || rm -f "${_f}"; 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
|
|
|
|
|
|
2009-06-07 16:50:58 +02:00
|
|
|
|
# Configuration depending on OS revision, on OSes that need them
|
|
|
|
|
case $TARGET_OS in
|
|
|
|
|
QNX)
|
|
|
|
|
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
|
2007-04-23 22:17:58 +02:00
|
|
|
|
AIX)
|
2008-07-17 16:50:24 +02:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
|
2008-10-10 23:36:04 +02:00
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
2007-04-23 22:17:58 +02:00
|
|
|
|
;;
|
2010-03-14 12:58:33 +01:00
|
|
|
|
BeOS)
|
2009-07-19 16:59:40 +02:00
|
|
|
|
oswarn=' and will currently not work'
|
2008-10-26 22:57:47 +01:00
|
|
|
|
;;
|
2009-04-05 15:07:06 +02:00
|
|
|
|
BSD/OS)
|
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
|
|
|
|
;;
|
2006-08-02 12:41:03 +02:00
|
|
|
|
CYGWIN*)
|
2008-05-11 16:47:04 +02:00
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
2006-08-02 12:41:03 +02:00
|
|
|
|
;;
|
2005-10-25 22:54:29 +02:00
|
|
|
|
Darwin)
|
|
|
|
|
;;
|
2007-01-17 18:46:18 +01:00
|
|
|
|
DragonFly)
|
|
|
|
|
;;
|
|
|
|
|
FreeBSD)
|
|
|
|
|
;;
|
2011-02-27 20:29:20 +01:00
|
|
|
|
FreeMiNT)
|
|
|
|
|
oswarn="; it has minor issues"
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
|
|
|
|
;;
|
2007-02-13 13:26:46 +01:00
|
|
|
|
GNU)
|
2011-06-05 21:55:22 +02:00
|
|
|
|
case $CC in
|
|
|
|
|
*tendracc*) ;;
|
|
|
|
|
*) CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" ;;
|
|
|
|
|
esac
|
2009-10-27 18:00:02 +01:00
|
|
|
|
# define NO_PATH_MAX to use Hurd-only functions
|
2011-06-05 21:55:22 +02:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -DNO_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*) ;;
|
|
|
|
|
*) CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" ;;
|
|
|
|
|
esac
|
2007-01-28 21:05:29 +01:00
|
|
|
|
;;
|
2010-03-14 12:58:33 +01:00
|
|
|
|
Haiku)
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -DMKSH_ASSUME_UTF8"
|
|
|
|
|
;;
|
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 '
|
2006-11-09 00:23:41 +01:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
|
2007-06-30 23:34:23 +02:00
|
|
|
|
: ${LIBS='-lcrypt'}
|
2008-05-13 02:08:12 +02:00
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
2006-03-19 19:06:32 +01:00
|
|
|
|
;;
|
2008-03-27 14:08:37 +01:00
|
|
|
|
IRIX*)
|
2008-07-11 20:31:10 +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*) ;;
|
|
|
|
|
*) CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" ;;
|
|
|
|
|
esac
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -DSETUID_CAN_FAIL_WITH_EAGAIN"
|
2007-01-28 21:05:29 +01:00
|
|
|
|
: ${HAVE_REVOKE=0}
|
2005-10-25 21:46:11 +02:00
|
|
|
|
;;
|
2007-07-27 00:38:31 +02:00
|
|
|
|
MidnightBSD)
|
|
|
|
|
;;
|
2007-03-04 05:45:36 +01:00
|
|
|
|
Minix)
|
2009-04-06 10:33:37 +02:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -DMKSH_UNEMPLOYED -DMKSH_CONSERVATIVE_FDS"
|
2011-06-12 16:37:00 +02:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -DMKSH_NO_LIMITS"
|
2009-04-06 10:33:37 +02:00
|
|
|
|
CPPFLAGS="$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
|
2008-05-13 02:08:12 +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_*)
|
|
|
|
|
# probably same as CYGWIN* – need to test; from RT|Chatzilla
|
|
|
|
|
oswarn='but will probably work'
|
|
|
|
|
;;
|
2007-01-17 18:46:18 +01:00
|
|
|
|
NetBSD)
|
|
|
|
|
;;
|
|
|
|
|
OpenBSD)
|
2008-05-10 05:16:07 +02:00
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
2007-01-17 18:46:18 +01:00
|
|
|
|
;;
|
2007-09-09 21:24:58 +02:00
|
|
|
|
OSF1)
|
2008-03-05 19:21:45 +01:00
|
|
|
|
HAVE_SIG_T=0 # incompatible
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE -D_POSIX_C_SOURCE=200112L"
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED"
|
2008-07-10 20:55:43 +02:00
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
2007-09-09 21:24:58 +02:00
|
|
|
|
;;
|
2007-07-24 23:54:46 +02:00
|
|
|
|
Plan9)
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE -D_LIMITS_EXTENSION"
|
2007-10-14 15:31:01 +02:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_BSD_EXTENSION -D_SUSV2_SOURCE"
|
2009-07-19 16:59:40 +02:00
|
|
|
|
oswarn=' and will currently not work'
|
2009-04-05 14:21:14 +02:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -DMKSH_ASSUME_UTF8 -DMKSH_UNEMPLOYED"
|
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'
|
2008-05-13 02:08:12 +02:00
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
2007-07-24 23:47:14 +02:00
|
|
|
|
;;
|
2008-11-03 00:06:36 +01:00
|
|
|
|
QNX)
|
2009-05-29 16:41:37 +02:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -D__NO_EXT_QNX"
|
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
|
2008-11-03 00:06:36 +01:00
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
|
|
|
|
;;
|
2005-10-25 21:46:11 +02:00
|
|
|
|
SunOS)
|
2006-09-14 01:07:10 +02:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_BSD_SOURCE -D__EXTENSIONS__"
|
2005-06-08 23:51:22 +02:00
|
|
|
|
;;
|
2008-03-14 22:34:55 +01:00
|
|
|
|
syllable)
|
2009-05-20 12:10:35 +02:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
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)
|
|
|
|
|
: ${CC=cc -YPOSIX}
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -Dssize_t=int"
|
2008-05-13 02:08:12 +02:00
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
2008-03-25 22:34:45 +01: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"
|
2008-05-13 02:08:12 +02:00
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
2007-07-01 18:47:05 +02:00
|
|
|
|
;;
|
2007-01-17 18:46:18 +01:00
|
|
|
|
*)
|
2009-07-19 16:59:40 +02:00
|
|
|
|
oswarn='; it may or may not work'
|
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
|
|
|
|
|
2010-10-08 19:56:57 +02:00
|
|
|
|
: ${HAVE_MKNOD=0}
|
|
|
|
|
|
2008-03-25 21:25:27 +01:00
|
|
|
|
: ${CC=cc} ${NROFF=nroff}
|
2008-07-21 23:00:25 +02:00
|
|
|
|
test 0 = $r && echo | $NROFF -v 2>&1 | grep GNU >/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"
|
2008-03-03 20:40:08 +01:00
|
|
|
|
vv '|' "uname -a >&2"
|
|
|
|
|
;;
|
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
|
|
|
|
;;
|
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.
|
|
|
|
|
"
|
2008-03-01 16:07:50 +01:00
|
|
|
|
$e "$bi$me: Building the MirBSD Korn Shell$ao $ui$dstversion$ao"
|
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# Begin of mirtoconf checks
|
|
|
|
|
#
|
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'
|
2009-08-01 23:51:24 +02:00
|
|
|
|
#if defined(__ICC) || defined(__INTEL_COMPILER)
|
2008-10-24 23:35:21 +02:00
|
|
|
|
ct=icc
|
|
|
|
|
#elif defined(__xlC__) || defined(__IBMC__)
|
|
|
|
|
ct=xlc
|
|
|
|
|
#elif defined(__SUNPRO_C)
|
|
|
|
|
ct=sunpro
|
2009-04-03 11:42:37 +02:00
|
|
|
|
#elif defined(__ACK__)
|
|
|
|
|
ct=ack
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__BORLANDC__)
|
|
|
|
|
ct=bcc
|
|
|
|
|
#elif defined(__WATCOMC__)
|
|
|
|
|
ct=watcom
|
|
|
|
|
#elif defined(__MWERKS__)
|
|
|
|
|
ct=metrowerks
|
|
|
|
|
#elif defined(__HP_cc)
|
|
|
|
|
ct=hpcc
|
|
|
|
|
#elif defined(__DECC) || (defined(__osf__) && !defined(__GNUC__))
|
|
|
|
|
ct=dec
|
|
|
|
|
#elif defined(__PGI)
|
|
|
|
|
ct=pgi
|
|
|
|
|
#elif defined(__DMC__)
|
|
|
|
|
ct=dmc
|
|
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
|
ct=msc
|
|
|
|
|
#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
|
|
|
|
|
ct=adsp
|
|
|
|
|
#elif defined(__IAR_SYSTEMS_ICC__)
|
|
|
|
|
ct=iar
|
|
|
|
|
#elif defined(SDCC)
|
|
|
|
|
ct=sdcc
|
|
|
|
|
#elif defined(__PCC__)
|
|
|
|
|
ct=pcc
|
|
|
|
|
#elif defined(__TenDRA__)
|
|
|
|
|
ct=tendra
|
|
|
|
|
#elif defined(__TINYC__)
|
|
|
|
|
ct=tcc
|
|
|
|
|
#elif defined(__llvm__) && defined(__clang__)
|
|
|
|
|
ct=clang
|
2008-10-30 18:11:14 +01:00
|
|
|
|
#elif defined(__NWCC__)
|
|
|
|
|
ct=nwcc
|
2008-10-24 23:35:21 +02:00
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
|
ct=gcc
|
|
|
|
|
#elif defined(_COMPILER_VERSION)
|
|
|
|
|
ct=mipspro
|
|
|
|
|
#elif defined(__sgi)
|
|
|
|
|
ct=mipspro
|
|
|
|
|
#elif defined(__hpux) || defined(__hpua)
|
|
|
|
|
ct=hpcc
|
|
|
|
|
#elif defined(__ultrix)
|
|
|
|
|
ct=ucode
|
|
|
|
|
#else
|
|
|
|
|
ct=unknown
|
2009-08-01 23:51:24 +02:00
|
|
|
|
#endif
|
|
|
|
|
EOF
|
2007-05-31 23:25:25 +02:00
|
|
|
|
ct=unknown
|
2010-02-23 23:02:35 +01:00
|
|
|
|
vv ']' "$CPP $CFLAGS $CPPFLAGS $NOWARN conftest.c | grep ct= | 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
|
2010-01-25 13:16:04 +01:00
|
|
|
|
echo 'int main(void) { return (0); }' >conftest.c
|
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"
|
2008-11-10 21:25:04 +01:00
|
|
|
|
# this works, for now
|
|
|
|
|
vv '|' "${CLANG-clang} -version"
|
|
|
|
|
# ensure compiler and linker are in sync unless overridden
|
|
|
|
|
case $CCC_CC:$CCC_LD in
|
|
|
|
|
:*) ;;
|
|
|
|
|
*:) CCC_LD=$CCC_CC; export CCC_LD ;;
|
|
|
|
|
esac
|
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`'
|
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
|
|
|
|
;;
|
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 | \
|
|
|
|
|
fgrep -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
|
|
|
|
;;
|
2008-03-27 23:44:17 +01:00
|
|
|
|
watcom)
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo >&2 'Warning: Watcom C Compiler 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: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
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
ct=unknown
|
|
|
|
|
;;
|
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
|
2007-10-25 16:18:56 +02:00
|
|
|
|
$e "$bi==> which compiler seems to be used...$ao $ui$ct$ao"
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf conftest.c conftest.o conftest a.out* a.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
|
2008-10-24 21:55:35 +02:00
|
|
|
|
: ${HAVE_CAN_DELEXE=x}
|
2007-07-01 23:27:03 +02:00
|
|
|
|
if test $ct = dmc; then
|
|
|
|
|
CFLAGS="$CFLAGS ${ccpl}/DELEXECUTABLE"
|
|
|
|
|
ac_testn can_delexe compiler_fails 0 'for the /DELEXECUTABLE linker option' <<-EOF
|
|
|
|
|
int main(void) { return (0); }
|
|
|
|
|
EOF
|
2008-10-24 21:55:35 +02:00
|
|
|
|
elif test $ct = dec; then
|
|
|
|
|
CFLAGS="$CFLAGS ${ccpl}-non_shared"
|
|
|
|
|
ac_testn can_delexe compiler_fails 0 'for the -non_shared linker option' <<-EOF
|
|
|
|
|
int main(void) { return (0); }
|
|
|
|
|
EOF
|
2007-07-01 23:27:03 +02:00
|
|
|
|
else
|
2008-03-05 20:14:19 +01:00
|
|
|
|
exit 1
|
2007-07-01 23:27:03 +02:00
|
|
|
|
fi
|
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__'
|
|
|
|
|
fi
|
2007-06-21 17:53:14 +02:00
|
|
|
|
|
2007-05-31 23:25:25 +02:00
|
|
|
|
if test $ct = sunpro; then
|
2007-07-01 23:52:20 +02:00
|
|
|
|
test x"$save_NOWARN" = x"" && save_NOWARN='-errwarn=%none'
|
2007-05-31 23:25:25 +02:00
|
|
|
|
ac_flags 0 errwarnnone "$save_NOWARN"
|
|
|
|
|
test 1 = $HAVE_CAN_ERRWARNNONE || save_NOWARN=
|
|
|
|
|
ac_flags 0 errwarnall "-errwarn=%all"
|
2007-07-01 17:45:58 +02:00
|
|
|
|
test 1 = $HAVE_CAN_ERRWARNALL && DOWARN="-errwarn=%all"
|
2007-06-21 17:43:33 +02:00
|
|
|
|
elif test $ct = hpcc; then
|
|
|
|
|
save_NOWARN=
|
2007-07-01 17:45:58 +02:00
|
|
|
|
DOWARN=+We
|
2008-03-27 23:17:01 +01:00
|
|
|
|
elif test $ct = mipspro; then
|
|
|
|
|
save_NOWARN=
|
|
|
|
|
DOWARN="-diag_error 1-10000"
|
2007-07-01 17:45:58 +02:00
|
|
|
|
elif test $ct = msc; then
|
2007-07-01 23:27:03 +02:00
|
|
|
|
save_NOWARN="${ccpc}/w"
|
|
|
|
|
DOWARN="${ccpc}/WX"
|
|
|
|
|
elif test $ct = dmc; then
|
|
|
|
|
save_NOWARN="${ccpc}-w"
|
|
|
|
|
DOWARN="${ccpc}-wx"
|
|
|
|
|
elif test $ct = bcc; then
|
|
|
|
|
save_NOWARN="${ccpc}-w"
|
|
|
|
|
DOWARN="${ccpc}-w!"
|
2008-03-05 18:00:33 +01:00
|
|
|
|
elif test $ct = dec; then
|
|
|
|
|
: -msg_* flags not used yet, or is -w2 correct?
|
2007-07-22 15:34:52 +02:00
|
|
|
|
elif test $ct = xlc; then
|
|
|
|
|
save_NOWARN=-qflag=i:e
|
|
|
|
|
DOWARN=-qflag=i:i
|
2007-07-31 12:04:46 +02:00
|
|
|
|
elif test $ct = tendra; then
|
|
|
|
|
save_NOWARN=-w
|
2008-03-25 22:34:45 +01:00
|
|
|
|
elif test $ct = ucode; then
|
|
|
|
|
save_NOWARN=
|
|
|
|
|
DOWARN=-w2
|
2007-05-31 23:25:25 +02:00
|
|
|
|
else
|
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
|
2007-05-31 23:25:25 +02:00
|
|
|
|
fi
|
2007-01-17 17:52:00 +01:00
|
|
|
|
|
2007-07-01 17:45:58 +02:00
|
|
|
|
test $ct = icc && DOWARN="$DOWARN -wd1419"
|
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
|
|
|
|
|
test x"$i" = x"" && if test $ct = sunpro; then
|
|
|
|
|
cat >x <<-'EOF'
|
|
|
|
|
int main(void) { return (0); }
|
|
|
|
|
#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
|
2007-06-21 18:11:37 +02:00
|
|
|
|
elif test $ct = hpcc; then
|
2009-12-12 23:27:10 +01:00
|
|
|
|
phase=u
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_flags 1 otwo +O2
|
2009-12-12 23:27:10 +01:00
|
|
|
|
phase=x
|
2007-07-22 15:34:52 +02:00
|
|
|
|
elif test $ct = xlc; then
|
|
|
|
|
ac_flags 1 othree "-O3 -qstrict"
|
|
|
|
|
test 1 = $HAVE_CAN_OTHREE || ac_flags 1 otwo -O2
|
2007-09-07 23:58:40 +02:00
|
|
|
|
elif test $ct = tcc || test $ct = tendra; then
|
2007-07-31 12:04:46 +02:00
|
|
|
|
: no special optimisation
|
2007-05-31 23:25:25 +02:00
|
|
|
|
else
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_flags 1 otwo -O2
|
|
|
|
|
test 1 = $HAVE_CAN_OTWO || ac_flags 1 optimise -O
|
2007-05-31 23:25:25 +02:00
|
|
|
|
fi
|
2007-06-30 23:34:23 +02:00
|
|
|
|
# other flags: just add them if they are supported
|
|
|
|
|
i=0
|
2007-05-31 23:25:25 +02:00
|
|
|
|
if test $ct = gcc; then
|
2008-10-28 15:32:43 +01:00
|
|
|
|
# The following tests run with -Werror (gcc only) if possible
|
|
|
|
|
NOWARN=$DOWARN; phase=u
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_flags 1 fnostrictaliasing -fno-strict-aliasing
|
|
|
|
|
ac_flags 1 fstackprotectorall -fstack-protector-all
|
|
|
|
|
ac_flags 1 fwrapv -fwrapv
|
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
|
2011-06-05 20:16:19 +02:00
|
|
|
|
if test $cm = lto; then
|
|
|
|
|
fv=0
|
|
|
|
|
checks='1 2 3 4 5 6 7 8'
|
|
|
|
|
elif test $cm = combine; then
|
|
|
|
|
fv=0
|
|
|
|
|
checks='7 8'
|
|
|
|
|
else
|
|
|
|
|
fv=1
|
|
|
|
|
fi
|
|
|
|
|
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
|
2007-06-30 23:34:23 +02:00
|
|
|
|
i=1
|
2007-06-06 23:56:12 +02:00
|
|
|
|
elif test $ct = icc; then
|
2007-07-01 00:02:50 +02:00
|
|
|
|
ac_flags 1 fnobuiltinsetmode -fno-builtin-setmode
|
|
|
|
|
ac_flags 1 fnostrictaliasing -fno-strict-aliasing
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_flags 1 fstacksecuritycheck -fstack-security-check
|
|
|
|
|
i=1
|
2007-05-31 23:25:25 +02:00
|
|
|
|
elif test $ct = sunpro; then
|
2010-01-28 20:46:53 +01:00
|
|
|
|
phase=u
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_flags 1 v -v
|
|
|
|
|
ac_flags 1 xc99 -xc99 'for support of ISO C99'
|
2010-01-28 20:46:53 +01:00
|
|
|
|
ac_flags 1 ipo -xipo 'for cross-module optimisation'
|
|
|
|
|
phase=x
|
2007-06-30 23:34:23 +02:00
|
|
|
|
elif test $ct = hpcc; then
|
2009-12-12 23:27:10 +01:00
|
|
|
|
phase=u
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_flags 1 agcc -Agcc 'for support of GCC extensions'
|
|
|
|
|
ac_flags 1 ac99 -AC99 'for support of ISO C99'
|
2009-12-12 23:27:10 +01:00
|
|
|
|
phase=x
|
2008-03-05 18:00:33 +01:00
|
|
|
|
elif test $ct = dec; then
|
2008-03-05 19:21:45 +01:00
|
|
|
|
ac_flags 0 verb -verbose
|
2008-03-05 18:00:33 +01:00
|
|
|
|
ac_flags 1 rodata -readonly_strings
|
2007-07-01 23:27:03 +02:00
|
|
|
|
elif test $ct = dmc; then
|
|
|
|
|
ac_flags 1 decl "${ccpc}-r" 'for strict prototype checks'
|
|
|
|
|
ac_flags 1 schk "${ccpc}-s" 'for stack overflow checking'
|
|
|
|
|
elif test $ct = bcc; then
|
2007-10-25 16:18:56 +02:00
|
|
|
|
ac_flags 1 strpool "${ccpc}-d" 'if string pooling can be enabled'
|
2008-03-27 23:17:01 +01:00
|
|
|
|
elif test $ct = mipspro; then
|
|
|
|
|
ac_flags 1 xc99 -c99 'for support of ISO C99'
|
|
|
|
|
ac_flags 1 fullwarn -fullwarn 'for remark output support'
|
2007-07-01 17:45:58 +02:00
|
|
|
|
elif test $ct = msc; then
|
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'
|
2007-07-22 15:34:52 +02:00
|
|
|
|
elif test $ct = xlc; then
|
|
|
|
|
ac_flags 1 x99 -qlanglvl=extc99
|
|
|
|
|
test 1 = $HAVE_CAN_X99 || ac_flags 1 c99 -qlanglvl=stdc99
|
|
|
|
|
ac_flags 1 rodata "-qro -qroconst -qroptr"
|
|
|
|
|
ac_flags 1 rtcheck -qcheck=all
|
|
|
|
|
ac_flags 1 rtchkc -qextchk
|
|
|
|
|
ac_flags 1 wformat "-qformat=all -qformat=nozln"
|
|
|
|
|
#ac_flags 1 wp64 -qwarn64 # too verbose for now
|
2007-07-31 12:04:46 +02:00
|
|
|
|
elif test $ct = tendra; then
|
|
|
|
|
ac_flags 0 ysystem -Ysystem
|
2007-09-11 19:47:25 +02:00
|
|
|
|
test 1 = $HAVE_CAN_YSYSTEM && CPPFLAGS="-Ysystem $CPPFLAGS"
|
2007-07-31 12:04:46 +02:00
|
|
|
|
ac_flags 1 extansi -Xa
|
|
|
|
|
elif test $ct = tcc; then
|
|
|
|
|
ac_flags 1 boundschk -b
|
2008-06-29 20:18:56 +02:00
|
|
|
|
elif test $ct = clang; then
|
|
|
|
|
i=1
|
2008-10-30 18:11:14 +01:00
|
|
|
|
elif test $ct = nwcc; then
|
2009-07-07 20:42:47 +02:00
|
|
|
|
i=1
|
2009-07-07 22:36:58 +02:00
|
|
|
|
#broken# ac_flags 1 ssp -stackprotect
|
2007-06-30 23:34:23 +02:00
|
|
|
|
fi
|
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 stdg99 -std=gnu99 'for support of ISO C99 + GCC extensions'
|
|
|
|
|
test 1 = $HAVE_CAN_STDG99 || \
|
|
|
|
|
ac_flags 1 stdc99 -std=c99 'for support of ISO C99'
|
|
|
|
|
ac_flags 1 wall -Wall
|
2007-03-10 19:51:59 +01:00
|
|
|
|
fi
|
2007-01-17 18:31:59 +01:00
|
|
|
|
|
2011-06-05 20:16:19 +02: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
|
|
|
|
|
cat >conftest.c <<-'EOF'
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
int main(void) { printf("Hello, World!\n"); return (0); }
|
|
|
|
|
EOF
|
|
|
|
|
case $cm in
|
|
|
|
|
llvm)
|
|
|
|
|
v "$CC $CFLAGS $CPPFLAGS $NOWARN -emit-llvm -c conftest.c" || fv=0
|
|
|
|
|
rmf mksh.s
|
|
|
|
|
test $fv = 0 || v "llvm-link -o - conftest.o | opt $optflags | llc -o mksh.s" || fv=0
|
|
|
|
|
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn mksh.s $LIBS $ccpr"
|
|
|
|
|
;;
|
|
|
|
|
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
|
|
|
|
|
rmf mksh.s
|
|
|
|
|
test $fv = 0 || v "llvm-link -o - conftest.bc | opt $optflags | llc -o mksh.s" || fv=0
|
|
|
|
|
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn mksh.s $LIBS $ccpr"
|
|
|
|
|
;;
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
/* 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)
|
2011-04-09 23:01:03 +02: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) {
|
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))
|
|
|
|
|
/* 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, ...)
|
2011-04-09 23:01:03 +02: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_nonnull '' 'for __attribute__((__nonnull__))' <<-'EOF'
|
2011-06-05 21:55:22 +02:00
|
|
|
|
#if defined(__TenDRA__) || (defined(__GNUC__) && (__GNUC__ < 2))
|
|
|
|
|
/* 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-04-09 23:01:03 +02:00
|
|
|
|
int foo(char *s1, char *s2) __attribute__((__nonnull__));
|
|
|
|
|
int bar(char *s1, char *s2) __attribute__((__nonnull__ (1, 2)));
|
|
|
|
|
int baz(char *s) __attribute__((__nonnull__ (1)));
|
2009-12-12 23:27:10 +01:00
|
|
|
|
int foo(char *s1, char *s2) { return (bar(s2, s1)); }
|
|
|
|
|
int bar(char *s1, char *s2) { return (baz(s1) - baz(s2)); }
|
|
|
|
|
int baz(char *s) { return (*s); }
|
|
|
|
|
int main(int ac, char **av) { return (ac == foo(av[0], av[ac-1])); }
|
|
|
|
|
#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))
|
|
|
|
|
/* 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
|
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))
|
|
|
|
|
/* 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-04-09 23:01:03 +02:00
|
|
|
|
int main(int ac __attribute__((__unused__)), char **av
|
|
|
|
|
__attribute__((__unused__))) { return (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))
|
|
|
|
|
/* 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-04-09 23:01:03 +02:00
|
|
|
|
static const char fnord[] __attribute__((__used__)) = "42";
|
2007-06-21 18:11:37 +02:00
|
|
|
|
int main(void) { return (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
|
2009-09-23 20:22:38 +02:00
|
|
|
|
#XXX this sucks; fix it for *all* compilers
|
|
|
|
|
case $ct in
|
|
|
|
|
clang|icc|nwcc)
|
2007-07-22 15:34:52 +02:00
|
|
|
|
ac_flags 1 fnoinline -fno-inline
|
2009-09-23 20:22:38 +02:00
|
|
|
|
;;
|
|
|
|
|
gcc)
|
|
|
|
|
NOWARN=$DOWARN; phase=u
|
|
|
|
|
ac_flags 1 fnoinline -fno-inline
|
|
|
|
|
NOWARN=$save_NOWARN; phase=x
|
|
|
|
|
;;
|
|
|
|
|
sunpro)
|
|
|
|
|
ac_flags 1 fnoinline -xinline=
|
|
|
|
|
;;
|
|
|
|
|
xlc)
|
|
|
|
|
ac_flags 1 fnoinline -qnoinline
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2006-11-10 08:18:58 +01:00
|
|
|
|
|
2010-03-27 16:32:58 +01:00
|
|
|
|
: ${HAVE_NICE=0}
|
2009-07-25 22:04:09 +02:00
|
|
|
|
: ${HAVE_PERSISTENT_HISTORY=0}
|
2011-03-28 23:15:05 +02:00
|
|
|
|
check_categories="$check_categories smksh"
|
2009-07-25 23:31:27 +02:00
|
|
|
|
HAVE_ISSET_MKSH_CONSERVATIVE_FDS=1 # from sh.h
|
2006-11-10 00:04:34 +01:00
|
|
|
|
fi
|
2009-07-19 16:59:40 +02:00
|
|
|
|
ac_ifcpp 'ifdef MKSH_BINSHREDUCED' isset_MKSH_BINSHREDUCED '' \
|
|
|
|
|
"if a reduced-feature sh is requested" && \
|
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 '' \
|
|
|
|
|
'if the default UTF-8 mode is specified' && : ${HAVE_SETLOCALE_CTYPE=0}
|
|
|
|
|
ac_ifcpp 'ifdef MKSH_CONSERVATIVE_FDS' isset_MKSH_CONSERVATIVE_FDS '' \
|
|
|
|
|
'if traditional/conservative fd use is requested' && \
|
2011-03-28 23:15:05 +02:00
|
|
|
|
check_categories="$check_categories convfds"
|
2006-11-10 00:04:34 +01:00
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# Environment: headers
|
|
|
|
|
#
|
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
|
|
|
|
|
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
|
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
|
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>
|
|
|
|
|
/* check that off_t can represent 2^63-1 correctly, thx FSF */
|
2009-08-08 15:08:53 +02:00
|
|
|
|
#define LARGE_OFF_T (((off_t)1 << 62) - 1 + ((off_t)1 << 62))
|
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];
|
|
|
|
|
int main(void) { return (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
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
|
|
|
|
|
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
|
|
|
|
|
CPPFLAGS="$save_CPPFLAGS -D_LARGE_FILES=1"
|
|
|
|
|
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
|
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>
|
|
|
|
|
int main(int ac, char **av) { return ((uint32_t)(ptrdiff_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>
|
|
|
|
|
int main(int ac, char **av) { return ((u_int32_t)(ptrdiff_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>
|
|
|
|
|
int main(int ac, char **av) { return ((uint8_t)(ptrdiff_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>
|
|
|
|
|
int main(int ac, char **av) { return ((u_int8_t)(ptrdiff_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>
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
#include <sys/resource.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) { return ((int)(rlim_t)0); }
|
|
|
|
|
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>
|
2010-10-01 21:04:38 +02:00
|
|
|
|
int main(void) { return ((int)(ptrdiff_t)(sig_t)(ptrdiff_t)kill(0,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>
|
2010-10-01 21:04:38 +02:00
|
|
|
|
int main(void) { return ((int)(ptrdiff_t)(sighandler_t)(ptrdiff_t)kill(0,0)); }
|
2007-01-18 00:54:39 +01:00
|
|
|
|
EOF
|
|
|
|
|
if test 1 = $HAVE_SIGHANDLER_T; then
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -Dsig_t=sighandler_t"
|
|
|
|
|
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>
|
2010-10-01 21:04:38 +02:00
|
|
|
|
int main(void) { return ((int)(ptrdiff_t)(__sighandler_t)(ptrdiff_t)kill(0,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
|
2007-01-18 00:54:39 +01:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -Dsig_t=__sighandler_t"
|
|
|
|
|
HAVE_SIG_T=1
|
|
|
|
|
fi
|
|
|
|
|
|
2008-03-05 19:21:45 +01:00
|
|
|
|
test 1 = $HAVE_SIG_T || CPPFLAGS="$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
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# Environment: signals
|
|
|
|
|
#
|
2007-04-23 13:33:26 +02:00
|
|
|
|
test x"NetBSD" = x"$TARGET_OS" && $e Ignore the compatibility warning.
|
|
|
|
|
|
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
|
|
|
|
|
extern const char *const sys_sig${what}[];
|
|
|
|
|
int main(void) { return (sys_sig${what}[0][0]); }
|
|
|
|
|
EOF
|
|
|
|
|
ac_testn _sys_sig$what '!' sys_sig$what 0 "the _sys_sig${what}[] array" <<-EOF
|
|
|
|
|
extern const char *const _sys_sig${what}[];
|
|
|
|
|
int main(void) { return (_sys_sig${what}[0][0]); }
|
|
|
|
|
EOF
|
|
|
|
|
if eval "test 1 = \$HAVE__SYS_SIG$uwhat"; then
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -Dsys_sig$what=_sys_sig$what"
|
|
|
|
|
eval "HAVE_SYS_SIG$uwhat=1"
|
|
|
|
|
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-18 00:47:15 +01:00
|
|
|
|
ac_test strsignal '!' sys_siglist 0 <<-'EOF'
|
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
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
int main(void) { return (strsignal(1)[0]); }
|
|
|
|
|
EOF
|
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# Environment: library functions
|
|
|
|
|
#
|
2008-04-20 04:15:12 +02:00
|
|
|
|
ac_testn flock_ex '' 'flock and mmap' <<-'EOF'
|
2007-01-18 21:40:39 +01:00
|
|
|
|
#include <sys/types.h>
|
2011-01-30 03:18:20 +01:00
|
|
|
|
#if HAVE_SYS_FILE_H
|
2007-01-18 21:40:39 +01:00
|
|
|
|
#include <sys/file.h>
|
2011-01-30 03:18:20 +01:00
|
|
|
|
#endif
|
2011-01-21 21:51:56 +01:00
|
|
|
|
#if HAVE_SYS_MMAN_H
|
2007-07-01 19:19:15 +02:00
|
|
|
|
#include <sys/mman.h>
|
2011-01-21 21:51:56 +01:00
|
|
|
|
#endif
|
2007-01-18 17:05:05 +01:00
|
|
|
|
#include <fcntl.h>
|
2007-07-01 23:47:08 +02:00
|
|
|
|
#include <stdlib.h>
|
2009-05-27 11:58:24 +02:00
|
|
|
|
int main(void) { return ((void *)mmap(NULL, (size_t)flock(0, LOCK_EX),
|
2009-08-08 15:08:53 +02:00
|
|
|
|
PROT_READ, MAP_PRIVATE, 0, (off_t)0) == (void *)NULL ? 1 :
|
2009-04-03 12:56:32 +02:00
|
|
|
|
munmap(NULL, 0)); }
|
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
|
|
|
|
|
|
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
|
|
|
|
|
|
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
|
|
|
|
|
|
2008-10-28 15:32:43 +01:00
|
|
|
|
ac_test mkstemp <<-'EOF'
|
|
|
|
|
#include <stdlib.h>
|
2009-08-01 23:58:06 +02:00
|
|
|
|
#include <unistd.h>
|
2008-10-28 15:32:43 +01:00
|
|
|
|
int main(void) { char tmpl[] = "X"; return (mkstemp(tmpl)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
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>
|
2009-05-27 11:58:24 +02:00
|
|
|
|
int main(void) { return ((int)(ptrdiff_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>
|
2009-05-27 11:58:24 +02:00
|
|
|
|
int main(void) { return ((int)(ptrdiff_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>
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
#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>
|
|
|
|
|
int main(void) { setresuid(0,0,0); return (setresgid(0,0,0)); }
|
|
|
|
|
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
|
|
|
|
|
|
2008-05-04 03:58:15 +02:00
|
|
|
|
ac_test strcasestr <<-'EOF'
|
2009-04-10 18:09:53 +02:00
|
|
|
|
#include <sys/types.h>
|
2006-11-12 14:49:22 +01:00
|
|
|
|
#include <stddef.h>
|
2006-11-12 14:15:27 +01:00
|
|
|
|
#include <string.h>
|
2008-11-02 23:29:36 +01:00
|
|
|
|
#if HAVE_STRINGS_H
|
|
|
|
|
#include <strings.h>
|
|
|
|
|
#endif
|
2006-11-12 14:49:22 +01:00
|
|
|
|
int main(int ac, char *av[]) {
|
2009-05-27 11:58:24 +02:00
|
|
|
|
return ((int)(ptrdiff_t)(void *)strcasestr(*av, av[ac]));
|
2006-11-12 14:49:22 +01:00
|
|
|
|
}
|
2006-11-12 14:15:27 +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
|
|
|
|
#
|
2008-05-17 20:19:11 +02:00
|
|
|
|
save_CC=$CC; save_LDFLAGS=$LDFLAGS; save_LIBS=$LIBS
|
|
|
|
|
CC="$CC -c -o $tcfn"; LDFLAGS=; LIBS=
|
2008-03-05 19:49:15 +01:00
|
|
|
|
ac_test '!' flock_decl flock_ex 1 'if flock() does not need to be declared' <<-'EOF'
|
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
|
|
|
|
long flock(void); /* this clashes if defined before */
|
2009-05-27 11:58:24 +02:00
|
|
|
|
int main(void) { return ((int)flock()); }
|
2008-03-05 19:49:15 +01:00
|
|
|
|
EOF
|
2008-03-05 18:06:50 +01:00
|
|
|
|
ac_test '!' revoke_decl revoke 1 'if revoke() does not need to be declared' <<-'EOF'
|
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
|
|
|
|
long revoke(void); /* this clashes if defined before */
|
2009-05-27 11:58:24 +02:00
|
|
|
|
int main(void) { return ((int)revoke()); }
|
2008-03-05 18:06:50 +01:00
|
|
|
|
EOF
|
2007-04-24 12:42:02 +02:00
|
|
|
|
ac_test sys_siglist_decl sys_siglist 1 'if sys_siglist[] does not need to be declared' <<-'EOF'
|
2007-04-23 22:37:16 +02:00
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
|
|
|
|
int main(void) { return (sys_siglist[0][0]); }
|
|
|
|
|
EOF
|
2008-05-17 20:19:11 +02:00
|
|
|
|
CC=$save_CC; LDFLAGS=$save_LDFLAGS; LIBS=$save_LIBS
|
2007-04-23 22:37:16 +02:00
|
|
|
|
|
2007-01-17 22:42:23 +01:00
|
|
|
|
#
|
|
|
|
|
# other checks
|
|
|
|
|
#
|
2007-06-30 22:57:55 +02:00
|
|
|
|
fd='if to use persistent history'
|
2009-07-25 22:04:09 +02:00
|
|
|
|
ac_cache PERSISTENT_HISTORY || test 0 = $HAVE_FLOCK_EX || fv=1
|
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
|
|
|
|
|
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
|
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
|
|
|
|
sigseen=:
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo '#include <signal.h>
|
|
|
|
|
#ifndef NSIG
|
|
|
|
|
#if defined(_NSIG)
|
|
|
|
|
#define NSIG _NSIG
|
|
|
|
|
#elif defined(SIGMAX)
|
|
|
|
|
#define NSIG (SIGMAX+1)
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2010-01-25 13:16:04 +01:00
|
|
|
|
mksh_cfg: NSIG' >conftest.c
|
2010-03-01 09:57:45 +01:00
|
|
|
|
NSIG=`vq "$CPP $CFLAGS $CPPFLAGS $NOWARN conftest.c" | \
|
2009-08-28 19:37:47 +02:00
|
|
|
|
grep mksh_cfg: | sed 's/^mksh_cfg:[ ]*\([0-9x ()+-]*\).*$/\1/'`
|
2007-04-23 22:57:50 +02:00
|
|
|
|
case $NSIG in
|
2007-06-30 21:48:04 +02:00
|
|
|
|
*[\ \(\)+-]*) NSIG=`awk "BEGIN { print $NSIG }"` ;;
|
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
|
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 ... "
|
2008-03-25 22:34:45 +01:00
|
|
|
|
sigs="ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INFO INT IO IOT"
|
|
|
|
|
sigs="$sigs KILL LOST PIPE PROF PWR QUIT RESV SAK SEGV STOP SYS TERM"
|
|
|
|
|
sigs="$sigs TRAP TSTP TTIN TTOU URG USR1 USR2 VTALRM WINCH XCPU XFSZ"
|
|
|
|
|
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" | \
|
2009-08-28 19:37:47 +02:00
|
|
|
|
grep '[ ]SIG[A-Z0-9]*[ ]' | \
|
2007-07-22 15:46:15 +02:00
|
|
|
|
sed 's/^\(.*[ ]SIG\)\([A-Z0-9]*\)\([ ].*\)$/\2/' | sort`
|
2008-03-25 22:34:45 +01:00
|
|
|
|
test $NSIG -gt 1 || sigs=
|
|
|
|
|
for name in $sigs; do
|
2010-01-25 13:16:04 +01:00
|
|
|
|
echo '#include <signal.h>' >conftest.c
|
|
|
|
|
echo mksh_cfg: SIG$name >>conftest.c
|
2010-03-01 09:57:45 +01:00
|
|
|
|
vq "$CPP $CFLAGS $CPPFLAGS $NOWARN conftest.c" | \
|
2009-08-28 19:37:47 +02:00
|
|
|
|
grep mksh_cfg: | \
|
2007-06-05 22:57:46 +02:00
|
|
|
|
sed 's/^mksh_cfg:[ ]*\([0-9x]*\).*$/\1:'$name/
|
2011-05-29 18:31:42 +02:00
|
|
|
|
done | grep -v '^:' | sed 's/:/ /g' | while read nr name; do
|
2008-03-25 22:34:45 +01:00
|
|
|
|
test $printf = echo || nr=`printf %d "$nr" 2>/dev/null`
|
2007-03-04 05:53:06 +01:00
|
|
|
|
test $nr -gt 0 && test $nr -le $NSIG || continue
|
2007-01-11 03:41:53 +01:00
|
|
|
|
case $sigseen in
|
|
|
|
|
*:$nr:*) ;;
|
2009-04-07 20:41:37 +02:00
|
|
|
|
*) echo " { \"$name\", $nr },"
|
2007-01-11 03:41:53 +01:00
|
|
|
|
sigseen=$sigseen$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
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf conftest.c
|
2007-01-11 04:03:34 +01:00
|
|
|
|
$e done.
|
2007-01-11 03:41:53 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2009-08-01 22:58:07 +02:00
|
|
|
|
addsrcs '!' HAVE_STRLCPY strlcpy.c
|
2009-07-30 21:11:12 +02:00
|
|
|
|
addsrcs USE_PRINTF_BUILTIN printf.c
|
|
|
|
|
test 1 = "$USE_PRINTF_BUILTIN" && CPPFLAGS="$CPPFLAGS -DMKSH_PRINTF_BUILTIN"
|
2008-03-05 19:25:57 +01:00
|
|
|
|
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
|
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=
|
2007-07-22 15:08:54 +02:00
|
|
|
|
case $curdir in
|
|
|
|
|
*\ *) echo "#!./mksh" >test.sh ;;
|
|
|
|
|
*) echo "#!$curdir/mksh" >test.sh ;;
|
|
|
|
|
esac
|
2008-04-01 19:13:49 +02:00
|
|
|
|
cat >>test.sh <<-EOF
|
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
|
|
|
|
|
pflag='$curdir/mksh'
|
|
|
|
|
sflag='$srcdir/check.t'
|
|
|
|
|
usee=0 Pflag=0 uset=0 vflag=0 xflag=0
|
|
|
|
|
while getopts "C:e:Pp:s:t:v" ch; do case \$ch {
|
|
|
|
|
(C) check_categories[\${#check_categories[*]}]=\$OPTARG ;;
|
|
|
|
|
(e) usee=1; eflag=\$OPTARG ;;
|
|
|
|
|
(P) Pflag=1 ;;
|
|
|
|
|
(p) pflag=\$OPTARG ;;
|
|
|
|
|
(s) sflag=\$OPTARG ;;
|
|
|
|
|
(t) uset=1; tflag=\$OPTARG ;;
|
|
|
|
|
(v) vflag=1 ;;
|
|
|
|
|
(*) xflag=1 ;;
|
|
|
|
|
}
|
|
|
|
|
done
|
|
|
|
|
shift \$((OPTIND - 1))
|
|
|
|
|
set -A args -- '$srcdir/check.pl' -p "\$pflag" -s "\$sflag"
|
|
|
|
|
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
|
2008-04-01 19:13:49 +02:00
|
|
|
|
print Testing mksh for conformance:
|
|
|
|
|
fgrep MirOS: '$srcdir/check.t'
|
|
|
|
|
fgrep MIRBSD '$srcdir/check.t'
|
|
|
|
|
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
|
|
|
|
|
[[ \$perli = no ]] && exit 1
|
2011-02-27 20:29:20 +01:00
|
|
|
|
perlos=\$(\$perli -e "\$cstr") 2>/dev/null || continue
|
2008-07-14 16:59:20 +02:00
|
|
|
|
print "Perl interpreter '\$perli' running on '\$perlos'"
|
|
|
|
|
[[ -n \$perlos ]] && break
|
|
|
|
|
done
|
2011-03-28 23:15:05 +02:00
|
|
|
|
exec \$perli "\${args[@]}" "\$@"$tsts
|
2008-04-01 19:13:49 +02:00
|
|
|
|
EOF
|
2007-07-22 15:08:54 +02:00
|
|
|
|
chmod 755 test.sh
|
2009-10-16 20:45:31 +02:00
|
|
|
|
if test $cm = llvm; then
|
2008-11-10 21:25:04 +01:00
|
|
|
|
emitbc="-emit-llvm -c"
|
2010-05-13 20:41:13 +02:00
|
|
|
|
elif test $cm = dragonegg; then
|
|
|
|
|
emitbc="-S -flto"
|
2009-10-16 20:45:31 +02:00
|
|
|
|
else
|
|
|
|
|
emitbc=-c
|
2008-11-10 21:25:04 +01:00
|
|
|
|
fi
|
2007-07-22 15:08:54 +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)
|
2008-11-10 21:25:04 +01:00
|
|
|
|
echo "rm -f mksh.s" >>Rebuild.sh
|
2010-05-13 20:41:13 +02:00
|
|
|
|
echo "llvm-link -o - $objs | opt $optflags | llc -o mksh.s" >>Rebuild.sh
|
2008-11-10 21:25:04 +01:00
|
|
|
|
lobjs=mksh.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
|
2008-03-05 18:52:43 +01:00
|
|
|
|
case $tcfn in
|
2009-10-16 20:45:31 +02:00
|
|
|
|
a.exe) mkshexe=mksh.exe ;;
|
|
|
|
|
*) mkshexe=mksh ;;
|
2008-03-05 18:52:43 +01: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
|
2008-03-23 21:19:26 +01:00
|
|
|
|
echo 'test -f $tcfn || exit 1; size $tcfn' >>Rebuild.sh
|
2009-10-16 20:45:31 +02:00
|
|
|
|
if test $cm = makefile; then
|
|
|
|
|
extras='emacsfn.h sh.h sh_flags.h var_spec.h'
|
|
|
|
|
test 0 = $HAVE_SYS_SIGNAME && extras="$extras signames.inc"
|
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
|
|
|
|
|
|
|
|
|
|
# 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:
|
|
|
|
|
#REGRESS_FLAGS= -v
|
|
|
|
|
#regress:
|
2009-10-16 20:51:30 +02:00
|
|
|
|
# ./test.sh \$(REGRESS_FLAGS)
|
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
|
|
|
|
|
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)
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf mksh.s
|
2010-05-13 20:41:13 +02:00
|
|
|
|
v "llvm-link -o - $objs | opt $optflags | llc -o mksh.s"
|
|
|
|
|
;;
|
|
|
|
|
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
|
2007-09-11 19:47:25 +02:00
|
|
|
|
test 1 = $r || v "$NROFF -mdoc <'$srcdir/mksh.1' >mksh.cat1" || \
|
2010-02-23 23:02:19 +01:00
|
|
|
|
rmf mksh.cat1
|
2008-09-30 19:34:25 +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:
|
2006-08-28 03:30:37 +02:00
|
|
|
|
$e "# $i -c -s -o root -g bin -m 555 mksh /bin/mksh"
|
2007-01-17 18:31:59 +01:00
|
|
|
|
$e "# grep -x /bin/mksh /etc/shells >/dev/null || echo /bin/mksh >>/etc/shells"
|
2006-08-28 03:30:37 +02:00
|
|
|
|
$e "# $i -c -o root -g bin -m 444 dot.mkshrc /usr/share/doc/mksh/examples/"
|
2005-05-26 01:44:50 +02:00
|
|
|
|
$e
|
|
|
|
|
$e Installing the manual:
|
2006-08-26 22:48:29 +02:00
|
|
|
|
if test -f mksh.cat1; then
|
2006-08-28 03:30:37 +02:00
|
|
|
|
$e "# $i -c -o root -g bin -m 444 mksh.cat1" \
|
2005-05-23 18:48:52 +02:00
|
|
|
|
"/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
|
2006-08-28 03:30:37 +02:00
|
|
|
|
$e "# $i -c -o root -g bin -m 444 mksh.1 /usr/share/man/man1/mksh.1"
|
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
|