With this commit, it becomes possible to provide C compiler and preprocessor
flags to use in addition to those defined by the build system.
As required by the GNU coding standards, the flags can be provided
either at configure or at make invocation.
The provided CFLAGS and CPPFLAGS will also be taken into account
when C code is compiled by ocamlc/ocamlopt.
This commit removes the explicit reference to CFLAGS in the
configuration for the xlc compiler, since it is not necessary any longer.
The instrumentation code in the instrumented runtime was replaced
with new APIs to gather runtime statistics and output them in a new format
(Common Trace Format).
This commit also exposes new functions in the Gc module to pause or resume
instrumentation during a program execution (Gc.eventlog_pause and
Gc.eventlog_resume).
Config.ocamlopt_cflags and Config.ocamlopt_cppflags were solely used by
the driver when compiling .c files passed on the command line. The
behaviour of this should be the same as for `ocamlc -c` and the
inclusion of `-fPIC` in `ocamlc_cflags` only on some systems causes
problems for `ocamlmklib` which behaves as though the two drivers
compile C files identically.
This PR eliminates the separate settings in configure.ac and deprecates
the old variables in Config.
This commit makes it possible to build the OCaml compiler according to
its configuration by simply runnning make. There is no need to specify
neither world nor world.opt explicitly, although the two targets
remain available.
This commit also introduces (and starts making use of) the
NATIVE_COMPILER build variable whosse value is true when the native
compiler is enabled and false otherwise.
Add --enable-function-sections option to configure. With this option,
the compiler will emit each function in a separate named text section,
on supported targets. This enables function reordering using a linker
script. With this option, the compiler also emits caml_hot__code_begin
and caml_hot__code_end sections. This allows a linker script to
move function sections outside of the segments they belong to,
without breaking caml_code_segments.
* Make s-nt.h and m-nt.h more autoconf-like
* Add SIZEOF_LONGLONG to m-nt.h
It's not used, but autoconf will generate it.
* Sections of s-nt.h and m-nt moved to config.h
* Re-order lines of s-nt.h
Allows the output to be more readily compared with autoconf's generated
s.h. Lines are purely reordered so:
diff <(git cat-file --textconv HEAD~1:config/s-nt.h | sort) \
<(git cat-file --textconv HEAD:config/s-nt.h | sort)
should return no differences.
* Add extra defines to s-nt.h for mingw32
These match up with facts determined by autoconf. The following
additional HAS_ defines are made:
- HAS_UNISTD
Behaviour of otherlibs/unix/access.c and otherlibs/win32unix/lseek.c
is affected but the effect is correct.
Behaviour of runtime/fix_code.c affected, but unistd.h includes
io.h, so there's no effective change.
In other cases, unistd.h is simply included where before it wasn't.
- HAS_DIRENT
Used in Unix-only closedir.c, opendir.c, readdir.c and rewinddir.c
Used in runtime/unix.c, but that obviously won't affect Windows!
- HAS_REWINDDIR
Used in Unix-only rewinddir.c
- HAS_TRUNCATE
Used in Unix-only ftruncate.c, mmap.c and truncate.c
- HAS_NANOSLEEP
Used in Unix-only sleep.c
- HAS_GETTIMEOFDAY
Used in vmthreads and Unix-only gettimeofday.c
Used in runtime/sys.c, but in a branch guarded by #ifndef _WIN32
- HAS_MKSTEMP
Changes yacc/main.c to use the MinGW implementation of mkstemp
(part of mingwex, which is linked by flexdll)
* Remove the old DISTRIB variable
This variable was originally added in 1973b55 and 1596174 and was always
specifically for Windows for installing the README files.
This should have been renamed to INSTALL_DISTRIB in de4f4cf (which was
part of MPR#6358/GPR#27). It should then have been removed in 13bb9d2
(GPR#1033).
May it forever rest in peace.
* Tweak the config/Makefile.m* to match autoconf
* Build debug runtime by default on Windows
* Build raw_spacetime_lib on msvc64 & mingw64
* Set ENABLE_CALL_COUNTS to true for Windows
No-op, since spacetime is not enabled by default, but easier comparison
with autoconf
* Remove X11 definitions from old Makefiles
win32graph removed in #2318
* mingw ports should use gcc for CPP
* Correct MKEXEDEBUGFLAG for mingw ports
-g is ignored by flexlink, -link -g is passed on to GCC.
* Correct SO to be dll not s.obj/s.o
Pedantic correction - $(SO) is not used by the Windows ports.
* Re-order lines of config/Makefile.m*
This commit replaces a few configure command-line options by configuration
variables:
- "--with-dllibs" is replaced by DLLIBS
- "--with-reserved-header-bits" is replaced by RESERVED_HEADER_BITS
- "--with-default-string" is replaced by DEFAULT_STRING
A #! line should not exceed 128 characters (including the \0
terminator). This adds a test - both to the generation of the camlheader
files and also to the -use-runtime flag which falls back to #!/bin/sh
and uses exec to invoke the the interpreter.
Call the C preprocessor through the C compiler rather than calling it
directly.
This required the definition of a new ocamltest variable,
ocaml_filetype_flag, which makes it possible to override the filetype
inferred by the compiler from the extnesion of the source file.
The Graphics library is now distributed as a separate package.
The sources are at https://github.com/ocaml/graphics .
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit removes support for gprof-based profiling (the -p option to ocamlopt). It follows a discussion on the core developers' list, which indicated that removing gprof support was a reasonable thing to do. The rationale is that there are better easy-to-use profilers out there now, such as perf for Linux and Instruments on macOS; and the gprof support has always been patchy across targets. We save a whole build of the runtime and simplify some other parts of the codebase by removing it.
Most of the time, the C preprocessor needs to be invoked through the C
compiler, e.g. so that the paths to the header files are resolved properly.
In some cases, though, we really need to be able to call the C
preprocessor directly, just to expand macros in .ml files (this only
happens in the testsuite, at the moment). In those cases, it is
simply impossible to call the C preprocessor through the compiler,
e.g. because this would require the input files to have a '.c'
extension, which the OCaml compiler would misinterprete as meaning this file
should be compiled with the C compiler.
Thus, this commit clarifies the distinction between CPP and DIRECT_CPP
and provides both variables to the build system. The ocamltest build system
is also updated to take advantage of this.
We rely on autoconf's macros to detect how to call the C preprocessor
via the C compiler, except for the MSVC port where its value is hard-coded
to guarantee backward compatibility.
--disable-unix-lib, --disable-vmthreads and --disable-str-lib added to
prevent building these three libraries.
ocamldoc, the debugger and caml-tex are automatically disabled if their
prerequisites are not built. Using --enable-debugger and
--enable-ocamldoc will result in errors if these tools cannot be built.