From 82ebd9320b5e9560c7b2dfc27705ee43b76ac84e Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 3 Mar 2012 21:30:13 +0000 Subject: [PATCH] distinguish between Minix 3 and Ninix 3 --- Build.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/Build.sh b/Build.sh index a0db15d..728479b 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/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, # 2011, 2012 @@ -293,7 +293,7 @@ if test -d mksh || test -d mksh.exe; then echo "$me: Error: ./mksh is a directory!" >&2 exit 1 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 curdir=`pwd` srcdir=`dirname "$0"` check_categories= @@ -395,6 +395,47 @@ if test x"$TARGET_OS" = x"Android"; then TARGET_OS=Linux 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 +#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 case $TARGET_OS in QNX) @@ -467,7 +508,7 @@ Linux) ;; MidnightBSD) ;; -Minix) +Minix3) add_cppflags -DMKSH_UNEMPLOYED add_cppflags -DMKSH_CONSERVATIVE_FDS add_cppflags -DMKSH_NO_LIMITS @@ -486,6 +527,14 @@ MSYS_*) ;; 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) : ${HAVE_SETLOCALE_CTYPE=0} ;; @@ -1248,7 +1297,7 @@ else #define EXTERN #define MKSH_INCLUDES_ONLY #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); } EOF case $cm in