Chris_T avatar Chris_T committed 4c52277

Compilation fixes for OCaml 3.11.0 on win32.

Comments (0)

Files changed (3)

 installation (http://camlcvs.inria.fr/cgi-bin/cvsweb/ocaml/README.win32),
 download "make" and "lapack".
 
-Modify Makefile.conf to include the full path of the lapack libraries, e.g.:
+For OCaml <= 3.10.2, modify Makefile.conf to include the full path of
+the lapack libraries, e.g.:
 
   export LIBDIRS := c:/cygwin/lib
 
+For OCaml >= 3.11.0, the default configuration should work.
+
 Open a cygwin shell, go to the directory where you downloaded Lacaml
 and type "make".
 
 ifdef MINGW
   export MINGW
   WIN32   := 1
-  CFLAGS_WIN32 := -mno-cygwin
+  # We are compiling with cywin tools:
+  CFLAGS_WIN32 := -mno-cygwin -I /usr/include
   # The default value 'cc' makes 'ocamlc -cc "cc"' raises the error 'The
   # NTVDM CPU has encountered an illegal instruction'.
   CC := gcc
 endif
 
 ifdef WIN32
-DLLSONAME := $(CLIB_BASE).dll
+DLLSONAME := dll$(CLIB_BASE).dll
 else
 DLLSONAME := dll$(CLIB_BASE).so
 endif
 
 ifndef STATIC
 ifdef MINGW
+# From OCaml 3.11.0, ocamlmklib is available on windows
+OCAMLMLIB_EXISTS = $(shell which $(OCAMLMKLIB))
+ifeq ($(strip $(OCAMLMLIB_EXISTS)),)
 $(DLLSONAME):		$(OBJ_LINK)
 			$(CC) $(CFLAGS) $(CFLAGS_WIN32) $(OBJ_LINK) -shared -o $@ \
-			-Wl,--whole-archive $(wildcard $(foreach dir,$(LIBDIRS),$(CLIBS:%=$(dir)/lib%.a))) \
+			$(wildcard $(foreach dir,$(LIBDIRS),$(CLIBS:%=$(dir)/lib%.a))) \
 			 '$(OCAMLLIBPATH)/ocamlrun.a' \
+			-Wl,--whole-archive \
 			-Wl,--export-all-symbols \
-			-Wl,--no-whole-archive \
 			-Wl,--allow-multiple-definition \
 			-Wl,--enable-auto-import
 else
+$(DLLSONAME):		$(OBJ_LINK)
+			$(OCAMLMKLIB) $(INCFLAGS) $(CLIBFLAGS) \
+				-o $(CLIB_BASE) $(OBJ_LINK) $(CLIBS:%=-l%) \
+				$(CFRAMEWORKS:%=-framework %) \
+				$(OCAMLMKLIB_FLAGS)
+endif
+else
 ifdef MSVC
 $(DLLSONAME):		$(OBJ_LINK)
 			link /NOLOGO /DLL /OUT:$@ $(OBJ_LINK) \
 -include ../Makefile.conf
 
 NO_CUSTOM = y
+INSTALL_DLL = dlllacaml_stubs.so
 
 SYSTEM=$(shell ocamlc -config 2>/dev/null|grep system|sed 's/system: //')
 
   OCAMLBLDFLAGS = -ccopt "-framework vecLib"
 else
 ifeq ($(SYSTEM), mingw)
-  # exp10 does not exists under cywin-mingw
+  # exp10 does not exists under cygwin-mingw
   EXP10 = exp10.c
   NO_CUSTOM =
-  # Useless for now:
-  INSTALL_DLL = lacaml_stubs.dll
+  # For ocaml >= 3.11.0
+  INSTALL_DLL = dlllacaml_stubs.dll
 else
   EXP10 =
 endif
   complex32.ml complex64.ml \
   io.cmi utils.cmi common.cmi \
   lacaml.cmi lacaml.cma lacaml_top.cma lacaml.cmxa lacaml.a \
-  liblacaml_stubs.a dlllacaml_stubs.so
+  liblacaml_stubs.a $(INSTALL_DLL)
 
 TRASH := \
   $(PREMAKE) \
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.