diff --git a/.depend b/.depend index 2e7da09b25e7..1a177e29bc9e 100644 --- a/.depend +++ b/.depend @@ -4189,6 +4189,7 @@ middle_end/closure/closure.cmo : \ typing/env.cmi \ lambda/debuginfo.cmi \ middle_end/convert_primitives.cmi \ + utils/config.cmi \ middle_end/compilenv.cmi \ utils/clflags.cmi \ middle_end/clambda_primitives.cmi \ @@ -4211,6 +4212,7 @@ middle_end/closure/closure.cmx : \ typing/env.cmx \ lambda/debuginfo.cmx \ middle_end/convert_primitives.cmx \ + utils/config.cmx \ middle_end/compilenv.cmx \ utils/clflags.cmx \ middle_end/clambda_primitives.cmx \ diff --git a/Makefile b/Makefile index 71d41cd2d65a..fbb36a496c29 100644 --- a/Makefile +++ b/Makefile @@ -1284,11 +1284,10 @@ runtime/caml/jumptbl.h : runtime/caml/instruct.h sed -n -e '/^ /s/ \([A-Z]\)/ \&\&lbl_\1/gp' \ -e '/^}/q' > $@ -# These are provided as a temporary shim to allow cross-compilation systems -# to supply a host C compiler and different flags and a linking macro. -SAK_CC ?= $(CC) -SAK_CFLAGS ?= $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS) -SAK_LINK ?= $(MKEXE_VIA_CC) +SAK_CC ?= $(CC_FOR_BUILD) +SAK_CFLAGS ?=\ + $(OC_CFLAGS) $(CFLAGS_FOR_BUILD) $(OC_CPPFLAGS) $(CPPFLAGS_FOR_BUILD) +SAK_LINK ?= $(SAK_CC) $(SAK_CFLAGS) $(OUTPUTEXE)$(1) $(2) $(SAK): runtime/sak.$(O) $(V_MKEXE)$(call SAK_LINK,$@,$^) @@ -2733,6 +2732,11 @@ endif include .depend +# Include the cross-compiler recipes only when relevant +ifneq "$(HOST)" "$(TARGET)" +include Makefile.cross +endif + Makefile.config Makefile.build_config: config.status config.status: @echo "Please refer to the installation instructions:" diff --git a/Makefile.config.in b/Makefile.config.in index 559738f6ed05..b91634efb696 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -65,11 +65,13 @@ LIBTOOL = $(TOP_BUILDDIR)/libtool ### Which C compiler to use TOOLPREF=@ac_tool_prefix@ CC=@CC@ +CC_FOR_BUILD=@CC_FOR_BUILD@ CC_HAS_DEBUG_PREFIX_MAP=@cc_has_debug_prefix_map@ AS_HAS_DEBUG_PREFIX_MAP=@as_has_debug_prefix_map@ LDFLAGS?=@LDFLAGS@ +LDFLAGS_FOR_BUILD=@LDFLAGS_FOR_BUILD@ ### How to invoke the C preprocessor through the C compiler CPP=@CPP@ @@ -160,7 +162,9 @@ UNIX_OR_WIN32=@unix_or_win32@ INSTALL_SOURCE_ARTIFACTS=@install_source_artifacts@ CFLAGS=@CFLAGS@ +CFLAGS_FOR_BUILD=@CFLAGS_FOR_BUILD@ CPPFLAGS=@CPPFLAGS@ +CPPFLAGS_FOR_BUILD=@CPPFLAGS_FOR_BUILD@ OCAMLC_CFLAGS=@ocamlc_cflags@ OCAMLC_CPPFLAGS=@ocamlc_cppflags@ @@ -181,6 +185,7 @@ OCAMLOPT_CFLAGS=@ocamlc_cflags@ OCAMLOPT_CPPFLAGS=@ocamlc_cppflags@ NATIVECCLIBS=@cclibs@ SYSTHREAD_SUPPORT=@systhread_support@ +STRIP=@STRIP@ PACKLD=@PACKLD@$(EMPTY) CCOMPTYPE=@ccomptype@ TOOLCHAIN=@toolchain@ diff --git a/Makefile.cross b/Makefile.cross new file mode 100644 index 000000000000..b993783d2fc9 --- /dev/null +++ b/Makefile.cross @@ -0,0 +1,83 @@ +#************************************************************************** +#* * +#* OCaml * +#* * +#* Samuel Hym, Tarides * +#* * +#* Copyright 2024 Tarides * +#* * +#* All rights reserved. This file is distributed under the terms of * +#* the GNU Lesser General Public License version 2.1, with the * +#* special exception on linking described in the file LICENSE. * +#* * +#************************************************************************** + +# Recipes to build a cross-compiler (_not_ cross-compiling the compiler), aka +# generating code that will run on `target`, assuming that a non-cross OCaml +# compiler (so targetting our build machine) of the same version is available in +# $PATH + +# We assume no zstd for the cross-compiler (ie no requirement on zstd for the +# target) +# Still the cross-compiler will run on host, not target. And as a consequence of +# the rules linking it, the cross-compilers will be linked with the _build_ +# version of libcomprmarsh, so we still must discover the flags to link with +# libzstd if it was set up in the non-cross compiler, so we rely on the +# pkg-config command to get the linking flags for zstd +PKG_CONFIG := pkg-config +# This is used only once, so it doesn't have to be much lazier +NATIVE_ZSTD_LIBS=ZSTD_LIBS="$(shell $(PKG_CONFIG) --libs libzstd)" +# As the libcomprmarsh built by the C cross compiler will not be linked in, we +# can build an empty one +NO_ZSTD=libcomprmarsh_OBJECTS= + +CROSS_OVERRIDES=OCAMLRUN=ocamlrun NEW_OCAMLRUN=ocamlrun \ + BOOT_OCAMLLEX=ocamllex OCAMLYACC=ocamlyacc +CROSS_COMPILER_OVERRIDES=$(CROSS_OVERRIDES) CAMLC=ocamlc CAMLOPT=ocamlopt \ + BEST_OCAMLC=ocamlc BEST_OCAMLOPT=ocamlopt BEST_OCAMLLEX=ocamllex + +INSTALL_OVERRIDES=build_ocamldoc=false WITH_DEBUGGER= + +# Freestanding target custom options +ifeq "$(SYSTEM)" "none" +RUNTIME_BUILD_OVERRIDES=runtime_PROGRAMS= +INSTALL_OVERRIDES += runtime_PROGRAMS=`which ocamlrun` \ + runtime_BYTECODE_STATIC_LIBRARIES=runtime/ld.conf +else +RUNTIME_BUILD_OVERRIDES= +endif + +cross.opt: + $(MAKE) runtime-all $(NO_ZSTD) $(RUNTIME_BUILD_OVERRIDES) + $(MAKE) ocamlc ocamlopt $(TOOLS_BYTECODE_TARGETS) expunge \ + $(CROSS_COMPILER_OVERRIDES) + $(MAKE) library $(CROSS_OVERRIDES) +ifneq "$(SYSTEM)" "none" + $(MAKE) ocamlyacc $(CROSS_OVERRIDES) + $(MAKE) ocamllex $(CROSS_COMPILER_OVERRIDES) +endif + $(MAKE) ocaml $(CROSS_COMPILER_OVERRIDES) + $(MAKE) -C otherlibs all $(CROSS_OVERRIDES) + # Opt + $(MAKE) runtimeopt $(NO_ZSTD) + $(MAKE) ocamlc.opt ocamlopt.opt $(TOOLS_NATIVE_TARGETS) \ + $(NO_ZSTD) $(CROSS_COMPILER_OVERRIDES) $(NATIVE_ZSTD_LIBS) + $(MAKE) libraryopt $(NO_ZSTD) $(CROSS_OVERRIDES) + $(MAKE) otherlibrariesopt ocamltoolsopt $(NO_ZSTD) $(CROSS_OVERRIDES) + $(MAKE) tools-allopt.opt $(NO_ZSTD) $(CROSS_COMPILER_OVERRIDES) + +.PHONY: cross-install +cross-install: + # dummy files + touch \ + $(addprefix toplevel/, \ + $(foreach ext,cmi cmt cmti cmx, native/nat__dummy__.$(ext)) \ + all__dummy__.cmx topstart.o native/tophooks.cmi) + $(LN) `which ocamlyacc` yacc/ocamlyacc.opt$(EXE) + $(LN) `which ocamllex` lex/ocamllex.opt$(EXE) +ifeq "$(SYSTEM)" "none" + $(LN) `which ocamlyacc` yacc/ocamlyacc$(EXE) + $(LN) `which ocamllex` lex/ocamllex$(EXE) +endif + # Real installation + $(MAKE) install $(INSTALL_OVERRIDES) OCAMLRUN=ocamlrun diff --git a/aclocal.m4 b/aclocal.m4 index cb73385dda20..caafaa63c777 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -30,6 +30,7 @@ m4_include([build-aux/ax_check_compile_flag.m4]) # Macros from the autoconf macro archive m4_include([build-aux/ax_func_which_gethostbyname_r.m4]) +m4_include([build-aux/ax_prog_cc_for_build.m4]) m4_include([build-aux/ax_pthread.m4]) # OCaml version @@ -414,27 +415,27 @@ EOF OCAML_CC_RESTORE_VARIABLES ]) -AC_DEFUN([OCAML_HOST_IS_EXECUTABLE], [ - AC_MSG_CHECKING([whether host executables can be run in the build]) +AC_DEFUN([OCAML_TARGET_IS_EXECUTABLE], [ + AC_MSG_CHECKING([whether target executables can be run in the build]) old_cross_compiling="$cross_compiling" cross_compiling='no' AC_RUN_IFELSE( [AC_LANG_SOURCE([[int main (void) {return 0;}]])], [AC_MSG_RESULT([yes]) - host_runnable=true], + target_runnable=true], [AC_MSG_RESULT([no]) - host_runnable=false], + target_runnable=false], # autoconf displays a warning if this parameter is missing, but # cross-compilation mode was disabled above. [assert=false]) cross_compiling="$old_cross_compiling" ]) -# This is AC_RUN_IFELSE but taking $host_runnable into account (i.e. if the +# This is AC_RUN_IFELSE but taking $target_runnable into account (i.e. if the # program can be run, then it is run) AC_DEFUN([OCAML_RUN_IFELSE], [ old_cross_compiling="$cross_compiling" - AS_IF([test "x$host_runnable" = 'xtrue'], [cross_compiling='no']) + AS_IF([test "x$target_runnable" = 'xtrue'], [cross_compiling='no']) AC_RUN_IFELSE([$1],[$2],[$3],[$4]) cross_compiling="$old_cross_compiling" ]) diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp index 619ce9c3c595..19f896c1ac51 100644 --- a/asmcomp/amd64/emit.mlp +++ b/asmcomp/amd64/emit.mlp @@ -1079,7 +1079,7 @@ let end_assembly() = D.size frametable (ConstSub (ConstThis, ConstLabel frametable)) end; - if system = S_linux then + if system = S_linux || system = S_unknown then (* Mark stack as non-executable, PR#4564 *) D.section [".note.GNU-stack"] (Some "") [ "%progbits" ]; diff --git a/asmcomp/arm64/emit.mlp b/asmcomp/arm64/emit.mlp index 1816f8c34537..41769e4f9347 100644 --- a/asmcomp/arm64/emit.mlp +++ b/asmcomp/arm64/emit.mlp @@ -1217,7 +1217,7 @@ let end_assembly () = emit_symbol_type emit_symbol lbl "object"; emit_symbol_size lbl; begin match Config.system with - | "linux" -> + | "linux" | "none" -> (* Mark stack as non-executable *) ` .section .note.GNU-stack,\"\",%progbits\n` | _ -> () diff --git a/asmcomp/x86_proc.ml b/asmcomp/x86_proc.ml index b7abe4d3d1ca..540ee4864c18 100644 --- a/asmcomp/x86_proc.ml +++ b/asmcomp/x86_proc.ml @@ -27,6 +27,7 @@ type system = | S_freebsd | S_netbsd | S_openbsd + | S_none | S_unknown @@ -43,6 +44,7 @@ let system = match Config.system with | "freebsd" -> S_freebsd | "netbsd" -> S_netbsd | "openbsd" -> S_openbsd + | "none" -> S_none | _ -> S_unknown diff --git a/asmcomp/x86_proc.mli b/asmcomp/x86_proc.mli index c7f9a5e59e13..002efff96878 100644 --- a/asmcomp/x86_proc.mli +++ b/asmcomp/x86_proc.mli @@ -69,6 +69,7 @@ type system = | S_freebsd | S_netbsd | S_openbsd + | S_none | S_unknown diff --git a/boot/ocamlc b/boot/ocamlc index ee406942e06d..aa35ace69ea6 100755 Binary files a/boot/ocamlc and b/boot/ocamlc differ diff --git a/build-aux/ax_prog_cc_for_build.m4 b/build-aux/ax_prog_cc_for_build.m4 new file mode 100644 index 000000000000..1db8d73f9667 --- /dev/null +++ b/build-aux/ax_prog_cc_for_build.m4 @@ -0,0 +1,155 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_CC_FOR_BUILD +# +# DESCRIPTION +# +# This macro searches for a C compiler that generates native executables, +# that is a C compiler that surely is not a cross-compiler. This can be +# useful if you have to generate source code at compile-time like for +# example GCC does. +# +# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything +# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD). +# The value of these variables can be overridden by the user by specifying +# a compiler with an environment variable (like you do for standard CC). +# +# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object +# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if +# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are +# substituted in the Makefile. +# +# LICENSE +# +# Copyright (c) 2008 Paolo Bonzini +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 21 + +AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD]) +AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl + +dnl Use the standard macros, but make them use other variable names +dnl +pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl +pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl +pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_c99)dnl +pushdef([ac_cv_prog_cc_c11], ac_cv_build_prog_cc_c11)dnl +pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl +pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl +pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl +pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl +pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu)dnl +pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl +pushdef([ac_cv_objext], ac_cv_build_objext)dnl +pushdef([ac_exeext], ac_build_exeext)dnl +pushdef([ac_objext], ac_build_objext)dnl +pushdef([CC], CC_FOR_BUILD)dnl +pushdef([CPP], CPP_FOR_BUILD)dnl +pushdef([GCC], GCC_FOR_BUILD)dnl +pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl +pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl +pushdef([EXEEXT], BUILD_EXEEXT)dnl +pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl +pushdef([OBJEXT], BUILD_OBJEXT)dnl +pushdef([host], build)dnl +pushdef([host_alias], build_alias)dnl +pushdef([host_cpu], build_cpu)dnl +pushdef([host_vendor], build_vendor)dnl +pushdef([host_os], build_os)dnl +pushdef([ac_cv_host], ac_cv_build)dnl +pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl +pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl +pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl +pushdef([ac_cv_host_os], ac_cv_build_os)dnl +pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl +pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl +pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl +pushdef([cross_compiling], cross_compiling_build)dnl + +cross_compiling_build=no + +ac_build_tool_prefix= +AS_IF([test -n "$build"], [ac_build_tool_prefix="$build-"], + [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"]) + +AC_LANG_PUSH([C]) + +dnl The pushdef([ac_cv_c_compiler_gnu], ...) currently does not cover +dnl the use of this variable in _AC_LANG_COMPILER_GNU called by +dnl AC_PROG_CC. Unset this cache variable temporarily as a workaround. +was_set_c_compiler_gnu=${[ac_cv_c_compiler_gnu]+y} +AS_IF([test ${was_set_c_compiler_gnu}], + [saved_c_compiler_gnu=$[ac_cv_c_compiler_gnu] + AS_UNSET([[ac_cv_c_compiler_gnu]])]) + +AC_PROG_CC + +dnl Restore ac_cv_c_compiler_gnu +AS_IF([test ${was_set_c_compiler_gnu}], + [[ac_cv_c_compiler_gnu]=$[saved_c_compiler_gnu]]) + +_AC_COMPILER_EXEEXT +_AC_COMPILER_OBJEXT +AC_PROG_CPP + +dnl Restore the old definitions +dnl +popdef([cross_compiling])dnl +popdef([am_cv_prog_cc_c_o])dnl +popdef([am_cv_CC_dependencies_compiler_type])dnl +popdef([ac_tool_prefix])dnl +popdef([ac_cv_host_os])dnl +popdef([ac_cv_host_vendor])dnl +popdef([ac_cv_host_cpu])dnl +popdef([ac_cv_host_alias])dnl +popdef([ac_cv_host])dnl +popdef([host_os])dnl +popdef([host_vendor])dnl +popdef([host_cpu])dnl +popdef([host_alias])dnl +popdef([host])dnl +popdef([OBJEXT])dnl +popdef([LDFLAGS])dnl +popdef([EXEEXT])dnl +popdef([CPPFLAGS])dnl +popdef([CFLAGS])dnl +popdef([GCC])dnl +popdef([CPP])dnl +popdef([CC])dnl +popdef([ac_objext])dnl +popdef([ac_exeext])dnl +popdef([ac_cv_objext])dnl +popdef([ac_cv_exeext])dnl +popdef([ac_cv_c_compiler_gnu])dnl +popdef([ac_cv_prog_cc_g])dnl +popdef([ac_cv_prog_cc_cross])dnl +popdef([ac_cv_prog_cc_works])dnl +popdef([ac_cv_prog_cc_c89])dnl +popdef([ac_cv_prog_gcc])dnl +popdef([ac_cv_prog_CPP])dnl + +dnl restore global variables ac_ext, ac_cpp, ac_compile, +dnl ac_link, ac_compiler_gnu (dependant on the current +dnl language after popping): +AC_LANG_POP([C]) + +dnl Finally, set Makefile variables +dnl +AC_SUBST(BUILD_EXEEXT)dnl +AC_SUBST(BUILD_OBJEXT)dnl +AC_SUBST([CFLAGS_FOR_BUILD])dnl +AC_SUBST([CPPFLAGS_FOR_BUILD])dnl +AC_SUBST([LDFLAGS_FOR_BUILD])dnl +]) diff --git a/configure b/configure index 6dc7cc751737..8ca1b2fe2cce 100755 --- a/configure +++ b/configure @@ -730,6 +730,14 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM flexlink +LDFLAGS_FOR_BUILD +CPPFLAGS_FOR_BUILD +CFLAGS_FOR_BUILD +BUILD_OBJEXT +BUILD_EXEEXT +CPP_FOR_BUILD +ac_ct_CC_FOR_BUILD +CC_FOR_BUILD CPP ac_ct_DEP_CC DEP_CC @@ -890,6 +898,7 @@ ocamlsrcdir systhread_support native_cppflags native_cflags +target_os_type system model arch64 @@ -3436,6 +3445,7 @@ LINEAR_MAGIC_NUMBER=Caml1999L034 + # TODO: rename this variable @@ -3619,6 +3629,25 @@ IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac +# Allow "ocaml" as target OS for freestanding compiler by temporarily rewriting +# the target OS to "none" to generate the canonical target +real_target_alias="$target_alias" +case $target_alias in #( + *-*-*-ocaml) : + ac_save_IFS=$IFS + IFS='-' + set x $target_alias + target_alias="$2-$3-none" + IFS=$ac_save_IFS ;; #( + *-*-ocaml) : + ac_save_IFS=$IFS + IFS='-' + set x $target_alias + target_alias="$2-none" + IFS=$ac_save_IFS ;; #( + *) : + ;; +esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 printf %s "checking target system type... " >&6; } if test ${ac_cv_target+y} @@ -3659,6 +3688,20 @@ test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- +target_alias="$real_target_alias" + +# Override cross_compiling and ac_tool_prefix variables since the C toolchain is +# used to generate target code when building a cross compiler +if test x"$build" = x"$target" +then : + cross_compiling=no +else $as_nop + cross_compiling=yes +fi +if test -n "$target_alias" +then : + ac_tool_prefix=$target_alias- +fi # Ensure that AC_CONFIG_LINKS will either create symlinks which are compatible # with native Windows (i.e. NTFS symlinks, not WSL or Cygwin-emulated ones) or @@ -3674,7 +3717,7 @@ esac # Systems that are known not to work, even in bytecode only. -case $host in #( +case $target in #( *-pc-windows) : as_fn_error 69 "the MSVC compiler is not supported currently" "$LINENO" 5 ;; #( i386-*-solaris*) : @@ -3687,7 +3730,7 @@ esac # MSVC special case -case $host in #( +case $target in #( *-pc-windows) : CC=cl ccomptype=msvc @@ -4173,11 +4216,10 @@ fi # Initialization of libtool # Allow the MSVC linker to be found even if ld isn't installed. # User-specified LD still takes precedence. -if test -n "$ac_tool_prefix"; then - for ac_prog in ld link - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +for ac_prog in ld link +do + # Extract the first word of "$target_alias-$ac_prog", so it can be a program name with args. +set dummy $target_alias-$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_LD+y} @@ -4198,7 +4240,7 @@ do esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_LD="$ac_tool_prefix$ac_prog" + ac_cv_prog_LD="$target_alias-$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi @@ -4218,12 +4260,12 @@ printf "%s\n" "no" >&6; } fi - test -n "$LD" && break - done -fi + test -n "$LD" && break +done if test -z "$LD"; then - ac_ct_LD=$LD - for ac_prog in ld link + if test "$build" = "$target"; then + ac_ct_LD=$LD + for ac_prog in ld link do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -4270,27 +4312,25 @@ fi test -n "$ac_ct_LD" && break done - if test "x$ac_ct_LD" = x; then - LD="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac LD=$ac_ct_LD + else + LD="" fi fi +# libtool will detect a build-to-host C toolchain but when building an OCaml +# cross compiler we need the C toolchain to build the target runtime so we +# temporarily define host* values as macros for target* values so that the +# proper toolchain is configured. Note that host=target unless we are building a +# cross compiler so this is transparent for the usual use case. # libtool expects host_os=mingw for native Windows # Also, it has been observed that, on some platforms (e.g. msvc) LT_INIT # alters the CFLAGS variable, so we save its value before calling the macro # and restore it after the call -old_host_os=$host_os -if test x"$host_os" = "xwindows" +old_host_os=$target_os +if test x"$target_os" = "xwindows" then : - host_os=mingw + target_os=mingw fi saved_CFLAGS="$CFLAGS" @@ -4495,8 +4535,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -4715,8 +4755,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -4817,8 +4857,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -5052,7 +5092,7 @@ printf "%s\n" "$ac_try_echo"; } >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. +If you meant to cross compile, use \`--target'. See \`config.log' for more details" "$LINENO" 5; } fi fi @@ -5720,7 +5760,7 @@ if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } - case $host in + case $target in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; @@ -5832,7 +5872,7 @@ else $as_nop lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + if test -n "$ac_tool_prefix" && test "$build" = "$target"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do @@ -5987,8 +6027,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN @@ -6232,13 +6272,13 @@ esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -printf %s "checking how to convert $build file names to $host format... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $target format" >&5 +printf %s "checking how to convert $build file names to $target format... " >&6; } if test ${lt_cv_to_host_file_cmd+y} then : printf %s "(cached) " >&6 else $as_nop - case $host in + case $target in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys @@ -6288,7 +6328,7 @@ then : else $as_nop #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in +case $target in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys @@ -6324,7 +6364,7 @@ case $reload_flag in *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in +case $target_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false @@ -6439,8 +6479,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP @@ -6479,7 +6519,7 @@ lt_cv_deplibs_check_method='unknown' # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. -case $host_os in +case $target_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; @@ -6526,7 +6566,7 @@ darwin* | rhapsody*) freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in + case $target_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. @@ -6546,7 +6586,7 @@ haiku*) hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in + case $target_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so @@ -6625,7 +6665,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) ;; sysv4 | sysv4.3*) - case $host_vendor in + case $target_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` @@ -6665,8 +6705,8 @@ printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in +if test "$build" = "$target"; then + case $target_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes @@ -6794,8 +6834,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL @@ -6823,7 +6863,7 @@ then : else $as_nop lt_cv_sharedlib_from_linklib_cmd='unknown' -case $host_os in +case $target_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL @@ -6957,8 +6997,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR @@ -7130,8 +7170,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -7239,8 +7279,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -7262,7 +7302,7 @@ old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then - case $host_os in + case $target_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; @@ -7273,7 +7313,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi -case $host_os in +case $target_os in darwin*) lock_old_archive_extraction=yes ;; *) @@ -7393,7 +7433,7 @@ symcode='[BCDEGRST]' sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. -case $host_os in +case $target_os in aix*) symcode='[BCDT]' ;; @@ -7401,7 +7441,7 @@ cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) - if test ia64 = "$host_cpu"; then + if test ia64 = "$target_cpu"; then symcode='[ABCDEGRST]' fi ;; @@ -7816,7 +7856,7 @@ func_cc_basename () *) break;; esac done - func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$target_alias-%%"` } # Check whether --enable-libtool-lock was given. @@ -7829,7 +7869,7 @@ test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. -case $host in +case $target in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. @@ -7940,7 +7980,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) - case $host in + case $target in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; @@ -7969,7 +8009,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) esac ;; *64-bit*) - case $host in + case $target in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; @@ -8057,7 +8097,7 @@ printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } *64-bit*) case $lt_cv_prog_gnu_ld in yes*) - case $host in + case $target in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; @@ -8177,8 +8217,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL @@ -8214,7 +8254,7 @@ fi - case $host_os in + case $target_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. @@ -8308,8 +8348,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL @@ -8410,8 +8450,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT @@ -8512,8 +8552,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO @@ -8614,8 +8654,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL @@ -8716,8 +8756,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with target triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with target triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 @@ -8859,7 +8899,7 @@ _LT_EOF fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 printf "%s\n" "$lt_cv_ld_force_load" >&6; } - case $host_os in + case $target_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) @@ -8868,7 +8908,7 @@ printf "%s\n" "$lt_cv_ld_force_load" >&6; } # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$target in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) @@ -9107,7 +9147,7 @@ fi shared_archive_member_spec= -case $host,$enable_shared in +case $target,$enable_shared in power*-*-aix[5-9]*,yes) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 printf %s "checking which variant of shared library versioning to provide... " >&6; } @@ -9246,7 +9286,7 @@ printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h -case $host_os in +case $target_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -9558,10 +9598,10 @@ lt_prog_compiler_static= lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' - case $host_os in + case $target_os in aix*) # All AIX code is PIC. - if test ia64 = "$host_cpu"; then + if test ia64 = "$target_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi @@ -9569,7 +9609,7 @@ lt_prog_compiler_static= ;; amigaos*) - case $host_cpu in + case $target_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' @@ -9593,7 +9633,7 @@ lt_prog_compiler_static= # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' - case $host_os in + case $target_os in os2*) lt_prog_compiler_static='$wl-static' ;; @@ -9616,7 +9656,7 @@ lt_prog_compiler_static= # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. - case $host_cpu in + case $target_cpu in hppa*64*) # +Z the default ;; @@ -9665,10 +9705,10 @@ lt_prog_compiler_static= esac else # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in + case $target_os in aix*) lt_prog_compiler_wl='-Wl,' - if test ia64 = "$host_cpu"; then + if test ia64 = "$target_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else @@ -9694,7 +9734,7 @@ lt_prog_compiler_static= # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' - case $host_os in + case $target_os in os2*) lt_prog_compiler_static='$wl-static' ;; @@ -9705,7 +9745,7 @@ lt_prog_compiler_static= lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case $host_cpu in + case $target_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -9881,7 +9921,7 @@ lt_prog_compiler_static= esac fi -case $host_os in +case $target_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= @@ -10196,7 +10236,7 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= - case $host_os in + case $target_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using @@ -10223,7 +10263,7 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then - case $host_os in + case $target_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld @@ -10271,10 +10311,10 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries esac # See if GNU ld supports shared libraries. - case $host_os in + case $target_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken - if test ia64 != "$host_cpu"; then + if test ia64 != "$target_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 @@ -10290,7 +10330,7 @@ _LT_EOF ;; amigaos*) - case $host_cpu in + case $target_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' @@ -10392,7 +10432,7 @@ _LT_EOF gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no - if test linux-dietlibc = "$host_os"; then + if test linux-dietlibc = "$target_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac @@ -10402,7 +10442,7 @@ _LT_EOF then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in + case $cc_basename,$target_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' @@ -10556,7 +10596,7 @@ _LT_EOF fi else # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in + case $target_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes @@ -10572,7 +10612,7 @@ _LT_EOF ;; aix[4-9]*) - if test ia64 = "$host_cpu"; then + if test ia64 = "$target_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no @@ -10609,7 +10649,7 @@ _LT_EOF # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + case $target_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes @@ -10652,7 +10692,7 @@ _LT_EOF esac if test yes = "$GCC"; then - case $host_os in aix4.[012]|aix4.[012].*) + case $target_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` @@ -10684,7 +10724,7 @@ _LT_EOF shared_flag_svr4='-shared $wl-G' else # not using gcc - if test ia64 = "$host_cpu"; then + if test ia64 = "$target_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' @@ -10757,7 +10797,7 @@ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else - if test ia64 = "$host_cpu"; then + if test ia64 = "$target_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" @@ -10841,7 +10881,7 @@ fi ;; amigaos*) - case $host_cpu in + case $target_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' @@ -11026,7 +11066,7 @@ fi hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then - case $host_cpu in + case $target_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; @@ -11038,7 +11078,7 @@ fi ;; esac else - case $host_cpu in + case $target_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; @@ -11094,7 +11134,7 @@ fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: - case $host_cpu in + case $target_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no @@ -11119,8 +11159,8 @@ fi # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $target_os linker accepts -exported_symbol" >&5 +printf %s "checking whether the $target_os linker accepts -exported_symbol... " >&6; } if test ${lt_cv_irix_exported_symbol+y} then : printf %s "(cached) " >&6 @@ -11293,7 +11333,7 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no - case $host_os in + case $target_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, @@ -11311,7 +11351,7 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } ;; sunos4*) - if test sequent = "$host_vendor"; then + if test sequent = "$target_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' @@ -11325,7 +11365,7 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } ;; sysv4) - case $host_vendor in + case $target_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? @@ -11414,8 +11454,8 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } ;; esac - if test sni = "$host_vendor"; then - case $host in + if test sni = "$target_vendor"; then + case $target in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; @@ -11668,11 +11708,11 @@ esac printf %s "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then - case $host_os in + case $target_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac - case $host_os in + case $target_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac @@ -11730,7 +11770,7 @@ BEGIN {RS = " "; FS = "/|\n";} { }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. - case $host_os in + case $target_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac @@ -11749,7 +11789,7 @@ finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none -dynamic_linker="$host_os ld.so" +dynamic_linker="$target_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no @@ -11760,7 +11800,7 @@ need_version=unknown -case $host_os in +case $target_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' @@ -11775,7 +11815,7 @@ aix[4-9]*) need_lib_prefix=no need_version=no hardcode_into_libs=yes - if test ia64 = "$host_cpu"; then + if test ia64 = "$target_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH @@ -11785,7 +11825,7 @@ aix[4-9]*) # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. - case $host_os in + case $target_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' @@ -11865,7 +11905,7 @@ aix[4-9]*) ;; amigaos*) - case $host_cpu in + case $target_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. @@ -11881,7 +11921,7 @@ amigaos*) beos*) library_names_spec='$libname$shared_ext' - dynamic_linker="$host_os ld.so" + dynamic_linker="$target_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -11924,7 +11964,7 @@ cygwin* | mingw* | pw32* | cegcc*) $RM \$dlpath' shlibpath_overrides_runpath=yes - case $host_os in + case $target_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' @@ -12010,7 +12050,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; darwin* | rhapsody*) - dynamic_linker="$host_os dyld" + dynamic_linker="$target_os dyld" version_type=darwin need_lib_prefix=no need_version=no @@ -12039,7 +12079,7 @@ freebsd* | dragonfly*) if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else - case $host_os in + case $target_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac @@ -12058,7 +12098,7 @@ freebsd* | dragonfly*) ;; esac shlibpath_var=LD_LIBRARY_PATH - case $host_os in + case $target_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; @@ -12082,7 +12122,7 @@ haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - dynamic_linker="$host_os runtime_loader" + dynamic_linker="$target_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH @@ -12097,11 +12137,11 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case $host_cpu in + case $target_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" + dynamic_linker="$target_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' @@ -12117,7 +12157,7 @@ hpux9* | hpux10* | hpux11*) hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" + dynamic_linker="$target_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' @@ -12127,7 +12167,7 @@ hpux9* | hpux10* | hpux11*) ;; *) shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" + dynamic_linker="$target_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' @@ -12153,7 +12193,7 @@ interix[3-9]*) ;; irix5* | irix6* | nonstopux*) - case $host_os in + case $target_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then @@ -12166,7 +12206,7 @@ irix5* | irix6* | nonstopux*) need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' - case $host_os in + case $target_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; @@ -12426,7 +12466,7 @@ sysv4 | sysv4.3*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in + case $target_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no @@ -12466,7 +12506,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in + case $target_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; @@ -12670,7 +12710,7 @@ else lt_cv_dlopen=no lt_cv_dlopen_libs= - case $host_os in + case $target_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= @@ -13205,7 +13245,7 @@ if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then printf "%s\n" "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough - case $host_os in + case $target_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" @@ -13247,7 +13287,7 @@ printf %s "checking whether to build shared libraries... " >&6; } # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. - case $host_os in + case $target_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then @@ -13257,7 +13297,7 @@ printf %s "checking whether to build shared libraries... " >&6; } ;; aix[4-9]*) - if test ia64 != "$host_cpu"; then + if test ia64 != "$target_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only @@ -13311,7 +13351,7 @@ CC=$lt_save_CC CFLAGS="$saved_CFLAGS" -host_os=$old_host_os +target_os=$old_host_os case $host in #( sparc-sun-solaris*) : @@ -13455,7 +13495,7 @@ else $as_nop fi ;; esac -case $host in #( +case $target in #( # In config/Makefile.mingw*, we had: # TARGET=i686-w64-mingw32 and x86_64-w64-mingw32 # TOOLPREF=$(TARGET)- @@ -13467,7 +13507,7 @@ case $host in #( mkexe_via_cc_extra_cmd=' && $(call MERGEMANIFESTEXE,$(1))' libext=lib AR="" - if test "$host_cpu" = "x86_64" + if test "$target_cpu" = "x86_64" then : machine="-machine:AMD64 " else $as_nop @@ -13678,8 +13718,8 @@ printf "%s\n" "$ocaml_cc_vendor" >&6; } ## In cross-compilation mode, can we run executables produced? # At the moment, it's required, but the fact is used in C99 function detection - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether host executables can be run in the build" >&5 -printf %s "checking whether host executables can be run in the build... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether target executables can be run in the build" >&5 +printf %s "checking whether target executables can be run in the build... " >&6; } old_cross_compiling="$cross_compiling" cross_compiling='no' if test "$cross_compiling" = yes @@ -13696,11 +13736,11 @@ if ac_fn_c_try_run "$LINENO" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - host_runnable=true + target_runnable=true else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - host_runnable=false + target_runnable=false fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -13759,23 +13799,28 @@ case lt_cv_ar_at_file in #( ar_supports_response_files=true ;; esac -# Libraries to build depending on the host +# Libraries to build depending on the target case $host in #( *-*-mingw32*|*-pc-windows) : - unix_or_win32="win32" ln='cp -pf' + ocamlsrcdir="$(LC_ALL=C.UTF-8 cygpath -w -- "$ocamlsrcdir")" ;; #( + *) : + ln='ln -sf' ;; +esac + +case $target in #( + *-*-mingw32*|*-pc-windows) : + unix_or_win32="win32" # or should it be tested against host? ocamltest_libunix="Some false" - ocamlsrcdir="$(LC_ALL=C.UTF-8 cygpath -w -- "$ocamlsrcdir")" ocamlyacc_wstr_module="yacc/wstr" ;; #( *) : unix_or_win32="unix" - ln='ln -sf' ocamltest_libunix="Some true" ocamlyacc_wstr_module="" ;; esac -case $host in #( +case $target in #( *-*-cygwin*|*-*-mingw32*|*-pc-windows) : exeext=".exe" ;; #( *) : @@ -13840,7 +13885,7 @@ shebangscripts=false launch_method='exe' if test "x$interpval" = "xyes" then : - case $host in #( + case $target in #( *-cygwin) : # Cygwin supports shebangs, which we use for the compiler itself, but # partially for legacy, and partially so that executables can be easily @@ -13875,85 +13920,1270 @@ then : cross_compiler=false else $as_nop cross_compiler=true + # We require a non-cross-compiler of the same version + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the version of the installed OCaml compiler" >&5 +printf %s "checking the version of the installed OCaml compiler... " >&6; } + already_installed_version=`ocamlc -vnum` + if test x"5.2.0" = x"$already_installed_version" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: compatible (5.2.0)" >&5 +printf "%s\n" "compatible (5.2.0)" >&6; } +else $as_nop + as_fn_error $? "incompatible (5.2.0 vs $already_installed_version)" "$LINENO" 5 +fi fi -# Checks for programs +if test x"$build" = x"$target" -o x"$target_runnable" = xtrue +then : + CC_FOR_BUILD='$(CC)' + CFLAGS_FOR_BUILD='$(CFLAGS)' + CPPFLAGS_FOR_BUILD='$(CPPFLAGS)' + LDFLAGS_FOR_BUILD='$(LDFLAGS)' +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: detecting the C toolchain for build" >&5 +printf "%s\n" "$as_me: detecting the C toolchain for build" >&6;} -## Check for the C compiler: done by libtool -## AC_PROG_CC -## Check for C99 support: done by libtool -## AC_PROG_CC_C99 +cross_compiling_build=no -## Determine which flags to use for the C compiler +ac_build_tool_prefix= +if test -n "$build" +then : + ac_build_tool_prefix="$build-" +elif test -n "$build_alias" +then : + ac_build_tool_prefix="$build_alias-" +fi -case $ocaml_cc_vendor in #( - xlc-*) : - outputobj='-o ' - warn_error_flag='' - cc_warnings='-qflag=i:i' ;; #( - # all warnings enabled - sunc-*) : - outputobj='-o '; cc_warnings="" ;; #( - msvc-*) : - outputobj='-Fo' - warn_error_flag='-WX' - cc_warnings='' ;; #( - *) : - outputobj='-o ' - warn_error_flag='-Werror' - cc_warnings="-Wall -Wint-conversion -Wstrict-prototypes \ --Wold-style-definition -Wundef" ;; -esac +ac_ext=c +ac_cpp='$CPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' +ac_compile='$CC_FOR_BUILD -c $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' +ac_link='$CC_FOR_BUILD -o conftest$ac_build_exeext $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_build_c_compiler_gnu -# Use -Wold-style-declaration if supported -as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_$warn_error_flag_-Wold-style-declaration" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wold-style-declaration" >&5 -printf %s "checking whether C compiler accepts -Wold-style-declaration... " >&6; } -if eval test \${$as_CACHEVAR+y} + +was_set_c_compiler_gnu=${ac_cv_c_compiler_gnu+y} +if test ${was_set_c_compiler_gnu} +then : + saved_c_compiler_gnu=$ac_cv_c_compiler_gnu + { ac_cv_c_compiler_gnu=; unset ac_cv_c_compiler_gnu;} +fi + +ac_ext=c +ac_cpp='$CPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' +ac_compile='$CC_FOR_BUILD -c $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' +ac_link='$CC_FOR_BUILD -o conftest$ac_build_exeext $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_build_c_compiler_gnu +if test -n "$ac_build_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_build_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC_FOR_BUILD+y} then : printf %s "(cached) " >&6 else $as_nop + if test -n "$CC_FOR_BUILD"; then + ac_cv_prog_CC_FOR_BUILD="$CC_FOR_BUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC_FOR_BUILD="${ac_build_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS $warn_error_flag -Wold-style-declaration" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +fi +fi +CC_FOR_BUILD=$ac_cv_prog_CC_FOR_BUILD +if test -n "$CC_FOR_BUILD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC_FOR_BUILD" >&5 +printf "%s\n" "$CC_FOR_BUILD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi -int -main (void) -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" +fi +if test -z "$ac_cv_prog_CC_FOR_BUILD"; then + ac_ct_CC_FOR_BUILD=$CC_FOR_BUILD + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC_FOR_BUILD+y} then : - eval "$as_CACHEVAR=yes" + printf %s "(cached) " >&6 else $as_nop - eval "$as_CACHEVAR=no" + if test -n "$ac_ct_CC_FOR_BUILD"; then + ac_cv_prog_ac_ct_CC_FOR_BUILD="$ac_ct_CC_FOR_BUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC_FOR_BUILD="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$ax_check_save_flags fi -eval ac_res=\$$as_CACHEVAR - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_CACHEVAR"\" = x"yes" +ac_ct_CC_FOR_BUILD=$ac_cv_prog_ac_ct_CC_FOR_BUILD +if test -n "$ac_ct_CC_FOR_BUILD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC_FOR_BUILD" >&5 +printf "%s\n" "$ac_ct_CC_FOR_BUILD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC_FOR_BUILD" = x; then + CC_FOR_BUILD="" + else + case $cross_compiling_build:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with build triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with build triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC_FOR_BUILD=$ac_ct_CC_FOR_BUILD + fi +else + CC_FOR_BUILD="$ac_cv_prog_CC_FOR_BUILD" +fi + +if test -z "$CC_FOR_BUILD"; then + if test -n "$ac_build_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_build_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC_FOR_BUILD+y} then : - cc_warnings="$cc_warnings -Wold-style-declaration" + printf %s "(cached) " >&6 else $as_nop - : -fi + if test -n "$CC_FOR_BUILD"; then + ac_cv_prog_CC_FOR_BUILD="$CC_FOR_BUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC_FOR_BUILD="${ac_build_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +CC_FOR_BUILD=$ac_cv_prog_CC_FOR_BUILD +if test -n "$CC_FOR_BUILD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC_FOR_BUILD" >&5 +printf "%s\n" "$CC_FOR_BUILD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi -case $enable_warn_error,false in #( - yes,*|,true) : - cc_warnings="$cc_warnings $warn_error_flag" ;; #( - *) : - ;; -esac + + fi +fi +if test -z "$CC_FOR_BUILD"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC_FOR_BUILD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC_FOR_BUILD"; then + ac_cv_prog_CC_FOR_BUILD="$CC_FOR_BUILD" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC_FOR_BUILD="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC_FOR_BUILD + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC_FOR_BUILD to just the basename; use the full file name. + shift + ac_cv_prog_CC_FOR_BUILD="$as_dir$ac_word${1+' '}$@" + fi +fi +fi +fi +CC_FOR_BUILD=$ac_cv_prog_CC_FOR_BUILD +if test -n "$CC_FOR_BUILD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC_FOR_BUILD" >&5 +printf "%s\n" "$CC_FOR_BUILD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC_FOR_BUILD"; then + if test -n "$ac_build_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_build_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC_FOR_BUILD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC_FOR_BUILD"; then + ac_cv_prog_CC_FOR_BUILD="$CC_FOR_BUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC_FOR_BUILD="$ac_build_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC_FOR_BUILD=$ac_cv_prog_CC_FOR_BUILD +if test -n "$CC_FOR_BUILD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC_FOR_BUILD" >&5 +printf "%s\n" "$CC_FOR_BUILD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC_FOR_BUILD" && break + done +fi +if test -z "$CC_FOR_BUILD"; then + ac_ct_CC_FOR_BUILD=$CC_FOR_BUILD + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC_FOR_BUILD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC_FOR_BUILD"; then + ac_cv_prog_ac_ct_CC_FOR_BUILD="$ac_ct_CC_FOR_BUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC_FOR_BUILD="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC_FOR_BUILD=$ac_cv_prog_ac_ct_CC_FOR_BUILD +if test -n "$ac_ct_CC_FOR_BUILD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC_FOR_BUILD" >&5 +printf "%s\n" "$ac_ct_CC_FOR_BUILD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC_FOR_BUILD" && break +done + + if test "x$ac_ct_CC_FOR_BUILD" = x; then + CC_FOR_BUILD="" + else + case $cross_compiling_build:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with build triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with build triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC_FOR_BUILD=$ac_ct_CC_FOR_BUILD + fi +fi + +fi +if test -z "$CC_FOR_BUILD"; then + if test -n "$ac_build_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_build_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC_FOR_BUILD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC_FOR_BUILD"; then + ac_cv_prog_CC_FOR_BUILD="$CC_FOR_BUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC_FOR_BUILD="${ac_build_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC_FOR_BUILD=$ac_cv_prog_CC_FOR_BUILD +if test -n "$CC_FOR_BUILD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC_FOR_BUILD" >&5 +printf "%s\n" "$CC_FOR_BUILD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC_FOR_BUILD"; then + ac_ct_CC_FOR_BUILD=$CC_FOR_BUILD + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC_FOR_BUILD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC_FOR_BUILD"; then + ac_cv_prog_ac_ct_CC_FOR_BUILD="$ac_ct_CC_FOR_BUILD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC_FOR_BUILD="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC_FOR_BUILD=$ac_cv_prog_ac_ct_CC_FOR_BUILD +if test -n "$ac_ct_CC_FOR_BUILD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC_FOR_BUILD" >&5 +printf "%s\n" "$ac_ct_CC_FOR_BUILD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC_FOR_BUILD" = x; then + CC_FOR_BUILD="" + else + case $cross_compiling_build:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with build triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with build triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC_FOR_BUILD=$ac_ct_CC_FOR_BUILD + fi +else + CC_FOR_BUILD="$ac_cv_prog_CC_FOR_BUILD" +fi + +fi + + +test -z "$CC_FOR_BUILD" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_build_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC_FOR_BUILD=yes +else + GCC_FOR_BUILD= +fi +ac_test_CFLAGS=${CFLAGS_FOR_BUILD+y} +ac_save_CFLAGS=$CFLAGS_FOR_BUILD +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC_FOR_BUILD accepts -g" >&5 +printf %s "checking whether $CC_FOR_BUILD accepts -g... " >&6; } +if test ${ac_cv_build_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_build_prog_cc_g=no + CFLAGS_FOR_BUILD="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_build_prog_cc_g=yes +else $as_nop + CFLAGS_FOR_BUILD="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS_FOR_BUILD="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_build_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_build_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_build_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_build_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_build_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS_FOR_BUILD=$ac_save_CFLAGS +elif test $ac_cv_build_prog_cc_g = yes; then + if test "$GCC_FOR_BUILD" = yes; then + CFLAGS_FOR_BUILD="-g -O2" + else + CFLAGS_FOR_BUILD="-g" + fi +else + if test "$GCC_FOR_BUILD" = yes; then + CFLAGS_FOR_BUILD="-O2" + else + CFLAGS_FOR_BUILD= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC_FOR_BUILD option to enable C11 features" >&5 +printf %s "checking for $CC_FOR_BUILD option to enable C11 features... " >&6; } +if test ${ac_cv_build_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_build_prog_cc_c11=no +ac_save_CC=$CC_FOR_BUILD +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC_FOR_BUILD="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_build_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_build_objext conftest.beam + test "x$ac_cv_build_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC_FOR_BUILD=$ac_save_CC +fi + +if test "x$ac_cv_build_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_build_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_build_prog_cc_c11" >&6; } + CC_FOR_BUILD="$CC_FOR_BUILD $ac_cv_build_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_build_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC_FOR_BUILD option to enable C99 features" >&5 +printf %s "checking for $CC_FOR_BUILD option to enable C99 features... " >&6; } +if test ${ac_cv_build_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_build_prog_cc_c99=no +ac_save_CC=$CC_FOR_BUILD +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC_FOR_BUILD="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_build_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_build_objext conftest.beam + test "x$ac_cv_build_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC_FOR_BUILD=$ac_save_CC +fi + +if test "x$ac_cv_build_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_build_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_build_prog_cc_c99" >&6; } + CC_FOR_BUILD="$CC_FOR_BUILD $ac_cv_build_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_build_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC_FOR_BUILD option to enable C89 features" >&5 +printf %s "checking for $CC_FOR_BUILD option to enable C89 features... " >&6; } +if test ${ac_cv_build_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_build_prog_cc_c89=no +ac_save_CC=$CC_FOR_BUILD +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC_FOR_BUILD="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_build_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_build_objext conftest.beam + test "x$ac_cv_build_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC_FOR_BUILD=$ac_save_CC +fi + +if test "x$ac_cv_build_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_build_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_build_prog_cc_c89" >&6; } + CC_FOR_BUILD="$CC_FOR_BUILD $ac_cv_build_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_build_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +fi + +ac_ext=c +ac_cpp='$CPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' +ac_compile='$CC_FOR_BUILD -c $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' +ac_link='$CC_FOR_BUILD -o conftest$ac_build_exeext $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_build_c_compiler_gnu + + +if test ${was_set_c_compiler_gnu} +then : + ac_cv_c_compiler_gnu=$saved_c_compiler_gnu +fi + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_build_exeext+y} && test "$ac_cv_build_exeext" != no; + then :; else + ac_cv_build_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_build_exeext" = no && ac_cv_build_exeext= + +else $as_nop + ac_file='' +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_build_exeext=$ac_cv_build_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_build_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_build_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_build_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build_exeext" >&5 +printf "%s\n" "$ac_cv_build_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_build_exeext +ac_build_exeext=$BUILD_EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling_build" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_build_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling_build=no + else + if test "$cross_compiling_build" = maybe; then + cross_compiling_build=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use \`--build'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling_build" >&5 +printf "%s\n" "$cross_compiling_build" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_build_exeext conftest.out +ac_clean_files=$ac_clean_files_save + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_build_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_build_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_build_objext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build_objext" >&5 +printf "%s\n" "$ac_cv_build_objext" >&6; } +OBJEXT=$ac_cv_build_objext +ac_build_objext=$BUILD_OBJEXT + +ac_ext=c +ac_cpp='$CPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' +ac_compile='$CC_FOR_BUILD -c $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' +ac_link='$CC_FOR_BUILD -o conftest$ac_build_exeext $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_build_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP_FOR_BUILD" && test -d "$CPP_FOR_BUILD"; then + CPP_FOR_BUILD= +fi +if test -z "$CPP_FOR_BUILD"; then + if test ${ac_cv_build_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP_FOR_BUILD in "$CC_FOR_BUILD -E" "$CC_FOR_BUILD -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_build_prog_CPP=$CPP_FOR_BUILD + +fi + CPP_FOR_BUILD=$ac_cv_build_prog_CPP +else + ac_cv_build_prog_CPP=$CPP_FOR_BUILD +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP_FOR_BUILD" >&5 +printf "%s\n" "$CPP_FOR_BUILD" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP_FOR_BUILD\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP_FOR_BUILD $CPPFLAGS_FOR_BUILD' +ac_compile='$CC_FOR_BUILD -c $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD conftest.$ac_ext >&5' +ac_link='$CC_FOR_BUILD -o conftest$ac_build_exeext $CFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_build_c_compiler_gnu + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +fi + +# Checks for programs + +## Check for the C compiler: done by libtool +## AC_PROG_CC + +## Check for C99 support: done by libtool +## AC_PROG_CC_C99 + +## Determine which flags to use for the C compiler + +case $ocaml_cc_vendor in #( + xlc-*) : + outputobj='-o ' + warn_error_flag='' + cc_warnings='-qflag=i:i' ;; #( + # all warnings enabled + sunc-*) : + outputobj='-o '; cc_warnings="" ;; #( + msvc-*) : + outputobj='-Fo' + warn_error_flag='-WX' + cc_warnings='' ;; #( + *) : + outputobj='-o ' + warn_error_flag='-Werror' + cc_warnings="-Wall -Wint-conversion -Wstrict-prototypes \ +-Wold-style-definition -Wundef" ;; +esac + +# Use -Wold-style-declaration if supported +as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_$warn_error_flag_-Wold-style-declaration" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wold-style-declaration" >&5 +printf %s "checking whether C compiler accepts -Wold-style-declaration... " >&6; } +if eval test \${$as_CACHEVAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $warn_error_flag -Wold-style-declaration" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$as_CACHEVAR=yes" +else $as_nop + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_CACHEVAR"\" = x"yes" +then : + cc_warnings="$cc_warnings -Wold-style-declaration" +else $as_nop + : +fi + + +case $enable_warn_error,false in #( + yes,*|,true) : + cc_warnings="$cc_warnings $warn_error_flag" ;; #( + *) : + ;; +esac # We select high optimization levels, provided we can turn off: # - strict type-based aliasing analysis (too risky for the OCaml runtime) @@ -14028,7 +15258,7 @@ fi esac # Enable SSE2 on x86 mingw to avoid using 80-bit registers. -case $host in #( +case $target in #( i686-*-mingw32*) : internal_cflags="$internal_cflags -mfpmath=sse -msse2" ;; #( *) : @@ -14038,7 +15268,7 @@ esac # Use 64-bit file offset if possible # See also AC_SYS_LARGEFILE # Problem: flags are added to CC rather than CPPFLAGS -case $host in #( +case $target in #( *-*-mingw32*|*-pc-windows) : ;; #( *) : @@ -14056,7 +15286,7 @@ esac if test x"$enable_shared" = "xno" then : supports_shared_libraries=false - case $host in #( + case $target in #( *-pc-windows|*-w64-mingw32*) : as_fn_error $? "Cannot build native Win32 with --disable-shared" "$LINENO" 5 ;; #( *) : @@ -14068,7 +15298,7 @@ fi # Define flexlink chain and flags correctly for the different Windows ports flexlink_flags='' -case $host in #( +case $target in #( i686-*-cygwin) : flexdll_chain='cygwin' flexlink_flags='-merge-manifest -stack 16777216' ;; #( @@ -14395,7 +15625,7 @@ fi fi -case $have_flexdll_h,$supports_shared_libraries,$host in #( +case $have_flexdll_h,$supports_shared_libraries,$target in #( no,true,*-*-cygwin*) : supports_shared_libraries=false { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: flexdll.h not found: shared library support disabled." >&5 @@ -14406,7 +15636,7 @@ printf "%s\n" "$as_me: WARNING: flexdll.h not found: shared library support disa ;; esac -case $flexdll_source_dir,$supports_shared_libraries,$flexlink,$host in #( +case $flexdll_source_dir,$supports_shared_libraries,$flexlink,$target in #( ,true,,*-*-cygwin*) : supports_shared_libraries=false { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: flexlink not found: shared library support disabled." >&5 @@ -14419,7 +15649,7 @@ esac mkexe_cmd_exp="$CC" -case $ocaml_cc_vendor,$host in #( +case $ocaml_cc_vendor,$target in #( *,x86_64-*-darwin*) : oc_ldflags='-Wl,-no_compact_unwind'; printf "%s\n" "#define HAS_ARCH_CODE32 1" >>confdefs.h @@ -14442,7 +15672,7 @@ else $as_nop fi ostype="Cygwin" ;; #( *,*-*-mingw32*) : - case $host in #( + case $target in #( i686-*-*) : oc_dll_ldflags="-static-libgcc" ;; #( *) : @@ -14477,6 +15707,8 @@ esac ;; #( gcc-*,powerpc-*-linux*) : oc_ldflags="-mbss-plt" ;; #( + *,*-*-none|*,*-*-elf*) : + ostype="None" ;; #( *) : ;; esac @@ -14655,7 +15887,7 @@ fi # Checks for header files # Don't check for unistd.h on Windows -case $host in #( +case $target in #( *-*-mingw32*|*-pc-windows) : ;; #( *) : @@ -15365,7 +16597,7 @@ fi # Full support for thread local storage # macOS and MinGW-w64 have problems with thread local storage accessed from DLLs -case $host in #( +case $target in #( *-apple-darwin*|*-mingw32*) : ;; #( *) : @@ -15386,7 +16618,7 @@ natdynlinkopts="" if test x"$enable_shared" != "xno" then : mkdll='' - case $host in #( + case $target in #( x86_64-apple-darwin*) : mkdll_flags=\ '-shared -undefined dynamic_lookup -Wl,-no_compact_unwind -Wl,-w' @@ -15417,7 +16649,7 @@ esac ;; #( *-*-linux*|*-*-freebsd[3-9]*|*-*-freebsd[1-9][0-9]*\ |*-*-openbsd*|*-*-netbsd*|*-*-dragonfly*|*-*-gnu*|*-*-haiku*) : sharedlib_cflags="-fPIC" - case $ocaml_cc_vendor,$host in #( + case $ocaml_cc_vendor,$target in #( gcc-*,powerpc-*-linux*) : mkdll_flags='-shared -mbss-plt' ;; #( *,i[3456]86-*) : @@ -15427,7 +16659,7 @@ esac ;; #( *) : mkdll_flags='-shared' ;; esac - case $host in #( + case $target in #( *-*-openbsd7.[3-9]|*-*-openbsd[89].*) : mkdll_flags="${mkdll_flags} -Wl,--no-execute-only" ;; #( *) : @@ -15457,7 +16689,7 @@ fi # Make sure code sections in OCaml-generated executables are readable # (required for marshaling of function closures) -case $host in #( +case $target in #( *-*-openbsd7.[3-9]|*-*-openbsd[89].*) : oc_ldflags="$oc_ldflags -Wl,--no-execute-only" natdynlinkopts="$natdynlinkopts -Wl,--no-execute-only" ;; #( @@ -15467,7 +16699,7 @@ esac # Disable control flow integrity -case $host in #( +case $target in #( *-*-openbsd7.[4-9]|*-*-openbsd[89].*) : oc_ldflags="$oc_ldflags -Wl,-z,nobtcfi" natdynlinkopts="$natdynlinkopts -Wl,-z,nobtcfi" ;; #( @@ -15482,7 +16714,7 @@ natdynlink=false if test x"$supports_shared_libraries" = 'xtrue' then : - case "$host" in #( + case "$target" in #( *-*-cygwin*) : natdynlink=true ;; #( *-*-mingw32*) : @@ -15560,7 +16792,7 @@ case $enable_native_toplevel,$natdynlink in #( esac # Try to work around the Skylake/Kaby Lake processor bug. -case "$ocaml_cc_vendor,$host" in #( +case "$ocaml_cc_vendor,$target" in #( *gcc*,x86_64-*|*gcc*,i686-*) : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler supports -fno-tree-vrp" >&5 @@ -15648,7 +16880,7 @@ system=unknown # preserving $arch = 'none' <=> $system = 'unknown' has_native_backend=no native_ldflags="" -case $host in #( +case $target in #( i[3456]86-*-linux*) : arch=i386; system=linux ;; #( i[3456]86-*-freebsd*) : @@ -15748,7 +16980,19 @@ fi ;; #( x86_64-*-cygwin*) : has_native_backend=yes; arch=amd64; system=cygwin ;; #( riscv64-*-linux*) : - has_native_backend=yes; arch=riscv; model=riscv64; system=linux + has_native_backend=yes; arch=riscv; model=riscv64; system=linux ;; #( + aarch64-*-none|arm64-*-none|aarch64-*-elf*|arm64-*-elf*) : + has_native_backend=yes; arch=arm64; system=none ;; #( + powerpc64le*-*-none|powerpc64le*-*-elf*) : + has_native_backend=yes; arch=power; model=ppc64le; system=none ;; #( + powerpc64*-*-none|powerpc64*-*-elf*) : + has_native_backend=yes; arch=power; model=ppc64; system=none ;; #( + riscv64-*-none|riscv64-*-elf*) : + has_native_backend=yes; arch=riscv; model=riscv64; system=none ;; #( + s390x*-*-none|s390x*-*-elf*) : + has_native_backend=yes; arch=s390x; model=z10; system=none ;; #( + x86_64-*-none|x86_64-*-elf*) : + has_native_backend=yes; arch=amd64; system=none ;; #( *) : ;; @@ -15813,10 +17057,10 @@ fi printf "%s\n" "#define OCAML_OS_TYPE \"$ostype\"" >>confdefs.h +target_os_type="$ostype" -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. -set dummy ${ac_tool_prefix}ld; ac_word=$2 +# Extract the first word of "$target_alias-ld", so it can be a program name with args. +set dummy $target_alias-ld; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_DIRECT_LD+y} @@ -15837,7 +17081,7 @@ do esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_DIRECT_LD="${ac_tool_prefix}ld" + ac_cv_prog_DIRECT_LD="$target_alias-ld" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi @@ -15857,10 +17101,10 @@ printf "%s\n" "no" >&6; } fi -fi if test -z "$ac_cv_prog_DIRECT_LD"; then - ac_ct_DIRECT_LD=$DIRECT_LD - # Extract the first word of "ld", so it can be a program name with args. + if test "$build" = "$target"; then + ac_ct_DIRECT_LD=$DIRECT_LD + # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } @@ -15901,16 +17145,9 @@ else printf "%s\n" "no" >&6; } fi - if test "x$ac_ct_DIRECT_LD" = x; then - DIRECT_LD="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac DIRECT_LD=$ac_ct_DIRECT_LD + else + DIRECT_LD="" fi else DIRECT_LD="$ac_cv_prog_DIRECT_LD" @@ -15918,7 +17155,7 @@ fi if test -z "$PARTIALLD" then : - case "$host,$ocaml_cc_vendor" in #( + case "$target,$ocaml_cc_vendor" in #( x86_64-*-darwin*,gcc-*) : PACKLD_FLAGS=' -arch x86_64' ;; #( powerpc64le*-*-linux*,gcc-*) : @@ -15965,7 +17202,7 @@ case $arch in #( # ocamlopt generates PIC code or doesn't generate code at all ;; #( *) : - case $host in #( + case $target in #( # expected to match "*-linux-musl" as well as "*-linux-musleabi*" *-linux-musl*) : # Alpine and other musl-based Linux distributions @@ -16168,7 +17405,7 @@ then : printf %s "checking whether round works... " >&6; } old_cross_compiling="$cross_compiling" - if test "x$host_runnable" = 'xtrue' + if test "x$target_runnable" = 'xtrue' then : cross_compiling='no' fi @@ -16236,7 +17473,7 @@ fi printf %s "checking whether fma works... " >&6; } old_cross_compiling="$cross_compiling" - if test "x$host_runnable" = 'xtrue' + if test "x$target_runnable" = 'xtrue' then : cross_compiling='no' fi @@ -16507,7 +17744,7 @@ fi ## On MacOS clock_gettime's CLOCK_MONOTONIC flag is not actually monotonic. ## mach_timebase_info and mach_absolute_time are used instead. -case $host in #( +case $target in #( *-*-windows) : has_monotonic_clock=true ;; #( *-apple-darwin*) : @@ -16567,7 +17804,7 @@ esac if test "x$enable_instrumented_runtime" != "xno" then : - case $host in #( + case $target in #( sparc-sun-solaris*) : instrumented_runtime=false ;; #( *-*-windows) : @@ -16952,7 +18189,7 @@ fi sockets=true -case $host in #( +case $target in #( *-*-mingw32*) : cclibs="$cclibs -lws2_32" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 @@ -17300,7 +18537,7 @@ fi ## socklen_t -case $host in #( +case $target in #( *-*-mingw32*|*-pc-windows) : ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include " @@ -17331,7 +18568,7 @@ fi ## Unix domain sockets support on Windows -case $host in #( +case $target in #( *-*-mingw32*|*-pc-windows) : for ac_header in afunix.h do : @@ -17353,7 +18590,7 @@ esac ipv6=true -case $host in #( +case $target in #( *-*-mingw32*|*-pc-windows) : ac_fn_c_check_type "$LINENO" "struct sockaddr_in6" "ac_cv_type_struct_sockaddr_in6" "#include " @@ -17473,7 +18710,7 @@ fi ## Note: this was defined in config/s-nt.h but the autoconf macros do not # seem to detect it properly on Windows so we hardcode the definition # of HAS_UTIME on Windows but this will probably need to be clarified -case $host in #( +case $target in #( *-*-mingw32*|*-pc-windows) : printf "%s\n" "#define HAS_UTIME 1" >>confdefs.h ;; #( @@ -17691,7 +18928,7 @@ fi ## gethostname # Note: detection fails on Windows so hardcoding the result # (should be debugged later) -case $host in #( +case $target in #( *-*-mingw32*|*-pc-windows) : printf "%s\n" "#define HAS_GETHOSTNAME 1" >>confdefs.h ;; #( @@ -17747,7 +18984,7 @@ fi ## setsid -case $host in #( +case $target in #( *-cygwin|*-*-mingw32*|*-pc-windows) : ;; #( *) : @@ -17788,7 +19025,7 @@ fi ## newlocale() and # Note: the detection fails on msvc so we hardcode the result # (should be debugged later) -case $host in #( +case $target in #( *-pc-windows) : printf "%s\n" "#define HAS_LOCALE_H 1" >>confdefs.h ;; #( @@ -17843,7 +19080,7 @@ fi ## strtod_l # Note: not detected on MSVC so hardcoding the result # (should be debugged later) -case $host in #( +case $target in #( *-pc-windows) : printf "%s\n" "#define HAS_STRTOD_L 1" >>confdefs.h ;; #( @@ -17860,7 +19097,7 @@ esac ## shared library support if $supports_shared_libraries then : - case $host in #( + case $target in #( *-*-mingw32*|*-pc-windows|*-*-cygwin*) : DLLIBS="" ;; #( *) : @@ -17960,7 +19197,7 @@ fi ## -fdebug-prefix-map support by the C compiler -case $ocaml_cc_vendor,$host in #( +case $ocaml_cc_vendor,$target in #( *,*-*-mingw32*) : cc_has_debug_prefix_map=false ;; #( *,*-pc-windows) : @@ -18571,9 +19808,8 @@ fi fi -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +# Extract the first word of "$target_alias-pkg-config", so it can be a program name with args. +set dummy $target_alias-pkg-config; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_PKG_CONFIG+y} @@ -18617,10 +19853,10 @@ printf "%s\n" "no" >&6; } fi -fi if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. + if test "$build" = "$target"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } @@ -18652,6 +19888,7 @@ done done IFS=$as_save_IFS + test -z "$ac_cv_path_ac_pt_PKG_CONFIG" && ac_cv_path_ac_pt_PKG_CONFIG="false" ;; esac fi @@ -18664,16 +19901,9 @@ else printf "%s\n" "no" >&6; } fi - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac PKG_CONFIG=$ac_pt_PKG_CONFIG + else + PKG_CONFIG="false" fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" @@ -18760,9 +19990,9 @@ fi # library available, but not have the DLL in PATH. This then causes the build to # fail as soon as ocamlrun is first executed. This check avoids automatically # enabling zstd when the resulting executable doesn't actually work. -case $host in #( +case $target in #( *-w64-mingw32*|*-pc-windows) : - check_zstd_runs=$host_runnable ;; #( + check_zstd_runs=$target_runnable ;; #( *) : check_zstd_runs=false ;; esac @@ -18896,7 +20126,7 @@ esac ## Determine how to link with the POSIX threads library -case $host in #( +case $target in #( *-*-mingw32*) : PTHREAD_LIBS="-l:libpthread.a -lgcc_eh" ;; #( *-pc-windows) : @@ -19764,7 +20994,7 @@ as_has_debug_prefix_map=false asm_cfi_supported=false if $native_compiler then : - case $host in #( + case $target in #( *-*-mingw32*|*-pc-windows) : ;; #( *) : @@ -19937,7 +21167,7 @@ fi if test x"$enable_frame_pointers" = "xyes" then : - case "$host,$ocaml_cc_vendor" in #( + case "$target,$ocaml_cc_vendor" in #( x86_64-*-linux*,gcc-*|x86_64-*-linux*,clang-*) : common_cflags="$common_cflags -g -fno-omit-frame-pointer" frame_pointers=true @@ -20351,7 +21581,7 @@ oc_cppflags="$common_cppflags $internal_cppflags" ocamlc_cflags="$ocamlc_cflags $common_cflags $sharedlib_cflags $CFLAGS" ocamlc_cppflags="$common_cppflags $CPPFLAGS" -case $host in #( +case $target in #( *-*-mingw32*) : cclibs="$cclibs -lole32 -luuid -lversion" ;; #( *-pc-windows) : @@ -20379,7 +21609,7 @@ then : mandir='${prefix}/man' fi -case $host in #( +case $target in #( *-*-mingw32*|*-pc-windows) : case $WINDOWS_UNICODE_MODE in #( ansi) : @@ -20424,7 +21654,7 @@ fi # Define a few macros that were defined in config/m-nt.h # but whose value is not guessed properly by configure # (all this should be understood and fixed) -case $host in #( +case $target in #( *-*-mingw32*) : printf "%s\n" "#define HAS_BROKEN_PRINTF 1" >>confdefs.h diff --git a/configure.ac b/configure.ac index 0c9d63859a96..2a1cc9995fa8 100644 --- a/configure.ac +++ b/configure.ac @@ -140,6 +140,7 @@ AC_SUBST([arch_specific_SOURCES]) AC_SUBST([arch64]) AC_SUBST([model]) AC_SUBST([system]) +AC_SUBST([target_os_type]) AC_SUBST([native_cflags]) AC_SUBST([native_cppflags]) AC_SUBST([systhread_support]) @@ -286,7 +287,32 @@ AC_CONFIG_COMMANDS_PRE(OCAML_QUOTED_STRING_ID) AC_CANONICAL_BUILD AC_CANONICAL_HOST +# Allow "ocaml" as target OS for freestanding compiler by temporarily rewriting +# the target OS to "none" to generate the canonical target +real_target_alias="$target_alias" +AS_CASE([$target_alias], + [*-*-*-ocaml], + [ac_save_IFS=$IFS + IFS='-' + set x $target_alias + target_alias="$2-$3-none" + IFS=$ac_save_IFS], + [*-*-ocaml], + [ac_save_IFS=$IFS + IFS='-' + set x $target_alias + target_alias="$2-none" + IFS=$ac_save_IFS]) AC_CANONICAL_TARGET +target_alias="$real_target_alias" + +# Override cross_compiling and ac_tool_prefix variables since the C toolchain is +# used to generate target code when building a cross compiler +AS_IF([test x"$build" = x"$target"], + [cross_compiling=no], + [cross_compiling=yes]) +AS_IF([test -n "$target_alias"], + [ac_tool_prefix=$target_alias-]) # Ensure that AC_CONFIG_LINKS will either create symlinks which are compatible # with native Windows (i.e. NTFS symlinks, not WSL or Cygwin-emulated ones) or @@ -300,7 +326,7 @@ AS_CASE([$host], # Systems that are known not to work, even in bytecode only. -AS_CASE([$host], +AS_CASE([$target], [*-pc-windows], [AC_MSG_ERROR([the MSVC compiler is not supported currently], 69)], [i386-*-solaris*], @@ -310,7 +336,7 @@ If your host is 64 bits, you can try with './configure CC="gcc -m64"' \ # MSVC special case -AS_CASE([$host], +AS_CASE([$target], [*-pc-windows], [CC=cl ccomptype=msvc @@ -589,7 +615,17 @@ AS_IF([test x"$enable_ocamldoc" = "xno"], # Initialization of libtool # Allow the MSVC linker to be found even if ld isn't installed. # User-specified LD still takes precedence. -AC_CHECK_TOOLS([LD],[ld link]) +AC_CHECK_TARGET_TOOLS([LD],[ld link]) +# libtool will detect a build-to-host C toolchain but when building an OCaml +# cross compiler we need the C toolchain to build the target runtime so we +# temporarily define host* values as macros for target* values so that the +# proper toolchain is configured. Note that host=target unless we are building a +# cross compiler so this is transparent for the usual use case. +pushdef([host], target)dnl +pushdef([host_alias], target_alias)dnl +pushdef([host_cpu], target_cpu)dnl +pushdef([host_vendor], target_vendor)dnl +pushdef([host_os], target_os)dnl # libtool expects host_os=mingw for native Windows # Also, it has been observed that, on some platforms (e.g. msvc) LT_INIT # alters the CFLAGS variable, so we save its value before calling the macro @@ -600,6 +636,11 @@ saved_CFLAGS="$CFLAGS" LT_INIT CFLAGS="$saved_CFLAGS" host_os=$old_host_os +popdef([host_os])dnl +popdef([host_vendor])dnl +popdef([host_cpu])dnl +popdef([host_alias])dnl +popdef([host])dnl AS_CASE([$host], [sparc-sun-solaris*], @@ -624,7 +665,7 @@ AS_CASE([$enable_dependency_generation], [compute_deps=true])], [compute_deps=false])]) -AS_CASE([$host], +AS_CASE([$target], # In config/Makefile.mingw*, we had: # TARGET=i686-w64-mingw32 and x86_64-w64-mingw32 # TOOLPREF=$(TARGET)- @@ -636,7 +677,7 @@ AS_CASE([$host], mkexe_via_cc_extra_cmd=' && $(call MERGEMANIFESTEXE,$(1))' libext=lib AR="" - AS_IF([test "$host_cpu" = "x86_64" ], + AS_IF([test "$target_cpu" = "x86_64" ], [machine="-machine:AMD64 "], [machine=""]) mklib="link -lib -nologo $machine /out:\$(1) \$(2)" @@ -650,7 +691,7 @@ OCAML_CC_VENDOR ## In cross-compilation mode, can we run executables produced? # At the moment, it's required, but the fact is used in C99 function detection -OCAML_HOST_IS_EXECUTABLE +OCAML_TARGET_IS_EXECUTABLE # Determine how to call the C preprocessor directly. # Most of the time, calling the C preprocessor through the C compiler is @@ -697,21 +738,24 @@ AS_CASE([lt_cv_ar_at_file], [no], [ar_supports_response_files=false], [ar_supports_response_files=true]) -# Libraries to build depending on the host +# Libraries to build depending on the target AS_CASE([$host], [*-*-mingw32*|*-pc-windows], - [unix_or_win32="win32" - ln='cp -pf' + [ln='cp -pf' + ocamlsrcdir="$(LC_ALL=C.UTF-8 cygpath -w -- "$ocamlsrcdir")"], + [ln='ln -sf']) + +AS_CASE([$target], + [*-*-mingw32*|*-pc-windows], + [unix_or_win32="win32" # or should it be tested against host? ocamltest_libunix="Some false" - ocamlsrcdir="$(LC_ALL=C.UTF-8 cygpath -w -- "$ocamlsrcdir")" ocamlyacc_wstr_module="yacc/wstr"], [unix_or_win32="unix" - ln='ln -sf' ocamltest_libunix="Some true" ocamlyacc_wstr_module=""]) -AS_CASE([$host], +AS_CASE([$target], [*-*-cygwin*|*-*-mingw32*|*-pc-windows], [exeext=".exe"], [exeext='']) @@ -746,7 +790,7 @@ AC_SYS_INTERPRETER shebangscripts=false launch_method='exe' AS_IF([test "x$interpval" = "xyes"], - [AS_CASE([$host], + [AS_CASE([$target], [*-cygwin], [# Cygwin supports shebangs, which we use for the compiler itself, but # partially for legacy, and partially so that executables can be easily @@ -785,7 +829,23 @@ dnl nefarious single quotes which may appear in any of the strings. AS_IF( [test x"$host" = x"$target"], [cross_compiler=false], - [cross_compiler=true]) + [cross_compiler=true + # We require a non-cross-compiler of the same version + AC_MSG_CHECKING([the version of the installed OCaml compiler]) + already_installed_version=`ocamlc -vnum` + AS_IF([test x"AC_PACKAGE_VERSION" = x"$already_installed_version"], + [AC_MSG_RESULT([compatible (AC_PACKAGE_VERSION)])], + [AC_MSG_ERROR(m4_normalize([incompatible (AC_PACKAGE_VERSION vs + $already_installed_version)]))])]) + +AS_IF( + [test x"$build" = x"$target" -o x"$target_runnable" = xtrue], + [CC_FOR_BUILD='$(CC)' + CFLAGS_FOR_BUILD='$(CFLAGS)' + CPPFLAGS_FOR_BUILD='$(CPPFLAGS)' + LDFLAGS_FOR_BUILD='$(LDFLAGS)'], + [AC_MSG_NOTICE([detecting the C toolchain for build]) + AX_PROG_CC_FOR_BUILD]) # Checks for programs @@ -870,14 +930,14 @@ AS_CASE([$ocaml_cc_vendor], [common_cflags="-O"]) # Enable SSE2 on x86 mingw to avoid using 80-bit registers. -AS_CASE([$host], +AS_CASE([$target], [i686-*-mingw32*], [internal_cflags="$internal_cflags -mfpmath=sse -msse2"]) # Use 64-bit file offset if possible # See also AC_SYS_LARGEFILE # Problem: flags are added to CC rather than CPPFLAGS -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*|*-pc-windows], [], [common_cppflags="$common_cppflags -D_FILE_OFFSET_BITS=64"]) @@ -891,14 +951,14 @@ AS_CASE([$host], AS_IF([test x"$enable_shared" = "xno"], [supports_shared_libraries=false - AS_CASE([$host], + AS_CASE([$target], [*-pc-windows|*-w64-mingw32*], [AC_MSG_ERROR([Cannot build native Win32 with --disable-shared])])], [supports_shared_libraries=true]) # Define flexlink chain and flags correctly for the different Windows ports flexlink_flags='' -AS_CASE([$host], +AS_CASE([$target], [i686-*-cygwin], [flexdll_chain='cygwin' flexlink_flags='-merge-manifest -stack 16777216'], @@ -987,14 +1047,14 @@ AS_IF([test x"$supports_shared_libraries" != 'xfalse'], [ ]) ]) -AS_CASE([$have_flexdll_h,$supports_shared_libraries,$host], +AS_CASE([$have_flexdll_h,$supports_shared_libraries,$target], [no,true,*-*-cygwin*], [supports_shared_libraries=false AC_MSG_WARN([flexdll.h not found: shared library support disabled.])], [no,*,*-w64-mingw32*|no,*,*-pc-windows], [AC_MSG_ERROR([flexdll.h is required for native Win32])]) -AS_CASE([$flexdll_source_dir,$supports_shared_libraries,$flexlink,$host], +AS_CASE([$flexdll_source_dir,$supports_shared_libraries,$flexlink,$target], [,true,,*-*-cygwin*], [supports_shared_libraries=false AC_MSG_WARN([flexlink not found: shared library support disabled.])], @@ -1003,7 +1063,7 @@ AS_CASE([$flexdll_source_dir,$supports_shared_libraries,$flexlink,$host], mkexe_cmd_exp="$CC" -AS_CASE([$ocaml_cc_vendor,$host], +AS_CASE([$ocaml_cc_vendor,$target], [*,x86_64-*-darwin*], [oc_ldflags='-Wl,-no_compact_unwind'; AC_DEFINE([HAS_ARCH_CODE32], [1])], @@ -1021,7 +1081,7 @@ AS_CASE([$ocaml_cc_vendor,$host], ) ostype="Cygwin"], [*,*-*-mingw32*], - [AS_CASE([$host], + [AS_CASE([$target], [i686-*-*], [oc_dll_ldflags="-static-libgcc"]) ostype="Win32" toolchain="mingw" @@ -1049,7 +1109,9 @@ AS_CASE([$ocaml_cc_vendor,$host], [oc_ldflags='-brtl -bexpfull' AC_DEFINE([HAS_ARCH_CODE32], [1])], [gcc-*,powerpc-*-linux*], - [oc_ldflags="-mbss-plt"]) + [oc_ldflags="-mbss-plt"], + [*,*-*-none|*,*-*-elf*], + [ostype="None"]) ## Program to use to install files AC_PROG_INSTALL @@ -1066,7 +1128,7 @@ AC_SEARCH_LIBS([cos], [m], # Checks for header files # Don't check for unistd.h on Windows -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*|*-pc-windows], [], [AC_CHECK_HEADERS([unistd.h],[AC_DEFINE([HAS_UNISTD])])]) @@ -1165,7 +1227,7 @@ AS_IF([! $cc_supports_atomic], # Full support for thread local storage # macOS and MinGW-w64 have problems with thread local storage accessed from DLLs -AS_CASE([$host], +AS_CASE([$target], [*-apple-darwin*|*-mingw32*], [], [AC_DEFINE([HAS_FULL_THREAD_VARIABLES])] ) @@ -1181,7 +1243,7 @@ natdynlinkopts="" AS_IF([test x"$enable_shared" != "xno"], [mkdll='' - AS_CASE([$host], + AS_CASE([$target], [x86_64-apple-darwin*], [mkdll_flags=\ '-shared -undefined dynamic_lookup -Wl,-no_compact_unwind -Wl,-w' @@ -1209,7 +1271,7 @@ AS_IF([test x"$enable_shared" != "xno"], [[*-*-linux*|*-*-freebsd[3-9]*|*-*-freebsd[1-9][0-9]*\ |*-*-openbsd*|*-*-netbsd*|*-*-dragonfly*|*-*-gnu*|*-*-haiku*]], [sharedlib_cflags="-fPIC" - AS_CASE([$ocaml_cc_vendor,$host], + AS_CASE([$ocaml_cc_vendor,$target], [gcc-*,powerpc-*-linux*], [mkdll_flags='-shared -mbss-plt'], [[*,i[3456]86-*]], @@ -1217,7 +1279,7 @@ AS_IF([test x"$enable_shared" != "xno"], # See https://github.com/ocaml/ocaml/issues/9800 [mkdll_flags='-shared -Wl,-z,notext'], [mkdll_flags='-shared']) - AS_CASE([$host], + AS_CASE([$target], [[*-*-openbsd7.[3-9]|*-*-openbsd[89].*]], [mkdll_flags="${mkdll_flags} -Wl,--no-execute-only"]) oc_ldflags="$oc_ldflags -Wl,-E" @@ -1237,14 +1299,14 @@ AS_IF([test -z "$mkmaindll"], # Make sure code sections in OCaml-generated executables are readable # (required for marshaling of function closures) -AS_CASE([$host], +AS_CASE([$target], [[*-*-openbsd7.[3-9]|*-*-openbsd[89].*]], [oc_ldflags="$oc_ldflags -Wl,--no-execute-only" natdynlinkopts="$natdynlinkopts -Wl,--no-execute-only"]) # Disable control flow integrity -AS_CASE([$host], +AS_CASE([$target], [[*-*-openbsd7.[4-9]|*-*-openbsd[89].*]], [oc_ldflags="$oc_ldflags -Wl,-z,nobtcfi" natdynlinkopts="$natdynlinkopts -Wl,-z,nobtcfi"]) @@ -1255,7 +1317,7 @@ AS_CASE([$host], natdynlink=false AS_IF([test x"$supports_shared_libraries" = 'xtrue'], - [AS_CASE(["$host"], + [AS_CASE(["$target"], [*-*-cygwin*], [natdynlink=true], [*-*-mingw32*], [natdynlink=true], [*-pc-windows], [natdynlink=true], @@ -1297,7 +1359,7 @@ AS_CASE([$enable_native_toplevel,$natdynlink], [install_ocamlnat=false]) # Try to work around the Skylake/Kaby Lake processor bug. -AS_CASE(["$ocaml_cc_vendor,$host"], +AS_CASE(["$ocaml_cc_vendor,$target"], [*gcc*,x86_64-*|*gcc*,i686-*], [OCAML_CC_HAS_FNO_TREE_VRP AS_IF([$cc_has_fno_tree_vrp], @@ -1318,7 +1380,7 @@ system=unknown # preserving $arch = 'none' <=> $system = 'unknown' has_native_backend=no native_ldflags="" -AS_CASE([$host], +AS_CASE([$target], [[i[3456]86-*-linux*]], [arch=i386; system=linux], [[i[3456]86-*-freebsd*]], @@ -1415,7 +1477,19 @@ AS_CASE([$host], [x86_64-*-cygwin*], [has_native_backend=yes; arch=amd64; system=cygwin], [riscv64-*-linux*], - [has_native_backend=yes; arch=riscv; model=riscv64; system=linux] + [has_native_backend=yes; arch=riscv; model=riscv64; system=linux], + [aarch64-*-none|arm64-*-none|aarch64-*-elf*|arm64-*-elf*], + [has_native_backend=yes; arch=arm64; system=none], + [powerpc64le*-*-none|powerpc64le*-*-elf*], + [has_native_backend=yes; arch=power; model=ppc64le; system=none], + [powerpc64*-*-none|powerpc64*-*-elf*], + [has_native_backend=yes; arch=power; model=ppc64; system=none], + [riscv64-*-none|riscv64-*-elf*], + [has_native_backend=yes; arch=riscv; model=riscv64; system=none], + [s390x*-*-none|s390x*-*-elf*], + [has_native_backend=yes; arch=s390x; model=z10; system=none], + [x86_64-*-none|x86_64-*-elf*], + [has_native_backend=yes; arch=amd64; system=none] ) AS_CASE([$arch], @@ -1454,10 +1528,11 @@ AS_IF([$natdynlink], [natdynlink_archive=""]) AC_DEFINE_UNQUOTED([OCAML_OS_TYPE], ["$ostype"]) +target_os_type="$ostype" -AC_CHECK_TOOL([DIRECT_LD],[ld]) +AC_CHECK_TARGET_TOOL([DIRECT_LD],[ld]) AS_IF([test -z "$PARTIALLD"], - [AS_CASE(["$host,$ocaml_cc_vendor"], + [AS_CASE(["$target,$ocaml_cc_vendor"], [x86_64-*-darwin*,gcc-*], [PACKLD_FLAGS=' -arch x86_64'], [powerpc64le*-*-linux*,gcc-*], [PACKLD_FLAGS=' -m elf64lppc'], [powerpc*-*-linux*,gcc-*], @@ -1492,7 +1567,7 @@ AS_CASE([$arch], [amd64|arm64|s390x|none], # ocamlopt generates PIC code or doesn't generate code at all [], - [AS_CASE([$host], + [AS_CASE([$target], # expected to match "*-linux-musl" as well as "*-linux-musleabi*" [*-linux-musl*], # Alpine and other musl-based Linux distributions @@ -1626,7 +1701,7 @@ AC_CHECK_FUNC([issetugid], [AC_DEFINE([HAS_ISSETUGID])]) ## On MacOS clock_gettime's CLOCK_MONOTONIC flag is not actually monotonic. ## mach_timebase_info and mach_absolute_time are used instead. -AS_CASE([$host], +AS_CASE([$target], [*-*-windows], [has_monotonic_clock=true], [*-apple-darwin*], [ @@ -1662,7 +1737,7 @@ AS_CASE([$host], # clock source is missing. AS_IF([test "x$enable_instrumented_runtime" != "xno" ], [ - AS_CASE([$host], + AS_CASE([$target], [sparc-sun-solaris*], [instrumented_runtime=false], [*-*-windows], @@ -1852,7 +1927,7 @@ AS_IF([$tsan], sockets=true -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*], [cclibs="$cclibs -lws2_32" AC_SEARCH_LIBS([socket], [ws2_32]) @@ -1880,7 +1955,7 @@ AS_IF([$sockets], [AC_DEFINE([HAS_SOCKETS])]) ## socklen_t -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*|*-pc-windows], [AC_CHECK_TYPE([socklen_t], [AC_DEFINE([HAS_SOCKLEN_T])], [], [#include ])], @@ -1891,7 +1966,7 @@ AC_CHECK_FUNC([inet_aton], [AC_DEFINE([HAS_INET_ATON])]) ## Unix domain sockets support on Windows -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*|*-pc-windows], [AC_CHECK_HEADERS([afunix.h], [AC_DEFINE([HAS_AFUNIX_H])], [], [#include ])]) @@ -1900,7 +1975,7 @@ AS_CASE([$host], ipv6=true -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*|*-pc-windows], [AC_CHECK_TYPE( [struct sockaddr_in6], [], [ipv6=false], [#include ])], @@ -1940,7 +2015,7 @@ AC_CHECK_DECL([system], [AC_DEFINE([HAS_SYSTEM])], [], [[#include ]]) ## Note: this was defined in config/s-nt.h but the autoconf macros do not # seem to detect it properly on Windows so we hardcode the definition # of HAS_UTIME on Windows but this will probably need to be clarified -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*|*-pc-windows], [AC_DEFINE([HAS_UTIME])], [AC_CHECK_HEADER([sys/types.h], [AC_CHECK_HEADER([utime.h], @@ -2017,7 +2092,7 @@ AC_CHECK_FUNC([setitimer], ## gethostname # Note: detection fails on Windows so hardcoding the result # (should be debugged later) -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*|*-pc-windows], [AC_DEFINE([HAS_GETHOSTNAME])], [AC_CHECK_FUNC([gethostname], [AC_DEFINE([HAS_GETHOSTNAME])])]) @@ -2041,7 +2116,7 @@ AC_CHECK_FUNC([mktime], [AC_DEFINE([HAS_MKTIME])]) ## setsid -AS_CASE([$host], +AS_CASE([$target], [*-cygwin|*-*-mingw32*|*-pc-windows], [], [AC_CHECK_FUNC([setsid], [AC_DEFINE([HAS_SETSID])])]) @@ -2057,7 +2132,7 @@ AC_CHECK_FUNC([setenv], ## newlocale() and # Note: the detection fails on msvc so we hardcode the result # (should be debugged later) -AS_CASE([$host], +AS_CASE([$target], [*-pc-windows], [AC_DEFINE([HAS_LOCALE_H])], [AC_CHECK_HEADER([locale.h], [AC_CHECK_FUNC([newlocale], @@ -2072,13 +2147,13 @@ AC_CHECK_HEADER([xlocale.h], ## strtod_l # Note: not detected on MSVC so hardcoding the result # (should be debugged later) -AS_CASE([$host], +AS_CASE([$target], [*-pc-windows], [AC_DEFINE([HAS_STRTOD_L])], [AC_CHECK_FUNC([strtod_l], [AC_DEFINE([HAS_STRTOD_L])])]) ## shared library support AS_IF([$supports_shared_libraries], - [AS_CASE([$host], + [AS_CASE([$target], [*-*-mingw32*|*-pc-windows|*-*-cygwin*], [DLLIBS=""], [AC_CHECK_FUNC([dlopen], @@ -2104,7 +2179,7 @@ AC_CHECK_HEADER([sys/mman.h], AC_CHECK_FUNC([pwrite], [AC_DEFINE([HAS_PWRITE])]) ## -fdebug-prefix-map support by the C compiler -AS_CASE([$ocaml_cc_vendor,$host], +AS_CASE([$ocaml_cc_vendor,$target], [*,*-*-mingw32*], [cc_has_debug_prefix_map=false], [*,*-pc-windows], [cc_has_debug_prefix_map=false], [xlc*,powerpc-ibm-aix*], [cc_has_debug_prefix_map=false], @@ -2207,7 +2282,7 @@ AC_CHECK_HEADER([spawn.h], [AC_CHECK_FUNC([posix_spawn], [AC_CHECK_FUNC([posix_spawnp], [AC_DEFINE([HAS_POSIX_SPAWN])])])]) -AC_PATH_TOOL([PKG_CONFIG], [pkg-config], [false]) +AC_PATH_TARGET_TOOL([PKG_CONFIG], [pkg-config], [false]) ## ZSTD compression library @@ -2238,9 +2313,9 @@ AS_IF([test x"$with_zstd" != "xno"], # library available, but not have the DLL in PATH. This then causes the build to # fail as soon as ocamlrun is first executed. This check avoids automatically # enabling zstd when the resulting executable doesn't actually work. -AS_CASE([$host], +AS_CASE([$target], [*-w64-mingw32*|*-pc-windows], - [check_zstd_runs=$host_runnable], + [check_zstd_runs=$target_runnable], [check_zstd_runs=false]) AS_IF([test x"$zstd_status" = "xok"],[ @@ -2308,7 +2383,7 @@ AS_CASE([$enable_debug_runtime], ## Determine how to link with the POSIX threads library -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*], [PTHREAD_LIBS="-l:libpthread.a -lgcc_eh"], [*-pc-windows], @@ -2373,7 +2448,7 @@ AS_CASE([$enable_systhreads,$enable_unix_lib], as_has_debug_prefix_map=false asm_cfi_supported=false AS_IF([$native_compiler], - [AS_CASE([$host], + [AS_CASE([$target], [*-*-mingw32*|*-pc-windows], [], [OCAML_AS_HAS_DEBUG_PREFIX_MAP OCAML_AS_HAS_CFI_DIRECTIVES])]) @@ -2381,7 +2456,7 @@ AS_IF([$native_compiler], ## Frame pointers AS_IF([test x"$enable_frame_pointers" = "xyes"], - [AS_CASE(["$host,$ocaml_cc_vendor"], + [AS_CASE(["$target,$ocaml_cc_vendor"], [x86_64-*-linux*,gcc-*|x86_64-*-linux*,clang-*], [common_cflags="$common_cflags -g -fno-omit-frame-pointer" frame_pointers=true @@ -2544,7 +2619,7 @@ oc_cppflags="$common_cppflags $internal_cppflags" ocamlc_cflags="$ocamlc_cflags $common_cflags $sharedlib_cflags $CFLAGS" ocamlc_cppflags="$common_cppflags $CPPFLAGS" -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*], [cclibs="$cclibs -lole32 -luuid -lversion"], [*-pc-windows], @@ -2563,7 +2638,7 @@ AS_IF([test x"$libdir" = x'${exec_prefix}/lib'], AS_IF([test x"$mandir" = x'${datarootdir}/man'], [mandir='${prefix}/man']) -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*|*-pc-windows], [AS_CASE([$WINDOWS_UNICODE_MODE], [ansi], @@ -2588,7 +2663,7 @@ AS_IF([test x"$prefix" = "xNONE"], # Define a few macros that were defined in config/m-nt.h # but whose value is not guessed properly by configure # (all this should be understood and fixed) -AS_CASE([$host], +AS_CASE([$target], [*-*-mingw32*], [AC_DEFINE([HAS_BROKEN_PRINTF]) AC_DEFINE([HAS_STRERROR]) diff --git a/middle_end/closure/closure.ml b/middle_end/closure/closure.ml index 880773fbac09..b78feab118c9 100644 --- a/middle_end/closure/closure.ml +++ b/middle_end/closure/closure.ml @@ -1058,9 +1058,9 @@ let rec close ({ backend; fenv; cenv ; mutable_vars } as env) lam = | Word_size -> make_const_int (8*B.size_int) | Int_size -> make_const_int (8*B.size_int - 1) | Max_wosize -> make_const_int ((1 lsl ((8*B.size_int) - 10)) - 1 ) - | Ostype_unix -> make_const_bool (Sys.os_type = "Unix") - | Ostype_win32 -> make_const_bool (Sys.os_type = "Win32") - | Ostype_cygwin -> make_const_bool (Sys.os_type = "Cygwin") + | Ostype_unix -> make_const_bool (Config.target_os_type = "Unix") + | Ostype_win32 -> make_const_bool (Config.target_os_type = "Win32") + | Ostype_cygwin -> make_const_bool (Config.target_os_type = "Cygwin") | Backend_type -> make_const_int 0 (* tag 0 is the same as Native here *) in diff --git a/otherlibs/Makefile.otherlibs.common b/otherlibs/Makefile.otherlibs.common index 53667c795488..31bbb9a52ee6 100644 --- a/otherlibs/Makefile.otherlibs.common +++ b/otherlibs/Makefile.otherlibs.common @@ -34,7 +34,7 @@ COMPFLAGS=-absname -w +a-4-9-41-42-44-45-48 -warn-error +A -bin-annot -g \ ifeq "$(FLAMBDA)" "true" OPTCOMPFLAGS += -O3 endif -MKLIB=$(OCAMLRUN) $(ROOTDIR)/tools/ocamlmklib +MKLIB=$(OCAMLRUN) $(ROOTDIR)/tools/ocamlmklib$(EXE) # Variables that must be defined by individual libraries: # LIBNAME diff --git a/runtime/amd64.S b/runtime/amd64.S index 49c712b16753..be0856a72b2a 100644 --- a/runtime/amd64.S +++ b/runtime/amd64.S @@ -1386,7 +1386,7 @@ G(caml_negf_mask): G(caml_absf_mask): .quad 0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF -#if defined(SYS_linux) +#if defined(SYS_linux) || defined(SYS_none) /* Mark stack as non-executable, PR#4564 */ .section .note.GNU-stack,"",%progbits #endif diff --git a/runtime/unix.c b/runtime/unix.c index b5fd4de17b9c..c0677e09ace0 100644 --- a/runtime/unix.c +++ b/runtime/unix.c @@ -27,13 +27,12 @@ #include #include #include +#include "caml/config.h" #ifdef HAS_GETTIMEOFDAY #include #endif #include #include -#include -#include "caml/config.h" #if defined(SUPPORT_DYNAMIC_LINKING) && !defined(BUILDING_LIBCAMLRUNS) #define WITH_DYNAMIC_LINKING #ifdef __CYGWIN__ @@ -47,7 +46,7 @@ #endif #ifdef HAS_POSIX_MONOTONIC_CLOCK #include -#elif HAS_CLOCK_GETTIME_NSEC_NP +#elif defined(HAS_CLOCK_GETTIME_NSEC_NP) #include #endif #ifdef HAS_DIRENT diff --git a/stdlib/Makefile b/stdlib/Makefile index 50f825a1b322..a7f2e60a7aa0 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -96,10 +96,7 @@ endif .INTERMEDIATE: tmpheader.exe tmpheader.exe: $(HEADERPROGRAM).$(O) $(V_MKEXE)$(call MKEXE_VIA_CC,$@,$^) -# FIXME This is wrong - mingw could invoke strip; MSVC equivalent? -ifneq "$(UNIX_OR_WIN32)" "win32" - strip $@ -endif + $(STRIP) $@ stdlib.cma: $(OBJS) $(V_LINKC)$(CAMLC) -a -o $@ $^ diff --git a/utils/config.common.ml.in b/utils/config.common.ml.in index 15043dae8432..ef9f4da4d9fa 100644 --- a/utils/config.common.ml.in +++ b/utils/config.common.ml.in @@ -101,7 +101,7 @@ let configuration_variables () = p "ext_asm" ext_asm; p "ext_lib" ext_lib; p "ext_dll" ext_dll; - p "os_type" Sys.os_type; + p "os_type" target_os_type; p "default_executable_name" default_executable_name; p_bool "systhread_supported" systhread_supported; p "host" host; diff --git a/utils/config.fixed.ml b/utils/config.fixed.ml index 9374f4464acc..99396610d67f 100644 --- a/utils/config.fixed.ml +++ b/utils/config.fixed.ml @@ -57,6 +57,8 @@ let tsan = false let architecture = "none" let model = "default" let system = "unknown" +let target_os_type = + "The boot compiler should not be using Config.target_os_type" let asm = boot_cannot_call "the assembler" let asm_cfi_supported = false let with_frame_pointers = false diff --git a/utils/config.generated.ml.in b/utils/config.generated.ml.in index 1d22c1d7f619..0dfa638270a3 100644 --- a/utils/config.generated.ml.in +++ b/utils/config.generated.ml.in @@ -71,6 +71,7 @@ let native_compiler = @native_compiler@ let architecture = {@QS@|@arch@|@QS@} let model = {@QS@|@model@|@QS@} let system = {@QS@|@system@|@QS@} +let target_os_type = {@QS@|@target_os_type@|@QS@} let asm = {@QS@|@AS@|@QS@} let asm_cfi_supported = @asm_cfi_supported@ diff --git a/utils/config.mli b/utils/config.mli index f1e1d04bd439..000d18b88f1c 100644 --- a/utils/config.mli +++ b/utils/config.mli @@ -167,6 +167,12 @@ val model: string val system: string (** Name of operating system for the native-code compiler *) +val target_os_type: string +(** Operating system targetted by the native-code compiler. One of +- ["Unix"] (for all Unix versions, including Linux and Mac OS X), +- ["Win32"] (for MS-Windows, OCaml compiled with MSVC++ or MinGW-w64), +- ["Cygwin"] (for MS-Windows, OCaml compiled with Cygwin). *) + val asm: string (** The assembler (and flags) to use for assembling ocamlopt-generated code. *)