Use “proper C code” for determining the compiler type even though we use

only cpp for this: NeXTstep things otherwise:
] conftest.c:42: illegal external declaration, missing ;' after `gcc'
| NeXT Computer, Inc. version cc-437.2.6, gcc version 2.5.8
| NeXT DevKit-based CPP 3.1
| GNU Objective-C version 2.5.8 (80386, BSD syntax) compiled by GNU C version 2.5.8.
This commit is contained in:
tg 2012-03-31 17:37:03 +00:00
parent e67b98e21b
commit 307224f143
1 changed files with 35 additions and 31 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.527 2012/03/30 10:24:45 tg Exp $' srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.528 2012/03/31 17:37:03 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
@ -404,11 +404,13 @@ You can avoid these by calling Build.sh correctly, see below.
" "
cat >conftest.c <<'EOF' cat >conftest.c <<'EOF'
#include <sys/types.h> #include <sys/types.h>
const char *
#ifdef _NETBSD_SOURCE #ifdef _NETBSD_SOURCE
ct=Ninix3 ct="Ninix3"
#else #else
ct=Minix3 ct="Minix3"
#endif #endif
;
EOF EOF
ct=unknown ct=unknown
vv ']' "${CC-cc} -E $CFLAGS $CPPFLAGS $NOWARN conftest.c | grep ct= | tr -d \\\\015 >x" vv ']' "${CC-cc} -E $CFLAGS $CPPFLAGS $NOWARN conftest.c | grep ct= | tr -d \\\\015 >x"
@ -677,61 +679,63 @@ $e $bi$me: Scanning for functions... please ignore any errors.$ao
CPP="$CC -E" CPP="$CC -E"
$e ... which compiler seems to be used $e ... which compiler seems to be used
cat >conftest.c <<'EOF' cat >conftest.c <<'EOF'
const char *
#if defined(__ICC) || defined(__INTEL_COMPILER) #if defined(__ICC) || defined(__INTEL_COMPILER)
ct=icc ct="icc"
#elif defined(__xlC__) || defined(__IBMC__) #elif defined(__xlC__) || defined(__IBMC__)
ct=xlc ct="xlc"
#elif defined(__SUNPRO_C) #elif defined(__SUNPRO_C)
ct=sunpro ct="sunpro"
#elif defined(__ACK__) #elif defined(__ACK__)
ct=ack ct="ack"
#elif defined(__BORLANDC__) #elif defined(__BORLANDC__)
ct=bcc ct="bcc"
#elif defined(__WATCOMC__) #elif defined(__WATCOMC__)
ct=watcom ct="watcom"
#elif defined(__MWERKS__) #elif defined(__MWERKS__)
ct=metrowerks ct="metrowerks"
#elif defined(__HP_cc) #elif defined(__HP_cc)
ct=hpcc ct="hpcc"
#elif defined(__DECC) || (defined(__osf__) && !defined(__GNUC__)) #elif defined(__DECC) || (defined(__osf__) && !defined(__GNUC__))
ct=dec ct="dec"
#elif defined(__PGI) #elif defined(__PGI)
ct=pgi ct="pgi"
#elif defined(__DMC__) #elif defined(__DMC__)
ct=dmc ct="dmc"
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
ct=msc ct="msc"
#elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
ct=adsp ct="adsp"
#elif defined(__IAR_SYSTEMS_ICC__) #elif defined(__IAR_SYSTEMS_ICC__)
ct=iar ct="iar"
#elif defined(SDCC) #elif defined(SDCC)
ct=sdcc ct="sdcc"
#elif defined(__PCC__) #elif defined(__PCC__)
ct=pcc ct="pcc"
#elif defined(__TenDRA__) #elif defined(__TenDRA__)
ct=tendra ct="tendra"
#elif defined(__TINYC__) #elif defined(__TINYC__)
ct=tcc ct="tcc"
#elif defined(__llvm__) && defined(__clang__) #elif defined(__llvm__) && defined(__clang__)
ct=clang ct="clang"
#elif defined(__NWCC__) #elif defined(__NWCC__)
ct=nwcc ct="nwcc"
#elif defined(__GNUC__) #elif defined(__GNUC__)
ct=gcc ct="gcc"
#elif defined(_COMPILER_VERSION) #elif defined(_COMPILER_VERSION)
ct=mipspro ct="mipspro"
#elif defined(__sgi) #elif defined(__sgi)
ct=mipspro ct="mipspro"
#elif defined(__hpux) || defined(__hpua) #elif defined(__hpux) || defined(__hpua)
ct=hpcc ct="hpcc"
#elif defined(__ultrix) #elif defined(__ultrix)
ct=ucode ct="ucode"
#elif defined(__USLC__) #elif defined(__USLC__)
ct=uslc ct="uslc"
#else #else
ct=unknown ct="unknown"
#endif #endif
;
EOF EOF
ct=unknown ct=unknown
vv ']' "$CPP $CFLAGS $CPPFLAGS $NOWARN conftest.c | grep ct= | tr -d \\\\015 >x" vv ']' "$CPP $CFLAGS $CPPFLAGS $NOWARN conftest.c | grep ct= | tr -d \\\\015 >x"
@ -1338,7 +1342,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.527 2012/03/30 10:24:45 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.528 2012/03/31 17:37:03 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