From 1909a882df9e40c079b7fbcdfba3d1742c52a0fb Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 25 Apr 2015 12:38:16 +0200 Subject: Provide and use compiler-dependent standard headers. This branch provides implementations of the following standard headers: These are the headers that are provided by GCC and Clang, as opposed to being provided by Glibc and similar C standard libraries. Configuration flag "-no-standard-headers" deactivates the installation and use of these headers. Lightly tested so far (IA32 Linux). --- driver/Configuration.ml | 5 +++++ driver/Configuration.mli | 2 ++ driver/Driver.ml | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'driver') diff --git a/driver/Configuration.ml b/driver/Configuration.ml index 2cea2b80..70131fc6 100644 --- a/driver/Configuration.ml +++ b/driver/Configuration.ml @@ -82,6 +82,11 @@ let has_runtime_lib = | "true" -> true | "false" -> false | v -> bad_config "has_runtime_lib" [v] +let has_standard_headers = + match get_config_string "has_standard_headers" with + | "true" -> true + | "false" -> false + | v -> bad_config "has_standard_headers" [v] let stdlib_path = if has_runtime_lib then get_config_string "stdlib_path" diff --git a/driver/Configuration.mli b/driver/Configuration.mli index 20c45518..72810456 100644 --- a/driver/Configuration.mli +++ b/driver/Configuration.mli @@ -31,6 +31,8 @@ val stdlib_path: string (** Path to CompCert's library *) val has_runtime_lib: bool (** True if CompCert's library is available. *) +val has_standard_headers: bool + (** True if CompCert's standard header files is available. *) val advanced_debug: bool (** True if advanced debug is implement for the Target *) diff --git a/driver/Driver.ml b/driver/Driver.ml index d225ec4f..380209ab 100644 --- a/driver/Driver.ml +++ b/driver/Driver.ml @@ -93,8 +93,8 @@ let preprocess ifile ofile = let cmd = List.concat [ Configuration.prepro; ["-D__COMPCERT__"]; - (if Configuration.has_runtime_lib - then ["-I" ^ !stdlib_path] + (if Configuration.has_standard_headers + then ["-I" ^ Filename.concat !stdlib_path "include" ] else []); List.rev !prepro_options; [ifile] -- cgit