Prefix may be passed to configure using a Cygwin-style PATH (e.g.
`./configure --prefix ~/local`). Use cygpath to ensure that the correct
version gets written to Makefile.config, or the resulting compiler has
an invalid default stdlib path.
Disallow function sections on arm32, as the simplest way to address issue #9124 and get the CI working on the newer versions of GNU binutils for Raspbian. After this change, configure --enable-function-sections is an error on arm32. When the issue with GNU ld is resolved, this can be added back with appropriate checks on version of binutils.
Closes: #9124
The Git configuration value ocaml.configure-cache can be used to specify
a directory to keep autoconf cache files in, relative to the worktree
root (so `git config ocaml.configure-cache .` enables the feature, and
`git config --global ocaml.configure-cache ..` enables it for all
worktrees, assuming they're at the same level).
autoconf's --cache-file option speeds up future runs of configure by
caching the results of previous tests. The cache is invalidated if any
environment variables differ (e.g. LDFLAGS) or if the build-host-target
triplet differs. This is a nuisance on Windows, where configure is both
very slow and it's also common to build with multiple different --host
values.
This PR allows a tree to be quickly reconfigured from one Windows port
to another.
The Git configuration value ocaml.configure is now passed to the
configure script's arguments before $@ if (and only if) OCaml is being
configured from a Git clone.
This allows, for example:
- Developer-specific preferences (e.g. `--disable-ocamldoc` or
`--disable-debug-runtime`)
- Automatic use of autoconf cach files (-C option)
It is implemented by inserting a test at the top of `configure`, which
is bypassed if `.git` doesn't exist.
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.
* Enable force-safe-string by default
* Run the autogen script
* Add a line to the changelog
* Remove test using the -unsafe-string argument
* Disable program comparison for tests giving different binaries between ocamlopt.opt and ocamlopt.byte after switching to force-safe-string by default
* Add a comment where the compare_programs tests have been disabled to refer to an explaination of the problem
If the user explicitly requests function sections by calling configure
with --enable-function-sections on a target that does not support it,
it's an error at configure time.
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.
--with-pic should be adding -fPIC (or equivalent) to $internal_cflags,
not $common_cflags. Additionally, unused variable aspp was being
updated, instead of ASPP.
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.
This commit removes the remaining traces of support
for the Power/PowerPC architecture with OS other than Linux.
ocamlopt stopped supporting those configurations in 2014,
see commit 8815d7e and following.
Using the clang/llvm assembler avoids an extra dependency on GNU binutils, and that's what 32-bit arm is using.
But in this case, there was a problem with floating point immediates: LLVM thinks that if they're written in hex, they must be integer values between 0 and 255.
Changed them to float literals.
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.
* Delete the deprecated vmthreads library
It was deprecated in 4.08.
* Remove the byte/native argument of init_path
It is no longer necessary.
* Error out when passing --{enable,disable}-vmthreads to ./configure
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This patch removes support for 32-bit Darwin (macOS, iOS, etc) targets on Intel hardware. This enables various special cases to be removed in the i386 backend.
The current version of macOS (Mojave) is the last one that will support 32-bit x86 binaries. The current version of iOS does not support execution of 32-bit binaries any more.
Cygwin is based on newlib, not glibc, and the fma function is not
implemented. Split off HAS_WORKING_FMA from HAS_C99_FLOAT_OPS. Disable
fma for Cygwin64 so that the fma test passes.
Note: Typos found with https://github.com/codespell-project/codespell
Here is the (semi-manual) command used to get (and correct) the typos:
$ codespell -i 3 -w --skip=".png,.gif,./ocaml/boot,./ocaml/.git,./ocaml/manual/styles,./ocaml/manual/manual/htmlman" -L minimise,instal,contructor,"o'caml",cristal,pres,clos,cmo,uint,iff,te,objext,nto,nd,mut,upto,larg,exten,leage,mthod,delte,tim,atleast,langage,hten,iwth,mke,contant,succint,methids,eles,valu,clas,modul,que,classe,missings,froms,defaut,correspondance,differents,configury,reachs,cas,approche,normale,dur,millon,amin,oje,transfert
--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.