GPR#226: select higher levels of optimization for GCC and Clang when

compiling the run-time system and C stub code.

Also: select "gnu99" mode (= ISO C99 + GNU extensions).

Also: gcc/clang warnings are errors when in development mode.
(Turned off for release builds.)

Also: clean up and modernize the autoconf tests in config/auto-aux

(Merge of branch 'cc-optim'.)


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16379 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 2015-08-25 14:47:46 +00:00
commit d55c7c8e9a
19 changed files with 112 additions and 385 deletions

View File

@ -61,6 +61,8 @@ Runtime system:
which is still open (Alain Frisch, review by Damien Doligez)
- Signal handling: for read-and-clear, use GCC/Clang atomic builtins
if available. (Xavier Leroy)
- GPR#226: select higher levels of optimization for GCC and Clang when
compiling the run-time system and C stub code. (Xavier Leroy)
Standard library:
- PR#6316: Scanf.scanf failure on %u formats when reading big integers

View File

@ -471,6 +471,7 @@ utils/config.ml: utils/config.mlp config/Makefile
-e 's|%%CCOMPTYPE%%|cc|' \
-e 's|%%BYTECC%%|$(BYTECC) $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS)|' \
-e 's|%%NATIVECC%%|$(NATIVECC) $(NATIVECCCOMPOPTS)|' \
-e '/c_compiler =/s| -Werror||' \
-e 's|%%PACKLD%%|$(PACKLD)|' \
-e 's|%%BYTECCLIBS%%|$(BYTECCLIBS)|' \
-e 's|%%NATIVECCLIBS%%|$(NATIVECCLIBS)|' \

View File

@ -18,8 +18,8 @@ FLAGS=-I../byterun -DCAML_NAME_SPACE -DNATIVE_CODE \
-DTARGET_$(ARCH) -DMODEL_$(MODEL) -DSYS_$(SYSTEM) $(IFLEXDIR)
CFLAGS=$(FLAGS) $(NATIVECCCOMPOPTS)
DFLAGS=$(FLAGS) -g -DDEBUG $(NATIVECCCOMPOPTS)
PFLAGS=$(FLAGS) -pg -O -DPROFILING $(NATIVECCPROFOPTS)
PICFLAGS=$(FLAGS) -O $(SHAREDCCCOMPOPTS) $(NATIVECCCOMPOPTS)
PFLAGS=$(FLAGS) -pg -DPROFILING $(NATIVECCPROFOPTS) $(NATIVECCCOMPOPTS)
PICFLAGS=$(FLAGS) $(SHAREDCCCOMPOPTS) $(NATIVECCCOMPOPTS)
COBJS=startup_aux.o startup.o \
main.o fail.o roots.o globroots.o signals.o signals_asm.o \

View File

@ -14,8 +14,12 @@
int main()
{
#ifdef __STDC__
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
return 0;
#else
return 1;
#endif
#else
return 2;
#endif
}

View File

@ -1,32 +0,0 @@
/***********************************************************************/
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../../LICENSE. */
/* */
/***********************************************************************/
char buffer[27];
#ifdef reverse
#define cpy(s1,s2,n) copy(s2,s1,n)
#else
#define cpy copy
#endif
int main(int argc, char ** argv)
{
cpy("abcdefghijklmnopqrstuvwxyz", buffer, 27);
if (strcmp(buffer, "abcdefghijklmnopqrstuvwxyz") != 0) exit(1);
cpy(buffer, buffer+3, 26-3);
if (strcmp(buffer, "abcabcdefghijklmnopqrstuvw") != 0) exit(1);
cpy("abcdefghijklmnopqrstuvwxyz", buffer, 27);
cpy(buffer+3, buffer, 26-3);
if (strcmp(buffer, "defghijklmnopqrstuvwxyzxyz") != 0) exit(1);
exit(0);
}

View File

@ -2,23 +2,27 @@
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* Xavier Leroy, projet Gallium, INRIA Rocquencourt */
/* */
/* Copyright 2011 Institut National de Recherche en Informatique et */
/* Copyright 2015 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../../LICENSE. */
/* */
/***********************************************************************/
#include <math.h>
/* Determine vendor and version of C compiler */
volatile double x;
/* This file is to be preprocessed and its output examined. */
/* It is not C source code to be executed. */
/* This helps with cross-compilation. */
int main(int argc, char **argv)
{
x = 3.1415;
x = expm1(x);
x = log1p(x);
return 0;
}
#if defined(__INTEL_COMPILER)
icc __INTEL_COMPILER
#elif defined(__clang_major__) && defined(__clang_minor__)
clang __clang_major __clang_minor__
#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
gcc __GNUC__ __GNUC_MINOR__
#else
unknown
#endif

View File

@ -15,9 +15,9 @@
#include <signal.h>
#include <setjmp.h>
double foo;
volatile double foo;
void access_double(double *p)
void access_double(volatile double *p)
{
foo = *p;
}
@ -38,8 +38,8 @@ int main(void)
signal(SIGBUS, sig_handler);
#endif
if(setjmp(failure) == 0) {
access_double((double *) n);
access_double((double *) (n+1));
access_double((volatile double *) n);
access_double((volatile double *) (n+1));
res = 0;
} else {
res = 1;
@ -48,5 +48,5 @@ int main(void)
#ifdef SIGBUS
signal(SIGBUS, SIG_DFL);
#endif
exit(res);
return res;
}

View File

@ -1,45 +0,0 @@
/***********************************************************************/
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../../LICENSE. */
/* */
/***********************************************************************/
/* Test semantics of division and modulus for negative arguments */
long div4[] =
{ -4,-3,-3,-3,-3,-2,-2,-2,-2,-1,-1,-1,-1,0,0,0,
0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4 };
long divm4[] =
{ 4,3,3,3,3,2,2,2,2,1,1,1,1,0,0,0,
0,0,0,0,-1,-1,-1,-1,-2,-2,-2,-2,-3,-3,-3,-3,-4 };
long mod4[] =
{ 0,-3,-2,-1,0,-3,-2,-1,0,-3,-2,-1,0,-3,-2,-1,
0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0 };
long modm4[] =
{ 0,-3,-2,-1,0,-3,-2,-1,0,-3,-2,-1,0,-3,-2,-1,
0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0 };
long q1 = 4;
long q2 = -4;
int main()
{
int i;
for (i = -16; i <= 16; i++) {
if (i / q1 != div4[i+16]) return 1;
if (i / q2 != divm4[i+16]) return 1;
if (i % q1 != mod4[i+16]) return 1;
if (i % q2 != modm4[i+16]) return 1;
}
return 0;
}

View File

@ -11,6 +11,7 @@
/* */
/***********************************************************************/
#include <string.h>
#include "m.h"
#ifndef ARCH_SIXTYFOUR
@ -23,7 +24,7 @@ char * bigendian = "ABCDEFGH";
char * littleendian = "HGFEDCBA";
#endif
main(void)
int main(void)
{
long n[2];
char * p;
@ -32,8 +33,8 @@ main(void)
n[1] = 0;
p = (char *) n;
if (strcmp(p, bigendian) == 0)
exit(0);
return 0;
if (strcmp(p, littleendian) == 0)
exit(1);
exit(2);
return 1;
return 2;
}

View File

@ -30,9 +30,9 @@ while : ; do
shift
done
(echo "main() {"
(echo "int main() {"
for f in $*; do echo " $f();"; done
echo "}") >> hasgot.c
echo " return 0; }") >> hasgot.c
if test "$verbose" = yes; then
echo "hasgot $args: $cc $opts -o tst hasgot.c $libs" >&2

View File

@ -30,9 +30,9 @@ while : ; do
shift
done
(echo "main() {"
(echo "int main() {"
for f in $*; do echo " (void) & $f;"; done
echo "}") >> hasgot.c
echo " return 0; }") >> hasgot.c
if test "$verbose" = yes; then
echo "hasgot2 $args: $cc $opts -o tst hasgot.c $libs" >&2

View File

@ -26,9 +26,9 @@ typedef long long int64_t;
#error "No 64-bit integer type available"
#endif
int64_t foo;
volatile int64_t foo;
void access_int64(int64_t *p)
void access_int64(volatile int64_t *p)
{
foo = *p;
}
@ -49,8 +49,8 @@ int main(void)
signal(SIGBUS, sig_handler);
#endif
if(setjmp(failure) == 0) {
access_int64((int64_t *) n);
access_int64((int64_t *) (n+1));
access_int64((volatile int64_t *) n);
access_int64((volatile int64_t *) (n+1));
res = 0;
} else {
res = 1;
@ -59,5 +59,5 @@ int main(void)
#ifdef SIGBUS
signal(SIGBUS, SIG_DFL);
#endif
exit(res);
return res;
}

View File

@ -1,41 +0,0 @@
/***********************************************************************/
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../../LICENSE. */
/* */
/***********************************************************************/
#include <stdio.h>
#include <string.h>
/* Check for the availability of "long long" type as per ISO C9X */
/* Meaning of return code:
0 long long OK, printf with %ll
1 long long OK, printf with %q
2 long long OK, no printf
3 long long not suitable */
int main(int argc, char **argv)
{
long long l;
unsigned long long u;
char buffer[64];
if (sizeof(long long) != 8) return 3;
l = 123456789123456789LL;
buffer[0] = '\0';
sprintf(buffer, "%lld", l);
if (strcmp(buffer, "123456789123456789") == 0) return 0;
/* the MacOS X library uses qd to format long longs */
buffer[0] = '\0';
sprintf (buffer, "%qd", l);
if (strcmp (buffer, "123456789123456789") == 0) return 1;
return 2;
}

View File

@ -1,21 +0,0 @@
/***********************************************************************/
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../../LICENSE. */
/* */
/***********************************************************************/
char foo[]="\377";
int main(int argc, char ** argv)
{
int i;
i = foo[0];
exit(i != -1);
}

View File

@ -1,21 +0,0 @@
/***********************************************************************/
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../../LICENSE. */
/* */
/***********************************************************************/
signed char foo[]="\377";
int main(int argc, char ** argv)
{
int i;
i = foo[0];
exit(i != -1);
}

View File

@ -1,21 +0,0 @@
/***********************************************************************/
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../../LICENSE. */
/* */
/***********************************************************************/
#include <signal.h>
int main(void)
{
SIGRETURN (*old)();
old = signal(SIGQUIT, SIG_DFL);
return 0;
}

View File

@ -16,7 +16,10 @@
int main(int argc, char **argv)
{
printf("%d %d %d %d %d\n",
sizeof(int), sizeof(long), sizeof(long *), sizeof(short),
sizeof(long long));
(int) sizeof(int),
(int) sizeof(long),
(int) sizeof(long *),
(int) sizeof(short),
(int) sizeof(long long));
return 0;
}

View File

@ -1,66 +0,0 @@
/***********************************************************************/
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 2001 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../../LICENSE. */
/* */
/***********************************************************************/
#include <stdio.h>
#include <signal.h>
#include <sys/resource.h>
static char sig_alt_stack[SIGSTKSZ];
static char * system_stack_top;
#if defined(TARGET_i386) && defined(SYS_linux_elf)
static void segv_handler(int signo, struct sigcontext sc)
{
char * fault_addr = (char *) sc.cr2;
#else
static void segv_handler(int signo, siginfo_t * info, void * context)
{
char * fault_addr = (char *) info->si_addr;
#endif
struct rlimit limit;
if (getrlimit(RLIMIT_STACK, &limit) == 0 &&
((long) fault_addr & (sizeof(long) - 1)) == 0 &&
fault_addr < system_stack_top &&
fault_addr >= system_stack_top - limit.rlim_cur - 0x2000) {
_exit(0);
} else {
_exit(4);
}
}
int main(int argc, char ** argv)
{
stack_t stk;
struct sigaction act;
stk.ss_sp = sig_alt_stack;
stk.ss_size = SIGSTKSZ;
stk.ss_flags = 0;
#if defined(TARGET_i386) && defined(SYS_linux_elf)
act.sa_handler = (void (*)(int)) segv_handler;
act.sa_flags = SA_ONSTACK | SA_NODEFER;
#else
act.sa_sigaction = segv_handler;
act.sa_flags = SA_SIGINFO | SA_ONSTACK | SA_NODEFER;
#endif
sigemptyset(&act.sa_mask);
system_stack_top = (char *) &act;
if (sigaltstack(&stk, NULL) != 0) { perror("sigaltstack"); return 2; }
if (sigaction(SIGSEGV, &act, NULL) != 0) { perror("sigaction"); return 2; }
/* We used to trigger a stack overflow at this point to test whether
the code above works, but this causes problems with POSIX threads
on some BSD systems. So, instead, we just test that all this
code compiles, indicating that the required syscalls are there. */
return 0;
}

169
configure vendored
View File

@ -13,7 +13,8 @@
# #
#########################################################################
echo Configuring OCaml version `head -1 VERSION`
ocamlversion=`head -1 VERSION`
echo "Configuring OCaml version $ocamlversion"
configure_options="$*"
prefix=/usr/local
@ -40,7 +41,6 @@ verbose=no
with_curses=yes
debugruntime=noruntimed
with_sharedlibs=yes
gcc_warnings="-Wall"
partialld="ld -r"
with_debugger=ocamldebugger
with_ocamldoc=ocamldoc
@ -267,50 +267,13 @@ fi
inf "Using compiler $cc."
# Check for buggy versions of GCC
# These checks are not done for cross-compilation (yet at least) because after
# 15 years, I doubt someone will try to use an experimental (2.96) or
# known-unstable (2.7.2.1) version for cross-compilation.
# Determine the C compiler family (GCC, Clang, etc)
buggycc="no"
case "$target,$cc" in
i[3456]86-*-*,gcc*)
case `$cc --version` in
2.7.2.1) cat <<'EOF'
WARNING: you are using gcc version 2.7.2.1 on an Intel x86 processor.
This version of gcc is known to generate incorrect code for the
OCaml runtime system on some Intel x86 machines. (The symptom
is a crash of boot/ocamlc when compiling stdlib/pervasives.mli.)
In particular, the version of gcc 2.7.2.1 that comes with
Linux RedHat 4.x / Intel is affected by this problem.
Other Linux distributions might also be affected.
If you are using one of these configurations, you are strongly advised
to use another version of gcc, such as 2.95, which are
known to work well with OCaml.
Press <enter> to proceed or <interrupt> to stop.
EOF
read reply;;
2.96*) cat <<'EOF'
WARNING: you are using gcc version 2.96 on an Intel x86 processor.
Certain patched versions of gcc 2.96 are known to generate incorrect
code for the OCaml runtime system. (The symptom is a segmentation
violation on boot/ocamlc.) Those incorrectly patched versions can be found
in RedHat 7.2 and Mandrake 8.0 and 8.1; other Linux distributions
might also be affected. (See bug #57760 on bugzilla.redhat.com)
Auto-configuration will now select gcc compiler flags that work around
the problem. Still, if you observe segmentation faults while running
ocamlc or ocamlopt, you are advised to try another version of gcc,
such as 2.95.3 or 3.2.
EOF
buggycc="gcc.2.96";;
esac;;
ccfamily=`$cc -E cckind.c | grep '^[a-z]' | tr -s ' ' '-'`
case $? in
0) inf "Compiler family and version: $ccfamily.";;
*) err "Unable to preprocess the test program.\n" \
"Make sure the C compiler $cc is properly installed.";;
esac
# Configure the bytecode compiler
@ -327,17 +290,49 @@ iflexdir=""
SO="so"
TOOLCHAIN="cc"
# Choose reasonable options based on compiler kind
# We select high optimization levels, provided we can turn off:
# - strict type-based aliasing analysis (too risky for the OCaml runtime)
# - strict no-overflow conditions on signed integer arithmetic
# (the OCaml runtime assumes Java-style behavior of signed integer arith.)
# Concerning optimization level, -O3 is somewhat risky, so take -O2
# Concerning language version, gnu99 is ISO C99 plus GNU extensions
# that are often used in standard headers. GCC defaults to gnu89,
# which is not C99. Clang defaults to gnu99 or gnu11, which is fine.
case "$ocamlversion" in
*+dev*) gcc_warnings="-Wall -Werror";;
*) gcc_warnings="-Wall";;
esac
case "$ccfamily" in
clang-*)
bytecccompopts="-O2 -fno-strict-aliasing -fwrapv $gcc_warnings";;
gcc-[012]-*)
# Some versions known to miscompile OCaml, e,g, 2.7,2.1, some 2.96.
# Plus: C99 support unknown.
err "This version of GCC is too old. Please use GCC version 3 or above.";;
gcc-3-[0123])
# No -fwrapv option yet
bytecccompopts="-std=gnu99 -O $gcc_warnings";;
gcc-*)
bytecccompopts="-std=gnu99 -O2 -fno-strict-aliasing -fwrapv $gcc_warnings";;
*)
bytecccompopts="-O";;
esac
# Adjust according to target
case "$bytecc,$target" in
cc,*-*-nextstep*)
# GNU C extensions disabled, but __GNUC__ still defined!
bytecccompopts="-fno-defer-pop $gcc_warnings -U__GNUC__ -posix"
bytecccompopts="$bytecccompopts -U__GNUC__ -posix"
bytecclinkopts="-posix";;
*,*-*-rhapsody*)
# Almost the same as NeXTStep
bytecccompopts="-fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
bytecccompopts="$bytecccompopts -DSHRINKED_GNUC"
mathlib="";;
*,*-*-darwin*)
bytecccompopts="$gcc_warnings"
mathlib=""
mkexe="$mkexe -Wl,-no_compact_unwind"
# Tell gcc that we can use 32-bit code addresses for threaded code
@ -346,15 +341,12 @@ case "$bytecc,$target" in
echo "# define ARCH_CODE32" >> m.h
echo "#endif" >> m.h;;
*,*-*-haiku*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
# No -lm library
mathlib="";;
*,*-*-beos*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
# No -lm library
mathlib="";;
*gcc,alpha*-*-osf*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
if cc="$bytecc" sh ./hasgot -mieee; then
bytecccompopts="-mieee $bytecccompopts";
fi
@ -368,30 +360,22 @@ case "$bytecc,$target" in
if cc="$bytecc" sh ./hasgot -mieee; then
bytecccompopts="-mieee $bytecccompopts";
fi;;
cc,mips-*-irix6*)
# Add -n32 flag to ensure compatibility with native-code compiler
bytecccompopts="-n32"
*,mips-*-irix6*)
# Turn off warning "unused library"
bytecclinkopts="-n32 -Wl,-woff,84";;
cc*,mips-*-irix6*)
# (For those who want to force "cc -64")
# Turn off warning "unused library"
bytecclinkopts="-Wl,-woff,84";;
*,alpha*-*-unicos*)
# For the Cray T3E
bytecccompopts="-DUMK";;
*gcc*,powerpc-*-aix*)
# Avoid name-space pollution by requiring Unix98-conformant includes
bytecccompopts="-fno-defer-pop $gcc_warnings -D_XOPEN_SOURCE=500";;
bytecccompopts="$bytecccompopts -DUMK";;
*,powerpc-*-aix*)
bytecccompopts="-D_XOPEN_SOURCE=500";;
*gcc*,*-*-cygwin*)
# Avoid name-space pollution by requiring Unix98-conformant includes
bytecccompopts="$bytecccompopts -D_XOPEN_SOURCE=500";;
*,*-*-cygwin*)
case $target in
i686-*) flavor=cygwin;;
x86_64-*) flavor=cygwin64;;
*) err "unknown cygwin variant";;
esac
bytecccompopts="-fno-defer-pop $gcc_warnings -U_WIN32"
bytecccompopts="$bytecccompopts -U_WIN32"
dllccompopts="-U_WIN32 -DCAML_DLL"
if test $with_sharedlibs = yes; then
flexlink="flexlink -chain $flavor -merge-manifest -stack 16777216"
@ -411,8 +395,7 @@ case "$bytecc,$target" in
fi
exe=".exe"
ostype="Cygwin";;
*gcc*,*-*-mingw*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
*,*-*-mingw*)
dllccompopt="-DCAML_DLL"
if test $with_sharedlibs = yes; then
case "$target" in
@ -435,34 +418,32 @@ case "$bytecc,$target" in
TOOLCHAIN="mingw"
SO="dll"
;;
*gcc*,x86_64-*-linux*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
*,x86_64-*-linux*)
# Tell gcc that we can use 32-bit code addresses for threaded code
# unless we are compiled for a shared library (-fPIC option)
echo "#ifndef __PIC__" >> m.h
echo "# define ARCH_CODE32" >> m.h
echo "#endif" >> m.h;;
*gcc*)
bytecccompopts="-fno-defer-pop $gcc_warnings";;
esac
# Configure compiler to use in further tests
# Configure compiler to use in further tests.
cc="$bytecc -O $bytecclinkopts"
cc="$bytecc $bytecclinkopts"
export cc cclibs verbose
# Check C compiler
# Check C compiler.
sh ./runtest ansi.c
cc="$bytecc $bytecccompopts $bytecclinkopts" sh ./runtest ansi.c
case $? in
0) inf "The C compiler is ANSI-compliant." ;;
1) err "The C compiler $cc is not ANSI-compliant.\n" \
"You need an ANSI C compiler to build OCaml.";;
0) inf "The C compiler is ISO C99 compliant." ;;
1) wrn "The C compiler is ANSI / ISO C90 compliant, but not ISO C99 compliant.";;
2) err "The C compiler $cc is not ISO C compliant.\n" \
"You need an ISO C99 compiler to build OCaml.";;
*)
if $cross_compiler; then
wrn "Unable to compile the test program.\n" \
"This failure is expected for cross-compilation:\n" \
"we will assume the C compiler is ANSI-compliant."
"we will assume the C compiler is ISO C99-compliant."
else
err "Unable to compile the test program.\n" \
"Make sure the C compiler $cc is properly installed."
@ -869,23 +850,16 @@ else
nativecc="$ccoption"
fi
nativecccompopts=''
nativecccompopts="$bytecccompopts"
nativeccprofopts=''
nativecclinkopts=''
# FIXME the naming of nativecclinkopts is broken: these are options for
# ld (for shared libs), not for cc
nativeccrpath="$byteccrpath"
case "$arch,$nativecc,$system,$target" in
*,*,nextstep,*) nativecccompopts="$gcc_warnings -U__GNUC__ -posix"
nativecclinkopts="-posix";;
*,*,rhapsody,*darwin[1-5].*)
nativecccompopts="$gcc_warnings -DSHRINKED_GNUC";;
*,*,rhapsody,*) nativecccompopts="$gcc_warnings -DDARWIN_VERSION_6 $dl_defs";;
*,gcc*,cygwin,*) nativecccompopts="$gcc_warnings -U_WIN32";;
*,gcc*,*,*) nativecccompopts="$gcc_warnings";;
esac
case "$arch,$nativecc,$system,$model" in
*,*,nextstep,*) nativecclinkopts="-posix";;
*,*,rhapsody,*) if $arch64; then partialld="ld -r -arch ppc64"; fi;;
amd64,gcc*,macosx,*) partialld="ld -r -arch x86_64";;
amd64,gcc*,solaris,*) partialld="ld -r -m elf_x86_64";;
power,gcc*,elf,ppc) partialld="ld -r -m elf32ppclinux";;
@ -1692,21 +1666,6 @@ if $no_naked_pointers; then
echo "#define NO_NAKED_POINTERS" >> m.h
fi
# Add Unix-style optimization flag
bytecccompopts="-O $bytecccompopts"
dllcccompopts="-O $dllcccompopts"
nativecccompopts="-O $nativecccompopts"
sharedcccompopts="-O $sharedcccompopts"
# Final twiddling of compiler options to work around known bugs
nativeccprofopts="$nativecccompopts"
case "$buggycc" in
gcc.2.96)
bytecccompopts="$bytecccompopts -fomit-frame-pointer"
nativecccompopts="$nativecccompopts -fomit-frame-pointer";;
esac
# Finish generated files
cclibs="$cclibs $mathlib"