#!/bin/sh
-srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.669.2.4 2015/04/19 19:18:08 tg Exp $'
+srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.689 2015/07/10 17:16:23 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014, 2015
vv ']' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN conftest.c $LIBS $ccpr"
test $tcfn = no && test -f a.out && tcfn=a.out
test $tcfn = no && test -f a.exe && tcfn=a.exe
+ test $tcfn = no && test -f conftest.exe && tcfn=conftest.exe
test $tcfn = no && test -f conftest && tcfn=conftest
if test -f $tcfn; then
test 1 = $fr || fv=1
echo "$me: Error: ./$tfn is a directory!" >&2
exit 1
fi
-rmf a.exe* a.out* conftest.c *core core.* lft ${tfn}* no *.bc *.ll *.o *.gen \
- Rebuild.sh signames.inc test.sh x vv.out
+rmf a.exe* a.out* conftest.c conftest.exe* *core core.* ${tfn}* *.bc *.dbg \
+ *.ll *.o *.gen Rebuild.sh lft no signames.inc test.sh x vv.out
SRCS="lalloc.c eval.c exec.c expr.c funcs.c histrap.c jobs.c"
SRCS="$SRCS lex.c main.c misc.c shf.c syn.c tree.c var.c"
# Configuration depending on OS name
case $TARGET_OS in
386BSD)
- : ${HAVE_CAN_OTWO=0}
+ : "${HAVE_CAN_OTWO=0}"
add_cppflags -DMKSH_NO_SIGSETJMP
add_cppflags -DMKSH_TYPEDEF_SIG_ATOMIC_T=int
add_cppflags -DMKSH_CONSERVATIVE_FDS
;;
AIX)
add_cppflags -D_ALL_SOURCE
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
BeOS)
case $KSH_VERSION in
add_cppflags -DMKSH__NO_SETEUGID
;;
BSD/OS)
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
Coherent)
oswarn="; it has major issues"
add_cppflags -DMKSH_DISABLE_TTY_WARNING
;;
CYGWIN*)
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
Darwin)
add_cppflags -D_DARWIN_C_SOURCE
oswarn="; it has minor issues"
add_cppflags -D_GNU_SOURCE
add_cppflags -DMKSH_CONSERVATIVE_FDS
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
GNU)
case $CC in
ccpc='-X '
ccpl='-Y '
add_cppflags -D_ALL_SOURCE
- : ${LIBS='-lcrypt'}
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${LIBS=-lcrypt}"
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
IRIX*)
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
Linux)
case $CC in
*) add_cppflags -D_GNU_SOURCE ;;
esac
add_cppflags -DSETUID_CAN_FAIL_WITH_EAGAIN
- : ${HAVE_REVOKE=0}
+ : "${HAVE_REVOKE=0}"
;;
LynxOS)
oswarn="; it has minor issues"
add_cppflags -DMKSH_CONSERVATIVE_FDS
add_cppflags -D_MINIX_SOURCE
oldish_ed=no-stderr-ed # no /bin/ed, maybe see below
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
Minix3)
add_cppflags -DMKSH_UNEMPLOYED
add_cppflags -DMKSH_NO_LIMITS
add_cppflags -D_POSIX_SOURCE -D_POSIX_1_SOURCE=2 -D_MINIX
oldish_ed=no-stderr-ed # /usr/bin/ed(!) is broken
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
MirBSD)
;;
MSYS_*)
add_cppflags -DMKSH_ASSUME_UTF8=0; HAVE_ISSET_MKSH_ASSUME_UTF8=1
# almost same as CYGWIN* (from RT|Chatzilla)
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
# broken on this OE (from ir0nh34d)
- : ${HAVE_STDINT_H=0}
+ : "${HAVE_STDINT_H=0}"
;;
NetBSD)
;;
NEXTSTEP)
add_cppflags -D_NEXT_SOURCE
add_cppflags -D_POSIX_SOURCE
- : ${AWK=gawk} ${CC=cc -posix}
+ : "${AWK=gawk}"
+ : "${CC=cc -posix}"
add_cppflags -DMKSH_NO_SIGSETJMP
# NeXTstep cannot get a controlling tty
add_cppflags -DMKSH_UNEMPLOYED
oswarn="; it has unknown issues"
;;
OpenBSD)
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
+ ;;
+OS/2)
+ HAVE_TERMIOS_H=0
+ HAVE_MKNOD=0 # setmode() incompatible
+ oswarn="; it is currently being ported"
+ check_categories="$check_categories nosymlink"
+ : "${CC=gcc}"
+ : "${SIZE=: size}"
+ add_cppflags -DMKSH_UNEMPLOYED
+ add_cppflags -DMKSH_NOPROSPECTOFWORK
;;
OSF1)
HAVE_SIG_T=0 # incompatible
add_cppflags -D_POSIX_C_SOURCE=200112L
add_cppflags -D_XOPEN_SOURCE=600
add_cppflags -D_XOPEN_SOURCE_EXTENDED
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
Plan9)
add_cppflags -D_POSIX_SOURCE
PW32*)
HAVE_SIG_T=0 # incompatible
oswarn=' and will currently not work'
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
QNX)
add_cppflags -D__NO_EXT_QNX
oldish_ed=no-stderr-ed # oldish /bin/ed is broken
;;
esac
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
SCO_SV)
case $TARGET_OSREV in
;;
esac
add_cppflags -DMKSH_CONSERVATIVE_FDS
- : ${HAVE_SYS_SIGLIST=0} ${HAVE__SYS_SIGLIST=0}
+ : "${HAVE_SYS_SIGLIST=0}${HAVE__SYS_SIGLIST=0}"
;;
skyos)
oswarn="; it has minor issues"
oswarn=' and will currently not work'
;;
ULTRIX)
- : ${CC=cc -YPOSIX}
+ : "${CC=cc -YPOSIX}"
add_cppflags -DMKSH_TYPEDEF_SSIZE_T=int
add_cppflags -DMKSH_CONSERVATIVE_FDS
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
UnixWare|UNIX_SV)
# SCO UnixWare
add_cppflags -DMKSH_CONSERVATIVE_FDS
- : ${HAVE_SYS_SIGLIST=0} ${HAVE__SYS_SIGLIST=0}
+ : "${HAVE_SYS_SIGLIST=0}${HAVE__SYS_SIGLIST=0}"
;;
UWIN*)
ccpc='-Yc,'
tsts=" 3<>/dev/tty"
oswarn="; it will compile, but the target"
oswarn="$oswarn${nl}platform itself is very flakey/unreliable"
- : ${HAVE_SETLOCALE_CTYPE=0}
+ : "${HAVE_SETLOCALE_CTYPE=0}"
;;
_svr4)
# generic target for SVR4 Unix with uname -s = uname -n
;;
esac
-: ${HAVE_MKNOD=0}
+: "${HAVE_MKNOD=0}"
-: ${AWK=awk} ${CC=cc} ${NROFF=nroff} ${SIZE=size}
+: "${AWK=awk}${CC=cc}${NROFF=nroff}${SIZE=size}"
test 0 = $r && echo | $NROFF -v 2>&1 | grep GNU >/dev/null 2>&1 && \
- NROFF="$NROFF -c"
+ echo | $NROFF -c >/dev/null 2>&1 && NROFF="$NROFF -c"
# this aids me in tracing FTBFSen without access to the buildd
$e "Hi from$ao $bi$srcversion$ao on:"
#endif
;
const char *
-#if defined(__KLIBC__)
+#if defined(__KLIBC__) && !defined(__OS2__)
et="klibc"
#else
et="unknown"
SCO_SV:3.2*)
# SCO OpenServer 5
CFLAGS="$CFLAGS -g"
- : ${HAVE_CAN_OTWO=0} ${HAVE_CAN_OPTIMISE=0}
+ : "${HAVE_CAN_OTWO=0}${HAVE_CAN_OPTIMISE=0}"
;;
esac
vv '|' "$CC $CFLAGS $CPPFLAGS $LDFLAGS $NOWARN -V conftest.c $LIBS"
;;
esac
$e "$bi==> which compiler seems to be used...$ao $ui$ct${et+ on $et}$ao"
-rmf conftest.c conftest.o conftest a.out* a.exe* vv.out
+rmf conftest.c conftest.o conftest a.out* a.exe* conftest.exe* vv.out
#
# Compiler: works as-is, with -Wno-error and -Werror
if ac_ifcpp 'if 0' compiler_fails '' \
'if the compiler does not fail correctly'; then
save_CFLAGS=$CFLAGS
- : ${HAVE_CAN_DELEXE=x}
+ : "${HAVE_CAN_DELEXE=x}"
case $ct in
dec)
CFLAGS="$CFLAGS ${ccpl}-non_shared"
#
if ac_ifcpp 'ifdef MKSH_SMALL' isset_MKSH_SMALL '' \
"if a reduced-feature mksh is requested"; then
- : ${HAVE_NICE=0}
- : ${HAVE_PERSISTENT_HISTORY=0}
+ : "${HAVE_NICE=0}"
+ : "${HAVE_PERSISTENT_HISTORY=0}"
check_categories="$check_categories smksh"
HAVE_ISSET_MKSH_CONSERVATIVE_FDS=1 # from sh.h
fi
"if mksh will be built without job signals" && \
check_categories="$check_categories arge nojsig"
ac_ifcpp 'ifdef MKSH_ASSUME_UTF8' isset_MKSH_ASSUME_UTF8 '' \
- 'if the default UTF-8 mode is specified' && : ${HAVE_SETLOCALE_CTYPE=0}
+ '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' && \
check_categories="$check_categories convfds"
ac_header sys/sysmacros.h
ac_header bstring.h
ac_header grp.h sys/types.h
+ac_header io.h
ac_header libgen.h
ac_header libutil.h sys/types.h
ac_header paths.h
sigseenone=:
sigseentwo=:
echo '#include <signal.h>
-#ifndef NSIG
-#if defined(_NSIG)
-#define NSIG _NSIG
+#if defined(NSIG_MAX)
+#define cfg_NSIG NSIG_MAX
+#elif defined(NSIG)
+#define cfg_NSIG NSIG
+#elif defined(_NSIG)
+#define cfg_NSIG _NSIG
#elif defined(SIGMAX)
-#define NSIG (SIGMAX+1)
+#define cfg_NSIG (SIGMAX + 1)
#elif defined(_SIGMAX)
-#define NSIG (_SIGMAX+1)
+#define cfg_NSIG (_SIGMAX + 1)
#else
-/* XXX better error out, see sh.h */
-#define NSIG 64
-#endif
+/*XXX better error out, see sh.h */
+#define cfg_NSIG 64
#endif
int
-mksh_cfg= NSIG
+mksh_cfg= cfg_NSIG
;' >conftest.c
# GNU sed 2.03 segfaults when optimising this to sed -n
NSIG=`vq "$CPP $CFLAGS $CPPFLAGS $NOWARN conftest.c" | \
$printf "NSIG=$NSIG ... "
sigs="ABRT FPE ILL INT SEGV TERM ALRM BUS CHLD CONT HUP KILL PIPE QUIT"
sigs="$sigs STOP TSTP TTIN TTOU USR1 USR2 POLL PROF SYS TRAP URG VTALRM"
- sigs="$sigs XCPU XFSZ INFO WINCH EMT IO DIL LOST PWR SAK CLD IOT RESV"
- sigs="$sigs STKFLT UNUSED"
+ sigs="$sigs XCPU XFSZ INFO WINCH EMT IO DIL LOST PWR SAK CLD IOT STKFLT"
+ sigs="$sigs ABND DCE DUMP IOERR TRACE DANGER THCONT THSTOP RESV UNUSED"
test 1 = $HAVE_CPP_DD && test $NSIG -gt 1 && sigs="$sigs "`vq \
"$CPP $CFLAGS $CPPFLAGS $NOWARN -dD conftest.c" | \
grep '[ ]SIG[A-Z0-9][A-Z0-9]*[ ]' | \
sed 's/^ *mksh_cfg *=[ ]*\([0-9][0-9x]*\).*$/:\1 '$name/
done | sed -n '/^:[^ ]/s/^://p' | while read nr name; do
test $printf = echo || nr=`printf %d "$nr" 2>/dev/null`
- test $nr -gt 0 && test $nr -le $NSIG || continue
+ test $nr -gt 0 && test $nr -lt $NSIG || continue
case $sigseentwo in
*:$nr:*) ;;
*) echo " { \"$name\", $nr },"
addsrcs USE_PRINTF_BUILTIN printf.c
test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
-add_cppflags -DMKSH_BUILD_R=506
+add_cppflags -DMKSH_BUILD_R=511
$e $bi$me: Finished configuration testing, now producing output.$ao
objs=
sp=
case $tcfn in
-a.exe) mkshexe=$tfn.exe ;;
-*) mkshexe=$tfn ;;
+a.exe|conftest.exe)
+ mkshexe=$tfn.exe
+ add_cppflags -DMKSH_EXE_EXT
+ ;;
+*)
+ mkshexe=$tfn
+ ;;
esac
case $curdir in
*\ *) mkshshebang="#!./$mkshexe" ;;
MKSH_NOPWNAM skip PAM calls, for -static on glibc or Solaris
MKSH_NO_CMDLINE_EDITING disable command line editing code entirely
MKSH_NO_DEPRECATED_WARNING omit warning when deprecated stuff is run
-MKSH_NO_EXTERNAL_CAT omit hack to skip cat builtin when flags passed
MKSH_NO_LIMITS omit ulimit code
MKSH_NO_SIGSETJMP define if sigsetjmp is broken or not available
MKSH_NO_SIGSUSPEND use sigprocmask+pause instead of sigsuspend
http://anonscm.debian.org/cgit/collab-maint/mksh.git/plain/debian/.mkshrc
and put dot.mkshrc as /etc/mkshrc so users need not keep up their HOME.
+You may also want to install the lksh binary (also as /bin/sh) built by:
+$ CPPFLAGS="$CPPFLAGS -DMKSH_BINSHPOSIX" sh Build.sh -L -r -c lto
+
EOD