Activate the -fno-common flag of GCC and Clang

So that problems with multiple definitions of global C variables
are detected early during development (see #9144 and #9176 for examples).
master
Xavier Leroy 2019-12-12 16:43:00 +01:00
parent 53327d777d
commit 06db4c995c
2 changed files with 60 additions and 4 deletions

60
configure vendored
View File

@ -1,4 +1,60 @@
#! /bin/sh
if test -e '.git' ; then :
if test -z "$ac_read_git_config" ; then :
extra_args=$(git config ocaml.configure 2>/dev/null)
extended_cache=$(git config ocaml.configure-cache 2>/dev/null)
cache_file=
# If ocaml.configure-cache is set, parse the command-line for the --host
# option, in order to determine the name of the cache file.
if test -n "$extended_cache" ; then :
echo "Detected Git configuration option ocaml.configure-cache set to \
\"$extended_cache\""
dashdash=
prev=
host=default
# The logic here is pretty borrowed from autoconf's
for option in $extra_args "$@"
do
if test -n "$prev" ; then :
host=$option
continue
fi
case $dashdash$option in
--)
dashdash=yes ;;
-host | --host | --hos | --ho)
prev=host ;;
-host=* | --host=* | --hos=* | --ho=*)
case $option in
*=?*) host=$(expr "X$option" : '[^=]*=\(.*\)') ;;
*=) host= ;;
esac ;;
esac
done
cache_file="`dirname "$0"`/$extended_cache/ocaml-$host.cache"
fi
# If either option has a value, re-invoke configure
if test -n "$extra_args$cache_file" ; then :
echo "Detected Git configuration option ocaml.configure set to \
\"$extra_args\""
# Too much effort to get the echo to show appropriate quoting - the
# invocation itself intentionally quotes $0 and passes $@ exactly as given
# but allows a single expansion of ocaml.configure
if test -n "$cache_file" ; then :
echo "Re-running $0 $extra_args --cache-file \"$cache_file\" $@"
ac_read_git_config=true exec "$0" $extra_args \
--cache-file "$cache_file" "$@"
else
echo "Re-running $0 $extra_args $@"
ac_read_git_config=true exec "$0" $extra_args "$@"
fi
fi
fi
fi
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for OCaml 4.11.0+dev0-2019-10-18.
#
@ -12442,7 +12498,7 @@ case $host in #(
case $ocaml_cv_cc_vendor in #(
clang-*) :
common_cflags="-O2 -fno-strict-aliasing -fwrapv";
internal_cflags="$gcc_warnings" ;; #(
internal_cflags="$gcc_warnings -fno-common" ;; #(
gcc-012-*) :
# Some versions known to miscompile OCaml, e,g, 2.7.2.1, some 2.96.
# Plus: C99 support unknown.
@ -12465,7 +12521,7 @@ $as_echo "$as_me: WARNING: Consider using GCC version 4.2 or above." >&2;};
internal_cflags="$gcc_warnings" ;; #(
gcc-*) :
common_cflags="-O2 -fno-strict-aliasing -fwrapv";
internal_cflags="$gcc_warnings" ;; #(
internal_cflags="$gcc_warnings -fno-common" ;; #(
msvc-*) :
common_cflags="-nologo -O2 -Gy- -MD"
common_cppflags="-D_CRT_SECURE_NO_DEPRECATE"

View File

@ -558,7 +558,7 @@ AS_CASE([$host],
[AS_CASE([$ocaml_cv_cc_vendor],
[clang-*],
[common_cflags="-O2 -fno-strict-aliasing -fwrapv";
internal_cflags="$gcc_warnings"],
internal_cflags="$gcc_warnings -fno-common"],
[gcc-[012]-*],
# Some versions known to miscompile OCaml, e,g, 2.7.2.1, some 2.96.
# Plus: C99 support unknown.
@ -578,7 +578,7 @@ AS_CASE([$host],
internal_cflags="$gcc_warnings"],
[gcc-*],
[common_cflags="-O2 -fno-strict-aliasing -fwrapv";
internal_cflags="$gcc_warnings"],
internal_cflags="$gcc_warnings -fno-common"],
[msvc-*],
[common_cflags="-nologo -O2 -Gy- -MD"
common_cppflags="-D_CRT_SECURE_NO_DEPRECATE"