Add attribute(align()) detection and fix XLC build.
parent
75983ab9b1
commit
d11a60bc22
|
@ -86,6 +86,14 @@ AC_DEFUN([OCAML_CC_HAS_FNO_TREE_VRP], [
|
|||
CFLAGS="$saved_CFLAGS"
|
||||
])
|
||||
|
||||
AC_DEFUN([OCAML_CC_SUPPORTS_ALIGNED], [
|
||||
AC_MSG_CHECKING([whether the C compiler supports __attribute__((aligned(n)))])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_SOURCE([typedef struct {__attribute__((aligned(8))) int t;} t;])],
|
||||
[AC_DEFINE([SUPPORTS_ALIGNED_ATTRIBUTE])
|
||||
AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])])])
|
||||
|
||||
AC_DEFUN([OCAML_CC_HAS_DEBUG_PREFIX_MAP], [
|
||||
AC_MSG_CHECKING([whether the C compiler supports -fdebug-prefix-map])
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
|
|
|
@ -1,60 +1,4 @@
|
|||
#! /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.
|
||||
#
|
||||
|
@ -12291,6 +12235,48 @@ fi
|
|||
;;
|
||||
esac
|
||||
|
||||
## Find vendor of the C compiler
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking C compiler vendor" >&5
|
||||
$as_echo_n "checking C compiler vendor... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
msvc _MSC_VER
|
||||
#elif 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__
|
||||
#elif defined(__xlc__) && defined(__xlC__)
|
||||
xlc __xlC__ __xlC_ver__
|
||||
#else
|
||||
unknown
|
||||
#endif
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_cpp "$LINENO"; then :
|
||||
if ${ocaml_cv_cc_vendor+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ocaml_cv_cc_vendor=`grep '^[a-z]' conftest.i | tr -s ' ' '-'`
|
||||
fi
|
||||
|
||||
else
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error $? "unexpected preprocessor failure
|
||||
See \`config.log' for more details" "$LINENO" 5; }
|
||||
fi
|
||||
rm -f conftest.err conftest.i conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ocaml_cv_cc_vendor" >&5
|
||||
$as_echo "$ocaml_cv_cc_vendor" >&6; }
|
||||
|
||||
|
||||
# Determine how to call the C preprocessor directly.
|
||||
# Most of the time, calling the C preprocessor through the C compiler is
|
||||
# desirable and even important.
|
||||
|
@ -12302,8 +12288,11 @@ esac
|
|||
# We thus figure out how to invoke the C preprocessor directly but
|
||||
# let the CPP variable untouched, except for the MSVC port where we set it
|
||||
# manually to make sure the backward compatibility is preserved
|
||||
case $host in #(
|
||||
*-pc-windows) :
|
||||
case $ocaml_cv_cc_vendor in #(
|
||||
xlc-*) :
|
||||
CPP="$CC -E -qnoppline" ;; #(
|
||||
# suppress incompatible XLC line directives
|
||||
msvc-*) :
|
||||
CPP="$CC -nologo -EP" ;; #(
|
||||
*) :
|
||||
;;
|
||||
|
@ -12407,48 +12396,6 @@ fi
|
|||
## Check for C99 support: done by libtool
|
||||
## AC_PROG_CC_C99
|
||||
|
||||
## Find vendor of the C compiler
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking C compiler vendor" >&5
|
||||
$as_echo_n "checking C compiler vendor... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
msvc _MSC_VER
|
||||
#elif 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__
|
||||
#elif defined(__xlc__) && defined(__xlC__)
|
||||
xlc __xlC__ __xlC_ver__
|
||||
#else
|
||||
unknown
|
||||
#endif
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_cpp "$LINENO"; then :
|
||||
if ${ocaml_cv_cc_vendor+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ocaml_cv_cc_vendor=`grep '^[a-z]' conftest.i | tr -s ' ' '-'`
|
||||
fi
|
||||
|
||||
else
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error $? "unexpected preprocessor failure
|
||||
See \`config.log' for more details" "$LINENO" 5; }
|
||||
fi
|
||||
rm -f conftest.err conftest.i conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ocaml_cv_cc_vendor" >&5
|
||||
$as_echo "$ocaml_cv_cc_vendor" >&6; }
|
||||
|
||||
|
||||
## Determine which flags to use for the C compiler
|
||||
|
||||
case $ocaml_cv_cc_vendor in #(
|
||||
|
@ -12456,7 +12403,7 @@ case $ocaml_cv_cc_vendor in #(
|
|||
outputobj='-o $(EMPTY)'; gcc_warnings="-qflag=i:i" ;; #(
|
||||
# all warnings enabled
|
||||
msvc-*) :
|
||||
outputobj=-Fo; CPP="cl -nologo -EP"; gcc_warnings="" ;; #(
|
||||
outputobj=-Fo; gcc_warnings="" ;; #(
|
||||
*) :
|
||||
outputobj='-o $(EMPTY)'; case 4.11.0+dev0-2019-10-18 in #(
|
||||
*+dev*) :
|
||||
|
@ -13542,6 +13489,24 @@ fi ;; #(
|
|||
;;
|
||||
esac
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler supports __attribute__((aligned(n)))" >&5
|
||||
$as_echo_n "checking whether the C compiler supports __attribute__((aligned(n)))... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
typedef struct {__attribute__((aligned(8))) int t;} t;
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
$as_echo "#define SUPPORTS_ALIGNED_ATTRIBUTE 1" >>confdefs.h
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
# Configure the native-code compiler
|
||||
|
||||
arch=none
|
||||
|
|
16
configure.ac
16
configure.ac
|
@ -436,6 +436,9 @@ AS_CASE([$host],
|
|||
mklib="rm -f \$(1) && ${AR} rc \$(1) \$(2) && ${RANLIB} \$(1)"
|
||||
])
|
||||
|
||||
## Find vendor of the C compiler
|
||||
OCAML_CC_VENDOR
|
||||
|
||||
# Determine how to call the C preprocessor directly.
|
||||
# Most of the time, calling the C preprocessor through the C compiler is
|
||||
# desirable and even important.
|
||||
|
@ -447,8 +450,10 @@ AS_CASE([$host],
|
|||
# We thus figure out how to invoke the C preprocessor directly but
|
||||
# let the CPP variable untouched, except for the MSVC port where we set it
|
||||
# manually to make sure the backward compatibility is preserved
|
||||
AS_CASE([$host],
|
||||
[*-pc-windows],
|
||||
AS_CASE([$ocaml_cv_cc_vendor],
|
||||
[xlc-*],
|
||||
[CPP="$CC -E -qnoppline"], # suppress incompatible XLC line directives
|
||||
[msvc-*],
|
||||
[CPP="$CC -nologo -EP"])
|
||||
|
||||
# Libraries to build depending on the host
|
||||
|
@ -513,16 +518,13 @@ AS_IF(
|
|||
## Check for C99 support: done by libtool
|
||||
## AC_PROG_CC_C99
|
||||
|
||||
## Find vendor of the C compiler
|
||||
OCAML_CC_VENDOR
|
||||
|
||||
## Determine which flags to use for the C compiler
|
||||
|
||||
AS_CASE([$ocaml_cv_cc_vendor],
|
||||
[xlc-*],
|
||||
[outputobj='-o $(EMPTY)'; gcc_warnings="-qflag=i:i"], # all warnings enabled
|
||||
[msvc-*],
|
||||
[outputobj=-Fo; CPP="cl -nologo -EP"; gcc_warnings=""],
|
||||
[outputobj=-Fo; gcc_warnings=""],
|
||||
[outputobj='-o $(EMPTY)'; AS_CASE([AC_PACKAGE_VERSION],
|
||||
[*+dev*],
|
||||
[gcc_warnings="-Wall -Werror"],
|
||||
|
@ -843,6 +845,8 @@ AS_CASE(["$CC,$host"],
|
|||
AS_IF([$cc_has_fno_tree_vrp],
|
||||
[internal_cflags="$internal_cflags -fno-tree-vrp"])])
|
||||
|
||||
OCAML_CC_SUPPORTS_ALIGNED
|
||||
|
||||
# Configure the native-code compiler
|
||||
|
||||
arch=none
|
||||
|
|
|
@ -104,3 +104,5 @@
|
|||
#undef FLAT_FLOAT_ARRAY
|
||||
|
||||
#undef FUNCTION_SECTIONS
|
||||
|
||||
#undef SUPPORTS_ALIGNED_ATTRIBUTE
|
||||
|
|
|
@ -95,8 +95,13 @@ CAMLdeprecated_typedef(addr, char *);
|
|||
#define CAMLweakdef
|
||||
#endif
|
||||
|
||||
/* Alignment */
|
||||
#ifdef __GNUC__
|
||||
/* Alignment is necessary for domain_state.h, since the code generated */
|
||||
/* by ocamlopt makes direct references into the domain state structure,*/
|
||||
/* which is stored in a register on many platforms. For this to work, */
|
||||
/* we need to be able to compute the exact offset of each member. */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
|
||||
#define CAMLalign(n) _Alignas(n)
|
||||
#elif defined(SUPPORTS_ALIGNED_ATTRIBUTE)
|
||||
#define CAMLalign(n) __attribute__((aligned(n)))
|
||||
#elif _MSC_VER >= 1500
|
||||
#define CAMLalign(n) __declspec(align(n))
|
||||
|
|
Loading…
Reference in New Issue