summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asmcomp/asmlibrarian.ml6
-rw-r--r--asmcomp/asmlink.ml24
-rw-r--r--asmcomp/compilenv.ml8
-rw-r--r--asmcomp/compilenv.mli18
-rw-r--r--bytecomp/bytelibrarian.ml7
-rw-r--r--bytecomp/bytelink.ml58
-rw-r--r--bytecomp/emitcode.ml12
-rw-r--r--bytecomp/emitcode.mli16
-rw-r--r--debugger/Makefile4
-rw-r--r--driver/main.ml1
-rw-r--r--driver/main_args.ml3
-rw-r--r--driver/main_args.mli1
-rw-r--r--driver/optmain.ml2
-rw-r--r--otherlibs/bigarray/Makefile6
-rw-r--r--otherlibs/db/Makefile4
-rw-r--r--otherlibs/dbm/Makefile4
-rw-r--r--otherlibs/graph/Makefile5
-rw-r--r--otherlibs/num/Makefile4
-rw-r--r--otherlibs/str/Makefile4
-rw-r--r--otherlibs/systhreads/Makefile6
-rw-r--r--otherlibs/threads/Makefile2
-rw-r--r--otherlibs/unix/.depend2
-rw-r--r--otherlibs/unix/Makefile4
-rw-r--r--otherlibs/win32unix/Makefile.nt6
-rw-r--r--test/Moretest/Makefile16
-rw-r--r--tools/ocamlcp.ml1
-rw-r--r--utils/clflags.ml1
-rw-r--r--utils/config.mlp6
28 files changed, 176 insertions, 55 deletions
diff --git a/asmcomp/asmlibrarian.ml b/asmcomp/asmlibrarian.ml
index 317e77bb0..eb8760507 100644
--- a/asmcomp/asmlibrarian.ml
+++ b/asmcomp/asmlibrarian.ml
@@ -46,7 +46,11 @@ let create_archive file_list lib_name =
output_string outchan cmxa_magic_number;
let (objfile_list, descr_list) =
List.split (List.map read_info file_list) in
- output_value outchan descr_list;
+ let infos =
+ { lib_units = descr_list;
+ lib_ccobjs = !Clflags.ccobjs;
+ lib_ccopts = !Clflags.ccopts } in
+ output_value outchan infos;
if Ccomp.create_archive archive_name objfile_list <> 0
then raise(Error(Archiver_error archive_name));
close_out outchan
diff --git a/asmcomp/asmlink.ml b/asmcomp/asmlink.ml
index 95cacda5b..322eed842 100644
--- a/asmcomp/asmlink.ml
+++ b/asmcomp/asmlink.ml
@@ -66,6 +66,18 @@ let check_consistency file_name unit crc =
unit.ui_imports_cmx;
Hashtbl.add crc_implementations unit.ui_name (file_name, crc)
+(* Add C objects and options and "custom" info from a library descriptor.
+ See bytecomp/bytelink.ml for comments on the order of C objects. *)
+
+let lib_ccobjs = ref []
+let lib_ccopts = ref []
+
+let add_ccobjs l =
+ if not !Clflags.no_auto_link then begin
+ lib_ccobjs := l.lib_ccobjs @ !lib_ccobjs;
+ lib_ccopts := l.lib_ccopts @ !lib_ccopts
+ end
+
(* First pass: determine which units are needed *)
module StringSet =
@@ -108,20 +120,22 @@ let scan_file obj_name tolink =
really_input ic buffer 0 (String.length cmxa_magic_number);
if buffer <> cmxa_magic_number then
raise(Error(Not_an_object_file file_name));
- let info_crc_list = (input_value ic : (unit_infos * Digest.t) list) in
+ let infos = (input_value ic : library_infos) in
close_in ic;
+ add_ccobjs infos;
List.fold_right
(fun (info, crc) reqd ->
if info.ui_force_link
- or !Clflags.link_everything
- or is_required info.ui_name then begin
+ || !Clflags.link_everything
+ || is_required info.ui_name
+ then begin
check_consistency file_name info crc;
remove_required info.ui_name;
List.iter add_required info.ui_imports_cmx;
info :: reqd
end else
reqd)
- info_crc_list tolink
+ infos.lib_units tolink
end
else raise(Error(Not_an_object_file file_name))
@@ -259,6 +273,8 @@ let link objfiles =
Array.iter remove_required Runtimedef.builtin_exceptions;
if not (StringSet.is_empty !missing_globals) then
raise(Error(Missing_implementations(StringSet.elements !missing_globals)));
+ Clflags.ccobjs := !Clflags.ccobjs @ !lib_ccobjs;
+ Clflags.ccopts := !Clflags.ccopts @ !lib_ccopts;
let startup = Filename.temp_file "camlstartup" ext_asm in
make_startup_file startup units_tolink;
let startup_obj = Filename.temp_file "camlstartup" ext_obj in
diff --git a/asmcomp/compilenv.ml b/asmcomp/compilenv.ml
index 1205a02bc..beb7777c6 100644
--- a/asmcomp/compilenv.ml
+++ b/asmcomp/compilenv.ml
@@ -44,6 +44,14 @@ type unit_infos =
mutable ui_apply_fun: int list; (* Apply functions needed *)
mutable ui_force_link: bool } (* Always linked *)
+(* Each .a library has a matching .cmxa file that provides the following
+ infos on the library: *)
+
+type library_infos =
+ { lib_units: (unit_infos * Digest.t) list; (* List of unit infos w/ CRCs *)
+ lib_ccobjs: string list; (* C object files needed *)
+ lib_ccopts: string list } (* Extra opts to C compiler *)
+
let global_approx_table =
(Hashtbl.create 17 : (string, value_approximation) Hashtbl.t)
diff --git a/asmcomp/compilenv.mli b/asmcomp/compilenv.mli
index e1d34b835..5c0ca1ceb 100644
--- a/asmcomp/compilenv.mli
+++ b/asmcomp/compilenv.mli
@@ -16,6 +16,16 @@
open Clambda
+(* Each .o file has a matching .cmx file that provides the following infos
+ on the compilation unit:
+ - list of other units imported, with CRCs of their .cmx files
+ - approximation of the structure implemented
+ (includes descriptions of known functions: arity and direct entry
+ points)
+ - list of currying functions and application functions needed
+ The .cmx file contains these infos (as an externed record) plus a CRC
+ of these infos *)
+
type unit_infos =
{ mutable ui_name: string; (* Name of unit implemented *)
mutable ui_imports_cmi: (string * Digest.t) list; (* Interfaces imported *)
@@ -25,6 +35,14 @@ type unit_infos =
mutable ui_apply_fun: int list; (* Apply functions needed *)
mutable ui_force_link: bool } (* Always linked *)
+(* Each .a library has a matching .cmxa file that provides the following
+ infos on the library: *)
+
+type library_infos =
+ { lib_units: (unit_infos * Digest.t) list; (* List of unit infos w/ CRCs *)
+ lib_ccobjs: string list; (* C object files needed *)
+ lib_ccopts: string list } (* Extra opts to C compiler *)
+
val reset: string -> unit
(* Reset the environment and record the name of the unit being
compiled (arg). *)
diff --git a/bytecomp/bytelibrarian.ml b/bytecomp/bytelibrarian.ml
index 5247bac04..25f463ac8 100644
--- a/bytecomp/bytelibrarian.ml
+++ b/bytecomp/bytelibrarian.ml
@@ -72,7 +72,12 @@ let create_archive file_list lib_name =
output_string outchan cma_magic_number;
let ofs_pos_toc = pos_out outchan in
output_binary_int outchan 0;
- let toc = List.flatten(List.map (copy_object_file outchan) file_list) in
+ let toc =
+ { lib_units =
+ List.flatten(List.map (copy_object_file outchan) file_list);
+ lib_custom = !Clflags.custom_runtime;
+ lib_ccobjs = !Clflags.ccobjs;
+ lib_ccopts = !Clflags.ccopts } in
let pos_toc = pos_out outchan in
output_value outchan toc;
seek_out outchan ofs_pos_toc;
diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
index b03b62aec..e0118d0ce 100644
--- a/bytecomp/bytelink.ml
+++ b/bytecomp/bytelink.ml
@@ -36,6 +36,40 @@ type link_action =
| Link_archive of string * compilation_unit list
(* Name of .cma file and descriptors of the units to be linked. *)
+(* Add C objects and options and "custom" info from a library descriptor *)
+
+let lib_ccobjs = ref []
+let lib_ccopts = ref []
+
+let add_ccobjs l =
+ if not !Clflags.no_auto_link then begin
+ if l.lib_custom then Clflags.custom_runtime := true;
+ lib_ccobjs := l.lib_ccobjs @ !lib_ccobjs;
+ lib_ccopts := l.lib_ccopts @ !lib_ccopts
+ end
+
+(* A note on ccobj ordering:
+ - Clflags.ccobjs is in reverse order w.r.t. what was given on the
+ ocamlc command line;
+ - l.lib_ccobjs is also in reverse order w.r.t. what was given on the
+ ocamlc -a command line when the library was created;
+ - Clflags.ccobjs is reversed just before calling the C compiler for the
+ custom link;
+ - .cma files on the command line of ocamlc are scanned right to left;
+ - Before linking, we add lib_ccobjs after Clflags.ccobjs.
+ Thus, for ocamlc a.cma b.cma obj1 obj2
+ where a.cma was built with ocamlc -i ... obja1 obja2
+ and b.cma was built with ocamlc -i ... objb1 objb2
+ lib_ccobjs starts as [],
+ becomes objb2 objb1 when b.cma is scanned,
+ then obja2 obja1 objb2 objb1 when b.cma is scanned.
+ Clflags.ccobjs was initially obj2 obj1,
+ and is set to obj2 obj1 obja2 obja1 objb2 objb1.
+ Finally, the C compiler is given objb1 objb2 obja1 obja2 obj1 obj2,
+ which is what we need. (If b depends on a, a.cma must appear before
+ b.cma, but b's C libraries must appear before a's C libraries.)
+*)
+
(* First pass: determine which units are needed *)
module IdentSet =
@@ -90,21 +124,22 @@ let scan_file obj_name tolink =
in only if needed. *)
let pos_toc = input_binary_int ic in (* Go to table of contents *)
seek_in ic pos_toc;
- let toc = (input_value ic : compilation_unit list) in
+ let toc = (input_value ic : library) in
close_in ic;
let required =
List.fold_right
(fun compunit reqd ->
if compunit.cu_force_link
- or !Clflags.link_everything
- or List.exists is_required compunit.cu_reloc
+ || !Clflags.link_everything
+ || List.exists is_required compunit.cu_reloc
then begin
List.iter remove_required compunit.cu_reloc;
List.iter add_required compunit.cu_reloc;
compunit :: reqd
end else
reqd)
- toc [] in
+ toc.lib_units [] in
+ if required <> [] then add_ccobjs toc;
Link_archive(file_name, required) :: tolink
end
else raise(Error(Not_an_object_file file_name))
@@ -220,8 +255,7 @@ let make_absolute file =
(* Create a bytecode executable file *)
-let link_bytecode objfiles exec_name copy_header =
- let tolink = List.fold_right scan_file objfiles [] in
+let link_bytecode tolink exec_name copy_header =
if Sys.os_type = "MacOS" then begin
(* Create it as a text file for bytecode scripts *)
let c = open_out_gen [Open_wronly; Open_creat] 0o777 exec_name in
@@ -317,8 +351,7 @@ let output_data_string outchan data =
(* Output a bytecode executable as a C file *)
-let link_bytecode_as_c objfiles outfile =
- let tolink = List.fold_right scan_file objfiles [] in
+let link_bytecode_as_c tolink outfile =
let outchan = open_out outfile in
try
(* The bytecode *)
@@ -471,13 +504,16 @@ let fix_exec_name name =
let link objfiles =
let objfiles = if !Clflags.nopervasives then objfiles
else "stdlib.cma" :: (objfiles @ ["std_exit.cmo"]) in
+ let tolink = List.fold_right scan_file objfiles [] in
+ Clflags.ccobjs := !Clflags.ccobjs @ !lib_ccobjs;
+ Clflags.ccopts := !Clflags.ccopts @ !lib_ccopts;
if not !Clflags.custom_runtime then
- link_bytecode objfiles !Clflags.exec_name true
+ link_bytecode tolink !Clflags.exec_name true
else if not !Clflags.output_c_object then begin
let bytecode_name = Filename.temp_file "camlcode" "" in
let prim_name = Filename.temp_file "camlprim" ".c" in
try
- link_bytecode objfiles bytecode_name false;
+ link_bytecode tolink bytecode_name false;
let poc = open_out prim_name in
Symtable.output_primitive_table poc;
close_out poc;
@@ -496,7 +532,7 @@ let link objfiles =
Filename.chop_suffix !Clflags.object_name Config.ext_obj ^ ".c" in
if Sys.file_exists c_file then raise(Error(File_exists c_file));
try
- link_bytecode_as_c objfiles c_file;
+ link_bytecode_as_c tolink c_file;
if Ccomp.compile_file c_file <> 0
then raise(Error Custom_runtime);
remove_file c_file
diff --git a/bytecomp/emitcode.ml b/bytecomp/emitcode.ml
index 981cd1e92..83e51dc2f 100644
--- a/bytecomp/emitcode.ml
+++ b/bytecomp/emitcode.ml
@@ -43,11 +43,13 @@ type compilation_unit =
mutable cu_debug: int; (* Position of debugging info, or 0 *)
cu_debugsize: int } (* Length of debugging info *)
-(* Format of a .cmo file:
- magic number (Config.cmo_magic_number)
- absolute offset of compilation unit descriptor
- block of relocatable bytecode
- compilation unit descriptor *)
+(* Descriptor for libraries *)
+
+type library =
+ { lib_units: compilation_unit list; (* List of compilation units *)
+ lib_custom: bool; (* Requires custom mode linking? *)
+ lib_ccobjs: string list; (* C object files needed *)
+ lib_ccopts: string list } (* Extra opts to C compiler *)
(* Buffering of bytecode *)
diff --git a/bytecomp/emitcode.mli b/bytecomp/emitcode.mli
index 3cb78c912..e38ef8644 100644
--- a/bytecomp/emitcode.mli
+++ b/bytecomp/emitcode.mli
@@ -44,6 +44,22 @@ type compilation_unit =
block of relocatable bytecode
compilation unit descriptor *)
+(* Descriptor for libraries *)
+
+type library =
+ { lib_units: compilation_unit list; (* List of compilation units *)
+ lib_custom: bool; (* Requires custom mode linking? *)
+ lib_ccobjs: string list; (* C object files needed *)
+ lib_ccopts: string list } (* Extra opts to C compiler *)
+
+(* Format of a .cma file:
+ magic number (Config.cma_magic_number)
+ absolute offset of library descriptor
+ object code for first library member
+ ...
+ object code for last library member
+ library descriptor *)
+
val to_file: out_channel -> string -> instruction list -> unit
(* Arguments:
channel on output file
diff --git a/debugger/Makefile b/debugger/Makefile
index b1f11b9a9..690d50061 100644
--- a/debugger/Makefile
+++ b/debugger/Makefile
@@ -16,7 +16,7 @@ include ../config/Makefile
CAMLC=../boot/ocamlrun ../ocamlc -I ../boot
COMPFLAGS=$(INCLUDES)
-LINKFLAGS=-custom -linkall
+LINKFLAGS=-linkall -ccopt -L../otherlibs/unix
CAMLYACC=../boot/ocamlyacc
YACCFLAGS=
CAMLLEX=../boot/ocamlrun ../boot/ocamllex
@@ -75,7 +75,7 @@ OBJS=\
all: ocamldebug
ocamldebug: $(OBJS) $(OTHEROBJS)
- $(CAMLC) $(LINKFLAGS) -o ocamldebug $(OTHEROBJS) $(OBJS) ../otherlibs/unix/libunix.a
+ $(CAMLC) $(LINKFLAGS) -o ocamldebug $(OTHEROBJS) $(OBJS)
install:
cp ocamldebug $(BINDIR)/ocamldebug
diff --git a/driver/main.ml b/driver/main.ml
index 43a330da3..7fb887ff3 100644
--- a/driver/main.ml
+++ b/driver/main.ml
@@ -81,6 +81,7 @@ module Options = Main_args.Make_options (struct
custom_runtime := true; make_runtime := true; link_everything := true
let _modern = unset classic
let _noassert = set noassert
+ let _noautolink = set no_auto_link
let _o s = exec_name := s; archive_name := s; object_name := s
let _output_obj () = output_c_object := true; custom_runtime := true
let _pp s = preprocessor := Some s
diff --git a/driver/main_args.ml b/driver/main_args.ml
index 7e19e95f5..1efeffb50 100644
--- a/driver/main_args.ml
+++ b/driver/main_args.ml
@@ -30,6 +30,7 @@ module Make_options (F :
val _make_runtime : unit -> unit
val _modern : unit -> unit
val _noassert : unit -> unit
+ val _noautolink : unit -> unit
val _o : string -> unit
val _output_obj : unit -> unit
val _pp : string -> unit
@@ -75,6 +76,8 @@ struct
"-make_runtime", Arg.Unit F._make_runtime,
" (deprecated) same as -make-runtime";
"-noassert", Arg.Unit F._noassert, " Do not compile assertion checks";
+ "-noautolink", Arg.Unit F._noautolink,
+ " Don't automatically link C libraries specified in .cma files";
"-o", Arg.String F._o, "<file> Set output file name to <file>";
"-output-obj", Arg.Unit F._output_obj,
"Output a C object file instead of an executable";
diff --git a/driver/main_args.mli b/driver/main_args.mli
index b453ebd38..540a27117 100644
--- a/driver/main_args.mli
+++ b/driver/main_args.mli
@@ -30,6 +30,7 @@ module Make_options (F :
val _make_runtime : unit -> unit
val _modern : unit -> unit
val _noassert : unit -> unit
+ val _noautolink : unit -> unit
val _o : string -> unit
val _output_obj : unit -> unit
val _pp : string -> unit
diff --git a/driver/optmain.ml b/driver/optmain.ml
index 90597375d..ba3a66fa4 100644
--- a/driver/optmain.ml
+++ b/driver/optmain.ml
@@ -86,6 +86,8 @@ let main () =
" Link all modules, even unused ones";
"-modern", Arg.Clear classic, " Use strict label syntax";
"-noassert", Arg.Set noassert, " Don't compile assertion checks";
+ "-noautolink", Arg.Set no_auto_link,
+ " Don't automatically link C libraries specified in .cma files";
"-o", Arg.String(fun s -> exec_name := s;
archive_name := s;
object_name := s),
diff --git a/otherlibs/bigarray/Makefile b/otherlibs/bigarray/Makefile
index 936b794ad..2414f1cc1 100644
--- a/otherlibs/bigarray/Makefile
+++ b/otherlibs/bigarray/Makefile
@@ -33,10 +33,12 @@ libbigarray.a: $(C_OBJS)
$(RANLIB) libbigarray.a
bigarray.cma: $(CAML_OBJS)
- $(CAMLC) -a -linkall -o bigarray.cma $(CAML_OBJS)
+ $(CAMLC) -a -linkall -custom -o bigarray.cma \
+ $(CAML_OBJS) -cclib -lbigarray
bigarray.cmxa: $(CAML_OBJS:.cmo=.cmx)
- $(CAMLOPT) -a -linkall -o bigarray.cmxa $(CAML_OBJS:.cmo=.cmx)
+ $(CAMLOPT) -a -linkall -o bigarray.cmxa \
+ $(CAML_OBJS:.cmo=.cmx) -cclib -lbigarray
install:
cp bigarray.cmi bigarray.mli libbigarray.a bigarray.cma $(LIBDIR)
diff --git a/otherlibs/db/Makefile b/otherlibs/db/Makefile
index d702202bc..98004d7cb 100644
--- a/otherlibs/db/Makefile
+++ b/otherlibs/db/Makefile
@@ -33,10 +33,10 @@ libmldb.a: $(COBJS)
$(RANLIB) libmldb.a
db.cma: db.cmo
- $(CAMLC) -a -o db.cma db.cmo
+ $(CAMLC) -a -o db.cma -custom db.cmo -cclib -lmldb
db.cmxa: db.cmx
- $(CAMLOPT) -a -o db.cmxa db.cmx
+ $(CAMLOPT) -a -o db.cmxa db.cmx -cclib -lmldb
partialclean:
rm -f *.cm*
diff --git a/otherlibs/dbm/Makefile b/otherlibs/dbm/Makefile
index b232811ed..99e55ea25 100644
--- a/otherlibs/dbm/Makefile
+++ b/otherlibs/dbm/Makefile
@@ -33,10 +33,10 @@ libmldbm.a: $(COBJS)
$(RANLIB) libmldbm.a
dbm.cma: dbm.cmo
- $(CAMLC) -a -o dbm.cma dbm.cmo
+ $(CAMLC) -a -o dbm.cma -custom dbm.cmo -cclib -lmldbm -cclib -lndbm
dbm.cmxa: dbm.cmx
- $(CAMLOPT) -a -o dbm.cmxa dbm.cmx
+ $(CAMLOPT) -a -o dbm.cmxa dbm.cmx -cclib -lmldbm -cclib -lndbm
partialclean:
rm -f *.cm*
diff --git a/otherlibs/graph/Makefile b/otherlibs/graph/Makefile
index dda82dfb1..7fdd84095 100644
--- a/otherlibs/graph/Makefile
+++ b/otherlibs/graph/Makefile
@@ -35,10 +35,11 @@ libgraphics.a: $(OBJS)
$(RANLIB) libgraphics.a
graphics.cma: graphics.cmo
- $(CAMLC) -a -o graphics.cma graphics.cmo
+ $(CAMLC) -a -o graphics.cma -custom \
+ graphics.cmo -cclib -lgraph $(X11_LINK)
graphics.cmxa: graphics.cmx
- $(CAMLOPT) -a -o graphics.cmxa graphics.cmx
+ $(CAMLOPT) -a -o graphics.cmxa graphics.cmx -cclib -lgraph $(X11_LINK)
partialclean:
rm -f *.cm*
diff --git a/otherlibs/num/Makefile b/otherlibs/num/Makefile
index db9ab52be..8365537f4 100644
--- a/otherlibs/num/Makefile
+++ b/otherlibs/num/Makefile
@@ -34,10 +34,10 @@ all: libnums.a nums.cma $(CMIFILES)
allopt: libnums.a nums.cmxa $(CMIFILES)
nums.cma: $(CAMLOBJS)
- $(CAMLC) -a -o nums.cma $(CAMLOBJS)
+ $(CAMLC) -a -o nums.cma -custom $(CAMLOBJS) -cclib -lnums
nums.cmxa: $(CAMLOBJS:.cmo=.cmx)
- $(CAMLOPT) -a -o nums.cmxa $(CAMLOBJS:.cmo=.cmx)
+ $(CAMLOPT) -a -o nums.cmxa $(CAMLOBJS:.cmo=.cmx) -cclib -lnums
libnums.a: bignum/libbignum.a $(COBJS)
cp bignum/libbignum.a libnums.a
diff --git a/otherlibs/str/Makefile b/otherlibs/str/Makefile
index 07e800520..75e6b69fe 100644
--- a/otherlibs/str/Makefile
+++ b/otherlibs/str/Makefile
@@ -34,10 +34,10 @@ libstr.a: $(COBJS)
$(RANLIB) libstr.a
str.cma: str.cmo
- $(CAMLC) -a -o str.cma str.cmo
+ $(CAMLC) -a -o str.cma -custom str.cmo -cclib -lstr
str.cmxa: str.cmx
- $(CAMLOPT) -a -o str.cmxa str.cmx
+ $(CAMLOPT) -a -o str.cmxa str.cmx -cclib -lstr
$(REGEXLIB)/regex.o: $(REGEXLIB)/regex.c $(REGEXLIB)/regex.h
cd $(REGEXLIB); CC="$(CC) $(BYTECCCOMPOPTS)" sh configure; $(MAKE)
diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile
index 13017b48a..6fc65b49f 100644
--- a/otherlibs/systhreads/Makefile
+++ b/otherlibs/systhreads/Makefile
@@ -45,10 +45,12 @@ posix_n.o: posix.c
mv posix.o posix_n.o
threads.cma: $(THREAD_OBJS)
- $(CAMLC) -a -o threads.cma $(THREAD_OBJS)
+ $(CAMLC) -a -o threads.cma -custom $(THREAD_OBJS) \
+ -cclib -lthreads -cclib -lunix $(PTHREAD_LINK)
threads.cmxa: $(THREAD_OBJS:.cmo=.cmx)
- $(CAMLOPT) -a -o threads.cmxa $(THREAD_OBJS:.cmo=.cmx)
+ $(CAMLOPT) -a -o threads.cmxa $(THREAD_OBJS:.cmo=.cmx) \
+ -cclib -lthreads -cclib -lunix $(PTHREAD_LINK)
$(THREAD_OBJS:.cmo=.cmx): ../../ocamlopt
diff --git a/otherlibs/threads/Makefile b/otherlibs/threads/Makefile
index 5535c6390..01fce3d23 100644
--- a/otherlibs/threads/Makefile
+++ b/otherlibs/threads/Makefile
@@ -47,7 +47,7 @@ libthreads.a: $(C_OBJS)
$(RANLIB) libthreads.a
threads.cma: $(CAML_OBJS)
- $(CAMLC) -a -o threads.cma $(CAML_OBJS)
+ $(CAMLC) -a -o threads.cma -custom $(CAML_OBJS) -cclib -lthreads
stdlib.cma: $(LIB_OBJS)
$(CAMLC) -a -o stdlib.cma $(LIB_OBJS)
diff --git a/otherlibs/unix/.depend b/otherlibs/unix/.depend
index f73969a88..809339c35 100644
--- a/otherlibs/unix/.depend
+++ b/otherlibs/unix/.depend
@@ -74,7 +74,7 @@ sleep.o: sleep.c unixsupport.h
socket.o: socket.c unixsupport.h
socketaddr.o: socketaddr.c unixsupport.h socketaddr.h
socketpair.o: socketpair.c unixsupport.h
-sockopt.o: sockopt.c unixsupport.h
+sockopt.o: sockopt.c unixsupport.h socketaddr.h
stat.o: stat.c unixsupport.h cst2constr.h
strofaddr.o: strofaddr.c unixsupport.h socketaddr.h
symlink.o: symlink.c unixsupport.h
diff --git a/otherlibs/unix/Makefile b/otherlibs/unix/Makefile
index a44729b01..fe5267871 100644
--- a/otherlibs/unix/Makefile
+++ b/otherlibs/unix/Makefile
@@ -48,10 +48,10 @@ libunix.a: $(OBJS)
$(RANLIB) libunix.a
unix.cma: unix.cmo
- $(CAMLC) -a -linkall -o unix.cma unix.cmo
+ $(CAMLC) -a -linkall -custom -o unix.cma unix.cmo -cclib -lunix
unix.cmxa: unix.cmx
- $(CAMLOPT) -a -linkall -o unix.cmxa unix.cmx
+ $(CAMLOPT) -a -linkall -o unix.cmxa unix.cmx -cclib -lunix
unix.cmx: ../../ocamlopt
diff --git a/otherlibs/win32unix/Makefile.nt b/otherlibs/win32unix/Makefile.nt
index b7dd1fd93..e21cd1b1f 100644
--- a/otherlibs/win32unix/Makefile.nt
+++ b/otherlibs/win32unix/Makefile.nt
@@ -60,10 +60,12 @@ io.h: $(SYSTEM_INCLUDES)\io.h
copy $(SYSTEM_INCLUDES)\io.h io.h
unix.cma: $(CAML_OBJS)
- $(CAMLC) -a -linkall -o unix.cma $(CAML_OBJS)
+ $(CAMLC) -a -linkall -o unix.cma -custom $(CAML_OBJS) \
+ -cclib -lunix wsock32.lib
unix.cmxa: $(CAMLOPT_OBJS)
- $(CAMLOPT) -a -linkall -o unix.cmxa $(CAMLOPT_OBJS)
+ $(CAMLOPT) -a -linkall -o unix.cmxa $(CAMLOPT_OBJS) \
+ -cclib -lunix wsock32.lib
partialclean:
rm -f *.cm*
diff --git a/test/Moretest/Makefile b/test/Moretest/Makefile
index 11d5e5184..71a1ce3dd 100644
--- a/test/Moretest/Makefile
+++ b/test/Moretest/Makefile
@@ -51,8 +51,8 @@ bigarrays.byt: ../../otherlibs/bigarray/bigarray.cma \
-I ../../otherlibs/bigarray \
-I ../../otherlibs/unix \
unix.cma bigarray.cma bigarrays.ml \
- ../../otherlibs/bigarray/libbigarray.a \
- ../../otherlibs/unix/libunix.a
+ -ccopt -L../../otherlibs/bigarray \
+ -ccopt -L../../otherlibs/unix
bigarrays.out: ../../otherlibs/bigarray/bigarray.cmxa \
../../otherlibs/bigarray/libbigarray.a bigarrays.ml
@@ -60,8 +60,8 @@ bigarrays.out: ../../otherlibs/bigarray/bigarray.cmxa \
-I ../../otherlibs/bigarray \
-I ../../otherlibs/unix \
unix.cmxa bigarray.cmxa bigarrays.ml \
- ../../otherlibs/bigarray/libbigarray.a \
- ../../otherlibs/unix/libunix.a
+ -ccopt -L../../otherlibs/bigarray \
+ -ccopt -L../../otherlibs/unix
bigarrf.byt: bigarrf.o bigarrfstub.o \
../../otherlibs/bigarray/bigarray.cma \
@@ -71,8 +71,8 @@ bigarrf.byt: bigarrf.o bigarrfstub.o \
-I ../../otherlibs/unix \
unix.cma bigarray.cma bigarrf.ml \
bigarrf.o bigarrfstub.o \
- ../../otherlibs/bigarray/libbigarray.a \
- ../../otherlibs/unix/libunix.a \
+ -ccopt -L../../otherlibs/bigarray \
+ -ccopt -L../../otherlibs/unix \
../../byterun/libcamlrun.a -cclib -lg2c
bigarrf.out: bigarrf.o bigarrfstub.o \
@@ -83,8 +83,8 @@ bigarrf.out: bigarrf.o bigarrfstub.o \
-I ../../otherlibs/unix \
unix.cma bigarray.cma bigarrf.ml \
bigarrf.o bigarrfstub.o \
- ../../otherlibs/bigarray/libbigarray.a \
- ../../otherlibs/unix/libunix.a \
+ -ccopt -L../../otherlibs/bigarray \
+ -ccopt -L../../otherlibs/unix \
../../byterun/libcamlrun.a -cclib -lg2c
bigarrf.o: bigarrf.f
diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml
index 65202ac22..491b7c231 100644
--- a/tools/ocamlcp.ml
+++ b/tools/ocamlcp.ml
@@ -49,6 +49,7 @@ module Options = Main_args.Make_options (struct
let _make_runtime = option "-make-runtime"
let _modern = option "-modern"
let _noassert = option "-noassert"
+ let _noautolink = option "-noautolink"
let _o s = option_with_arg "-o" s
let _output_obj = option "-output-obj"
let _pp s = incompatible "-pp"
diff --git a/utils/clflags.ml b/utils/clflags.ml
index 5ad786c9f..925aac338 100644
--- a/utils/clflags.ml
+++ b/utils/clflags.ml
@@ -42,6 +42,7 @@ and recursive_types = ref false (* -rectypes *)
and make_runtime = ref false (* -make_runtime *)
and gprofile = ref false (* -p *)
and c_compiler = ref Config.bytecomp_c_compiler (* -cc *)
+and no_auto_link = ref false (* -noautolink *)
let dump_parsetree = ref false (* -dparsetree *)
and dump_rawlambda = ref false (* -drawlambda *)
and dump_lambda = ref false (* -dlambda *)
diff --git a/utils/config.mlp b/utils/config.mlp
index a406b9684..f8eb1248a 100644
--- a/utils/config.mlp
+++ b/utils/config.mlp
@@ -12,7 +12,7 @@
(* $Id$ *)
-let version = "2.99+8"
+let version = "2.99+9"
let standard_library =
try
@@ -30,9 +30,9 @@ let ranlib = "%%RANLIBCMD%%"
let exec_magic_number = "Caml1999X006"
and cmi_magic_number = "Caml1999I005"
and cmo_magic_number = "Caml1999O004"
-and cma_magic_number = "Caml1999A004"
+and cma_magic_number = "Caml1999A005"
and cmx_magic_number = "Caml1999Y006"
-and cmxa_magic_number = "Caml1999Z006"
+and cmxa_magic_number = "Caml1999Z007"
and ast_impl_magic_number = "Caml1999M007"
and ast_intf_magic_number = "Caml1999N007"