--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.
Adds a fused multiply-add operation to the Float module.
The following changes are made:
- configure: check math.h for the C99 fma() operation.
- fma declarations in float.ml[i] (stdlib/).
- C fma() call or emulation in runtime/floats.c.
- dedicated tests in testsuite/tests/fma.
In order to prepare the transition to autoconf, this commit moves the
configuration Makefile out of the config directory which will disappear
and gives it the name it will have once intstalled, namely Makefile.config.
Before this commit, this C preprocessor macro was defined in
byterun/caml/m.h by the configure script, but just on some architectures
and only in non-PIC mode.
This commit introduces the HAS_ARCH_CODE32 predicate which is inserted
in the m.h file when this is relevant, the ifdef block on PIC
being moved to config.h.
This is to prepare the switch to autoconf, since header files processed
by config.status are not allowed to contain ifdef blocks.
This commit simplifies the configure script by removing the support
for obsolete platforms. The list of removed platforms is documented
in the associated Changes entry.
The mechanism complicates the runtime system and is not very general
(only a few system functions are instrumented). There are other ways
to intercept system calls that are more general and require no
modification to the source code of the runtime system.
- Introduce `-dcamlprimc`, to keep the generated C file containing the primitive list
- Use `-fdebug-prefix-map` for compiling temporary C files when this option is supported
This commit renames a few C compiler related build variables so that
they are reserved for the build system. They will then be re-introduced,
but this time as user varialbes whose value can be freely customized
when compiling the package, without risking to conflict with those
command-line flags that are required by the build system itself.
Here are the variables this commit renames:
- CFLAGS -> OC_CFLAGS
- CPPFLAGS -> OC_CPPFLAGS
- LDFLAGS -> OC_LDFLAGS
Note: before this commit the compilation of scheduler.c in
otherlibs/threads was relying on make's implicit rule to compile C files.
Since this commit stops using the standard variables for flags,
it is necessary to introduce an explicit rule to compile C files
and that makes use of the newly introduced variables.
In environments where the executables compiled to native code,
such as ocamlopt.opt, are always used in preference to the bytecode
versions then space can be saved by not installing the latter.
This patch provides a configure option to do such. It is relatively lightly
engineered; in particular, it won't complain if the native code executables
aren't themselves being built; but given this is an option for knowledgeable
users we think that it is reasonable.
awk is symbolic link in Cygwin, which means it can't be used in -pp for
a native Windows build. Just use gawk instead, as no other package
provides the awk command on Cygwin.
This commit builds the debug and instrumented runtimes by default.
For a user that discovers a use for either of those, not having built
by default makes the experience pretty bad: they have to recompile
their own OCaml compiler, possibly from a source checkout if the
option is not available on opam...
With this change the total compilation time only increased by
7 seconds on my machine, from 3m24s to 3m33s -- these are sequential
builds, with parallel builds the difference is lost in the noise.
We wish to make -with-instrumented-runtime the default, but not break
the build on systems that do not support it -- when clock_gettime is
missing. This is done by tracking whether -with-instrumented-runtime
was set explicitly or is the default value; in the latter case,
a missing clock_gettime defaults to no instrumented runtime, without
raising an error at configure-time.
Otherwise leftover .a files from an earlier compilation may contain
unwanted modules, as shown in MPR#7679.
However, ocamlmklib always erases the destination .a file before
calling the `mkdll` function defined in `#ml` blocks of the
configuration makefile. Hence there is no need for a `rm` (or `del`)
shell command in `mklib`.
Finally, in the config/Makefile.mingw* files, we can safely assume
"ar" supports the "s" option because this is "ar" from the GNU
binutils, so no need to call ranlib.
The terminfo C library was used for displaying error messages from the
toplevel. Instead, just use ANSI escape sequences to display, and a
ioctl() to get the number of lines of the terminal.
- Remove byterun/terminfo.c
- Add primitive to query number of lines to io.c
with OS-dependent code in unix.c (ioctl-based implementation)
and win32.c (no implementation yet)
- Add a Terminfo.num_lines function and simplify interface to Terminfo.setup
- Query num_lines every time an error message needs to be highlighted,
so as to react to windows resizing.
- Bootstrap to enable removal of old primitives.
Use the system-provided execvpe() if possible. Otherwise, use
a serious reimplementation written in OCaml and patterned after
the Glibc execvpe() implementation.
Added a test in tests/lib-unix/unix-execvpe.
Don't test Unix.execvpe if we are using the system-provided implementation.
The execvpe() functions provided by Win32 and Cygwin aren't quite to
our specs. At any rate, the test is there to find bugs in our
implementation of execvpe(), not in others's.
-(un)safe-string becomes -(no-)force-safe-string
-(un)safe-string-default becomes -default-unsafe-string
Config.safe_string (and Clflags.unsafe_string) keep their name for
backward-compatibility, as well as the C define CAML_SAFE_STRING
(which corresponds to -force-safe-string).
The CPP variable tells the build system how to invoke the C preprocessor.
Before this commit, this variable was defined by the Windows Makefiles
but not by the Makefile generated by configure. This commit fixes this.
This commit also fixes a few makefiles: to compute dependencies for C files,
they incorrectly called $(CPP) -MM instead of $(CC) -MM.
Continuing a general effort, this commit removes the "num" library for arbitrary-precision arithmetic from the core OCaml system. A standalone distribution of this library already exists and is hosted at https://github.com/ocaml/num
The opam-compiler-conf script will generate an opam switch name
(and thus a directory name) from the name of the current git
branch. Branches named 'PR#1234-foo-bar' would have the ./configure
script generate a config/Makefile with the lines
PREFIX=~/.opam/4.06.0+local-git-PR#1234-foo-bar
BINDIR=$(PREFIX)/bin
BYTERUN=$(BINDIR)/ocamlrun
LIBDIR=$(PREFIX)/lib/ocaml
The '#' in the first line parses as the start of a comment, so
the second part is ignored and the build system would then install
in ~/.opam/4.06.0+local-git-PR instead.
After this change, config/Makefile starts with:
# generated by ./configure --prefix ~/.opam/4.06.0+local-git-PR#1234-foo-bar
CONFIGURE_ARGS=--prefix ~/.opam/4.06.0+local-git-PR\#1234-foo-bar
PREFIX=~/.opam/4.06.0+local-git-PR\#1234-foo-bar
* Restrict Unix.environment to return an empty array in privileged environments.
* Add Unix.unsafe_environment.
Unix.unsafe_environment is an analogue of Unix.environment that
returns the process environment regardless of privileges.
* fall back to __secure_getenv when secure_getenv is not available
* use secure_getenv for instrumented runtimes
* documentation: warn against setting the setuid or setgid bits on custom bytecode executables
* fall back to __secure_getenv when secure_getenv is not available
* use secure_getenv for instrumented runtimes
* documentation: warn against setting the setuid or setgid bits on custom bytecode executables
This commit moves:
- config/m.h to byterun/caml/m.h
- config/s.h to byterun/caml/s.h
Consequently, m.h and s.h now get installed alongside other
OCaml header files.
This commit also updates the .depend files, introducing updates in the
dependencies which are not consequences of this commit itself.
This patch adds support for xlc (IBM C compiler, used on
Linux and AIX) in cckind.cc and enables shared libraries
support in bytecode compiled programs on AIX.
It was tested on Linux/gcc and AIX7.1/xlc 12. By default
configure script uses gcc compiler, so there should be no
impact on Linux/xlc systems. To use xlc one should run
configure with -cc xlc.
This commit is a follow-up to PR#1114. It ensures that C compilers
other than msvc are called with a space between the -o option and
its object or executabe file argument.
It contains the section for library function manual pages (3).
This will be useful to properly install the manual pages generated
by ocamldoc for the standard library.
Before this commit, auxiliary scripts were called before verbose
was exported, so they were not executed in verbose mode.
This commit fixes this and makes sure all the auxiliary scripts take
the verbose environment variable into acocunt.
Before this commit there was BYTECCRPATH and NATIVECCRPATH, but they
were actually identical to each other.
This commit gets rid of them and uses the RPATH variable.
For the verbose variable, use boolean values true and false rather
than yes and no.
Also fix indentation in scripts under config/auto-aux where appropriate.
Generally, OCaml creates dynamic libraries in three cases:
* when building bytecode stubs (dllX.so);
* when building a .cmxs plugin;
* when building a .native.so or even .byte.so.
Right now, this results in DLLs on Windows and ELF shared objects on Linux,
all of which can be dynamically loaded (with dlopen() or equivalent) or
linked against (with the -l linker flag or equivalent). However, on macOS,
this is not the case.
macOS has two kinds of dynamic libraries: "bundles" and "dylibs". Prior to
the version 10.4, there have been significant differences between these,
which I will not describe in this commit because 10.4 has long became
irrelevant. After 10.4, there are only two differences:
* rpath is handled slightly differently.
* dylibs can be linked against, with the -l linker flag;
Before this commit, ocamlc/ocamlopt on macOS produce bundles, when using
the .so extension for the output file. After this commit, OCaml on macOS
will produce dylibs, when using the same extension. The rationale is as
follows:
* For bytecode stubs and plugins, the exact structure of which is essentially
an implementation detail of the OCaml runtime, nothing will change because
they can still be dynamically loaded.
* For .native.so and .byte.so objects, there are two changes:
1. The objects can be linked against with the -l flag.
2. The objects can be linked with the -cclib -shared flag, which is
what ocamlbuild and perhaps other buildsystems pass when building
a shared object through -output-obj/-output-complete-obj.
These variables represent the C compilers ocamlc and ocamlopt should use
to compile a third-party C source file when no -cc command-line option
has been specified.
Thanks to these variables, the substitutions performed in Makefile and
Makefile.nt to generate utils/config.ml from utils/config.ml become
similar.
(The NATIVE_C_COMPILER variable is not really necessary but it has still
been introduced to preserve symetry.)
This variable is used to give a value to standard_runtime in
utils/config.ml.
Before this commit, its values were hard-coded in Makefile and
Makefile.nt, in the rules generating utils/config.ml from utils/config.mlp.
This commit gets rid of this hardcoding, to prepare the sharing of the
rules mentionned above.
* Merge Unix and Windows build systems in the asmrun directory
Changes in make variables:
- Removal of the SHARED make variable, which had the same
semantics than SUPPORTS_SHARED_LIBRARIES, the later having values true
and false while the former had values shared and noshared.
(SHARED was not defined on Windows)
- RUNTIMED now takes values true and false rather than runtimed and
noruntimed
* Do not use -O0 in asmrun's Makefile
* Add /asmrun/win32.c to .gitignore
* Build PIC libraries only under Unix
This makes things closer to what they were before, since PIC objects
were not built for Windows.
This commit modifies these two behaviours:
1. ``make install'' installs libraries with profiling support only when
this makes sense.
2. On platforms that do not support profiling with gprof, the -p option of
ocamlopt produces an error message.
On such platforms, ``make install'' was installing dummy profiling
libraries and ocamlopt's -p option was silently ignored.
In addition, this commit modifies the values of the PROFILING make
variable. Before the commit it was either prof or noprof. After the
commit it is either true or false.
In the asmrun directory, the call to ranlib for libasmrunp.a has also been
removed from the install target because this command is already invoked
in the rule that builds libasmrunp.a.
ocamlc/ocamlopt -config now prints the state of profiling support
This reverts commit 8adfe15f18.
This is a temporary revert caused by Continuous Integration
failure. We'll investigate the issue and merge again when it is fixed.
This commit modifies these two behaviours:
1. ``make install'' installs libraries with profiling support only when
this makes sense.
2. On platforms that do not support profiling with gprof, the -p option of
ocamlopt produces an error message.
On such platforms, ``make install'' was installing dummy profiling
libraries and ocamlopt's -p option was silently ignored.
In addition, this commit modifies the values of the PROFILING make
variable. Before the commit it was either prof or noprof. After the
commit it is either true or false.
In the asmrun directory, the call to ranlib for libasmrunp.a has also been
removed from the install target because this command is already invoked
in the rule that builds libasmrunp.a.
ocamlc/ocamlopt -config now prints the state of profiling support
In particular, this adds support for systems where the `cat` binary isn't
located in /usr/bin/ or /bin/, but can be found using /usr/bin/env.
An example of such a system is NixOS (https://nixos.org).
* Don't use the compatibility macros, neither in the C stub code nor in the testsuite.
* Make sure compiler sources do not use deprecated C identifiers.
This is achieved by ensuring that the CAML_NAME_SPACE macro is defined
everytime a C source file is compiled, rather than being defined only
in a few places. Defining this macro guarantees that the compatibility.h
header (where these deprecated identifiers are defined) will not be
included.
Before this commit, there was no distinction between the options
used to compile C source files coming with the OCaml distribution
and third-party C source files compiled by calling ocamlc or ocamlopt.
This commit makes it possible to use options when compiling C source
files that come with OCaml without imposing these options to the compilation
of third-party code.
More specifically, the options in the BYTECCCOMPOPTS and NATIVECCCOMPOPTS
variables are not passed to the C compiler when called by ocamlc and
ocamlopt any longer.
This commit also documents the role of each concerned variable.
In addition:
- On Unix:
* The -Wall and -Werror options are no longer passed to the C
compiler by ocamlc and ocamlopt for third-party C source files
- For the MinGW port:
* The -O option has been removed from the SHAREDCCCOMPOPTS variable
* The -Wall and -Wno-unused options are no longer passed to the C
compiler by ocamlc and ocamlopt for third-party C source files
- For the msvc port: the
* The -Ox option has been removed from the SHAREDCCCOMPOPTS variable.
* The -Wall and -Wno-unused options are no longer passed to the C
compiler by ocamlc and ocamlopt for third-party C source files
When configured with -safe-string, the OCaml tools will default to the
safe-string mode and ignore -unsafe-string command-line arguments. This
is intended to serve two purposes:
- Facilitate the detection of packages that are not ready
for -safe-string ready. (Perhaps with some OPAM switch?)
- Enable some optimizations that assume that all linked units are
compiled with -safe-string.
Note: currently, there is no check that units compiled with an OCaml
configured without -safe-string are not linked in.
In PR#7172, Daniel Bünzli remarks that even if an user does only "make
world install" only, intentionally not installing the native code
compiler, the configuration variables exposed through
$(ocamlc -where)/Makefile.config will be misleading as they indicate
the configuration-time prediction that this installation has a native
compiler and support native dynlink.
The -no-native-compiler switch allows to avoid this issue by
intentionally indicating at configure-time that no native compiler
shall be built. However, its current implementation forgot to also
explicitly disable native dynlinking. Changing this fixes the
Makefile.config information and has no impact on the compiler build
process (a build with ARCH=none will never hit the {all,install}opt of
dynlink/Makefile that inspect NATDYNLINK).
On regression risk: it is easy to check in ./configure that this
change only affects configuration when the -no-native-compiler option
is passed, which did not exist before (late in) 4.03+dev.
MAX_TESTSUITE_DIR_RETRIES (which defaults to 1 for the native Windows
ports and 0 for all other platforms) causes the `all` and `list` targets
to re-run any given test directory an additional number of times in
order to eliminate random failures during tests.
This is needed because some required constants and prototypes are defined
inside `#ifdef _ALL_SOURCE`
Examples are:
- AI_NUMERICHOST constant in netdb.h (used from getaddrinfo.c)
- chroot prototype in unistd.h (used from chroot.c)
having them. The config script doesn't fail when there's no prototype to the
functions. It should maybe be compiled as "warnings as errors".
(obtained from PKGSRC patches.)