summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWojciech Meyer <wojciech.meyer@gmail.com>2013-06-30 12:58:35 +0000
committerWojciech Meyer <wojciech.meyer@gmail.com>2013-06-30 12:58:35 +0000
commite5eeea88af186f2e16eca05fb62ef1a4b71d3b7f (patch)
tree67af454c340fcf5e1ef5a7913cab3357e8b684d5
parentfdf9cde11debd66758f032118d3d4b7e21310aff (diff)
configure: store $target and $host in the build configuration.
(Patch by Adrien Nader!) git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13857 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--Makefile2
-rw-r--r--bytecomp/bytelink.ml5
-rwxr-xr-xconfigure2
-rw-r--r--utils/config.mlbuild5
-rw-r--r--utils/config.mli6
-rw-r--r--utils/config.mlp5
6 files changed, 23 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 10c80d2f5..d3c8f69e7 100644
--- a/Makefile
+++ b/Makefile
@@ -425,6 +425,8 @@ utils/config.ml: utils/config.mlp config/Makefile
-e 's|%%MKDLL%%|$(MKDLL)|' \
-e 's|%%MKEXE%%|$(MKEXE)|' \
-e 's|%%MKMAINDLL%%|$(MKMAINDLL)|' \
+ -e 's|%%HOST%%|$(HOST)|' \
+ -e 's|%%TARGET%%|$(TARGET)|' \
utils/config.mlp > utils/config.ml
@chmod -w utils/config.ml
diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
index 3751a0b77..b5c08898d 100644
--- a/bytecomp/bytelink.ml
+++ b/bytecomp/bytelink.ml
@@ -307,7 +307,8 @@ let link_bytecode ppf tolink exec_name standalone =
Symtable.init();
Consistbl.clear crc_interfaces;
let sharedobjs = List.map Dll.extract_dll_name !Clflags.dllibs in
- if standalone then begin
+ let check_dlls = standalone && Config.target = Config.host in
+ if check_dlls then begin
(* Initialize the DLL machinery *)
Dll.init_compile !Clflags.no_std_include;
Dll.add_path !load_path;
@@ -317,7 +318,7 @@ let link_bytecode ppf tolink exec_name standalone =
let output_fun = output_string outchan
and currpos_fun () = pos_out outchan - start_code in
List.iter (link_file ppf output_fun currpos_fun) tolink;
- if standalone then Dll.close_all_dlls();
+ if check_dlls then Dll.close_all_dlls();
(* The final STOP instruction *)
output_byte outchan Opcodes.opSTOP;
output_byte outchan 0; output_byte outchan 0; output_byte outchan 0;
diff --git a/configure b/configure
index 5c9e74197..08b90bbfc 100755
--- a/configure
+++ b/configure
@@ -1832,6 +1832,8 @@ echo "RUNTIMED=${debugruntime}" >>Makefile
echo "CAMLP4=${withcamlp4}" >>Makefile
echo "ASM_CFI_SUPPORTED=$asm_cfi_supported" >> Makefile
echo "WITH_FRAME_POINTERS=$with_frame_pointers" >> Makefile
+echo "TARGET=$target" >> Makefile
+echo "HOST=$host" >> Makefile
if [ "$ostype" = Cygwin ]; then
echo "DIFF=diff -q --strip-trailing-cr" >>Makefile
fi
diff --git a/utils/config.mlbuild b/utils/config.mlbuild
index b8debe8d1..264ed6dad 100644
--- a/utils/config.mlbuild
+++ b/utils/config.mlbuild
@@ -95,6 +95,9 @@ let ext_asm = C.ext_asm
let ext_lib = C.ext_lib
let ext_dll = C.ext_dll
+let host = C.host
+let target = C.target
+
let default_executable_name =
match Sys.os_type with
"Unix" -> "a.out"
@@ -130,6 +133,8 @@ let print_config oc =
p "os_type" Sys.os_type;
p "default_executable_name" default_executable_name;
p_bool "systhread_supported" systhread_supported;
+ p "host" host;
+ p "target" target;
p "exec_magic_number" exec_magic_number;
p "cmi_magic_number" cmi_magic_number;
p "cmo_magic_number" cmo_magic_number;
diff --git a/utils/config.mli b/utils/config.mli
index d8c02006b..7b178e573 100644
--- a/utils/config.mli
+++ b/utils/config.mli
@@ -120,4 +120,10 @@ val default_executable_name: string
val systhread_supported : bool
(* Whether the system thread library is implemented *)
+val host : string
+ (* Whether the compiler is a cross-compiler *)
+
+val target : string
+ (* Whether the compiler is a cross-compiler *)
+
val print_config : out_channel -> unit;;
diff --git a/utils/config.mlp b/utils/config.mlp
index 9affafe52..f77bc54f9 100644
--- a/utils/config.mlp
+++ b/utils/config.mlp
@@ -85,6 +85,9 @@ let ext_asm = "%%EXT_ASM%%"
let ext_lib = "%%EXT_LIB%%"
let ext_dll = "%%EXT_DLL%%"
+let host = "%%HOST%%"
+let target = "%%TARGET%%"
+
let default_executable_name =
match Sys.os_type with
"Unix" -> "a.out"
@@ -121,6 +124,8 @@ let print_config oc =
p "os_type" Sys.os_type;
p "default_executable_name" default_executable_name;
p_bool "systhread_supported" systhread_supported;
+ p "host" host;
+ p "target" target;
(* print the magic number *)
p "exec_magic_number" exec_magic_number;