summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile16
-rw-r--r--asmcomp/asmlink.ml11
-rwxr-xr-xboot/ocamlcbin784954 -> 786998 bytes
-rwxr-xr-xboot/ocamllexbin87735 -> 88917 bytes
-rw-r--r--bytecomp/bytelibrarian.ml7
-rw-r--r--bytecomp/bytelink.ml22
-rw-r--r--bytecomp/dll.ml71
-rw-r--r--bytecomp/dll.mli4
-rw-r--r--bytecomp/dllpath.ml59
-rw-r--r--bytecomp/dllpath.mli25
-rw-r--r--bytecomp/emitcode.ml5
-rw-r--r--bytecomp/emitcode.mli5
-rwxr-xr-xconfigure15
-rw-r--r--driver/main.ml6
-rw-r--r--driver/main_args.ml2
-rw-r--r--driver/main_args.mli1
-rw-r--r--otherlibs/bigarray/Makefile2
-rw-r--r--otherlibs/dbm/Makefile2
-rw-r--r--otherlibs/dynlink/Makefile2
-rw-r--r--otherlibs/dynlink/dynlink.ml2
-rw-r--r--otherlibs/graph/Makefile2
-rw-r--r--otherlibs/labltk/lib/Makefile2
-rw-r--r--otherlibs/labltk/support/Makefile4
-rw-r--r--otherlibs/num/Makefile2
-rw-r--r--otherlibs/str/Makefile2
-rw-r--r--otherlibs/systhreads/Makefile2
-rw-r--r--otherlibs/threads/Makefile2
-rw-r--r--otherlibs/unix/Makefile2
-rw-r--r--tools/ocamlcp.ml1
-rw-r--r--toplevel/topdirs.ml2
-rw-r--r--utils/clflags.ml3
-rw-r--r--utils/config.mli6
-rw-r--r--utils/config.mlp11
33 files changed, 122 insertions, 176 deletions
diff --git a/Makefile b/Makefile
index 079b6aca1..dc5c42665 100644
--- a/Makefile
+++ b/Makefile
@@ -57,7 +57,7 @@ COMP=bytecomp/lambda.cmo bytecomp/printlambda.cmo \
bytecomp/typeopt.cmo bytecomp/switch.cmo bytecomp/matching.cmo \
bytecomp/translobj.cmo bytecomp/translcore.cmo \
bytecomp/translclass.cmo bytecomp/translmod.cmo \
- bytecomp/simplif.cmo bytecomp/runtimedef.cmo bytecomp/dllpath.cmo
+ bytecomp/simplif.cmo bytecomp/runtimedef.cmo
BYTECOMP=bytecomp/meta.cmo bytecomp/instruct.cmo bytecomp/bytegen.cmo \
bytecomp/printinstr.cmo bytecomp/opcodes.cmo bytecomp/emitcode.cmo \
@@ -102,8 +102,7 @@ EXPUNGEOBJS=utils/misc.cmo utils/tbl.cmo \
utils/config.cmo utils/clflags.cmo \
typing/ident.cmo typing/path.cmo typing/types.cmo typing/btype.cmo \
typing/predef.cmo bytecomp/runtimedef.cmo bytecomp/bytesections.cmo \
- bytecomp/dllpath.cmo bytecomp/dll.cmo \
- bytecomp/symtable.cmo toplevel/expunge.cmo
+ bytecomp/dll.cmo bytecomp/symtable.cmo toplevel/expunge.cmo
PERVASIVES=arg array buffer callback char digest filename format gc hashtbl \
lexing list map obj parsing pervasives printexc printf queue random \
@@ -213,6 +212,7 @@ opt.opt: ocamlc.opt ocamlopt.opt ocamllex.opt camlp4optopt
install: FORCE
if test -d $(BINDIR); then : ; else $(MKDIR) $(BINDIR); fi
if test -d $(LIBDIR); then : ; else $(MKDIR) $(LIBDIR); fi
+ if test -d $(LIBDIR)/shlibs; then : ; else $(MKDIR) $(LIBDIR)/shlibs; fi
if test -d $(MANDIR); then : ; else $(MKDIR) $(MANDIR); fi
cd byterun; $(MAKE) install
if test -r $(LIBDIR)/ld.conf; then :; else echo "$(LIBDIR)" > $(LIBDIR)/ld.conf; fi
@@ -229,7 +229,7 @@ install: FORCE
cd tools; $(MAKE) install
-cd man; $(MAKE) install
for i in $(OTHERLIBRARIES); do \
- (cd otherlibs/$$i; $(MAKE) install) || exit $?; \
+ (cd otherlibs/$$i; $(MAKE) install) || exit $$?; \
done
if test -f ocamlopt; then $(MAKE) installopt; else :; fi
cd camlp4; $(MAKE) install
@@ -240,7 +240,7 @@ installopt:
cd asmrun; $(MAKE) install
cp ocamlopt $(BINDIR)/ocamlopt$(EXE)
cd stdlib; $(MAKE) installopt
- for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) installopt) || exit $?; done
+ for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) installopt) || exit $$?; done
if test -f ocamlc.opt; then cp ocamlc.opt $(BINDIR)/ocamlc.opt$(EXE); else :; fi
if test -f ocamlopt.opt; then cp ocamlopt.opt $(BINDIR)/ocamlopt.opt$(EXE); else :; fi
if test -f lex/ocamllex.opt; then cp lex/ocamllex.opt $(BINDIR)/ocamllex.opt$(EXE); else :; fi
@@ -284,11 +284,9 @@ utils/config.ml: utils/config.mlp config/Makefile
-e 's|%%BYTERUN%%|$(BINDIR)/ocamlrun|' \
-e 's|%%BYTECC%%|$(BYTECC) $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS)|' \
-e 's|%%BYTELINK%%|$(BYTECC) $(BYTECCLINKOPTS)|' \
- -e 's|%%BYTECCRPATH%%|$(BYTECCRPATH)|' \
-e 's|%%NATIVECC%%|$(NATIVECC) $(NATIVECCCOMPOPTS)|' \
-e 's|%%NATIVELINK%%|$(NATIVECC) $(NATIVECCLINKOPTS)|' \
-e 's|%%PARTIALLD%%|ld -r $(NATIVECCLINKOPTS)|' \
- -e 's|%%NATIVECCRPATH%%|$(NATIVECCRPATH)|' \
-e 's|%%BYTECCLIBS%%|$(BYTECCLIBS)|' \
-e 's|%%NATIVECCLIBS%%|$(NATIVECCLIBS)|' \
-e 's|%%RANLIBCMD%%|$(RANLIBCMD)|' \
@@ -519,11 +517,11 @@ alldepend::
otherlibraries:
for i in $(OTHERLIBRARIES); do \
- (cd otherlibs/$$i; $(MAKE) RUNTIME=$(RUNTIME) all) || exit $?; \
+ (cd otherlibs/$$i; $(MAKE) RUNTIME=$(RUNTIME) all) || exit $$?; \
done
otherlibrariesopt:
for i in $(OTHERLIBRARIES); do \
- (cd otherlibs/$$i; $(MAKE) allopt) || exit $?; \
+ (cd otherlibs/$$i; $(MAKE) allopt) || exit $$?; \
done
partialclean::
for i in $(OTHERLIBRARIES); do \
diff --git a/asmcomp/asmlink.ml b/asmcomp/asmlink.ml
index 80eeaae06..15ae74366 100644
--- a/asmcomp/asmlink.ml
+++ b/asmcomp/asmlink.ml
@@ -233,15 +233,7 @@ let call_linker file_list startup_file =
(String.concat " " (List.rev file_list))
| _ ->
if not !Clflags.output_c_object then
- let rpath =
- if Config.bytecomp_c_rpath = "" then "" else
- String.concat ":"
- (List.filter ((<>) "")
- (!Clflags.dllpaths @
- Dllpath.ld_library_path_contents() @
- Dllpath.ld_conf_contents()))
- in
- Printf.sprintf "%s %s -o %s -I%s %s %s %s %s %s %s %s %s"
+ Printf.sprintf "%s %s -o %s -I%s %s %s %s %s %s %s %s"
!Clflags.c_linker
(if !Clflags.gprofile then "-pg" else "")
!Clflags.exec_name
@@ -252,7 +244,6 @@ let call_linker file_list startup_file =
(String.concat " "
(List.map (fun dir -> if dir = "" then "" else "-L" ^ dir)
!load_path))
- (if rpath <> "" then Config.bytecomp_c_rpath ^ rpath else "")
(String.concat " " (List.rev !Clflags.ccobjs))
runtime_lib
c_lib
diff --git a/boot/ocamlc b/boot/ocamlc
index faaa3d04b..0d23f3f91 100755
--- a/boot/ocamlc
+++ b/boot/ocamlc
Binary files differ
diff --git a/boot/ocamllex b/boot/ocamllex
index 94e138654..2855abbcf 100755
--- a/boot/ocamllex
+++ b/boot/ocamllex
Binary files differ
diff --git a/bytecomp/bytelibrarian.ml b/bytecomp/bytelibrarian.ml
index 7bece0570..bad04b7a5 100644
--- a/bytecomp/bytelibrarian.ml
+++ b/bytecomp/bytelibrarian.ml
@@ -41,6 +41,7 @@ let copy_compunit ic oc compunit =
let lib_sharedobjs = ref []
let lib_ccobjs = ref []
let lib_ccopts = ref []
+let lib_dllibs = ref []
(* See Bytelink.add_ccobjs for explanations on how options are ordered.
Notice that here we scan .cma files given on the command line from
@@ -50,7 +51,8 @@ let add_ccobjs l =
if not !Clflags.no_auto_link then begin
if l.lib_custom then Clflags.custom_runtime := true;
lib_ccobjs := !lib_ccobjs @ l.lib_ccobjs;
- lib_ccopts := !lib_ccopts @ l.lib_ccopts
+ lib_ccopts := !lib_ccopts @ l.lib_ccopts;
+ lib_dllibs := !lib_dllibs @ l.lib_dllibs
end
let copy_object_file oc name =
@@ -96,7 +98,8 @@ let create_archive file_list lib_name =
{ lib_units = units;
lib_custom = !Clflags.custom_runtime;
lib_ccobjs = !Clflags.ccobjs @ !lib_ccobjs;
- lib_ccopts = !Clflags.ccopts @ !lib_ccopts } in
+ lib_ccopts = !Clflags.ccopts @ !lib_ccopts;
+ lib_dllibs = !Clflags.dllibs @ !lib_dllibs } 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 c0cffe6a1..2fec10427 100644
--- a/bytecomp/bytelink.ml
+++ b/bytecomp/bytelink.ml
@@ -43,12 +43,14 @@ type link_action =
let lib_ccobjs = ref []
let lib_ccopts = ref []
+let lib_dllibs = 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
+ lib_ccopts := l.lib_ccopts @ !lib_ccopts;
+ lib_dllibs := l.lib_dllibs @ !lib_dllibs
end
(* A note on ccobj ordering:
@@ -278,11 +280,9 @@ let link_bytecode tolink exec_name standalone =
let start_code = pos_out outchan in
Symtable.init();
Hashtbl.clear crc_interfaces;
- let sharedobjs = Dll.extract_dll_names !Clflags.ccobjs in
+ let sharedobjs = List.map Dll.extract_dll_name !Clflags.dllibs in
if standalone then begin
(* Initialize the DLL machinery *)
- if List.length sharedobjs < List.length !Clflags.ccobjs
- then raise (Error Require_custom);
Dll.add_path !load_path;
try Dll.open_dlls sharedobjs
with Failure reason -> raise(Error(Cannot_open_dll reason))
@@ -405,17 +405,9 @@ let rec extract suffix l =
let build_custom_runtime prim_name exec_name =
match Sys.os_type with
"Unix" | "Cygwin" ->
- let rpath =
- if Config.bytecomp_c_rpath = "" then "" else
- String.concat ":"
- (List.filter ((<>) "")
- (!Clflags.dllpaths @
- Dllpath.ld_library_path_contents() @
- Dllpath.ld_conf_contents()))
- in
Ccomp.command
(Printf.sprintf
- "%s -o %s -I%s %s %s %s %s %s -lcamlrun %s"
+ "%s -o %s -I%s %s %s %s %s -lcamlrun %s"
!Clflags.c_linker
exec_name
Config.standard_library
@@ -424,7 +416,6 @@ let build_custom_runtime prim_name exec_name =
(String.concat " "
(List.map (fun dir -> if dir = "" then "" else "-L" ^ dir)
!load_path))
- (if rpath <> "" then Config.bytecomp_c_rpath ^ rpath else "")
(String.concat " " (List.rev !Clflags.ccobjs))
Config.bytecomp_c_libraries)
| "Win32" ->
@@ -500,8 +491,9 @@ 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.ccobjs := !Clflags.ccobjs @ !lib_ccobjs; (* put user's libs last *)
Clflags.ccopts := !lib_ccopts @ !Clflags.ccopts; (* put user's opts first *)
+ Clflags.dllibs := !lib_dllibs @ !Clflags.dllibs; (* put user's DLLs first *)
if not !Clflags.custom_runtime then
link_bytecode tolink !Clflags.exec_name true
else if not !Clflags.output_c_object then begin
diff --git a/bytecomp/dll.ml b/bytecomp/dll.ml
index e986af2fe..755bffd73 100644
--- a/bytecomp/dll.ml
+++ b/bytecomp/dll.ml
@@ -38,18 +38,15 @@ let names_of_opened_dlls = ref ([] : string list)
let add_path dirs =
search_path := dirs @ !search_path
-(* Extract names of DLLs from a list of C object files and libraries *)
-
-let extract_dll_names files =
- List.fold_right
- (fun file res ->
- if Filename.check_suffix file Config.ext_dll then
- Filename.chop_suffix file Config.ext_dll :: res
- else if String.length file >= 2 && String.sub file 0 2 = "-l" then
- ("lib" ^ String.sub file 2 (String.length file - 2)) :: res
- else
- res)
- files []
+(* Extract the name of a DLLs from its external name (xxx.so or -lxxx) *)
+
+let extract_dll_name file =
+ if Filename.check_suffix file Config.ext_dll then
+ Filename.chop_suffix file Config.ext_dll
+ else if String.length file >= 2 && String.sub file 0 2 = "-l" then
+ "dll" ^ String.sub file 2 (String.length file - 2)
+ else
+ file (* will cause error later *)
(* Open a list of DLLs, adding them to opened_dlls.
Raise [Failure msg] in case of error. *)
@@ -104,13 +101,57 @@ let synchronize_primitive num symb =
assert (actual_num = num)
end
+(* Read the [ld.conf] file and return the corresponding list of directories *)
+
+let ld_conf_contents () =
+ let path = ref [] in
+ begin try
+ let ic = open_in (Filename.concat Config.standard_library "ld.conf") in
+ begin try
+ while true do
+ path := input_line ic :: !path
+ done
+ with End_of_file -> ()
+ end;
+ close_in ic
+ with Sys_error _ -> ()
+ end;
+ List.rev !path
+
+(* Split the CAML_LD_LIBRARY_PATH environment variable and return
+ the corresponding list of directories. *)
+
+let split str sep =
+ let rec split_rec pos =
+ if pos >= String.length str then [] else begin
+ try
+ let newpos = String.index_from str pos sep in
+ String.sub str pos (newpos - pos) ::
+ split_rec (newpos + 1)
+ with Not_found ->
+ [String.sub str pos (String.length str - pos)]
+ end in
+ split_rec 0
+
+let ld_library_path_contents () =
+ let path_separator =
+ match Sys.os_type with
+ "Unix" | "Cygwin" -> ':' | "Win32" -> ';' | _ -> assert false in
+ try
+ split (Sys.getenv "CAML_LD_LIBRARY_PATH") path_separator
+ with Not_found ->
+ []
+
+let split_dll_path path =
+ split path '\000'
+
(* Initialization for linking in core (dynlink or toplevel) *)
let init_toplevel dllpath =
search_path :=
- Dllpath.ld_library_path_contents() @
- Dllpath.split_dll_path dllpath @
- Dllpath.ld_conf_contents();
+ ld_library_path_contents() @
+ split_dll_path dllpath @
+ ld_conf_contents();
opened_dlls := Array.to_list (get_current_dlls());
names_of_opened_dlls := [];
linking_in_core := true
diff --git a/bytecomp/dll.mli b/bytecomp/dll.mli
index 0e79207a9..0be68e2ab 100644
--- a/bytecomp/dll.mli
+++ b/bytecomp/dll.mli
@@ -14,8 +14,8 @@
(* Handling of dynamically-linked libraries *)
-(* Extract names of DLLs from a list of C object files and libraries *)
-val extract_dll_names: string list -> string list
+(* Extract the name of a DLLs from its external name (xxx.so or -lxxx) *)
+val extract_dll_name: string -> string
(* Open a list of DLLs, adding them to opened_dlls.
Raise [Failure msg] in case of error. *)
diff --git a/bytecomp/dllpath.ml b/bytecomp/dllpath.ml
deleted file mode 100644
index f0626a871..000000000
--- a/bytecomp/dllpath.ml
+++ /dev/null
@@ -1,59 +0,0 @@
-(***********************************************************************)
-(* *)
-(* Objective Caml *)
-(* *)
-(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
-(* *)
-(* Copyright 2001 Institut National de Recherche en Informatique et *)
-(* en Automatique. All rights reserved. This file is distributed *)
-(* under the terms of the Q Public License version 1.0. *)
-(* *)
-(***********************************************************************)
-
-(* $Id$ *)
-
-(* Handling of load path for dynamically-linked libraries *)
-
-(* Read the [ld.conf] file and return the corresponding list of directories *)
-
-let ld_conf_contents () =
- let path = ref [] in
- begin try
- let ic = open_in (Filename.concat Config.standard_library "ld.conf") in
- begin try
- while true do
- path := input_line ic :: !path
- done
- with End_of_file -> ()
- end;
- close_in ic
- with Sys_error _ -> ()
- end;
- List.rev !path
-
-(* Split the CAML_LD_LIBRARY_PATH environment variable and return
- the corresponding list of directories. *)
-
-let split str sep =
- let rec split_rec pos =
- if pos >= String.length str then [] else begin
- try
- let newpos = String.index_from str pos sep in
- String.sub str pos (newpos - pos) ::
- split_rec (newpos + 1)
- with Not_found ->
- [String.sub str pos (String.length str - pos)]
- end in
- split_rec 0
-
-let ld_library_path_contents () =
- let path_separator =
- match Sys.os_type with
- "Unix" | "Cygwin" -> ':' | "Win32" -> ';' | _ -> assert false in
- try
- split (Sys.getenv "CAML_LD_LIBRARY_PATH") path_separator
- with Not_found ->
- []
-
-let split_dll_path path =
- split path '\000'
diff --git a/bytecomp/dllpath.mli b/bytecomp/dllpath.mli
deleted file mode 100644
index 496fbf497..000000000
--- a/bytecomp/dllpath.mli
+++ /dev/null
@@ -1,25 +0,0 @@
-(***********************************************************************)
-(* *)
-(* Objective Caml *)
-(* *)
-(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
-(* *)
-(* Copyright 2001 Institut National de Recherche en Informatique et *)
-(* en Automatique. All rights reserved. This file is distributed *)
-(* under the terms of the Q Public License version 1.0. *)
-(* *)
-(***********************************************************************)
-
-(* $Id$ *)
-
-(* Handling of load path for dynamically-linked libraries *)
-
-(* Read the [ld.conf] file and return the corresponding list of directories *)
-val ld_conf_contents: unit -> string list
-
-(* Split the CAML_LD_LIBRARY_PATH environment variable and return
- the corresponding list of directories *)
-val ld_library_path_contents: unit -> string list
-
-(* Split the given 0-separated path *)
-val split_dll_path: string -> string list
diff --git a/bytecomp/emitcode.ml b/bytecomp/emitcode.ml
index c84159b51..01fbde4ba 100644
--- a/bytecomp/emitcode.ml
+++ b/bytecomp/emitcode.ml
@@ -48,8 +48,9 @@ type compilation_unit =
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 *)
+ lib_ccobjs: string list; (* C object files needed for -custom *)
+ lib_ccopts: string list; (* Extra opts to C compiler *)
+ lib_dllibs: string list } (* DLLs needed *)
(* Buffering of bytecode *)
diff --git a/bytecomp/emitcode.mli b/bytecomp/emitcode.mli
index e38ef8644..481ad506b 100644
--- a/bytecomp/emitcode.mli
+++ b/bytecomp/emitcode.mli
@@ -49,8 +49,9 @@ type compilation_unit =
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 *)
+ lib_ccobjs: string list; (* C object files needed for -custom *)
+ lib_ccopts: string list; (* Extra opts to C compiler *)
+ lib_dllibs: string list } (* DLLs needed *)
(* Format of a .cma file:
magic number (Config.cma_magic_number)
diff --git a/configure b/configure
index e3d93a24e..f085ed88a 100755
--- a/configure
+++ b/configure
@@ -368,7 +368,7 @@ shared_libraries_supported=false
sharedcccompopts=''
mksharedlib=''
byteccrpath=''
-sharedldtype='cc'
+mksharedlibrpath=''
if test $withsharedlibs = "yes"; then
case "$host" in
@@ -377,6 +377,7 @@ if test $withsharedlibs = "yes"; then
mksharedlib="gcc -shared -o"
bytecclinkopts="$bytecclinkopts -Wl,-E"
byteccrpath="-Wl,-rpath,"
+ mksharedlibrpath="-Wl,-rpath,"
shared_libraries_supported=true;;
alpha*-*-osf*)
case "$bytecc" in
@@ -385,7 +386,7 @@ if test $withsharedlibs = "yes"; then
esac
mksharedlib="ld -shared -expect_unresolved '*' -o"
byteccrpath="-Wl,-rpath,"
- sharedldtype="ld"
+ mksharedlibrpath="-rpath "
shared_libraries_supported=true;;
*-*-solaris2*)
case "$bytecc" in
@@ -394,17 +395,18 @@ if test $withsharedlibs = "yes"; then
if sh ./solaris-ld; then
mksharedlib="$bytecc -shared -o"
byteccrpath="-Wl,-R"
+ mksharedlibrpath="-R"
else
mksharedlib="$bytecc -shared -o"
bytecclinkopts="$bytecclinkopts -Wl,-E"
byteccrpath="-Wl,-rpath,"
+ mksharedlibrpath="-rpath "
fi
shared_libraries_supported=true;;
*)
sharedcccompopts="-KPIC"
byteccrpath="-Wl,-R"
mksharedlib="/usr/ccs/bin/ld -G -o"
- sharedldtype="ld"
shared_libraries_supported=true;;
esac;;
mips-sgi-irix[56]*)
@@ -414,7 +416,7 @@ if test $withsharedlibs = "yes"; then
esac
mksharedlib="ld -shared -rdata_shared -o"
byteccrpath="-Wl,-rpath,"
- sharedldtype="ld"
+ mksharedlibrpath="-rpath "
shared_libraries_supported=true;;
esac
fi
@@ -1122,8 +1124,7 @@ echo "EXE=$exe" >> Makefile
echo "SUPPORTS_SHARED_LIBRARIES=$shared_libraries_supported" >> Makefile
echo "SHAREDCCCOMPOPTS=$sharedcccompopts" >> Makefile
echo "MKSHAREDLIB=$mksharedlib" >> Makefile
-echo "SHAREDLDTYPE=$sharedldtype" >> Makefile
-
+echo "MKSHAREDLIBRPATH=$mksharedlibrpath" >> Makefile
echo "ARCH=$arch" >> Makefile
echo "MODEL=$model" >> Makefile
echo "SYSTEM=$system" >> Makefile
@@ -1163,7 +1164,7 @@ echo " options for linking....... $bytecclinkopts $cclibs $dllib $cursesl
if $shared_libraries_supported; then
echo " shared libraries are supported"
echo " options for compiling..... $sharedcccompopts $bytecccompopts"
-echo " command for building...... $mksharedlib <target>.so <objects>"
+echo " command for building...... $mksharedlib lib.so $mksharedlibrpath/a/path objs"
else
echo " shared libraries not supported"
fi
diff --git a/driver/main.ml b/driver/main.ml
index 4d97a070e..0d8f1942d 100644
--- a/driver/main.ml
+++ b/driver/main.ml
@@ -34,9 +34,10 @@ let process_file ppf name =
|| Filename.check_suffix name ".cma" then
objfiles := name :: !objfiles
else if Filename.check_suffix name ext_obj
- || Filename.check_suffix name ext_lib
- || Filename.check_suffix name ext_dll then
+ || Filename.check_suffix name ext_lib then
ccobjs := name :: !ccobjs
+ else if Filename.check_suffix name ext_dll then
+ dllibs := name :: !dllibs
else if Filename.check_suffix name ".c" then begin
Compile.c_file name;
match Sys.os_type with
@@ -74,6 +75,7 @@ module Options = Main_args.Make_options (struct
let _cclib s = ccobjs := s :: !ccobjs
let _ccopt s = ccopts := s :: !ccopts
let _custom = set custom_runtime
+ let _dllib s = dllibs := s :: !dllibs
let _dllpath s = dllpaths := !dllpaths @ [s]
let _g = set debug
let _i = set print_types
diff --git a/driver/main_args.ml b/driver/main_args.ml
index f56f16957..dc191d45c 100644
--- a/driver/main_args.ml
+++ b/driver/main_args.ml
@@ -20,6 +20,7 @@ module Make_options (F :
val _cclib : string -> unit
val _ccopt : string -> unit
val _custom : unit -> unit
+ val _dllib : string -> unit
val _dllpath : string -> unit
val _g : unit -> unit
val _i : unit -> unit
@@ -64,6 +65,7 @@ struct
"-ccopt", Arg.String F._ccopt,
"<opt> Pass option <opt> to the C compiler and linker";
"-custom", Arg.Unit F._custom, " Link in custom mode";
+ "-dllib", Arg.String F._dllib, "<lib> Use the dynamically-loaded library <lib>";
"-dllpath", Arg.String F._dllpath, "<dir> Add <dir> to the run-time search path for shared libraries";
"-g", Arg.Unit F._g, " Save debugging information";
"-i", Arg.Unit F._i, " Print the types";
diff --git a/driver/main_args.mli b/driver/main_args.mli
index f8d270f0d..3ddec52b7 100644
--- a/driver/main_args.mli
+++ b/driver/main_args.mli
@@ -20,6 +20,7 @@ module Make_options (F :
val _cclib : string -> unit
val _ccopt : string -> unit
val _custom : unit -> unit
+ val _dllib : string -> unit
val _dllpath : string -> unit
val _g : unit -> unit
val _i : unit -> unit
diff --git a/otherlibs/bigarray/Makefile b/otherlibs/bigarray/Makefile
index 43dac9458..600f9863d 100644
--- a/otherlibs/bigarray/Makefile
+++ b/otherlibs/bigarray/Makefile
@@ -39,7 +39,7 @@ bigarray.cmxa: $(CAML_OBJS:.cmo=.cmx)
$(CAML_OBJS:.cmo=.cmx)
install:
- if test -f libbigarray.so; then cp libbigarray.so $(LIBDIR); fi
+ if test -f dllbigarray.so; then cp dllbigarray.so $(LIBDIR)/dllbigarray.so; fi
cp bigarray.cmi bigarray.mli libbigarray.a bigarray.cma $(LIBDIR)
cd $(LIBDIR); $(RANLIB) libbigarray.a
cp bigarray.h $(LIBDIR)/caml/bigarray.h
diff --git a/otherlibs/dbm/Makefile b/otherlibs/dbm/Makefile
index 5e8b99737..188771e84 100644
--- a/otherlibs/dbm/Makefile
+++ b/otherlibs/dbm/Makefile
@@ -45,7 +45,7 @@ clean: partialclean
rm -f *.a *.o
install:
- if test -f libmldbm.so; then cp libmldbm.so $(LIBDIR)/libmldbm.so; fi
+ if test -f dllmldbm.so; then cp dllmldbm.so $(LIBDIR)/dllmldbm.so; fi
cp libmldbm.a $(LIBDIR)/libmldbm.a
cd $(LIBDIR); $(RANLIB) libmldbm.a
cp dbm.cma dbm.cmi dbm.mli $(LIBDIR)
diff --git a/otherlibs/dynlink/Makefile b/otherlibs/dynlink/Makefile
index abecf597a..fd9e99989 100644
--- a/otherlibs/dynlink/Makefile
+++ b/otherlibs/dynlink/Makefile
@@ -24,7 +24,7 @@ OBJS=dynlink.cmo
COMPILEROBJS=misc.cmo config.cmo tbl.cmo clflags.cmo \
ident.cmo path.cmo \
types.cmo btype.cmo predef.cmo runtimedef.cmo \
- bytesections.cmo dllpath.cmo dll.cmo symtable.cmo opcodes.cmo meta.cmo
+ bytesections.cmo dll.cmo symtable.cmo opcodes.cmo meta.cmo
all: dynlink.cma extract_crc
diff --git a/otherlibs/dynlink/dynlink.ml b/otherlibs/dynlink/dynlink.ml
index 408fed34b..831ea963e 100644
--- a/otherlibs/dynlink/dynlink.ml
+++ b/otherlibs/dynlink/dynlink.ml
@@ -181,7 +181,7 @@ let loadfile file_name =
seek_in ic toc_pos;
let lib = (input_value ic : library) in
begin try
- Dll.open_dlls (Dll.extract_dll_names lib.lib_ccobjs)
+ Dll.open_dlls lib.lib_dllibs
with Failure reason ->
raise(Error(Cannot_open_dll reason))
end;
diff --git a/otherlibs/graph/Makefile b/otherlibs/graph/Makefile
index 47974e74f..738b9d59b 100644
--- a/otherlibs/graph/Makefile
+++ b/otherlibs/graph/Makefile
@@ -48,7 +48,7 @@ clean: partialclean
rm -f *.a *.so *.o
install:
- if test -f libgraphics.so; then cp libgraphics.so $(LIBDIR)/libgraphics.so; fi
+ if test -f dllgraphics.so; then cp dllgraphics.so $(LIBDIR)/dllgraphics.so; fi
cp libgraphics.a $(LIBDIR)/libgraphics.a
cd $(LIBDIR); $(RANLIB) libgraphics.a
cp graphics.cm[ia] graphicsX11.cmi graphics.mli graphicsX11.mli $(LIBDIR)
diff --git a/otherlibs/labltk/lib/Makefile b/otherlibs/labltk/lib/Makefile
index f9e592a6e..ec1e04cd3 100644
--- a/otherlibs/labltk/lib/Makefile
+++ b/otherlibs/labltk/lib/Makefile
@@ -47,7 +47,7 @@ clean :
install: labltk.cma labltktop$(EXE) labltk
if test -d $(LABLTKDIR); then : ; else mkdir $(LABLTKDIR); fi
if test `grep -s -c '^$(LABLTKDIR)$$' $(LIBDIR)/ld.conf || :` = 0; \
- then echo $(LABLTKDIR) >> $(LIBDIR)/ld.conf; fi
+ then echo $(LABLTKDIR) >> $(LIBDIR)/ld.conf; fi
cp $(WIDGETOBJS:.cmo=.cmi) tk.cmi $(LABLTKDIR)
cp labltk.cma labltktop$(EXE) $(LABLTKDIR)
chmod 644 $(LABLTKDIR)/*.cmi
diff --git a/otherlibs/labltk/support/Makefile b/otherlibs/labltk/support/Makefile
index a66f13f49..5e5888506 100644
--- a/otherlibs/labltk/support/Makefile
+++ b/otherlibs/labltk/support/Makefile
@@ -28,8 +28,8 @@ install: liblabltk41.a $(PUB)
if test -d $(LABLTKDIR); then : ; else mkdir $(LABLTKDIR); fi
cp $(PUB) liblabltk41.a $(LABLTKDIR)
cd $(LABLTKDIR); $(RANLIB) liblabltk41.a
- if test -f liblabltk41.so; then cp liblabltk41.so $(LABLTKDIR); fi
- cd $(LABLTKDIR); chmod 644 $(PUB) liblabltk41.*
+ if test -f dlllabltk41.so; then cp dlllabltk41.so $(LABLTKDIR)/dlllabltk41.so; fi
+ cd $(LABLTKDIR); chmod 644 $(PUB) liblabltk41.a dlllabltk41.so
clean :
rm -f *.cm* *.o *.a
diff --git a/otherlibs/num/Makefile b/otherlibs/num/Makefile
index 0d3ff246c..ab71be00e 100644
--- a/otherlibs/num/Makefile
+++ b/otherlibs/num/Makefile
@@ -51,7 +51,7 @@ $(BIGNUM_OBJS):
$(CAMLOBJS:.cmo=.cmx): ../../ocamlopt
install:
- if test -f libnums.so; then cp libnums.so $(LIBDIR); fi
+ if test -f dllnums.so; then cp dllnums.so $(LIBDIR)/dllnums.so; fi
cp libnums.a $(LIBDIR)/libnums.a
cd $(LIBDIR); $(RANLIB) libnums.a
cp nums.cma $(CMIFILES) $(CMIFILES:.cmi=.mli) $(LIBDIR)
diff --git a/otherlibs/str/Makefile b/otherlibs/str/Makefile
index f0e22e08e..0d4fdc04c 100644
--- a/otherlibs/str/Makefile
+++ b/otherlibs/str/Makefile
@@ -51,7 +51,7 @@ clean: partialclean
cd $(REGEXLIB); if test -f Makefile; then $(MAKE) distclean; else exit 0; fi
install:
- if test -f libstr.so; then cp libstr.so $(LIBDIR)/libstr.so; fi
+ if test -f dllstr.so; then cp dllstr.so $(LIBDIR)/dllstr.so; fi
cp libstr.a $(LIBDIR)/libstr.a
cd $(LIBDIR); $(RANLIB) libstr.a
cp str.cma str.cmi str.mli $(LIBDIR)
diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile
index 3f5265983..6ea121cdc 100644
--- a/otherlibs/systhreads/Makefile
+++ b/otherlibs/systhreads/Makefile
@@ -68,7 +68,7 @@ clean: partialclean
rm -f $(GENFILES)
install:
- if test -f libthreads.so; then cp libthreads.so $(LIBDIR)/libthreads.so; fi
+ if test -f dllthreads.so; then cp dllthreads.so $(LIBDIR)/dllthreads.so; fi
cp libthreads.a $(LIBDIR)/libthreads.a
cd $(LIBDIR); $(RANLIB) libthreads.a
if test -d $(LIBDIR)/threads; then :; else mkdir $(LIBDIR)/threads; fi
diff --git a/otherlibs/threads/Makefile b/otherlibs/threads/Makefile
index a2cc80493..1133128c0 100644
--- a/otherlibs/threads/Makefile
+++ b/otherlibs/threads/Makefile
@@ -95,7 +95,7 @@ clean: partialclean
rm -f pervasives.mli marshal.mli unix.mli
install:
- if test -f libthreads.so; then cp libthreads.so $(LIBDIR)/libthreads.so; fi
+ if test -f dllthreads.so; then cp dllthreads.so $(LIBDIR)/dllthreads.so; fi
cp libthreads.a $(LIBDIR)/libthreads.a
cd $(LIBDIR); $(RANLIB) libthreads.a
if test -d $(LIBDIR)/threads; then : ; else mkdir $(LIBDIR)/threads; fi
diff --git a/otherlibs/unix/Makefile b/otherlibs/unix/Makefile
index 4ec0cea7d..4e903b9c2 100644
--- a/otherlibs/unix/Makefile
+++ b/otherlibs/unix/Makefile
@@ -63,7 +63,7 @@ clean: partialclean
rm -f *.a *.o *.so
install:
- if test -f libunix.so; then cp libunix.so $(LIBDIR)/libunix.so; fi
+ if test -f dllunix.so; then cp dllunix.so $(LIBDIR)/dllunix.so; fi
cp libunix.a $(LIBDIR)/libunix.a
cd $(LIBDIR); $(RANLIB) libunix.a
cp unix.cma $(MLOBJS:.cmo=.cmi) $(MLOBJS:.cmo=.mli) $(LIBDIR)
diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml
index 7615d4686..c3d9fe272 100644
--- a/tools/ocamlcp.ml
+++ b/tools/ocamlcp.ml
@@ -39,6 +39,7 @@ module Options = Main_args.Make_options (struct
let _cclib s = option_with_arg "-cclib" s
let _ccopt s = option_with_arg "-ccopt" s
let _custom = option "-custom"
+ let _dllib = option_with_arg "-dllib"
let _dllpath = option_with_arg "-dllpath"
let _g = option "-g"
let _i = option "-i"
diff --git a/toplevel/topdirs.ml b/toplevel/topdirs.ml
index ee7e8f36c..fa028ac82 100644
--- a/toplevel/topdirs.ml
+++ b/toplevel/topdirs.ml
@@ -110,7 +110,7 @@ let dir_load ppf name =
seek_in ic toc_pos;
let lib = (input_value ic : library) in
begin try
- Dll.open_dlls (Dll.extract_dll_names lib.lib_ccobjs)
+ Dll.open_dlls (List.map Dll.extract_dll_name lib.lib_dllibs)
with Failure reason ->
fprintf ppf "Cannot load required shared library: %s.@." reason;
raise Load_failed
diff --git a/utils/clflags.ml b/utils/clflags.ml
index 0c82dee4a..7da86147c 100644
--- a/utils/clflags.ml
+++ b/utils/clflags.ml
@@ -15,7 +15,8 @@
(* Command-line parameters *)
let objfiles = ref ([] : string list) (* .cmo and .cma files *)
-and ccobjs = ref ([] : string list) (* .o, .a, .so and -lxxx files *)
+and ccobjs = ref ([] : string list) (* .o, .a, .so and -cclib -lxxx *)
+and dllibs = ref ([] : string list) (* .so and -dllib -lxxx *)
let compile_only = ref false (* -c *)
and exec_name = ref "a.out" (* -o *)
diff --git a/utils/config.mli b/utils/config.mli
index a82c96f20..bad3f0a22 100644
--- a/utils/config.mli
+++ b/utils/config.mli
@@ -29,9 +29,6 @@ val bytecomp_c_linker: string
with the bytecode compiler *)
val bytecomp_c_libraries: string
(* The C libraries to link with custom runtimes *)
-val bytecomp_c_rpath: string
- (* Option to [bytecomp_c_compiler] for specifying a
- directory to search shared libraries at run-time *)
val native_c_compiler: string
(* The C compiler to use for compiling C files
with the native-code compiler *)
@@ -42,9 +39,6 @@ val native_c_libraries: string
(* The C libraries to link with native-code programs *)
val native_partial_linker: string
(* The linker to use for partial links (-output-obj option) *)
-val native_c_rpath: string
- (* Option to [native_c_compiler] for specifying a
- directory to search shared libraries at run-time *)
val ranlib: string
(* Command to randomize a library, or "" if not needed *)
diff --git a/utils/config.mlp b/utils/config.mlp
index ea0ac16a6..201fd4b5d 100644
--- a/utils/config.mlp
+++ b/utils/config.mlp
@@ -12,10 +12,13 @@
(* $Id$ *)
-let version = "3.03 ALPHA+1 (2001-10-22)"
+let version = "3.03 ALPHA+2 (2001-10-29)"
let standard_library =
try
+ Sys.getenv "OCAMLLIB"
+ with Not_found ->
+ try
Sys.getenv "CAMLLIB"
with Not_found ->
"%%LIBDIR%%"
@@ -24,20 +27,18 @@ let standard_runtime = "%%BYTERUN%%"
let bytecomp_c_compiler = "%%BYTECC%%"
let bytecomp_c_linker = "%%BYTELINK%%"
let bytecomp_c_libraries = "%%BYTECCLIBS%%"
-let bytecomp_c_rpath = "%%BYTECCRPATH%%"
let native_c_compiler = "%%NATIVECC%%"
let native_c_linker = "%%NATIVELINK%%"
let native_c_libraries = "%%NATIVECCLIBS%%"
-let native_c_rpath = "%%NATIVECCRPATH%%"
let native_partial_linker = "%%PARTIALLD%%"
let ranlib = "%%RANLIBCMD%%"
let exec_magic_number = "Caml1999X006"
and cmi_magic_number = "Caml1999I008"
and cmo_magic_number = "Caml1999O004"
-and cma_magic_number = "Caml1999A005"
+and cma_magic_number = "Caml1999A006"
and cmx_magic_number = "Caml1999Y006"
-and cmxa_magic_number = "Caml1999Z007"
+and cmxa_magic_number = "Caml1999Z008"
and ast_impl_magic_number = "Caml1999M008"
and ast_intf_magic_number = "Caml1999N007"