2005-05-23 18:48:52 +02:00
|
|
|
|
#!/bin/sh
|
2009-05-27 11:58:24 +02:00
|
|
|
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.395 2009/05/27 09:58:20 tg Stab $'
|
2009-05-16 18:59:42 +02:00
|
|
|
|
#-
|
|
|
|
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
|
|
|
|
# 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
|
|
|
|
#-
|
2007-06-06 23:59:38 +02:00
|
|
|
|
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
|
2007-10-09 16:21:54 +02:00
|
|
|
|
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
|
2009-04-03 11:42:37 +02:00
|
|
|
|
# MKSH_CLS_STRING MKSH_BINSHREDUCED MKSH_UNEMPLOYED
|
2009-05-16 20:40:09 +02:00
|
|
|
|
# MKSH_CONSERVATIVE_FDS MKSH_MIDNIGHTBSD01ASH_COMPAT
|
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
|
|
|
|
|
eval "$@" 2>&1 | sed "s^${_c} "
|
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 "$@"
|
|
|
|
|
}
|
|
|
|
|
|
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
|
2006-11-09 00:38:28 +01:00
|
|
|
|
cat >scn.c
|
2008-11-12 00:20:08 +01:00
|
|
|
|
vv ']' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN scn.c $LIBS $ccpr" | \
|
|
|
|
|
sed 's^\] scn.c:\([0-9]*\):\] mirtoconf(\1):'
|
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
|
2008-10-25 14:58:41 +02:00
|
|
|
|
test $tcfn = no && test -f scn && tcfn=scn
|
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
|
2008-03-05 20:59:27 +01:00
|
|
|
|
test ugcc=$phase$ct && $CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN scn.c \
|
|
|
|
|
$LIBS 2>&1 | grep 'unrecogni[sz]ed' >/dev/null 2>&1 && fv=$fr
|
2008-06-29 20:08:55 +02:00
|
|
|
|
rm -f scn.c scn.o ${tcfn}*
|
2007-06-30 22:57:55 +02:00
|
|
|
|
ac_testdone
|
2006-11-09 23:56:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2007-06-04 22:00:50 +02:00
|
|
|
|
# ac_flags [-] add varname flags [text]
|
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
|
2007-01-17 17:39:55 +01:00
|
|
|
|
test x"$ft" = x"" && ft="if $f can be used"
|
|
|
|
|
save_CFLAGS=$CFLAGS
|
|
|
|
|
CFLAGS="$CFLAGS $f"
|
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'
|
|
|
|
|
int main(void) { return (0); }
|
|
|
|
|
EOF
|
|
|
|
|
fi
|
2007-01-17 17:44:19 +01:00
|
|
|
|
eval fv=\$HAVE_CAN_`upper $vn`
|
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
|
2007-01-18 16:50:32 +01:00
|
|
|
|
rm -f 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() {
|
2006-11-09 00:38:28 +01:00
|
|
|
|
eval i=\$$1
|
|
|
|
|
test 0 = $i && case " $SRCS " in
|
|
|
|
|
*\ $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
|
2008-11-10 21:25:04 +01:00
|
|
|
|
rm -f a.exe* a.out* *core crypt.exp lft mksh mksh.cat1 mksh.exe mksh.s \
|
|
|
|
|
no *.o scn.c signames.inc stdint.h test.sh x
|
2006-08-24 22:32:53 +02:00
|
|
|
|
|
2008-06-21 21:20:15 +02:00
|
|
|
|
curdir=`pwd` srcdir=`dirname "$0"` check_categories=
|
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
|
2008-11-10 21:25:04 +01:00
|
|
|
|
llvm=NO
|
2005-06-09 00:42:31 +02:00
|
|
|
|
|
2006-08-12 22:19:36 +02:00
|
|
|
|
for i
|
|
|
|
|
do
|
|
|
|
|
case $i in
|
2007-10-09 16:29:42 +02:00
|
|
|
|
-j)
|
|
|
|
|
pm=1
|
|
|
|
|
;;
|
2008-12-20 21:39:05 +01:00
|
|
|
|
-combine)
|
|
|
|
|
llvm=COMBINE
|
|
|
|
|
;;
|
2008-11-10 21:25:04 +01:00
|
|
|
|
-llvm)
|
|
|
|
|
llvm=-std-compile-opts
|
|
|
|
|
;;
|
|
|
|
|
-llvm=*)
|
|
|
|
|
llvm=`echo "x$i" | sed 's/^x-llvm=//'`
|
|
|
|
|
;;
|
2007-05-28 15:47:09 +02:00
|
|
|
|
-Q)
|
|
|
|
|
eq=1
|
|
|
|
|
;;
|
2005-06-09 00:42:31 +02:00
|
|
|
|
-r)
|
|
|
|
|
r=1
|
|
|
|
|
;;
|
|
|
|
|
*)
|
2007-06-30 22:57:55 +02:00
|
|
|
|
echo "$me: Unknown option '$i'!" >&2
|
2005-06-09 00:42:31 +02:00
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
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`
|
2007-02-13 13:26:46 +01:00
|
|
|
|
warn=
|
2007-07-01 23:27:03 +02:00
|
|
|
|
ccpc=-Wc,
|
|
|
|
|
ccpl=-Wl,
|
2007-07-01 21:04:53 +02:00
|
|
|
|
tsts=
|
2008-06-29 20:08:55 +02:00
|
|
|
|
ccpr='|| rm -f ${tcfn}*'
|
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"
|
2007-04-23 22:17:58 +02:00
|
|
|
|
if test x"$LDFLAGS" = x""; then
|
2007-07-01 23:27:03 +02:00
|
|
|
|
LDFLAGS="${ccpl}-bI:crypt.exp"
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo '#!
|
|
|
|
|
__crypt_r
|
|
|
|
|
__encrypt_r
|
|
|
|
|
__setkey_r' >crypt.exp
|
2007-04-23 22:17:58 +02:00
|
|
|
|
fi
|
2007-06-30 23:34:23 +02:00
|
|
|
|
: ${LIBS='-lcrypt'}
|
2008-10-10 23:36:04 +02:00
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
2007-04-23 22:17:58 +02:00
|
|
|
|
;;
|
2008-10-26 22:57:47 +01:00
|
|
|
|
BeOS|Haiku)
|
|
|
|
|
warn=' and will currently not work'
|
|
|
|
|
;;
|
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)
|
|
|
|
|
;;
|
2007-02-13 13:26:46 +01:00
|
|
|
|
GNU)
|
2007-03-19 23:58:19 +01:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
2007-02-13 13:26:46 +01:00
|
|
|
|
;;
|
2007-01-28 21:05:29 +01:00
|
|
|
|
GNU/kFreeBSD)
|
2007-03-19 23:58:19 +01:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
2007-01-28 21:05:29 +01:00
|
|
|
|
;;
|
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)
|
2007-03-19 23:58:19 +01:00
|
|
|
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
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"
|
|
|
|
|
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)
|
|
|
|
|
;;
|
|
|
|
|
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"
|
2007-07-24 23:54:46 +02:00
|
|
|
|
warn=' 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
|
2007-07-24 23:47:14 +02:00
|
|
|
|
warn=' and will currently not work'
|
2009-04-03 11:45:23 +02:00
|
|
|
|
# missing: killpg()
|
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)
|
2008-11-08 18:36:35 +01:00
|
|
|
|
oldish_ed=no-stderr-ed # oldish /bin/ed is broken
|
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"
|
2008-03-14 22:34:55 +01:00
|
|
|
|
warn=' and will currently not work'
|
|
|
|
|
;;
|
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"
|
2007-07-01 23:27:03 +02:00
|
|
|
|
warn="; it will compile, but the target"
|
|
|
|
|
warn="$warn${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
|
|
|
|
*)
|
2007-02-13 13:26:46 +01:00
|
|
|
|
warn='; 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
|
|
|
|
|
2008-11-11 22:52:51 +01:00
|
|
|
|
case " $CPPFLAGS " in
|
2009-04-06 10:29:21 +02:00
|
|
|
|
*\ -DMKSH_ASSUME_UTF8\ *|*\ -DMKSH_ASSUME_UTF8=*)
|
2008-11-11 22:52:51 +01:00
|
|
|
|
: ${HAVE_SETLOCALE_CTYPE=0}
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2009-04-06 10:33:37 +02:00
|
|
|
|
case " $CPPFLAGS " in
|
|
|
|
|
*\ -DMKSH_CONSERVATIVE_FDS\ *|*\ -DMKSH_CONSERVATIVE_FDS=*)
|
|
|
|
|
check_categories=$check_categories,convfds
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2008-11-11 22:52:51 +01:00
|
|
|
|
|
2007-02-13 13:26:46 +01:00
|
|
|
|
if test -n "$warn"; then
|
|
|
|
|
echo "Warning: mksh has not yet been ported to or tested on your" >&2
|
|
|
|
|
echo "operating system '$TARGET_OS'$warn. If you can provide" >&2
|
|
|
|
|
echo "a shell account to the developer, this may improve; please" >&2
|
|
|
|
|
echo "drop us a success or failure notice or even send in diffs." >&2
|
|
|
|
|
fi
|
|
|
|
|
|
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
|
|
|
|
|
dstversion=`sed -n '/define MKSH_VERSION/s/^.*"\(.*\)".*$/\1/p' $srcdir/sh.h`
|
2008-03-03 20:40:08 +01:00
|
|
|
|
$e "Hi from$ao $bi$srcversion$ao on:"
|
|
|
|
|
case $TARGET_OS in
|
|
|
|
|
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
|
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
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo '#if defined(__ICC) || defined(__INTEL_COMPILER)
|
|
|
|
|
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
|
|
|
|
|
#endif' >scn.c
|
2007-05-31 23:25:25 +02:00
|
|
|
|
ct=unknown
|
2008-03-03 20:40:08 +01:00
|
|
|
|
vv ']' "$CPP scn.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`
|
|
|
|
|
rm -f x
|
2008-10-24 23:35:21 +02:00
|
|
|
|
echo 'int main(void) { return (0); }' >scn.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
|
|
|
|
|
vv '|' "$CC -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)
|
2008-03-05 18:30:10 +01:00
|
|
|
|
vv '|' "$CC -V"
|
2008-10-24 21:55:35 +02:00
|
|
|
|
vv '|' "$CC -Wl,-V scn.c"
|
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)
|
2008-07-08 23:14:42 +02:00
|
|
|
|
vv '|' "$CC -v scn.c"
|
2008-03-28 15:04:23 +01:00
|
|
|
|
vv '|' 'echo `$CC -dumpmachine` gcc`$CC -dumpversion`'
|
2008-03-03 20:40:08 +01:00
|
|
|
|
;;
|
2008-03-27 23:17:01 +01:00
|
|
|
|
hpcc)
|
2008-07-07 01:19:31 +02:00
|
|
|
|
vv '|' "$CC -V scn.c"
|
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)
|
2008-03-03 20:40:08 +01:00
|
|
|
|
vv '|' "$CC -V"
|
|
|
|
|
;;
|
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)
|
|
|
|
|
vv '|' "$CC -version"
|
|
|
|
|
;;
|
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)
|
|
|
|
|
vv '|' "$CC -version"
|
|
|
|
|
;;
|
2008-03-27 23:17:01 +01:00
|
|
|
|
pcc)
|
|
|
|
|
vv '|' "$CC -v"
|
|
|
|
|
;;
|
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)
|
2008-06-21 21:38:41 +02:00
|
|
|
|
vv '|' "$CC -V scn.c"
|
2008-03-27 23:17:01 +01:00
|
|
|
|
;;
|
2008-03-27 23:44:17 +01:00
|
|
|
|
tcc)
|
2008-03-03 20:40:08 +01:00
|
|
|
|
vv '|' "$CC -v"
|
|
|
|
|
;;
|
|
|
|
|
tendra)
|
|
|
|
|
vv '|' "$CC -V 2>&1 | fgrep -i -e version -e release"
|
|
|
|
|
;;
|
2008-03-25 22:34:45 +01:00
|
|
|
|
ucode)
|
|
|
|
|
vv '|' "$CC -V"
|
2008-10-24 21:59:54 +02:00
|
|
|
|
vv '|' "$CC -Wl,-V scn.c"
|
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)
|
|
|
|
|
vv '|' "$CC -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
|
2008-12-20 21:39:05 +01:00
|
|
|
|
test x"$llvm" = x"NO" || test x"$llvm" = x"COMBINE" || vv '|' "llc -version"
|
2007-10-25 16:18:56 +02:00
|
|
|
|
$e "$bi==> which compiler seems to be used...$ao $ui$ct$ao"
|
2008-06-29 20:08:55 +02:00
|
|
|
|
rm -f scn.c scn.o scn a.out* a.exe*
|
2007-05-31 23:25:25 +02:00
|
|
|
|
|
2007-06-21 17:53:14 +02:00
|
|
|
|
case $TARGET_OS in
|
|
|
|
|
HP-UX)
|
|
|
|
|
case $ct:`uname -m` in
|
2007-06-30 23:34:23 +02:00
|
|
|
|
gcc:ia64) : ${CFLAGS='-mlp64'} ;;
|
|
|
|
|
hpcc:ia64) : ${CFLAGS='+DD64'} ;;
|
2007-06-21 17:53:14 +02:00
|
|
|
|
esac
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# 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
|
2007-06-21 17:53:14 +02:00
|
|
|
|
ac_testn compiler_fails '' 'if the compiler does not fail correctly' <<-EOF
|
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
EOF
|
2007-09-11 19:47:25 +02:00
|
|
|
|
if test 1 = $HAVE_COMPILER_FAILS; 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
|
2008-03-28 14:55:11 +01:00
|
|
|
|
ac_testn couldbe_tcc '!' compiler_known 0 'if this could be tcc' <<-EOF
|
|
|
|
|
#ifdef __TINYC__
|
|
|
|
|
int main(void) { return (0); }
|
|
|
|
|
#else
|
|
|
|
|
/* force a failure: __TINYC__ not defined */
|
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
#endif
|
|
|
|
|
EOF
|
|
|
|
|
if test 1 = $HAVE_COULDBE_TCC; then
|
|
|
|
|
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
|
2007-07-01 23:59:10 +02:00
|
|
|
|
rm -f x
|
2007-06-21 18:11:37 +02:00
|
|
|
|
elif test $ct = hpcc; then
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_flags 1 otwo +O2
|
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
|
2008-12-31 17:09:51 +01:00
|
|
|
|
test x"$llvm" = x"COMBINE" && ac_flags 0 combine \
|
|
|
|
|
'-fwhole-program --combine' \
|
|
|
|
|
'if gcc supports -fwhole-program --combine'
|
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
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_flags 1 v -v
|
|
|
|
|
ac_flags 1 xc99 -xc99 'for support of ISO C99'
|
|
|
|
|
elif test $ct = hpcc; then
|
|
|
|
|
ac_flags 1 agcc -Agcc 'for support of GCC extensions'
|
|
|
|
|
ac_flags 1 ac99 -AC99 'for support of ISO C99'
|
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
|
2007-07-01 23:59:10 +02:00
|
|
|
|
rm -f 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
|
|
|
|
|
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
|
2008-03-05 20:59:27 +01:00
|
|
|
|
phase=x
|
2007-01-17 18:31:59 +01:00
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Compiler: check for stuff that only generates warnings
|
|
|
|
|
#
|
2007-10-25 16:18:56 +02:00
|
|
|
|
ac_test attribute '' 'for basic __attribute__((...)) support' <<-'EOF'
|
2008-03-23 22:53:36 +01:00
|
|
|
|
#if defined(__GNUC__) && (__GNUC__ < 2)
|
2008-03-28 14:55:11 +01:00
|
|
|
|
/* force a failure: gcc 1.42 has a false positive here */
|
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
#else
|
2007-06-21 18:11:37 +02:00
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#undef __attribute__
|
|
|
|
|
void fnord(void) __attribute__((noreturn));
|
|
|
|
|
int main(void) { fnord(); }
|
|
|
|
|
void fnord(void) { exit(0); }
|
2008-03-28 14:55:11 +01:00
|
|
|
|
#endif
|
2007-06-21 18:11:37 +02:00
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
ac_test attribute_bounded attribute 0 'for __attribute__((bounded))' <<-'EOF'
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#undef __attribute__
|
|
|
|
|
int xcopy(const void *, void *, size_t)
|
|
|
|
|
__attribute__((bounded (buffer, 1, 3)))
|
|
|
|
|
__attribute__((bounded (buffer, 2, 3)));
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
ac_test attribute_used attribute 0 'for __attribute__((used))' <<-'EOF'
|
|
|
|
|
static const char fnord[] __attribute__((used)) = "42";
|
|
|
|
|
int main(void) { return (0); }
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
# End of tests run with -Werror
|
|
|
|
|
NOWARN=$save_NOWARN
|
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# mksh: flavours (full/small mksh, omit certain stuff)
|
|
|
|
|
#
|
2007-10-25 16:18:56 +02:00
|
|
|
|
ac_testn mksh_full '' "if a full-featured mksh is requested" <<-'EOF'
|
2006-11-09 23:51:49 +01:00
|
|
|
|
#ifdef MKSH_SMALL
|
2008-03-28 14:55:11 +01:00
|
|
|
|
/* force a failure: we want a small mksh */
|
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
#else
|
|
|
|
|
/* force a success: we want a full mksh */
|
2007-01-12 03:40:18 +01:00
|
|
|
|
int main(void) { return (0); }
|
2008-03-28 14:55:11 +01:00
|
|
|
|
#endif
|
2006-11-09 23:51:49 +01:00
|
|
|
|
EOF
|
2008-10-20 21:29:25 +02:00
|
|
|
|
ac_testn mksh_reduced mksh_full 0 "if a reduced-feature sh is requested" <<-'EOF'
|
|
|
|
|
#ifdef MKSH_BINSHREDUCED
|
|
|
|
|
/* force a success: we want a reduced mksh-as-bin-sh */
|
|
|
|
|
int main(void) { return (0); }
|
|
|
|
|
#else
|
|
|
|
|
/* force a failure: we want a full mksh, always */
|
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
#endif
|
|
|
|
|
EOF
|
2006-11-09 23:51:49 +01:00
|
|
|
|
|
2006-11-10 00:04:34 +01:00
|
|
|
|
if test 0 = $HAVE_MKSH_FULL; then
|
2007-07-22 15:34:52 +02:00
|
|
|
|
if test $ct = xlc; then
|
|
|
|
|
ac_flags 1 fnoinline -qnoinline
|
|
|
|
|
else
|
|
|
|
|
ac_flags 1 fnoinline -fno-inline
|
|
|
|
|
fi
|
2006-11-10 08:18:58 +01:00
|
|
|
|
|
2008-05-04 03:58:15 +02:00
|
|
|
|
: ${HAVE_MKNOD=0}
|
2008-07-11 21:51:23 +02:00
|
|
|
|
check_categories=$check_categories,smksh
|
2009-04-06 10:33:37 +02:00
|
|
|
|
check_categories=$check_categories,convfds
|
2006-11-10 00:04:34 +01:00
|
|
|
|
fi
|
2008-10-20 21:29:25 +02:00
|
|
|
|
if test 1 = $HAVE_MKSH_REDUCED; then
|
|
|
|
|
check_categories=$check_categories,binsh
|
|
|
|
|
fi
|
2006-11-10 00:04:34 +01:00
|
|
|
|
|
2007-01-17 18:42:22 +01:00
|
|
|
|
#
|
|
|
|
|
# Environment: headers
|
|
|
|
|
#
|
2007-01-18 16:50:32 +01:00
|
|
|
|
ac_header sys/param.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
|
2007-01-18 16:50:32 +01:00
|
|
|
|
ac_header sys/sysmacros.h
|
|
|
|
|
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
|
|
|
|
|
ac_header stdbool.h
|
2009-04-06 10:24:57 +02:00
|
|
|
|
ac_header strings.h sys/types.h
|
2007-01-18 16:50:32 +01:00
|
|
|
|
ac_header grp.h sys/types.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-10-10 13:32:49 +02:00
|
|
|
|
ac_header '!' stdint.h stdarg.h
|
2007-10-25 16:18:56 +02:00
|
|
|
|
ac_testn can_inttypes '!' stdint_h 1 "for standard 32-bit integer types" <<-'EOF'
|
2007-09-09 13:04:30 +02:00
|
|
|
|
#include <sys/types.h>
|
2007-10-10 13:32:49 +02:00
|
|
|
|
int main(int ac, char **av) { return ((uint32_t)*av + (int32_t)ac); }
|
|
|
|
|
EOF
|
2007-10-25 16:18:56 +02:00
|
|
|
|
ac_testn can_ucbints '!' can_inttypes 1 "for UCB 32-bit integer types" <<-'EOF'
|
2007-10-10 13:32:49 +02:00
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
int main(int ac, char **av) { return ((u_int32_t)*av + (int32_t)ac); }
|
|
|
|
|
EOF
|
2007-10-25 16:18:56 +02:00
|
|
|
|
case $HAVE_CAN_INTTYPES$HAVE_CAN_UCBINTS in
|
2007-10-10 13:42:24 +02:00
|
|
|
|
01) HAVE_U_INT32_T=1
|
|
|
|
|
echo 'typedef u_int32_t uint32_t;' >>stdint.h ;;
|
2007-10-10 13:32:49 +02:00
|
|
|
|
00) echo 'typedef signed int int32_t;' >>stdint.h
|
|
|
|
|
echo 'typedef unsigned int uint32_t;' >>stdint.h ;;
|
|
|
|
|
esac
|
|
|
|
|
test -f stdint.h && HAVE_STDINT_H=1
|
2007-09-09 13:04:30 +02:00
|
|
|
|
ac_cppflags STDINT_H
|
|
|
|
|
|
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 */
|
|
|
|
|
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
|
|
|
|
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
|
2007-06-04 23:15:27 +02:00
|
|
|
|
rm -f lft.c lft.o # end of large file support test
|
2007-03-19 23:58:19 +01:00
|
|
|
|
|
2007-01-18 00:18:55 +01:00
|
|
|
|
#
|
|
|
|
|
# Environment: types
|
|
|
|
|
#
|
|
|
|
|
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>
|
2008-07-18 13:34:20 +02:00
|
|
|
|
int main(void) { return ((ptrdiff_t)(sig_t)0); }
|
2007-01-18 00:54:39 +01:00
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
ac_testn sighandler_t '!' sig_t 0 <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <signal.h>
|
2008-07-18 13:42:52 +02:00
|
|
|
|
#include <stddef.h>
|
2008-07-18 13:34:20 +02:00
|
|
|
|
int main(void) { return ((ptrdiff_t)(sighandler_t)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>
|
2008-07-18 13:34:20 +02:00
|
|
|
|
int main(void) { return ((ptrdiff_t)(__sighandler_t)0); }
|
2007-01-18 00:54:39 +01:00
|
|
|
|
EOF
|
2007-01-18 01:16:26 +01:00
|
|
|
|
if test 1 = $HAVE___SIGHANDLER_T; then
|
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-09-11 20:12:16 +02:00
|
|
|
|
ac_testn u_int32_t <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#if HAVE_STDINT_H
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#endif
|
|
|
|
|
int main(void) { return ((int)(u_int32_t)0); }
|
|
|
|
|
EOF
|
|
|
|
|
test 1 = $HAVE_U_INT32_T || CPPFLAGS="$CPPFLAGS -Du_int32_t=uint32_t"
|
|
|
|
|
|
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
|
|
|
|
|
#
|
2007-06-10 19:06:07 +02:00
|
|
|
|
ac_testn arc4random <<-'EOF'
|
2007-04-24 12:42:02 +02:00
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#if HAVE_STDINT_H
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#endif
|
|
|
|
|
extern u_int32_t arc4random(void);
|
2009-05-27 11:58:24 +02:00
|
|
|
|
int main(void) { return ((int)(arc4random() & 0xFF)); }
|
2006-11-09 00:38:28 +01:00
|
|
|
|
EOF
|
2006-08-26 22:30:27 +02:00
|
|
|
|
|
2007-09-11 20:12:16 +02:00
|
|
|
|
save_LIBS=$LIBS
|
2008-06-29 21:46:56 +02:00
|
|
|
|
if test 0 = $HAVE_ARC4RANDOM; then
|
|
|
|
|
test -f arc4random.c || if test -f "$srcdir/arc4random.c"; then
|
|
|
|
|
# ensure isolation of source directory from build directory
|
|
|
|
|
cp "$srcdir/arc4random.c" .
|
|
|
|
|
fi
|
|
|
|
|
if test -f arc4random.c; then
|
|
|
|
|
ac_header sys/sysctl.h
|
|
|
|
|
addsrcs HAVE_ARC4RANDOM arc4random.c
|
|
|
|
|
HAVE_ARC4RANDOM=1
|
|
|
|
|
LIBS="$LIBS arc4random.c"
|
|
|
|
|
fi
|
2007-06-10 19:06:07 +02:00
|
|
|
|
fi
|
2007-06-30 23:34:23 +02:00
|
|
|
|
ac_cppflags ARC4RANDOM
|
2007-06-10 19:06:07 +02:00
|
|
|
|
|
2007-08-12 15:42:23 +02:00
|
|
|
|
ac_test arc4random_pushb arc4random 0 <<-'EOF'
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#if HAVE_STDINT_H
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#endif
|
|
|
|
|
extern uint32_t arc4random_pushb(void *, size_t);
|
2009-05-27 11:58:24 +02:00
|
|
|
|
int main(int ac, char *av[]) { return ((int)(arc4random_pushb(*av,
|
|
|
|
|
(size_t)ac)) & 0xFF); }
|
2006-11-09 00:38:28 +01:00
|
|
|
|
EOF
|
2007-09-11 20:12:16 +02:00
|
|
|
|
LIBS=$save_LIBS
|
2006-08-26 22:30:27 +02:00
|
|
|
|
|
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>
|
|
|
|
|
#include <sys/file.h>
|
2007-07-01 19:19:15 +02:00
|
|
|
|
#include <sys/mman.h>
|
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-04-03 12:56:32 +02:00
|
|
|
|
PROT_READ, MAP_PRIVATE, 0, 0) == (void *)NULL ? 1 :
|
|
|
|
|
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
|
|
|
|
|
|
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-05-27 11:58:24 +02:00
|
|
|
|
dv = makedev((unsigned int)ac, 1);
|
2007-07-31 13:11:25 +02:00
|
|
|
|
return (mknod(av[0], 0, dv) ? (int)major(dv) : (int)minor(dv));
|
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
|
2008-10-28 15:32:43 +01:00
|
|
|
|
ac_test mkstemp <<-'EOF'
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
int main(void) { char tmpl[] = "X"; return (mkstemp(tmpl)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
ac_test nice <<-'EOF'
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
int main(void) { return (nice(4)); }
|
|
|
|
|
EOF
|
|
|
|
|
|
2008-05-17 20:27:57 +02:00
|
|
|
|
ac_test realpath mksh_full 0 <<-'EOF'
|
|
|
|
|
#if HAVE_SYS_PARAM_H
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
#endif
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#ifndef PATH_MAX
|
|
|
|
|
#define PATH_MAX 1024
|
|
|
|
|
#endif
|
|
|
|
|
char *res, dst[PATH_MAX];
|
|
|
|
|
const char src[] = ".";
|
|
|
|
|
int main(void) {
|
|
|
|
|
res = realpath(src, dst);
|
|
|
|
|
return (res == NULL ? 1 : 0);
|
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
|
2007-01-26 19:25:01 +01:00
|
|
|
|
ac_test revoke mksh_full 0 <<-'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
|
|
|
|
|
|
2007-07-31 13:11:25 +02:00
|
|
|
|
ac_test setmode mknod 1 <<-'EOF'
|
2006-11-12 14:35:29 +01:00
|
|
|
|
#if defined(__MSVCRT__) || defined(__CYGWIN__)
|
2009-05-16 20:40:09 +02:00
|
|
|
|
/* force a failure: Win32 setmode() is not what we want... */
|
2008-03-28 14:55:11 +01:00
|
|
|
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
|
|
|
|
#else
|
2006-11-09 00:38:28 +01:00
|
|
|
|
#include <unistd.h>
|
2006-11-12 14:38:40 +01:00
|
|
|
|
int main(int ac, char *av[]) { return (getmode(setmode(av[0]), ac)); }
|
2008-03-28 14:55:11 +01:00
|
|
|
|
#endif
|
2006-11-09 00:38:28 +01:00
|
|
|
|
EOF
|
2006-11-09 00:23:41 +01:00
|
|
|
|
|
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>
|
2006-11-12 14:35:29 +01:00
|
|
|
|
int main(int ac, char *av[]) { return (strlcpy(*av, av[1], 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=
|
2007-05-24 11:22:58 +02:00
|
|
|
|
ac_test '!' arc4random_decl arc4random 1 'if arc4random() does not need to be declared' <<-'EOF'
|
2007-04-24 12:42:02 +02:00
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
2007-05-24 11:22:58 +02:00
|
|
|
|
long arc4random(void); /* this clashes if defined before */
|
2009-05-27 11:58:24 +02:00
|
|
|
|
int main(void) { return ((int)arc4random()); }
|
2007-04-24 12:42:02 +02:00
|
|
|
|
EOF
|
2007-08-12 15:42:23 +02:00
|
|
|
|
ac_test '!' arc4random_pushb_decl arc4random_pushb 1 'if arc4random_pushb() does not need to be declared' <<-'EOF'
|
2007-04-24 12:42:02 +02:00
|
|
|
|
#define MKSH_INCLUDES_ONLY
|
|
|
|
|
#include "sh.h"
|
2007-08-12 15:42:23 +02:00
|
|
|
|
int arc4random_pushb(char, int); /* this clashes if defined before */
|
2009-05-27 11:58:24 +02:00
|
|
|
|
int main(int ac, char *av[]) { return ((int)arc4random_pushb(**av, ac)); }
|
2007-04-24 12:42:02 +02:00
|
|
|
|
EOF
|
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'
|
|
|
|
|
ac_cache PERSISTENT_HISTORY || test 11 != $HAVE_FLOCK_EX$HAVE_MKSH_FULL || fv=1
|
|
|
|
|
test 1 = $fv || check_categories=$check_categories,no-histfile
|
|
|
|
|
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
|
2007-07-01 18:57:00 +02:00
|
|
|
|
echo '#define foo bar' >scn.c
|
2008-03-03 20:40:08 +01:00
|
|
|
|
vv ']' "$CPP -dD scn.c >x"
|
2007-06-30 22:57:55 +02:00
|
|
|
|
grep '#define foo bar' x >/dev/null 2>&1 && fv=1
|
2007-07-01 18:57:00 +02:00
|
|
|
|
rm -f scn.c x
|
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 && \
|
2008-11-08 18:36:35 +01:00
|
|
|
|
check_categories=$check_categories,$oldish_ed
|
2007-01-18 02:10:55 +01:00
|
|
|
|
rm -f x
|
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
|
|
|
|
|
mksh_cfg: NSIG' >scn.c
|
2007-07-31 12:17:52 +02:00
|
|
|
|
NSIG=`vq "$CPP $CPPFLAGS scn.c" | grep mksh_cfg: | \
|
2007-06-05 22:57:46 +02:00
|
|
|
|
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 \
|
2007-07-31 12:17:52 +02:00
|
|
|
|
"$CPP $CPPFLAGS -dD scn.c" | 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
|
2007-07-01 18:57:00 +02:00
|
|
|
|
echo '#include <signal.h>' >scn.c
|
|
|
|
|
echo mksh_cfg: SIG$name >>scn.c
|
2007-07-31 12:17:52 +02:00
|
|
|
|
vq "$CPP $CPPFLAGS scn.c" | grep mksh_cfg: | \
|
2007-06-05 22:57:46 +02:00
|
|
|
|
sed 's/^mksh_cfg:[ ]*\([0-9x]*\).*$/\1:'$name/
|
2007-01-11 03:41:53 +01:00
|
|
|
|
done | grep -v '^:' | while IFS=: 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
|
2007-07-01 18:57:00 +02:00
|
|
|
|
rm -f scn.c
|
2007-01-11 04:03:34 +01:00
|
|
|
|
$e done.
|
2007-01-11 03:41:53 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2006-11-09 00:38:28 +01:00
|
|
|
|
addsrcs HAVE_SETMODE setmode.c
|
• remove strcasestr.c, use home-grown implementation¹, call it stricmp,
and have it return an API-correct const char *
• enhance and stylify comments
• a little KNF and simplifications
• #ifdef DEBUG: replace strchr and strstr with ucstrchr and ucstrstr
that take and return a non-const char *, and fix the violations
• new cstrchr, cstrstr (take and give const char *)
• new vstrchr, vstrstr (take const or not, give boolean value)
• new afreechk(x) = afreechv(x,x) = if (x1) afree(x2, ATEMP)
• new ksh_isdash(str) = (str != NULL) && !strcmp(str, "-")
• replace the only use of strrchr with inlined code to shrink
• minor man page fixes
• Minix 3 signames are autogenerated with gcc
• rename strlfun.c to strlcpy.c since we don't do strlcat(3) anyway,
only strlcpy(3), and shorten it
• dot.mkshrc: move MKSH=… down to the export line
to not disturb the PS1 visual impression ☺
• dot.mkshrc: Lstripcom(): optimise
• bump version
¹) side effect from creating API-correct cstrchr, cstrstr, etc.
uses goto so it must be better ☻
tested on mirbsd-current via both Makefile and Build.sh
2007-03-04 04:04:28 +01:00
|
|
|
|
addsrcs HAVE_STRLCPY strlcpy.c
|
2009-03-29 19:50:45 +02:00
|
|
|
|
test 0 = "$HAVE_SETMODE" && CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -DCONFIG_H_FILENAME=\\\"sh.h\\\""
|
2008-03-05 19:25:57 +01:00
|
|
|
|
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
|
2006-08-26 22:30:27 +02:00
|
|
|
|
|
2007-06-04 22:14:34 +02:00
|
|
|
|
objs=
|
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
|
2008-04-01 19:22:54 +02:00
|
|
|
|
check_categories=$check_categories
|
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
|
2008-07-14 17:06:02 +02:00
|
|
|
|
perlos=\$(\$perli -e "\$cstr") 2>&- || continue
|
2008-07-14 16:59:20 +02:00
|
|
|
|
print "Perl interpreter '\$perli' running on '\$perlos'"
|
|
|
|
|
[[ -n \$perlos ]] && break
|
|
|
|
|
done
|
2008-07-16 01:44:51 +02:00
|
|
|
|
exec \$perli '$srcdir/check.pl' -s '$srcdir/check.t' -p '$curdir/mksh' -C \${check_categories#,} \$*$tsts
|
2008-04-01 19:13:49 +02:00
|
|
|
|
EOF
|
2007-07-22 15:08:54 +02:00
|
|
|
|
chmod 755 test.sh
|
2008-12-31 17:09:51 +01:00
|
|
|
|
test "$HAVE_CAN_COMBINE$llvm" = "0COMBINE" && llvm=NO
|
2008-11-10 21:25:04 +01:00
|
|
|
|
if test x"$llvm" = x"NO"; then
|
|
|
|
|
emitbc=-c
|
2008-12-20 21:39:05 +01:00
|
|
|
|
elif test x"$llvm" = x"COMBINE"; then
|
|
|
|
|
emitbc="-fwhole-program --combine"
|
2008-11-10 21:25:04 +01:00
|
|
|
|
else
|
|
|
|
|
emitbc="-emit-llvm -c"
|
|
|
|
|
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
|
|
|
|
|
objs="$objs `echo x"$file" | sed 's/^x\(.*\)\.c$/\1.o/'`"
|
2007-07-22 15:08:54 +02:00
|
|
|
|
test -f $file || file=$srcdir/$file
|
2008-11-10 21:25:04 +01:00
|
|
|
|
echo "$CC $CFLAGS $CPPFLAGS $emitbc $file || exit 1" >>Rebuild.sh
|
2007-07-22 15:08:54 +02:00
|
|
|
|
done
|
2008-12-20 21:39:05 +01:00
|
|
|
|
if test x"$llvm" = x"NO" || test x"$llvm" = x"COMBINE"; then
|
2008-11-10 21:25:04 +01:00
|
|
|
|
lobjs=$objs
|
|
|
|
|
else
|
|
|
|
|
echo "rm -f mksh.s" >>Rebuild.sh
|
|
|
|
|
echo "llvm-link -o - $objs | opt $llvm | llc -o mksh.s" >>Rebuild.sh
|
|
|
|
|
lobjs=mksh.s
|
|
|
|
|
fi
|
2008-03-05 18:52:43 +01:00
|
|
|
|
case $tcfn in
|
|
|
|
|
a.exe) echo tcfn=mksh.exe >>Rebuild.sh ;;
|
|
|
|
|
*) echo tcfn=mksh >>Rebuild.sh ;;
|
|
|
|
|
esac
|
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
|
2008-12-20 21:39:05 +01:00
|
|
|
|
if test x"$llvm" = x"COMBINE"; then
|
|
|
|
|
case $tcfn in
|
|
|
|
|
a.exe) objs="-o mksh.exe" ;;
|
|
|
|
|
*) objs="-o mksh" ;;
|
|
|
|
|
esac
|
|
|
|
|
for file in $SRCS; do
|
|
|
|
|
test -f $file || file=$srcdir/$file
|
|
|
|
|
objs="$objs $file"
|
|
|
|
|
done
|
|
|
|
|
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
|
|
|
|
|
test -f $file || file=$srcdir/$file
|
2008-11-10 21:25:04 +01:00
|
|
|
|
v "$CC $CFLAGS $CPPFLAGS $emitbc $file" || exit 1
|
2007-10-09 16:29:42 +02:00
|
|
|
|
done
|
|
|
|
|
fi
|
2008-11-10 21:25:04 +01:00
|
|
|
|
if test x"$emitbc" = x"-emit-llvm -c"; then
|
|
|
|
|
rm -f mksh.s
|
|
|
|
|
v "llvm-link -o - $objs | opt $llvm | llc -o mksh.s"
|
|
|
|
|
fi
|
2008-03-05 18:52:43 +01:00
|
|
|
|
case $tcfn in
|
|
|
|
|
a.exe) tcfn=mksh.exe ;;
|
|
|
|
|
*) tcfn=mksh ;;
|
|
|
|
|
esac
|
2008-12-20 21:39:05 +01:00
|
|
|
|
test x"$llvm" = x"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" || \
|
2006-08-12 21:51:09 +02:00
|
|
|
|
rm -f 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
|