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.