-(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.)
The locgr instruction is not available in z10, the baseline for this port.
Instead, generate pedestrian code with a conditional branch.
Pass -march=z10 to the assembler to enforce z10 compliance.
Following reports that -fwrapv has known issues in GCC prior to version 4.2,
use '-O' (and warn) for GCC [3.0, 4.2);
use '-O2 -fwrapv -fno-strict-aliasing' for GCC 4.2 and up.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16540 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Auxiliary changes:
- Put GCC in gnu99 mode (= C99 + GNU extensions).
- Check C99 conformance, warn if not.
- Reject if gcc is too old ( < 3.0 )
- Stop C compilation on warnings if this is a development version of OCaml.
(I'm tired of C warnings being ignored.)
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/cc-optim@16329 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
configure: deselect ocamlopt, which is not supported
signals_machdep.h: use i386 instruction sequence, not amd64.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16243 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
- Removed MacOS X support, long dead.
- Added support for PowerPC 64 bits, big-endian, ELF v1 ABI
(tested, mostly works, some issues remain with marshaling of code pointers)
- Added support for PowerPC 64 bits, little-endian, ELF v2 ABI
(completely untested)
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/ppc64@16226 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Peter Zotov, review by Mark Shinwell)
NB: after applying this change you need to run ./configure again.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16068 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
- configure: no change necessary
- byterun/config.h: make sure ARCH_INT64_TYPE and related macros
are always defined, for Coq and others to use.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14636 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
and maybe others rely on it
byterun/config.h: select "long long" in preference to "long" for "int64",
just because this is how it was done in earlier versions.
(Minimizing suprises.)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14635 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
An ISO C99-compliant C compiler and standard library is now assumed.
(Plus special exceptions for MSVC.) In particular, emulation code for
64-bit integer arithmetic was removed, the C compiler must support a
64-bit integer type.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14607 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
14278
14277
14276
14176
14175
14173
14172
14171
14169
14168
14167
These changes need to mature on their own branch.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14329 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Patch by Adrien Nader!)
-C doesn't work on at least openbsd's make so don't use it.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14173 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
This script was built from ocamlcomp.sh.in through sed and is called
instead of "ocamlc" (for instance).
It makes it possible to switch from "ocamlc" to "ocamlc.opt" without
changing anything in the Makefiles, only calling sed.
I couldn't cleanly make it handle both a compiler for the target and for
the build. Instead I'm replacing it and doing as much as possible
directly in the Makefiles.
I hoped it would reduce the number of shell invocations, which would
speed things up quite a lot on Windows but I still had to have at least
one since it's not possible to update a make variable from inside a make
rule: i.e. it's not possible to do X=a, build a.opt and update X to be
a.opt.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14168 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Patch by Adrien Nader!)
This doesn't touch the build system in build/ since it's obsolete and
unmaintained as far as I know (I'll try to remove it in a further
commit).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13943 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Patch by Adrien Nader!)
This makes the variable names more coherent and is in preparation for
another patch that will allow disabling ocamldoc and ocamlbuild.
This changes the interface of the configuration somewhat but I don't
think anything outside of the ocaml tree reads the Makefile.config file
that gets installed in order to see whether the debugger and camlp4 have
been built. It also changes a .mli which might be problematic but I also
believe it is safe and we have time to see if there's a bad impact.
It also adds a configure switch to skip building ocamldebug.
While at it, it fixes a PR number in the Changes file.
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables.
This makes the variable names more coherent and is in preparation for
another patch that will allow disabling ocamldoc and ocamlbuild.
This changes the interface of the configuration somewhat but I don't
think anything outside of the ocaml tree reads the Makefile.config file
that gets installed in order to see whether the debugger and camlp4 have
been built. It also changes a .mli which might be problematic but I also
believe it is safe and we have time to see if there's a bad impact.
It also adds a configure switch to skip building ocamldebug.
While at it, it fixes a PR number in the Changes file.
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables.
This makes the variable names more coherent and is in preparation for
another patch that will allow disabling ocamldoc and ocamlbuild.
This changes the interface of the configuration somewhat but I don't
think anything outside of the ocaml tree reads the Makefile.config file
that gets installed in order to see whether the debugger and camlp4 have
been built. It also changes a .mli which might be problematic but I also
believe it is safe and we have time to see if there's a bad impact.
It also adds a configure switch to skip building ocamldebug.
While at it, it fixes a PR number in the Changes file.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(modified patch from Adrien Nader!)
Add also new comments for the new INSTALL flags.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13864 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Patch by Adrien Nader!)
I tried to use "hasgot" to test it but proved too difficult since you
must #include <winsock2.h> to make link succeed (windows magic) which
then makes gcc complain about the prototype being wrong.
Since windows already needs a special case in order to add -lws2_32 and
since we know for sure it will be available, skip the hasgot test and
check $target directly.
configure: add a special case to test for BSD sockets for mingw.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13855 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(patch by Adrien Nader!)
While at it also re-add two spaces that were eaten.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13851 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(patch by Adrien Nader!)
The test tried to do something like:
case "$foo,$bar" in
*,*) echo 1 ;;
*) echo "compiler not working" ;;
esac
However the second case cannot match because of the first one.
Instead, check the return code of the command.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13844 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
(Patch by Adrien Nader!)
This makes messages to the user more consistent.
Behaviours:
inf(): writes its arguments to stderr
wrn(): writes "[WARNING]" to stderr and then its arguments to stderr
err(): writes "[ERROR!]" to stderr, then its arguments to stderr, and
calls "exit 2"
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13841 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Fails to compile alt-ergo without frame-pointers. No time to debug
before tonight, so I revert and will merge again after fixing the
problem.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13732 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
This option can be used to tell the native compiler that it should
update frame pointers, so that debuggers and profiling tools
(especially Linux perf) can use them. For now, it is only supported
by the Unix/amd64 port.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13730 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Mac OS X ships with a really old version of as, which does not support
the CFI directives. LLVM itself provides an assembler that is certainly
way more up to date, but currently there's no dedicated frontend, so we
simply use clang in this case.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13226 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
before calling into C functions, raising a Stack_overflow exception
otherwise. This reduces (but does not eliminate) the risk of
segmentation faults due to stack overflow in C code.
Implemented for i386, amd64 and power, under Linux and MacOSX.
Plus: remove some more stuff related to obsoleted platforms (IA64, SunOS 4).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12159 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Initial merge of the new ARM backend (commit ec5b444c7f) from my development
repository at https://github.com/bmeurer/ocaml-arm/tree/ec5b444c7f .
Compared to the old ARM backend, this one does the following:
- Support for both software and hardware floating-point (VFPv3).
- Properly supports interworking with Thumb/Thumb-2 code for both OCaml and C
code.
- Supports dynamic linking and large memory models (PR#5049).
- Optional support for position-independent code via a command line option
-fPIC. This is disabled by default and not required for natdynlink.
- Can emit both ARM and Thumb-2 code, with avg. code size savings of 28% for
Thumb-2 (quite close the optimal 30% advertised by ARM Ltd.).
- Supports both AAPCS (armel) as well as extended VFP calling conventions
(armhf).
- Supports several special ARM instructions to reduce code size and latency.
- Uses standard ARM EABI runtime functions instead of relying on GCC internals.
- Supports exception backtraces.
- Supports profiling using gprof.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12124 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02