forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.common.ml.in
More file actions
225 lines (201 loc) · 7.69 KB
/
Copy pathconfig.common.ml.in
File metadata and controls
225 lines (201 loc) · 7.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
(* @configure_input@ *)
#3 "utils/config.common.ml.in"
(**************************************************************************)
(* *)
(* OCaml *)
(* *)
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
(* *)
(* Copyright 1996 Institut National de Recherche en Informatique et *)
(* en Automatique. *)
(* *)
(* All rights reserved. This file is distributed under the terms of *)
(* the GNU Lesser General Public License version 2.1, with the *)
(* special exception on linking described in the file LICENSE. *)
(* *)
(**************************************************************************)
(* Portions of the Config module common to both the boot and main compiler. *)
(* The main OCaml version string has moved to ../build-aux/ocaml_version.m4 *)
let version = Sys.ocaml_version
(* is_official_release and release_number are automatically updated autoconf
from values in ../build-aux/ocaml_version.m4 - do not edit these lines
directly. *)
let is_official_release = false
let release_number = 22
external standard_library_default : unit -> string = "%standard_library_default"
let standard_library_default_raw = standard_library_default ()
external stdlib_dirs : string -> string * string option
= "caml_sys_get_stdlib_dirs"
let standard_library_default, relative_root_dir =
stdlib_dirs standard_library_default_raw
let standard_library_relative =
if relative_root_dir = None then
None
else
Some standard_library_default_raw
let standard_library =
try
Sys.getenv "OCAMLLIB"
with Not_found ->
try
Sys.getenv "CAMLLIB"
with Not_found ->
standard_library_default
let bindir = Option.value ~default:bindir relative_root_dir
let target_bindir =
if target_bindir = Filename.current_dir_name then
Filename.dirname Sys.executable_name
else
target_bindir
let exec_magic_number = {magic|@EXEC_MAGIC_NUMBER@|magic}
(* exec_magic_number is duplicated in runtime/caml/exec.h *)
and cmi_magic_number = {magic|@CMI_MAGIC_NUMBER@|magic}
and cmo_magic_number = {magic|@CMO_MAGIC_NUMBER@|magic}
and cma_magic_number = {magic|@CMA_MAGIC_NUMBER@|magic}
and cmx_magic_number = {magic|@CMX_MAGIC_NUMBER@|magic}
and cmxa_magic_number = {magic|@CMXA_MAGIC_NUMBER@|magic}
and ast_impl_magic_number = {magic|@AST_IMPL_MAGIC_NUMBER@|magic}
and ast_intf_magic_number = {magic|@AST_INTF_MAGIC_NUMBER@|magic}
and cmxs_magic_number = {magic|@CMXS_MAGIC_NUMBER@|magic}
and cmt_magic_number = {magic|@CMT_MAGIC_NUMBER@|magic}
and linear_magic_number = {magic|@LINEAR_MAGIC_NUMBER@|magic}
let safe_string = true
let default_safe_string = true
let naked_pointers = false
type launch_method = Executable | Shebang of string option
type search_method = Disable | Fallback | Enable
let launch_method =
match launch_method with
| "exe" -> Executable
| "sh" -> Shebang None
| _ -> Shebang (Some launch_method)
let search_method =
match search_method with
| "enable" -> Enable
| "fallback" -> Fallback
| _ -> Disable
let interface_suffix = ref ".mli"
let max_tag = 243
(* This is normally the same as in obj.ml, but we have to define it
separately because it can differ when we're in the middle of a
bootstrapping phase. *)
let lazy_tag = 246
let max_young_wosize = 256
let stack_threshold = 32 (* see runtime/caml/config.h *)
let stack_safety_margin = 6
let target_unix = (target_os_type = "Unix")
let target_win32 = (target_os_type = "Win32")
let target_cygwin = (target_os_type = "Cygwin")
let default_executable_name =
if target_unix then
"a.out"
else if target_win32 || target_cygwin then
"camlprog.exe"
else
"camlprog"
type configuration_value =
| String of string
| Int of int
| Bool of bool
let configuration_variables () =
let p x v = (x, String v) in
let p_int x v = (x, Int v) in
let p_bool x v = (x, Bool v) in
let standard_library_relative =
Option.value ~default:"" standard_library_relative
in
[
p "version" version;
p "standard_library_default" standard_library_default;
p "standard_library_relative" standard_library_relative;
p "standard_library" standard_library;
p "ccomp_type" ccomp_type;
p "c_compiler" c_compiler;
p "bytecode_cflags" bytecode_cflags;
p "ocamlc_cflags" bytecode_cflags;
p "bytecode_cppflags" bytecode_cppflags;
p "ocamlc_cppflags" bytecode_cppflags;
p "native_cflags" native_cflags;
p "ocamlopt_cflags" native_cflags;
p "native_cppflags" native_cppflags;
p "ocamlopt_cppflags" native_cppflags;
p "bytecomp_c_compiler" bytecomp_c_compiler;
p "native_c_compiler" native_c_compiler;
p "bytecomp_c_libraries" bytecomp_c_libraries;
p "native_c_libraries" native_c_libraries;
p "compression_c_libraries" compression_c_libraries;
p "native_ldflags" native_ldflags;
p "native_pack_linker" native_pack_linker;
p_bool "native_compiler" native_compiler;
p "architecture" architecture;
p "model" model;
p_int "int_size" Sys.int_size;
p_int "word_size" Sys.word_size;
p "system" system;
p "asm" asm;
p_bool "asm_cfi_supported" asm_cfi_supported;
p_bool "asm_size_type_directives" asm_size_type_directives;
p_bool "with_frame_pointers" with_frame_pointers;
p_bool "with_nonexecstack_note" with_nonexecstack_note;
p "ext_exe" ext_exe;
p "ext_obj" ext_obj;
p "ext_asm" ext_asm;
p "ext_lib" ext_lib;
p "ext_dll" ext_dll;
p "os_type" target_os_type;
p "default_executable_name" default_executable_name;
p_bool "systhread_supported" systhread_supported;
p "host" host;
p "target" target;
p "bytecode_runtime_id" bytecode_runtime_id;
p "native_runtime_id" native_runtime_id;
p_bool "flambda" flambda;
p_bool "safe_string" safe_string;
p_bool "default_safe_string" default_safe_string;
p_bool "flat_float_array" flat_float_array;
p_bool "align_double" align_double;
p_bool "align_int64" align_int64;
p_bool "function_sections" function_sections;
p_bool "afl_instrument" afl_instrument;
p_bool "tsan" tsan;
p_bool "windows_unicode" windows_unicode;
p_bool "supports_shared_libraries" supports_shared_libraries;
p_bool "native_dynlink" native_dynlink;
p_bool "naked_pointers" naked_pointers;
p_bool "with_codegen_invariants" with_codegen_invariants;
p_int "reserved_header_bits" reserved_header_bits;
p "exec_magic_number" exec_magic_number;
p "cmi_magic_number" cmi_magic_number;
p "cmo_magic_number" cmo_magic_number;
p "cma_magic_number" cma_magic_number;
p "cmx_magic_number" cmx_magic_number;
p "cmxa_magic_number" cmxa_magic_number;
p "ast_impl_magic_number" ast_impl_magic_number;
p "ast_intf_magic_number" ast_intf_magic_number;
p "cmxs_magic_number" cmxs_magic_number;
p "cmt_magic_number" cmt_magic_number;
p "linear_magic_number" linear_magic_number;
]
let print_config_value oc = function
| String s ->
Printf.fprintf oc "%s" s
| Int n ->
Printf.fprintf oc "%d" n
| Bool p ->
Printf.fprintf oc "%B" p
let print_config oc =
let print (x, v) =
Printf.fprintf oc "%s: %a\n" x print_config_value v in
List.iter print (configuration_variables ());
flush oc
let config_var x =
match List.assoc_opt x (configuration_variables()) with
| None -> None
| Some v ->
let s = match v with
| String s -> s
| Int n -> Int.to_string n
| Bool b -> string_of_bool b
in
Some s
let merlin = false