distinguish between Minix 3 and Ninix 3

This commit is contained in:
tg 2012-03-03 21:30:13 +00:00
parent bc039caa9f
commit 82ebd9320b

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.511 2012/03/03 19:27:07 tg Exp $' srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.512 2012/03/03 21:30:13 tg Exp $'
#- #-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 # 2011, 2012
@ -293,7 +293,7 @@ if test -d mksh || test -d mksh.exe; then
echo "$me: Error: ./mksh is a directory!" >&2 echo "$me: Error: ./mksh is a directory!" >&2
exit 1 exit 1
fi fi
rmf a.exe* a.out* conftest.c *core lft mksh* no *.bc *.ll *.o \ rmf a.exe* a.out* conftest.c *core core.* lft mksh* no *.bc *.ll *.o \
Rebuild.sh signames.inc test.sh x vv.out Rebuild.sh signames.inc test.sh x vv.out
curdir=`pwd` srcdir=`dirname "$0"` check_categories= curdir=`pwd` srcdir=`dirname "$0"` check_categories=
@ -395,6 +395,47 @@ if test x"$TARGET_OS" = x"Android"; then
TARGET_OS=Linux TARGET_OS=Linux
fi fi
# Evil OS
if test x"$TARGET_OS" = x"Minix"; then
echo >&2 "
WARNING: additional checks before running Build.sh required!
You can avoid these by calling Build.sh correctly, see below.
"
cat >conftest.c <<'EOF'
#include <sys/types.h>
#ifdef _NETBSD_SOURCE
ct=Ninix3
#else
ct=Minix3
#endif
EOF
ct=unknown
vv ']' "${CC-cc} -E $CFLAGS $CPPFLAGS $NOWARN conftest.c | grep ct= | tr -d \\\\015 >x"
sed 's/^/[ /' x
eval `cat x`
rmf x vv.out
case $ct in
Minix3|Ninix3)
echo >&2 "
Warning: you set TARGET_OS to $TARGET_OS but that is ambiguous.
Please set it to either Minix3 or Ninix3, whereas the latter is
all versions of Minix with even partial NetBSD(R) userland. The
value determined from your compiler for the current compilation
(which may be wrong) is: $ct
"
TARGET_OS=$ct
;;
*)
echo >&2 "
Warning: you set TARGET_OS to $TARGET_OS but that is ambiguous.
Please set it to either Minix3 or Ninix3, whereas the latter is
all versions of Minix with even partial NetBSD(R) userland. The
proper value couldn't be determined, continue at your own risk.
"
;;
esac
fi
# Configuration depending on OS revision, on OSes that need them # Configuration depending on OS revision, on OSes that need them
case $TARGET_OS in case $TARGET_OS in
QNX) QNX)
@ -467,7 +508,7 @@ Linux)
;; ;;
MidnightBSD) MidnightBSD)
;; ;;
Minix) Minix3)
add_cppflags -DMKSH_UNEMPLOYED add_cppflags -DMKSH_UNEMPLOYED
add_cppflags -DMKSH_CONSERVATIVE_FDS add_cppflags -DMKSH_CONSERVATIVE_FDS
add_cppflags -DMKSH_NO_LIMITS add_cppflags -DMKSH_NO_LIMITS
@ -486,6 +527,14 @@ MSYS_*)
;; ;;
NetBSD) NetBSD)
;; ;;
Ninix3)
# similar to Minix3
add_cppflags -DMKSH_UNEMPLOYED
add_cppflags -DMKSH_CONSERVATIVE_FDS
add_cppflags -DMKSH_NO_LIMITS
# but no idea what else could be needed
oswarn="; it has unknown issues"
;;
OpenBSD) OpenBSD)
: ${HAVE_SETLOCALE_CTYPE=0} : ${HAVE_SETLOCALE_CTYPE=0}
;; ;;
@ -1248,7 +1297,7 @@ else
#define EXTERN #define EXTERN
#define MKSH_INCLUDES_ONLY #define MKSH_INCLUDES_ONLY
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.511 2012/03/03 19:27:07 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.512 2012/03/03 21:30:13 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (0); } int main(void) { printf("Hello, World!\n"); return (0); }
EOF EOF
case $cm in case $cm in