Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file unic_cfg.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107leterror_msgffmt=Fmt.kstr(funmsg->Error(`Msgmsg))fmt(* A configuration variable: its [ocamlc -config] name, the {!Uniq_cfg.Value}
witness needed to read it back with the right type, and how to print it. *)typeentry=E:string*'aUniq_cfg.Value.t*'aFmt.t->entryletentries=letskey=E(key,Uniq_cfg.Value.string,Fmt.string)inletpkey=E(key,Uniq_cfg.Value.path,Fpath.pp)inletbkey=E(key,Uniq_cfg.Value.bool,Fmt.bool)inletikey=E(key,Uniq_cfg.Value.int,Fmt.int)inletlkey=E(key,Uniq_cfg.Value.(liststring),Fmt.(list~sep:(any" ")string))in[s"version";p"standard_library_default";p"standard_library";s"ccomp_type";s"c_compiler";l"CFLAGS";l"CPPFLAGS";l"ocamlc_cflags";l"ocamlc_cppflags";l"ocamlopt_cflags";l"ocamlopt_cppflags";l"bytecode_c_compiler";l"native_c_compiler";l"bytecomp_c_libraries";l"native_c_libraries";l"native_pack_linker";b"native_compiler";s"architecture";s"model";i"int_size";i"word_size";s"system";s"asm";b"asm_cfi_supported";b"with_frame_pointers";s"ext_exe";s"ext_obj";s"ext_asm";s"ext_lib";s"ext_dll";s"os_type";s"default_executable_name";b"systhread_supported";s"host";s"target";b"flambda";b"safe_string";b"default_safe_string";b"flat_float_array";b"function_sections";b"afl_instrument";b"windows_unicode";b"supports_shared_libraries";b"native_dynlink";b"naked_pointers";b"compression_supported";s"exec_magic_number";s"cmi_magic_number";s"cmo_magic_number";s"cma_magic_number";s"cmx_magic_number";s"cmxa_magic_number";s"ast_impl_magic_number";s"ast_intf_magic_number";s"cmxs_magic_number";s"cmt_magic_number";s"linear_magic_number"]letnormalize=Astring.String.map(function'-'->'_'|chr->chr)letrunquietcfgnativekey=let(let*)=Result.bindinlet*cfg=matchcfgwithSomecfg->Okcfg|None->Uniq_cfg.v()inmatchkeywith|None->(* Dump the whole configuration, one variable per line. *)letprint(E(key,w,pp))=matchUniq_cfg.get~nativecfg~keywwith|Somev->ifnotquietthenFmt.pr"%-26s %a\n%!"keyppv|None->()inList.iterprintentries;Ok0|Somek->beginletsame(E(key,_,_))=String.equal(normalizekey)(normalizek)inmatchList.find_optsameentrieswith|None->error_msgf"Unknown configuration variable: %S"k|Some(E(key,w,pp))->beginmatchUniq_cfg.get~nativecfg~keywwith|Somev->ifnotquietthenFmt.pr"%a\n%!"ppv;Ok0|None->error_msgf"%S depends on the chosen toolchain; pass --native or \
--bytecode"kendendopenCmdlineropenUnic_cliletnative=letopenArginvalue&vflagNone[(Sometrue,info["native"]~doc:"Assume the native toolchain.");(Somefalse,info["bytecode"]~doc:"Assume the bytecode toolchain.")]letkey=letdoc="The configuration variable to print (e.g. $(b,standard_library)). When \
omitted, every variable is printed."inletopenArginvalue&pos0(somestring)None&info[]~doc~docv:"VARIABLE"letterm=letopenTerminterm_result~usage:false(construn$setup_logs$setup_ocaml$native$key)letcmd=letdoc="Print the configuration of the OCaml toolchain."inletman=[`SManpage.s_description;`P"$(tname) prints the configuration of the OCaml toolchain, as \
$(b,ocamlc -config) does. If a variable is given as an argument, only \
its value is printed.";`P"With the $(b,--toolchain) option, the configuration comes from the \
given ocamlfind toolchain (such as $(b,solo5)) instead of the host \
one.";`P"Some variables depend on the compiler used. In this case, \
$(b,--native) or $(b,--bytecode) must be given."]inCmd.v(Cmd.info"cfg"~doc~man)term