| Attached Files | 0001-various-patches-to-build-an-ocaml-cross-compiler.patch [^] (21,616 bytes) 2012-08-24 00:26 [Show Content] [Hide Content]From 0a4f59615e611ce517dc02226ca185370ae646a6 Mon Sep 17 00:00:00 2001
From: William <r.3@libertysurf.fr>
Date: Wed, 13 Jun 2012 22:27:54 +0200
Subject: [PATCH] various patches to build an ocaml cross compiler
---
Makefile-mingw.in | 82 +++++++++++++++++++++++++++++++++++++
asmrun/Makefile | 6 ++-
asmrun/i386.S | 3 ++
byterun/Makefile.common | 2 +-
byterun/dynlink.c | 7 +++-
byterun/unix.c | 4 ++
byterun/win32.c | 28 ++++++++++++-
hardcode_mingw_include.patch | 24 +++++++++++
myocamlbuild.ml | 8 ++--
ocamldoc/Makefile | 1 +
otherlibs/Makefile.shared | 7 ++--
otherlibs/bigarray/Makefile | 4 +-
otherlibs/bigarray/Makefile.nt | 1 +
otherlibs/num/Makefile | 1 +
otherlibs/str/Makefile | 1 +
otherlibs/systhreads/Makefile | 18 +++++---
otherlibs/systhreads/Makefile.nt | 7 +++-
otherlibs/systhreads/st_win32.h | 2 +-
otherlibs/win32graph/Makefile.nt | 2 +-
otherlibs/win32unix/Makefile.nt | 2 +-
otherlibs/win32unix/nonblock.c | 4 +-
otherlibs/win32unix/select.c | 2 +-
otherlibs/win32unix/unixsupport.c | 4 +-
utils/config.mlp | 8 +---
24 files changed, 193 insertions(+), 35 deletions(-)
create mode 100644 Makefile-mingw.in
create mode 100644 hardcode_mingw_include.patch
diff --git a/Makefile-mingw.in b/Makefile-mingw.in
new file mode 100644
index 0000000..a303487
--- /dev/null
+++ b/Makefile-mingw.in
@@ -0,0 +1,82 @@
+PREFIX=@prefix@
+BINDIR=@bindir@
+LIBDIR=@libdir@
+TARGET2=@target2@
+LIBDIR2=@libdir2@
+STUBLIBDIR=$(LIBDIR)/stublibs
+MANDIR=$(PREFIX)/man
+MANEXT=1
+RANLIB=$(TARGET2)ranlib
+RANLIBCMD=$(TARGET2)ranlib
+SHARPBANGSCRIPTS=true
+BNG_ARCH=i386
+BNG_ASM_LEVEL=1
+PTHREAD_LINK=
+X11_INCLUDES=
+X11_LINK=
+DBM_INCLUDES=
+DBM_LINK=
+TK_DEFS=
+TK_LINK=
+BYTECC=$(TARGET2)gcc
+BYTECCCOMPOPTS=-O -mms-bitfields -Wall -Wno-unused
+BYTECCLINKOPTS=-L$(LIBDIR2)
+BYTECCLIBS=
+BYTECCRPATH=
+EXE=
+SUPPORTS_SHARED_LIBRARIES=true
+SHAREDCCCOMPOPTS=
+MKSHAREDLIBRPATH=
+NATDYNLINK=true
+NATDYNLINKOPTS=
+SYSLIB=-l$(1)
+#ml let syslib x = "-l"^x;;
+
+### How to build a static library
+MKLIB=$(TARGET2)ar rcs $(1) $(2)
+#ml let mklib out files opts = Printf.sprintf ("%sar rcs %s %s %s") target2 out opts files;;
+ARCH=i386
+MODEL=default
+SYSTEM=mingw
+NATIVECC=$(TARGET2)gcc
+NATIVECCCOMPOPTS=-O -mms-bitfields -Wall -Wno-unused
+NATIVECCPROFOPTS=-pg
+NATIVECCLINKOPTS=-L$(LIBDIR2)
+NATIVECCRPATH=
+NATIVECCLIBS=
+ASM=$(TARGET2)as
+ASPP=$(TARGET2)gcc -c
+ASPPPROFFLAGS=-DPROFILING
+PROFILING=prof
+DYNLINKOPTS=-ldl
+OTHERLIBRARIES=@otherlibraries@
+DEBUGGER=ocamldebugger
+CC_PROFILE=-pg
+SYSTHREAD_SUPPORT=true
+PARTIALLD=$(TARGET2)ld -r
+PACKLD=$(PARTIALLD) $(NATIVECCLINKOPTS) -o
+DLLCCCOMPOPTS=
+IFLEXDIR=-I@flexdir@
+O=o
+A=a
+SO=dll
+EXT_OBJ=.o
+EXT_ASM=.s
+EXT_LIB=.a
+EXT_DLL=.dll
+EXTRALIBS=
+CCOMPTYPE=cc
+TOOLCHAIN=cc
+CMXS=cmxs
+FLEXLINK=$(TARGET2)flexlink -chain mingw
+MKEXE=$(FLEXLINK) -exe
+MKDLL=$(FLEXLINK)
+MKMAINDLL=$(FLEXLINK) -maindll
+
+# Build compiler for cross-compilation.
+BUILD_MKEXE=gcc
+BUILD_RANLIB=ranlib
+BUILD_MKDLL=gcc -shared
+BUILD_CC=gcc
+BUILD_CCLIBS=-lm
+BUILD_CFLAGS=
diff --git a/asmrun/Makefile b/asmrun/Makefile
index efffa33..5b1a8a5 100644
--- a/asmrun/Makefile
+++ b/asmrun/Makefile
@@ -26,7 +26,7 @@ COBJS=startup.o main.o fail.o roots.o globroots.o signals.o signals_asm.o \
misc.o freelist.o major_gc.o minor_gc.o memory.o alloc.o compare.o ints.o \
floats.o str.o array.o io.o extern.o intern.o hash.o sys.o parsing.o \
gc_ctrl.o terminfo.o md5.o obj.o lexing.o printexc.o callback.o weak.o \
- compact.o finalise.o custom.o unix.o backtrace.o natdynlink.o debugger.o
+ compact.o finalise.o custom.o unix.o win32.o backtrace.o natdynlink.o debugger.o
ASMOBJS=$(ARCH).o
@@ -138,6 +138,8 @@ globroots.c: ../byterun/globroots.c
ln -s ../byterun/globroots.c globroots.c
unix.c: ../byterun/unix.c
ln -s ../byterun/unix.c unix.c
+win32.c: ../byterun/win32.c
+ ln -s ../byterun/win32.c win32.c
dynlink.c: ../byterun/dynlink.c
ln -s ../byterun/dynlink.c dynlink.c
signals.c: ../byterun/signals.c
@@ -148,7 +150,7 @@ debugger.c: ../byterun/debugger.c
LINKEDFILES=misc.c freelist.c major_gc.c minor_gc.c memory.c alloc.c array.c \
compare.c ints.c floats.c str.c io.c extern.c intern.c hash.c sys.c \
parsing.c gc_ctrl.c terminfo.c md5.c obj.c lexing.c printexc.c callback.c \
- weak.c compact.c finalise.c meta.c custom.c main.c globroots.c unix.c \
+ weak.c compact.c finalise.c meta.c custom.c main.c globroots.c unix.c win32.c \
dynlink.c signals.c debugger.c
clean::
diff --git a/asmrun/i386.S b/asmrun/i386.S
index 95198e0..25edd28 100644
--- a/asmrun/i386.S
+++ b/asmrun/i386.S
@@ -64,6 +64,9 @@
popl %edx; popl %ecx; popl %eax; popl %ebp
#define PROFILE_C \
pushl %ebp; movl %esp, %ebp; call Lmcount$stub; popl %ebp
+#elif defined(SYS_mingw)
+#define PROFILE_CAML
+#define PROFILE_C
#endif
#else
#define PROFILE_CAML
diff --git a/byterun/Makefile.common b/byterun/Makefile.common
index d554d29..047d817 100755
--- a/byterun/Makefile.common
+++ b/byterun/Makefile.common
@@ -24,7 +24,7 @@ COMMONOBJS=\
compare.o ints.o floats.o str.o array.o io.o extern.o intern.o \
hash.o sys.o meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o \
lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o \
- dynlink.o
+ dynlink.o win32.o
PRIMS=\
alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
diff --git a/byterun/dynlink.c b/byterun/dynlink.c
index 9f46597..2aaa07b 100644
--- a/byterun/dynlink.c
+++ b/byterun/dynlink.c
@@ -80,7 +80,12 @@ static char * parse_ld_conf(void)
stdlib = getenv("OCAMLLIB");
if (stdlib == NULL) stdlib = getenv("CAMLLIB");
- if (stdlib == NULL) stdlib = OCAML_STDLIB_DIR;
+ if (stdlib == NULL)
+#ifdef OCAML_STDLIB_DIR
+ stdlib = OCAML_STDLIB_DIR;
+#else
+ stdlib = ".";
+#endif
ldconfname = caml_stat_alloc(strlen(stdlib) + 2 + sizeof(LD_CONF_NAME));
strcpy(ldconfname, stdlib);
strcat(ldconfname, "/" LD_CONF_NAME);
diff --git a/byterun/unix.c b/byterun/unix.c
index 20fd172..e86f1c8 100644
--- a/byterun/unix.c
+++ b/byterun/unix.c
@@ -15,6 +15,8 @@
/* Unix-specific stuff */
+#ifndef WIN32
+
#define _GNU_SOURCE
/* Helps finding RTLD_DEFAULT in glibc */
@@ -323,3 +325,5 @@ int caml_executable_name(char * name, int name_len)
}
#endif
+
+#endif /* !WIN32 */
diff --git a/byterun/win32.c b/byterun/win32.c
index 29991c0..e7767a4 100644
--- a/byterun/win32.c
+++ b/byterun/win32.c
@@ -13,6 +13,8 @@
/* $Id: win32.c 9547 2010-01-22 12:48:24Z doligez $ */
+#ifdef WIN32
+
/* Win32-specific stuff */
#include <windows.h>
@@ -35,6 +37,26 @@
#include "flexdll.h"
+/* XXX including <io.h> gets ../byterun/io.h for some reason.
+ * Including the real io.h using the full path fails because of
+ * some strange bug in the system header file itself. Give up and
+ * just define _finddata_t explicitly here.
+ */
+#ifndef _FSIZE_T_DEFINED
+typedef unsigned long _fsize_t;
+#define _FSIZE_T_DEFINED
+
+struct _finddata_t
+{
+ unsigned attrib;
+ time_t time_create;
+ time_t time_access;
+ time_t time_write;
+ _fsize_t size;
+ char name[FILENAME_MAX];
+};
+#endif
+
#ifndef S_ISREG
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#endif
@@ -93,7 +115,7 @@ CAMLexport char * caml_search_exe_in_path(char * name)
pathlen = strlen(name) + 1;
if (pathlen < 256) pathlen = 256;
while (1) {
- fullname = stat_alloc(pathlen);
+ fullname = caml_stat_alloc(pathlen);
retcode = SearchPath(NULL, /* use system search path */
name,
".exe", /* add .exe extension if needed */
@@ -107,7 +129,7 @@ CAMLexport char * caml_search_exe_in_path(char * name)
break;
}
if (retcode < pathlen) break;
- stat_free(fullname);
+ caml_stat_free(fullname);
pathlen = retcode + 1;
}
return fullname;
@@ -543,3 +565,5 @@ intnat caml_win32_random_seed (void)
seed ^= GetCurrentProcessId();
return seed;
}
+
+#endif /* WIN32 */
diff --git a/hardcode_mingw_include.patch b/hardcode_mingw_include.patch
new file mode 100644
index 0000000..571747d
--- /dev/null
+++ b/hardcode_mingw_include.patch
@@ -0,0 +1,24 @@
+Index: build-tree/ocaml-3.11.1/utils/clflags.ml
+===================================================================
+--- build-tree.orig/ocaml-3.12.1/utils/clflags.ml 2010-01-07 04:00:11.000000000 +0100
++++ build-tree/ocaml-3.12.1/utils/clflags.ml 2010-01-07 04:00:24.000000000 +0100
+@@ -20,7 +20,7 @@
+
+ let compile_only = ref false (* -c *)
+ and output_name = ref (None : string option) (* -o *)
+-and include_dirs = ref ([] : string list)(* -I *)
++and include_dirs = ref (["@libdir@"] : string list)(* -I *)
+ and no_std_include = ref false (* -nostdlib *)
+ and print_types = ref false (* -i *)
+ and make_archive = ref false (* -a *)
+--- build-tree.orig/ocaml-3.12.1/tools/ocamlmklib.mlp 2010-02-22 20:15:57.000000000 -0600
++++ build-tree/ocaml-3.12.1/tools/ocamlmklib.mlp 2010-02-22 20:16:20.000000000 -0600
+@@ -29,7 +29,7 @@
+ and failsafe = ref false (* whether to fall back on static build only *)
+ and c_libs = ref [] (* libs to pass to mksharedlib and ocamlc -cclib *)
+ and c_opts = ref [] (* options to pass to mksharedlib and ocamlc -ccopt *)
+-and ld_opts = ref [] (* options to pass only to the linker *)
++and ld_opts = ref ["-I @libdir@"] (* options to pass only to the linker *)
+ and ocamlc = ref (compiler_path "ocamlc")
+ and ocamlopt = ref (compiler_path "ocamlopt")
+ and output = ref "a" (* Output name for Caml part of library *)
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index d50274d..ecdad32 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -107,9 +107,11 @@ let if_mixed_dir dir =
if mixed then ".."/dir else dir;;
let unix_dir =
- match Sys.os_type with
- | "Win32" -> if_mixed_dir "otherlibs/win32unix"
- | _ -> if_mixed_dir "otherlibs/unix";;
+ if_mixed_dir (
+ let win32path = "otherlibs/win32unix" in
+ if Sys.file_exists (win32path / "unix.cma") then win32path
+ else "otherlibs/unix"
+ );;
let threads_dir = if_mixed_dir "otherlibs/threads";;
let systhreads_dir = if_mixed_dir "otherlibs/systhreads";;
diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile
index 8f6e87c..30b4489 100644
--- a/ocamldoc/Makefile
+++ b/ocamldoc/Makefile
@@ -62,6 +62,7 @@ INCLUDES_DEP=-I $(OCAMLSRCDIR)/parsing \
INCLUDES_NODEP= -I $(OCAMLSRCDIR)/stdlib \
-I $(OCAMLSRCDIR)/otherlibs/str \
-I $(OCAMLSRCDIR)/otherlibs/dynlink \
+ -I $(OCAMLSRCDIR)/otherlibs/win32unix \
-I $(OCAMLSRCDIR)/otherlibs/unix \
-I $(OCAMLSRCDIR)/otherlibs/num \
-I $(OCAMLSRCDIR)/otherlibs/graph
diff --git a/otherlibs/Makefile.shared b/otherlibs/Makefile.shared
index b235cc3..97217d5 100644
--- a/otherlibs/Makefile.shared
+++ b/otherlibs/Makefile.shared
@@ -42,7 +42,8 @@ CLIBNAME ?= $(LIBNAME)
all: lib$(CLIBNAME).$(A) $(LIBNAME).cma $(CMIFILES)
-allopt: lib$(CLIBNAME).$(A) $(LIBNAME).cmxa $(LIBNAME).$(CMXS) $(CMIFILES)
+allopt: lib$(CLIBNAME).$(A) $(LIBNAME).cmxa $(CMIFILES)
+# $(LIBNAME).$(CMXS)
$(LIBNAME).cma: $(CAMLOBJS)
$(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlc '$(CAMLC)' -linkall $(CAMLOBJS) $(LINKOPTS)
@@ -50,8 +51,8 @@ $(LIBNAME).cma: $(CAMLOBJS)
$(LIBNAME).cmxa: $(CAMLOBJS_NAT)
$(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlopt '$(CAMLOPT)' -linkall $(CAMLOBJS_NAT) $(LINKOPTS)
-$(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(CLIBNAME).$(A)
- $(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . $(LIBNAME).cmxa
+#$(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(CLIBNAME).$(A)
+# $(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . $(LIBNAME).cmxa
lib$(CLIBNAME).$(A): $(COBJS)
$(MKLIB) -oc $(CLIBNAME) $(COBJS) $(LDOPTS)
diff --git a/otherlibs/bigarray/Makefile b/otherlibs/bigarray/Makefile
index 81f5aef..f5f0747 100644
--- a/otherlibs/bigarray/Makefile
+++ b/otherlibs/bigarray/Makefile
@@ -14,8 +14,8 @@
# $Id: Makefile 8748 2008-01-04 09:52:27Z xleroy $
LIBNAME=bigarray
-EXTRACFLAGS=-I../unix -DIN_OCAML_BIGARRAY -DCAML_NAME_SPACE
-EXTRACAMLFLAGS=-I ../unix
+EXTRACFLAGS=-I../win32unix -I../unix -DIN_OCAML_BIGARRAY -DCAML_NAME_SPACE
+EXTRACAMLFLAGS=-I ../win32unix -I ../unix
COBJS=bigarray_stubs.$(O) mmap_unix.$(O)
CAMLOBJS=bigarray.cmo
HEADERS=bigarray.h
diff --git a/otherlibs/bigarray/Makefile.nt b/otherlibs/bigarray/Makefile.nt
index 94ef9dd..0b72534 100644
--- a/otherlibs/bigarray/Makefile.nt
+++ b/otherlibs/bigarray/Makefile.nt
@@ -19,6 +19,7 @@ EXTRACAMLFLAGS=-I ../win32unix
COBJS=bigarray_stubs.$(O) mmap_win32.$(O)
CAMLOBJS=bigarray.cmo
HEADERS=bigarray.h
+LDOPTS=-L@libdir@
include ../Makefile.nt
diff --git a/otherlibs/num/Makefile b/otherlibs/num/Makefile
index 6feef50..86d331c 100644
--- a/otherlibs/num/Makefile
+++ b/otherlibs/num/Makefile
@@ -21,6 +21,7 @@ CAMLOBJS=int_misc.cmo nat.cmo big_int.cmo arith_flags.cmo \
ratio.cmo num.cmo arith_status.cmo
CMIFILES=big_int.cmi nat.cmi num.cmi ratio.cmi arith_status.cmi
COBJS=bng.$(O) nat_stubs.$(O)
+LDOPTS=-L@libdir@
include ../Makefile
diff --git a/otherlibs/str/Makefile b/otherlibs/str/Makefile
index b59fe80..38c6798 100644
--- a/otherlibs/str/Makefile
+++ b/otherlibs/str/Makefile
@@ -20,6 +20,7 @@ LIBNAME=str
COBJS=strstubs.$(O)
CLIBNAME=camlstr
CAMLOBJS=str.cmo
+LDOPTS=-L@libdir@
include ../Makefile
diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile
index 5ee2775..bcd3186 100644
--- a/otherlibs/systhreads/Makefile
+++ b/otherlibs/systhreads/Makefile
@@ -15,13 +15,13 @@
include ../../config/Makefile
-CAMLC=../../ocamlcomp.sh -I ../unix
-CAMLOPT=../../ocamlcompopt.sh -I ../unix
+CAMLC=../../ocamlcomp.sh -I ../win32unix -I ../unix
+CAMLOPT=../../ocamlcompopt.sh -I ../win32unix -I ../unix
MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib
COMPFLAGS=-warn-error A -g
-BYTECODE_C_OBJS=st_stubs_b.o
-NATIVECODE_C_OBJS=st_stubs_n.o
+BYTECODE_C_OBJS=st_stubs_b.o win32_b.o
+NATIVECODE_C_OBJS=st_stubs_n.o win32_n.o
THREAD_OBJS= thread.cmo mutex.cmo condition.cmo event.cmo threadUnix.cmo
@@ -37,6 +37,10 @@ st_stubs_b.o: st_stubs.c st_posix.h
-c st_stubs.c
mv st_stubs.o st_stubs_b.o
+win32_b.$(O): st_stubs.c st_win32.h
+ $(BYTECC) -I ../../byterun $(BYTECCCOMPOPTS) $(CFLAGS) -c st_stubs.c
+ mv st_stubs.$(O) win32_b.$(O)
+
# Dynamic linking with -lpthread is risky on many platforms, so
# do not create a shared object for libthreadsnat.
libthreadsnat.a: $(NATIVECODE_C_OBJS)
@@ -46,9 +50,13 @@ st_stubs_n.o: st_stubs.c st_posix.h
$(NATIVECC) -O -I../../asmrun -I../../byterun $(NATIVECCCOMPOPTS) $(SHAREDCCCOMPOPTS) -DNATIVE_CODE -DTARGET_$(ARCH) -DSYS_$(SYSTEM) -c st_stubs.c
mv st_stubs.o st_stubs_n.o
+win32_n.$(O): st_stubs.c st_win32.h
+ $(NATIVECC) -DNATIVE_CODE -O -I../../asmrun -I../../byterun $(NATIVECCCOMPOPTS) -c st_stubs.c
+ mv st_stubs.$(O) win32_n.$(O)
+
threads.cma: $(THREAD_OBJS)
$(MKLIB) -ocamlc '$(CAMLC)' -o threads $(THREAD_OBJS) \
- -cclib -lunix $(PTHREAD_LINK)
+ -cclib -lunix $(PTHREAD_LINK) -lcamlrun
# See remark above: force static linking of libthreadsnat.a
threads.cmxa: $(THREAD_OBJS:.cmo=.cmx)
diff --git a/otherlibs/systhreads/Makefile.nt b/otherlibs/systhreads/Makefile.nt
index a7d6aaa..1766b6e 100644
--- a/otherlibs/systhreads/Makefile.nt
+++ b/otherlibs/systhreads/Makefile.nt
@@ -21,6 +21,7 @@ CAMLOPT=../../boot/ocamlrun ../../ocamlopt -I ../../stdlib -I ../win32unix
COMPFLAGS=-warn-error A -g
MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib
CFLAGS=-I../../byterun $(EXTRACFLAGS)
+LDOPTS=-L@libdir@
CAMLOBJS=thread.cmo mutex.cmo condition.cmo event.cmo threadUnix.cmo
CMIFILES=$(CAMLOBJS:.cmo=.cmi)
@@ -34,7 +35,7 @@ all: lib$(LIBNAME).$(A) $(LIBNAME).cma $(CMIFILES)
allopt: lib$(LIBNAME).$(A) $(LIBNAME).cmxa $(LIBNAME).cmxs $(CMIFILES)
$(LIBNAME).cma: $(CAMLOBJS)
- $(MKLIB) -o $(LIBNAME) -ocamlc "..\\..\\boot\\ocamlrun ..\\..\\ocamlc" -linkall $(CAMLOBJS) $(LINKOPTS)
+ $(MKLIB) -o $(LIBNAME) -ocamlc "../../boot/ocamlrun ../../ocamlc" -linkall $(CAMLOBJS) $(LINKOPTS)
lib$(LIBNAME).$(A): $(COBJS)
$(MKLIB) -o $(LIBNAME) $(COBJS) $(LDOPTS)
@@ -46,7 +47,7 @@ st_stubs_b.$(O): st_stubs.c st_win32.h
$(LIBNAME).cmxa: $(CAMLOBJS:.cmo=.cmx)
- $(MKLIB) -o $(LIBNAME)nat -ocamlopt "..\\..\\boot\\ocamlrun ..\\..\\ocamlopt" -linkall $(CAMLOBJS:.cmo=.cmx) $(LINKOPTS)
+ $(MKLIB) -o $(LIBNAME)nat -ocamlopt "../../boot/ocamlrun ../../ocamlopt" -linkall $(CAMLOBJS:.cmo=.cmx) $(LINKOPTS)
mv $(LIBNAME)nat.cmxa $(LIBNAME).cmxa
mv $(LIBNAME)nat.$(A) $(LIBNAME).$(A)
@@ -71,6 +72,7 @@ clean: partialclean
install:
cp dllthreads.dll $(STUBLIBDIR)/dllthreads.dll
cp libthreads.$(A) $(LIBDIR)/libthreads.$(A)
+ cd $(LIBDIR); $(RANLIB) libthreads.$(A)
mkdir -p $(LIBDIR)/threads
cp $(CMIFILES) threads.cma $(LIBDIR)/threads
rm -f $(LIBDIR)/threads/stdlib.cma
@@ -78,6 +80,7 @@ install:
installopt:
cp libthreadsnat.$(A) $(LIBDIR)/libthreadsnat.$(A)
+ cd $(LIBDIR); $(RANLIB) libthreadsnat.$(A)
cp $(THREAD_OBJS:.cmo=.cmx) threads.cmxa threads.$(A) $(LIBDIR)/threads
cp threads.cmxs $(LIBDIR)/threads
diff --git a/otherlibs/systhreads/st_win32.h b/otherlibs/systhreads/st_win32.h
index e3e37c8..a55c4b4 100644
--- a/otherlibs/systhreads/st_win32.h
+++ b/otherlibs/systhreads/st_win32.h
@@ -16,7 +16,7 @@
/* Win32 implementation of the "st" interface */
#include <windows.h>
-#include <WinError.h>
+#include <winerror.h>
#include <stdio.h>
#include <signal.h>
diff --git a/otherlibs/win32graph/Makefile.nt b/otherlibs/win32graph/Makefile.nt
index 92f244d..0201484 100644
--- a/otherlibs/win32graph/Makefile.nt
+++ b/otherlibs/win32graph/Makefile.nt
@@ -18,7 +18,7 @@ COBJS=open.$(O) draw.$(O) events.$(O) dib.$(O)
CAMLOBJS=graphics.cmo
WIN32LIBS=$(call SYSLIB,kernel32) $(call SYSLIB,gdi32) $(call SYSLIB,user32)
LINKOPTS=-cclib "\"$(WIN32LIBS)\""
-LDOPTS=-ldopt "$(WIN32LIBS)"
+LDOPTS=-L@libdir@ -ldopt "$(WIN32LIBS)"
include ../Makefile.nt
diff --git a/otherlibs/win32unix/Makefile.nt b/otherlibs/win32unix/Makefile.nt
index 5fa26cf..f048cee 100644
--- a/otherlibs/win32unix/Makefile.nt
+++ b/otherlibs/win32unix/Makefile.nt
@@ -40,7 +40,7 @@ LIBNAME=unix
COBJS=$(ALL_FILES:.c=.$(O))
CAMLOBJS=unix.cmo unixLabels.cmo
LINKOPTS=-cclib $(WSOCKLIB)
-LDOPTS=-ldopt $(WSOCKLIB)
+LDOPTS=-L@libdir@ -ldopt $(WSOCKLIB)
EXTRACAMLFLAGS=-nolabels
EXTRACFLAGS=-I../unix
HEADERS=unixsupport.h socketaddr.h
diff --git a/otherlibs/win32unix/nonblock.c b/otherlibs/win32unix/nonblock.c
index ab5f2aa..0383940 100755
--- a/otherlibs/win32unix/nonblock.c
+++ b/otherlibs/win32unix/nonblock.c
@@ -26,7 +26,7 @@ CAMLprim value unix_set_nonblock(socket)
win32_maperr(WSAGetLastError());
uerror("unix_set_nonblock", Nothing);
}
- Flags_fd_val(socket) = Flags_fd_val(socket) | FLAGS_FD_IS_BLOCKING;
+ Flags_fd_val(socket) = Flags_fd_val(socket) & ~FLAGS_FD_IS_BLOCKING;
return Val_unit;
}
@@ -39,6 +39,6 @@ CAMLprim value unix_clear_nonblock(socket)
win32_maperr(WSAGetLastError());
uerror("unix_clear_nonblock", Nothing);
}
- Flags_fd_val(socket) = Flags_fd_val(socket) & ~FLAGS_FD_IS_BLOCKING;
+ Flags_fd_val(socket) = Flags_fd_val(socket) | FLAGS_FD_IS_BLOCKING;
return Val_unit;
}
diff --git a/otherlibs/win32unix/select.c b/otherlibs/win32unix/select.c
index 1c2b4dd..da31000 100644
--- a/otherlibs/win32unix/select.c
+++ b/otherlibs/win32unix/select.c
@@ -556,7 +556,7 @@ void socket_poll (HANDLE hStop, void *_data)
if (iterQuery->uFlagsFd & FLAGS_FD_IS_BLOCKING)
{
DEBUG_PRINT("Restore a blocking socket");
- iMode = 1;
+ iMode = 0;
check_error(lpSelectData,
WSAEventSelect((SOCKET)(iterQuery->hFileDescr), aEvents[i], 0) != 0 ||
ioctlsocket((SOCKET)(iterQuery->hFileDescr), FIONBIO, &iMode) != 0);
diff --git a/otherlibs/win32unix/unixsupport.c b/otherlibs/win32unix/unixsupport.c
index 5f8077d..c83b1d4 100644
--- a/otherlibs/win32unix/unixsupport.c
+++ b/otherlibs/win32unix/unixsupport.c
@@ -53,7 +53,7 @@ value win_alloc_handle(HANDLE h)
Handle_val(res) = h;
Descr_kind_val(res) = KIND_HANDLE;
CRT_fd_val(res) = NO_CRT_FD;
- Flags_fd_val(res) = 0;
+ Flags_fd_val(res) = FLAGS_FD_IS_BLOCKING;
return res;
}
@@ -63,7 +63,7 @@ value win_alloc_socket(SOCKET s)
Socket_val(res) = s;
Descr_kind_val(res) = KIND_SOCKET;
CRT_fd_val(res) = NO_CRT_FD;
- Flags_fd_val(res) = 0;
+ Flags_fd_val(res) = FLAGS_FD_IS_BLOCKING;
return res;
}
diff --git a/utils/config.mlp b/utils/config.mlp
index 9694868..373fb7a 100644
--- a/utils/config.mlp
+++ b/utils/config.mlp
@@ -83,11 +83,7 @@ let ext_asm = "%%EXT_ASM%%"
let ext_lib = "%%EXT_LIB%%"
let ext_dll = "%%EXT_DLL%%"
-let default_executable_name =
- match Sys.os_type with
- "Unix" -> "a.out"
- | "Win32" | "Cygwin" -> "camlprog.exe"
- | _ -> "camlprog"
+let default_executable_name = "camlprog.exe"
let systhread_supported = %%SYSTHREAD_SUPPORT%%;;
@@ -114,7 +110,7 @@ let print_config oc =
p "ext_asm" ext_asm;
p "ext_lib" ext_lib;
p "ext_dll" ext_dll;
- p "os_type" Sys.os_type;
+ p "os_type" "Win32";
p "default_executable_name" default_executable_name;
p_bool "systhread_supported" systhread_supported;
flush oc;
--
1.7.9.5
0001-config-Makefile.mingw64-remove-redundant-mms-bitfiel.patch [^] (1,386 bytes) 2012-12-26 22:23 [Show Content] [Hide Content]From 711c9198d72b10e8052b73d493bf62a452671156 Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Sat, 15 Dec 2012 09:59:44 +0100
Subject: [PATCH 01/13] config/Makefile.mingw64: remove redundant
-mms-bitfields.
mingw-w64 defaults to -mms-bitfields; there is no need to specify it.
---
config/Makefile.mingw64 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/config/Makefile.mingw64 b/config/Makefile.mingw64
index 673e3b5..0ff83c2 100644
--- a/config/Makefile.mingw64
+++ b/config/Makefile.mingw64
@@ -86,13 +86,13 @@ ASM_CFI_SUPPORTED=false
BYTECC=$(TOOLPREF)gcc
### Additional compile-time options for $(BYTECC). (For static linking.)
-BYTECCCOMPOPTS=-O -mms-bitfields -Wall -Wno-unused
+BYTECCCOMPOPTS=-O -Wall -Wno-unused
### Additional link-time options for $(BYTECC). (For static linking.)
BYTECCLINKOPTS=
### Additional compile-time options for $(BYTECC). (For building a DLL.)
-DLLCCCOMPOPTS=-O -mms-bitfields -Wall -Wno-unused -DCAML_DLL
+DLLCCCOMPOPTS=-O -Wall -Wno-unused -DCAML_DLL
### Libraries needed
BYTECCLIBS=-lws2_32
@@ -139,7 +139,7 @@ SYSTEM=mingw64
NATIVECC=$(BYTECC)
### Additional compile-time options for $(NATIVECC).
-NATIVECCCOMPOPTS=-O -mms-bitfields -Wall -Wno-unused
+NATIVECCCOMPOPTS=-O -Wall -Wno-unused
### Additional link-time options for $(NATIVECC)
NATIVECCLINKOPTS=
--
1.7.12.1
0002-.gitignore-ignore-vim-temp-files-and-.cm-stuff.patch [^] (486 bytes) 2012-12-26 22:23 [Show Content] [Hide Content]From 3c301e782e4bced3734e0325e51b6b54958da4a1 Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Sat, 15 Dec 2012 10:04:21 +0100
Subject: [PATCH 02/13] .gitignore: ignore vim temp files and .cm* stuff.
---
.gitignore | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..756d3e2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+.*.swp
+*~
+*.cm[oax]
+*.cmx[as]
--
1.7.12.1
0003-configure-use-stderr-for-all-messages-targetted-at-t.patch [^] (35,508 bytes) 2012-12-26 22:23 [Show Content] [Hide Content]From dfbfa9fcedfc2beb50850d7416748bf631862aa4 Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Sat, 15 Dec 2012 13:19:02 +0100
Subject: [PATCH 03/13] configure: use stderr for all messages targetted at
the user.
This is a bit more consistent and frees stdout for shell script uses.
---
configure | 392 +++++++++++++++++++++++++++++++-------------------------------
1 file changed, 196 insertions(+), 196 deletions(-)
diff --git a/configure b/configure
index 139fdd5..ca3080d 100755
--- a/configure
+++ b/configure
@@ -183,22 +183,22 @@ echo "MANEXT=$manext" >> Makefile
if test "$host_type" = "unknown"; then
if host_type=`../gnu/config.guess`; then :; else
- echo "Cannot guess host type"
- echo "You must specify one with the -host option"
+ echo "Cannot guess host type" 1>&2
+ echo "You must specify one with the -host option" 1>&2
exit 2
fi
fi
if host=`../gnu/config.sub $host_type`; then :; else
- echo "Please specify the correct host type with the -host option"
+ echo "Please specify the correct host type with the -host option" 1>&2
exit 2
fi
-echo "Configuring for a $host ..."
+echo "Configuring for a $host ..." 1>&2
# Do we have gcc?
if test -z "$ccoption"; then
if sh ./searchpath gcc; then
- echo "gcc found"
+ echo "gcc found" 1>&2
cc=gcc
else
cc=cc
@@ -322,7 +322,7 @@ case "$bytecc,$host" in
flexlink="flexlink -chain cygwin -merge-manifest -stack 16777216"
flexdir=`$flexlink -where | dos2unix`
if test -z "$flexdir"; then
- echo "flexlink not found: native shared libraries won't be available"
+ echo "flexlink not found: native shared libraries won't be available" 1>&2
withsharedlibs=no
else
iflexdir="-I\"$flexdir\""
@@ -352,37 +352,37 @@ export cc cclibs verbose
sh ./runtest ansi.c
case $? in
- 0) echo "The C compiler is ANSI-compliant.";;
- 1) echo "The C compiler $cc is not ANSI-compliant."
- echo "You need an ANSI C compiler to build OCaml."
+ 0) echo "The C compiler is ANSI-compliant." 1>&2 ;;
+ 1) echo "The C compiler $cc is not ANSI-compliant." 1>&2
+ echo "You need an ANSI C compiler to build OCaml." 1>&2
exit 2;;
- *) echo "Unable to compile the test program."
- echo "Make sure the C compiler $cc is properly installed."
+ *) echo "Unable to compile the test program." 1>&2
+ echo "Make sure the C compiler $cc is properly installed." 1>&2
exit 2;;
esac
# Check the sizes of data types
-echo "Checking the sizes of integers and pointers..."
+echo "Checking the sizes of integers and pointers..." 1>&2
set `sh ./runtest sizes.c`
case "$2,$3" in
- 4,4) echo "OK, this is a regular 32 bit architecture."
+ 4,4) echo "OK, this is a regular 32 bit architecture." 1>&2
echo "#undef ARCH_SIXTYFOUR" >> m.h
arch64=false;;
- *,8) echo "Wow! A 64 bit architecture!"
+ *,8) echo "Wow! A 64 bit architecture!" 1>&2
echo "#define ARCH_SIXTYFOUR" >> m.h
arch64=true;;
- *,*) echo "This architecture seems to be neither 32 bits nor 64 bits."
- echo "OCaml won't run on this architecture."
+ *,*) echo "This architecture seems to be neither 32 bits nor 64 bits." 1>&2
+ echo "OCaml won't run on this architecture." 1>&2
exit 2;;
- *) echo "Unable to compile the test program."
- echo "Make sure the C compiler $cc is properly installed."
+ *) echo "Unable to compile the test program." 1>&2
+ echo "Make sure the C compiler $cc is properly installed." 1>&2
exit 2;;
esac
if test $1 != 4 && test $2 != 4 && test $4 != 4; then
- echo "Sorry, we can't find a 32-bit integer type"
- echo "(sizeof(short) = $4, sizeof(int) = $1, sizeof(long) = $2)"
- echo "OCaml won't run on this architecture."
+ echo "Sorry, we can't find a 32-bit integer type" 1>&2
+ echo "(sizeof(short) = $4, sizeof(int) = $1, sizeof(long) = $2)" 1>&2
+ echo "OCaml won't run on this architecture." 1>&2
exit 2
fi
@@ -399,22 +399,22 @@ if test $2 = 8; then
else
sh ./runtest longlong.c
case $? in
- 0) echo "64-bit \"long long\" integer type found (printf with \"%ll\")."
+ 0) echo "64-bit \"long long\" integer type found (printf with \"%ll\")." 1>&2
echo "#define ARCH_INT64_TYPE long long" >> m.h
echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
echo '#define ARCH_INT64_PRINTF_FORMAT "ll"' >> m.h
int64_native=true;;
- 1) echo "64-bit \"long long\" integer type found (printf with \"%q\")."
+ 1) echo "64-bit \"long long\" integer type found (printf with \"%q\")." 1>&2
echo "#define ARCH_INT64_TYPE long long" >> m.h
echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
echo '#define ARCH_INT64_PRINTF_FORMAT "q"' >> m.h
int64_native=true;;
- 2) echo "64-bit \"long long\" integer type found (but no printf)."
+ 2) echo "64-bit \"long long\" integer type found (but no printf)." 1>&2
echo "#define ARCH_INT64_TYPE long long" >> m.h
echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
int64_native=true;;
- *) echo "No suitable 64-bit integer type found, will use software emulation."
+ *) echo "No suitable 64-bit integer type found, will use software emulation." 1>&2
echo "#undef ARCH_INT64_TYPE" >> m.h
echo "#undef ARCH_UINT64_TYPE" >> m.h
echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
@@ -423,8 +423,8 @@ else
fi
if test $3 = 8 && test $int64_native = false; then
- echo "This architecture has 64-bit pointers but no 64-bit integer type."
- echo "OCaml won't run on this architecture."
+ echo "This architecture has 64-bit pointers but no 64-bit integer type." 1>&2
+ echo "OCaml won't run on this architecture." 1>&2
exit 2
fi
@@ -432,16 +432,16 @@ fi
sh ./runtest endian.c
case $? in
- 0) echo "This is a big-endian architecture."
+ 0) echo "This is a big-endian architecture." 1>&2
echo "#define ARCH_BIG_ENDIAN" >> m.h;;
- 1) echo "This is a little-endian architecture."
+ 1) echo "This is a little-endian architecture." 1>&2
echo "#undef ARCH_BIG_ENDIAN" >> m.h;;
- 2) echo "This architecture seems to be neither big endian nor little endian."
- echo "OCaml won't run on this architecture."
+ 2) echo "This architecture seems to be neither big endian nor little endian." 1>&2
+ echo "OCaml won't run on this architecture." 1>&2
exit 2;;
- *) echo "Something went wrong during endianness determination."
- echo "You'll have to figure out endianness yourself"
- echo "(option ARCH_BIG_ENDIAN in m.h).";;
+ *) echo "Something went wrong during endianness determination." 1>&2
+ echo "You'll have to figure out endianness yourself" 1>&2
+ echo "(option ARCH_BIG_ENDIAN in m.h)." 1>&2 ;;
esac
# Determine alignment constraints
@@ -457,23 +457,23 @@ case "$host" in
# if we're in 64-bit mode (sizeof(long) == 8),
# we must not doubleword-align floats...
if test $2 = 8; then
- echo "Doubles can be word-aligned."
+ echo "Doubles can be word-aligned." 1>&2
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h
else
- echo "Doubles must be doubleword-aligned."
+ echo "Doubles must be doubleword-aligned." 1>&2
echo "#define ARCH_ALIGN_DOUBLE" >> m.h
fi;;
*)
sh ./runtest dblalign.c
case $? in
- 0) echo "Doubles can be word-aligned."
+ 0) echo "Doubles can be word-aligned." 1>&2
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h;;
- 1) echo "Doubles must be doubleword-aligned."
+ 1) echo "Doubles must be doubleword-aligned." 1>&2
echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
- *) echo "Something went wrong during alignment determination for doubles."
- echo "I'm going to assume this architecture has alignment constraints over doubles."
- echo "That's a safe bet: OCaml will work even if"
- echo "this architecture has actually no alignment constraints."
+ *) echo "Something went wrong during alignment determination for doubles." 1>&2
+ echo "I'm going to assume this architecture has alignment constraints over doubles." 1>&2
+ echo "That's a safe bet: OCaml will work even if" 1>&2
+ echo "this architecture has actually no alignment constraints." 1>&2
echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
esac;;
esac
@@ -483,23 +483,23 @@ if $int64_native; then
# PR#5088: autodetection is unreliable on ARM. PR#5280: also on MIPS.
sparc*-*-*|hppa*-*-*|arm*-*-*|mips*-*-*)
if test $2 = 8; then
- echo "64-bit integers can be word-aligned."
+ echo "64-bit integers can be word-aligned." 1>&2
echo "#undef ARCH_ALIGN_INT64" >> m.h
else
- echo "64-bit integers must be doubleword-aligned."
+ echo "64-bit integers must be doubleword-aligned." 1>&2
echo "#define ARCH_ALIGN_INT64" >> m.h
fi;;
*)
sh ./runtest int64align.c
case $? in
- 0) echo "64-bit integers can be word-aligned."
+ 0) echo "64-bit integers can be word-aligned." 1>&2
echo "#undef ARCH_ALIGN_INT64" >> m.h;;
- 1) echo "64-bit integers must be doubleword-aligned."
+ 1) echo "64-bit integers must be doubleword-aligned." 1>&2
echo "#define ARCH_ALIGN_INT64" >> m.h;;
- *) echo "Something went wrong during alignment determination for 64-bit integers."
- echo "I'm going to assume this architecture has alignment constraints."
- echo "That's a safe bet: OCaml will work even if"
- echo "this architecture has actually no alignment constraints."
+ *) echo "Something went wrong during alignment determination for 64-bit integers." 1>&2
+ echo "I'm going to assume this architecture has alignment constraints." 1>&2
+ echo "That's a safe bet: OCaml will work even if" 1>&2
+ echo "this architecture has actually no alignment constraints." 1>&2
echo "#define ARCH_ALIGN_INT64" >> m.h;;
esac
esac
@@ -511,11 +511,11 @@ fi
sh ./runtest divmod.c
case $? in
- 0) echo "Native division and modulus have round-towards-zero semantics, will use them."
+ 0) echo "Native division and modulus have round-towards-zero semantics, will use them." 1>&2
echo "#undef NONSTANDARD_DIV_MOD" >> m.h;;
- 1) echo "Native division and modulus do not have round-towards-zero semantics, will use software emulation."
+ 1) echo "Native division and modulus do not have round-towards-zero semantics, will use software emulation." 1>&2
echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
- *) echo "Something went wrong while checking native division and modulus, please report it."
+ *) echo "Something went wrong while checking native division and modulus, please report it." 1>&2
echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
esac
@@ -791,11 +791,11 @@ esac
# Where is ranlib?
if sh ./searchpath ranlib; then
- echo "ranlib found"
+ echo "ranlib found" 1>&2
echo "RANLIB=ranlib" >> Makefile
echo "RANLIBCMD=ranlib" >> Makefile
else
- echo "ranlib not used"
+ echo "ranlib not used" 1>&2
echo "RANLIB=ar rs" >> Makefile
echo "RANLIBCMD=" >> Makefile
fi
@@ -806,21 +806,21 @@ echo "ARCMD=ar" >> Makefile
# Do #! scripts work?
if (SHELL=/bin/sh; export SHELL; (./sharpbang || ./sharpbang2) >/dev/null); then
- echo "#! appears to work in shell scripts"
+ echo "#! appears to work in shell scripts" 1>&2
case "$host" in
*-*-sunos*|*-*-unicos*)
- echo "We won't use it, though, because under SunOS and Unicos it breaks"
- echo "on pathnames longer than 30 characters"
+ echo "We won't use it, though, because under SunOS and Unicos it" 1>&2
+ echo " breaks on pathnames longer than 30 characters" 1>&2
echo "SHARPBANGSCRIPTS=false" >> Makefile;;
*-*-cygwin*)
- echo "We won't use it, though, because of conflicts with .exe extension"
- echo " under Cygwin"
+ echo "We won't use it, though, because of conflicts with .exe" 1>&2
+ echo " extension under Cygwin" 1>&2
echo "SHARPBANGSCRIPTS=false" >> Makefile;;
*)
echo "SHARPBANGSCRIPTS=true" >> Makefile;;
esac
else
- echo "No support for #! in shell scripts"
+ echo "No support for #! in shell scripts" 1>&2
echo "SHARPBANGSCRIPTS=false" >> Makefile
fi
@@ -837,17 +837,17 @@ nativecccompopts="$nativecccompopts -D_FILE_OFFSET_BITS=64"
# Check the semantics of signal handlers
if sh ./hasgot sigaction sigprocmask; then
- echo "POSIX signal handling found."
+ echo "POSIX signal handling found." 1>&2
echo "#define POSIX_SIGNALS" >> s.h
else
if sh ./runtest signals.c; then
- echo "Signals have the BSD semantics."
+ echo "Signals have the BSD semantics." 1>&2
echo "#define BSD_SIGNALS" >> s.h
else
- echo "Signals have the System V semantics."
+ echo "Signals have the System V semantics." 1>&2
fi
if sh ./hasgot sigsetmask; then
- echo "sigsetmask() found"
+ echo "sigsetmask() found" 1>&2
echo "#define HAS_SIGSETMASK" >> s.h
fi
fi
@@ -855,19 +855,19 @@ fi
# For the Pervasives module
if sh ./hasgot2 -i math.h $mathlib expm1 log1p hypot copysign; then
- echo "expm1(), log1p(), hypot(), copysign() found."
+ echo "expm1(), log1p(), hypot(), copysign() found." 1>&2
echo "#define HAS_C99_FLOAT_OPS" >> s.h
fi
# For the Sys module
if sh ./hasgot getrusage; then
- echo "getrusage() found."
+ echo "getrusage() found." 1>&2
echo "#define HAS_GETRUSAGE" >> s.h
fi
if sh ./hasgot times; then
- echo "times() found."
+ echo "times() found." 1>&2
echo "#define HAS_TIMES" >> s.h
fi
@@ -876,7 +876,7 @@ fi
if test "$withcurses" = "yes"; then
for libs in "" "-lcurses" "-ltermcap" "-lcurses -ltermcap" "-lncurses"; do
if sh ./hasgot $libs tgetent tgetstr tgetnum tputs; then
- echo "termcap functions found (with libraries '$libs')"
+ echo "termcap functions found (with libraries '$libs')" 1>&2
echo "#define HAS_TERMCAP" >> s.h
curseslibs="${libs}"
break
@@ -892,106 +892,106 @@ otherlibraries="unix str num dynlink bigarray"
has_sockets=no
if sh ./hasgot socket socketpair bind listen accept connect; then
- echo "You have BSD sockets."
+ echo "You have BSD sockets." 1>&2
echo "#define HAS_SOCKETS" >> s.h
has_sockets=yes
elif sh ./hasgot -lnsl -lsocket socket socketpair bind listen accept connect; then
- echo "You have BSD sockets (with libraries '-lnsl -lsocket')"
+ echo "You have BSD sockets (with libraries '-lnsl -lsocket')" 1>&2
cclibs="$cclibs -lnsl -lsocket"
echo "#define HAS_SOCKETS" >> s.h
has_sockets=yes
fi
if sh ./hasgot -i sys/socket.h -t socklen_t; then
- echo "socklen_t is defined in <sys/socket.h>"
+ echo "socklen_t is defined in <sys/socket.h>" 1>&2
echo "#define HAS_SOCKLEN_T" >> s.h
fi
if sh ./hasgot inet_aton; then
- echo "inet_aton() found."
+ echo "inet_aton() found." 1>&2
echo "#define HAS_INET_ATON" >> s.h
fi
if sh ./hasgot -i sys/types.h -i sys/socket.h -i netinet/in.h \
-t 'struct sockaddr_in6' \
&& sh ./hasgot getaddrinfo getnameinfo inet_pton inet_ntop; then
- echo "IPv6 is supported."
+ echo "IPv6 is supported." 1>&2
echo "#define HAS_IPV6" >> s.h
fi
if sh ./hasgot -i unistd.h; then
- echo "unistd.h found."
+ echo "unistd.h found." 1>&2
echo "#define HAS_UNISTD" >> s.h
fi
if sh ./hasgot -i sys/types.h -t off_t; then
- echo "off_t is defined in <sys/types.h>"
+ echo "off_t is defined in <sys/types.h>" 1>&2
echo "#define HAS_OFF_T" >> s.h
fi
if sh ./hasgot -i sys/types.h -i dirent.h; then
- echo "dirent.h found."
+ echo "dirent.h found." 1>&2
echo "#define HAS_DIRENT" >> s.h
fi
if sh ./hasgot rewinddir; then
- echo "rewinddir() found."
+ echo "rewinddir() found." 1>&2
echo "#define HAS_REWINDDIR" >> s.h
fi
if sh ./hasgot lockf; then
- echo "lockf() found."
+ echo "lockf() found." 1>&2
echo "#define HAS_LOCKF" >> s.h
fi
if sh ./hasgot mkfifo; then
- echo "mkfifo() found."
+ echo "mkfifo() found." 1>&2
echo "#define HAS_MKFIFO" >> s.h
fi
if sh ./hasgot getcwd; then
- echo "getcwd() found."
+ echo "getcwd() found." 1>&2
echo "#define HAS_GETCWD" >> s.h
fi
if sh ./hasgot getwd; then
- echo "getwd() found."
+ echo "getwd() found." 1>&2
echo "#define HAS_GETWD" >> s.h
fi
if sh ./hasgot getpriority setpriority; then
- echo "getpriority() found."
+ echo "getpriority() found." 1>&2
echo "#define HAS_GETPRIORITY" >> s.h
fi
if sh ./hasgot -i sys/types.h -i utime.h && sh ./hasgot utime; then
- echo "utime() found."
+ echo "utime() found." 1>&2
echo "#define HAS_UTIME" >> s.h
fi
if sh ./hasgot utimes; then
- echo "utimes() found."
+ echo "utimes() found." 1>&2
echo "#define HAS_UTIMES" >> s.h
fi
if sh ./hasgot dup2; then
- echo "dup2() found."
+ echo "dup2() found." 1>&2
echo "#define HAS_DUP2" >> s.h
fi
if sh ./hasgot fchmod fchown; then
- echo "fchmod() found."
+ echo "fchmod() found." 1>&2
echo "#define HAS_FCHMOD" >> s.h
fi
if sh ./hasgot truncate ftruncate; then
- echo "truncate() found."
+ echo "truncate() found." 1>&2
echo "#define HAS_TRUNCATE" >> s.h
fi
select_include=''
if sh ./hasgot -i sys/types.h -i sys/select.h; then
- echo "sys/select.h found."
+ echo "sys/select.h found." 1>&2
echo "#define HAS_SYS_SELECT_H" >> s.h
select_include='-i sys/select.h'
fi
@@ -999,114 +999,114 @@ fi
has_select=no
if sh ./hasgot select && \
sh ./hasgot -i sys/types.h $select_include -t fd_set ; then
- echo "select() found."
+ echo "select() found." 1>&2
echo "#define HAS_SELECT" >> s.h
has_select=yes
fi
if sh ./hasgot symlink readlink lstat; then
- echo "symlink() found."
+ echo "symlink() found." 1>&2
echo "#define HAS_SYMLINK" >> s.h
fi
has_wait=no
if sh ./hasgot waitpid; then
- echo "waitpid() found."
+ echo "waitpid() found." 1>&2
echo "#define HAS_WAITPID" >> s.h
has_wait=yes
fi
if sh ./hasgot wait4; then
- echo "wait4() found."
+ echo "wait4() found." 1>&2
echo "#define HAS_WAIT4" >> s.h
has_wait=yes
fi
if sh ./hasgot -i limits.h && sh ./runtest getgroups.c; then
- echo "getgroups() found."
+ echo "getgroups() found." 1>&2
echo "#define HAS_GETGROUPS" >> s.h
fi
if sh ./hasgot -i limits.h -i grp.h && sh ./runtest setgroups.c; then
- echo "setgroups() found."
+ echo "setgroups() found." 1>&2
echo "#define HAS_SETGROUPS" >> s.h
fi
if sh ./hasgot -i limits.h -i grp.h && sh ./runtest initgroups.c; then
- echo "initgroups() found."
+ echo "initgroups() found." 1>&2
echo "#define HAS_INITGROUPS" >> s.h
fi
if sh ./hasgot -i termios.h &&
sh ./hasgot tcgetattr tcsetattr tcsendbreak tcflush tcflow; then
- echo "POSIX termios found."
+ echo "POSIX termios found." 1>&2
echo "#define HAS_TERMIOS" >> s.h
fi
if sh ./runtest async_io.c; then
- echo "Asynchronous I/O are supported."
+ echo "Asynchronous I/O are supported." 1>&2
echo "#define HAS_ASYNC_IO" >> s.h
fi
has_setitimer=no
if sh ./hasgot setitimer; then
- echo "setitimer() found."
+ echo "setitimer() found." 1>&2
echo "#define HAS_SETITIMER" >> s.h
has_setitimer="yes"
fi
if sh ./hasgot gethostname; then
- echo "gethostname() found."
+ echo "gethostname() found." 1>&2
echo "#define HAS_GETHOSTNAME" >> s.h
fi
if sh ./hasgot -i sys/utsname.h && sh ./hasgot uname; then
- echo "uname() found."
+ echo "uname() found." 1>&2
echo "#define HAS_UNAME" >> s.h
fi
has_gettimeofday=no
if sh ./hasgot gettimeofday; then
- echo "gettimeofday() found."
+ echo "gettimeofday() found." 1>&2
echo "#define HAS_GETTIMEOFDAY" >> s.h
has_gettimeofday="yes"
fi
if sh ./hasgot mktime; then
- echo "mktime() found."
+ echo "mktime() found." 1>&2
echo "#define HAS_MKTIME" >> s.h
fi
case "$host" in
*-*-cygwin*) ;; # setsid emulation under Cygwin breaks the debugger
*) if sh ./hasgot setsid; then
- echo "setsid() found."
+ echo "setsid() found." 1>&2
echo "#define HAS_SETSID" >> s.h
fi;;
esac
if sh ./hasgot putenv; then
- echo "putenv() found."
+ echo "putenv() found." 1>&2
echo "#define HAS_PUTENV" >> s.h
fi
if sh ./hasgot -i locale.h && sh ./hasgot setlocale; then
- echo "setlocale() and <locale.h> found."
+ echo "setlocale() and <locale.h> found." 1>&2
echo "#define HAS_LOCALE" >> s.h
fi
if sh ./hasgot $dllib dlopen; then
- echo "dlopen() found."
+ echo "dlopen() found." 1>&2
elif sh ./hasgot $dllib -ldl dlopen; then
- echo "dlopen() found in -ldl."
+ echo "dlopen() found in -ldl." 1>&2
dllib="$dllib -ldl"
else
shared_libraries_supported=false
fi
if $shared_libraries_supported; then
- echo "Dynamic loading of shared libraries is supported."
+ echo "Dynamic loading of shared libraries is supported." 1>&2
echo "#define SUPPORT_DYNAMIC_LINKING" >> s.h
if $dl_needs_underscore; then
echo '#define DL_NEEDS_UNDERSCORE' >>s.h
@@ -1114,12 +1114,12 @@ if $shared_libraries_supported; then
fi
if sh ./hasgot -i sys/types.h -i sys/mman.h && sh ./hasgot mmap munmap; then
- echo "mmap() found."
+ echo "mmap() found." 1>&2
echo "#define HAS_MMAP" >> s.h
fi
if sh ./hasgot pwrite; then
- echo "pwrite() found"
+ echo "pwrite() found" 1>&2
echo "#define HAS_PWRITE" >> s.h
fi
@@ -1128,7 +1128,7 @@ for i in 5 6; do
if sh ./trycompile -DNUM_ARGS=${i} gethostbyname.c; then nargs=$i; break; fi
done
if test $nargs != "none"; then
- echo "gethostbyname_r() found (with ${nargs} arguments)."
+ echo "gethostbyname_r() found (with ${nargs} arguments)." 1>&2
echo "#define HAS_GETHOSTBYNAME_R $nargs" >> s.h
fi
@@ -1137,17 +1137,17 @@ for i in 7 8; do
if sh ./trycompile -DNUM_ARGS=${i} gethostbyaddr.c; then nargs=$i; break; fi
done
if test $nargs != "none"; then
- echo "gethostbyaddr_r() found (with ${nargs} arguments)."
+ echo "gethostbyaddr_r() found (with ${nargs} arguments)." 1>&2
echo "#define HAS_GETHOSTBYADDR_R $nargs" >> s.h
fi
# Determine if the debugger is supported
if test "$has_sockets" = "yes"; then
- echo "Replay debugger supported."
+ echo "Replay debugger supported." 1>&2
debugger="ocamldebugger"
else
- echo "No replay debugger (missing system calls)"
+ echo "No replay debugger (missing system calls)" 1>&2
debugger=""
fi
@@ -1156,10 +1156,10 @@ fi
case "$arch,$system" in
i386,linux_elf|amd64,linux|power,rhapsody|amd64,macosx|i386,macosx)
- echo "System stack overflow can be detected."
+ echo "System stack overflow can be detected." 1>&2
echo "#define HAS_STACK_OVERFLOW_DETECTION" >> s.h;;
*)
- echo "Cannot detect system stack overflow.";;
+ echo "Cannot detect system stack overflow." 1>&2 ;;
esac
# Determine the target architecture for the "num" library
@@ -1194,7 +1194,7 @@ if test "$pthread_wanted" = "yes"; then
pthread_caml_link="-cclib -lpthread";;
esac
if ./hasgot -i pthread.h $pthread_link pthread_self; then
- echo "POSIX threads library supported."
+ echo "POSIX threads library supported." 1>&2
systhread_support=true
otherlibraries="$otherlibraries systhreads"
bytecccompopts="$bytecccompopts -D_REENTRANT"
@@ -1208,13 +1208,13 @@ if test "$pthread_wanted" = "yes"; then
asppflags="$asppflags -pthread"
nativecccompopts="$nativecccompopts -pthread";;
esac
- echo "Options for linking with POSIX threads: $pthread_link"
+ echo "Options for linking with POSIX threads: $pthread_link" 1>&2
if sh ./hasgot $pthread_link sigwait; then
- echo "sigwait() found"
+ echo "sigwait() found" 1>&2
echo "#define HAS_SIGWAIT" >> s.h
fi
else
- echo "POSIX threads not found."
+ echo "POSIX threads not found." 1>&2
pthread_link=""
fi
else
@@ -1228,10 +1228,10 @@ if test "$has_select" = "yes" \
&& test "$has_setitimer" = "yes" \
&& test "$has_gettimeofday" = "yes" \
&& test "$has_wait" = "yes"; then
- echo "Bytecode threads library supported."
+ echo "Bytecode threads library supported." 1>&2
otherlibraries="$otherlibraries threads"
else
- echo "Bytecode threads library not supported (missing system calls)"
+ echo "Bytecode threads library not supported (missing system calls)" 1>&2
fi
# Determine the location of X include files and libraries
@@ -1384,9 +1384,9 @@ if test "x11_include" != "not found"; then
x11_include=""
fi
if ./hasgot $x11_include $x11_link -i X11/Xlib.h XrmInitialize; then
- echo "X11 works"
+ echo "X11 works" 1>&2
else
- echo "Cannot compile X11 program"
+ echo "Cannot compile X11 program" 1>&2
x11_include="not found"
fi
fi
@@ -1394,12 +1394,12 @@ fi
has_graph=false
if test "$x11_include" = "not found" || test "$x11_link" = "not found"
then
- echo "X11 not found, the \"graph\" library will not be supported."
+ echo "X11 not found, the \"graph\" library will not be supported." 1>&2
x11_include="not found"
x11_link="not found"
else
- echo "Options for compiling for X11: $x11_include"
- echo "Options for linking with X11: $x11_link"
+ echo "Options for compiling for X11: $x11_include" 1>&2
+ echo "Options for linking with X11: $x11_link" 1>&2
if test "$graph_wanted" = yes
then
has_graph=true
@@ -1411,14 +1411,14 @@ echo "X11_LINK=$x11_link" >> Makefile
# Look for tcl/tk
-echo "Configuring LablTk..."
+echo "Configuring LablTk..." 1>&2
if test $tk_wanted = no; then
has_tk=false
elif test $tk_x11 = no; then
has_tk=true
elif test "$x11_include" = "not found" || test "$x11_link" = "not found"; then
- echo "X11 not found or disabled."
+ echo "X11 not found or disabled." 1>&2
has_tk=false
else
tk_x11_include="$x11_include"
@@ -1447,7 +1447,7 @@ if test $has_tk = true; then
tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
fi; done
if test -n "$tcl_version" && test "x$tcl_version" != "xnone"; then
- echo "tcl.h and tk.h version $tcl_version found with \"$tk_defs\"."
+ echo "tcl.h and tk.h version $tcl_version found with \"$tk_defs\"." 1>&2
case $tcl_version in
8.5) tclmaj=8 tclmin=5 tkmaj=8 tkmin=5 ;;
8.4) tclmaj=8 tclmin=4 tkmaj=8 tkmin=4 ;;
@@ -1457,10 +1457,10 @@ if test $has_tk = true; then
8.0) tclmaj=8 tclmin=0 tkmaj=8 tkmin=0 ;;
7.6) tclmaj=7 tclmin=6 tkmaj=4 tkmin=2 ;;
7.5) tclmaj=7 tclmin=5 tkmaj=4 tkmin=1 ;;
- *) echo "This version is not known."; has_tk=false ;;
+ *) echo "This version is not known." 1>&2 ; has_tk=false ;;
esac
else
- echo "tcl.h and/or tk.h not found."
+ echo "tcl.h and/or tk.h not found." 1>&2
has_tk=false
fi
fi
@@ -1497,30 +1497,30 @@ if test $has_tk = true; then
*) tk_libs="-L/usr/pkg/lib $tk_libs $tk_x11_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin -lpthread $tkauxlibs";;
esac
else
- echo "Tcl library not found."
+ echo "Tcl library not found." 1>&2
has_tk=false
fi
fi
if test $has_tk = true; then
if sh ./hasgot $tk_libs $tk_x11_libs $tkauxlibs Tk_SetGrid; then
- echo "Tcl/Tk libraries found."
+ echo "Tcl/Tk libraries found." 1>&2
elif sh ./hasgot -L/sw/lib $tk_libs $tk_x11_libs $tkauxlibs Tk_SetGrid; then
case "$host" in
*-*-*bsd*) tk_libs="-R/sw/lib -L/sw/lib $tk_libs";;
*) tk_libs="-L/sw/lib $tk_libs";;
esac
- echo "Tcl/Tk libraries found."
+ echo "Tcl/Tk libraries found." 1>&2
elif sh ./hasgot -L/usr/pkg/lib $tk_libs $tk_x11_libs $tkauxlibs \
Tk_SetGrid; then
case "$host" in
*-*-*bsd*) tk_libs="-R/usr/pkg/lib -L/usr/pkg/lib $tk_libs";;
*) tk_libs="-L/usr/pkg/lib $tk_libs";;
esac
- echo "Tcl/Tk libraries found."
+ echo "Tcl/Tk libraries found." 1>&2
else
- echo "Tcl library found."
- echo "Tk library not found."
+ echo "Tcl library found." 1>&2
+ echo "Tk library not found." 1>&2
has_tk=false
fi
fi
@@ -1535,7 +1535,7 @@ if test $has_tk = true; then
fi
otherlibraries="$otherlibraries labltk"
else
- echo "Configuration failed, LablTk will not be built."
+ echo "Configuration failed, LablTk will not be built." 1>&2
echo "TK_DEFS=" >> Makefile
echo "TK_LINK=" >> Makefile
fi
@@ -1544,11 +1544,11 @@ fi
if ./hasgot -i bfd.h && \
./hasgot -lbfd -ldl -liberty -lz bfd_openr; then
- echo "BFD library found."
+ echo "BFD library found." 1>&2
echo "#define HAS_LIBBFD" >> s.h
echo "LIBBFD_LINK=-lbfd -ldl -liberty -lz" >> Makefile
else
- echo "BFD library not found, 'objinfo' will be unable to display info on .cmxs files"
+ echo "BFD library not found, 'objinfo' will be unable to display info on .cmxs files" 1>&2
echo "LIBBFD_LINK=" >> Makefile
fi
@@ -1561,9 +1561,9 @@ export as aspp
if sh ./tryassemble cfi.S; then
echo "#define ASM_CFI_SUPPORTED" >> m.h
asm_cfi_supported=true
- echo "Assembler supports CFI"
+ echo "Assembler supports CFI" 1>&2
else
- echo "Assembler does not support CFI"
+ echo "Assembler does not support CFI" 1>&2
fi
# Final twiddling of compiler options to work around known bugs
@@ -1646,94 +1646,94 @@ mv m.h s.h Makefile ..
# Print a summary
-echo
-echo "** Configuration summary **"
-echo
-echo "Directories where OCaml will be installed:"
-echo " binaries.................. $bindir"
-echo " standard library.......... $libdir"
-echo " manual pages.............. $mandir (with extension .$manext)"
-
-echo "Configuration for the bytecode compiler:"
-echo " C compiler used........... $bytecc"
-echo " options for compiling..... $bytecccompopts"
-echo " options for linking....... $bytecclinkopts $cclibs $dllib $curseslibs $pthread_link"
+echo 1>&2
+echo "** Configuration summary **" 1>&2
+echo 1>&2
+echo "Directories where OCaml will be installed:" 1>&2
+echo " binaries.................. $bindir" 1>&2
+echo " standard library.......... $libdir" 1>&2
+echo " manual pages.............. $mandir (with extension .$manext)" 1>&2
+
+echo "Configuration for the bytecode compiler:" 1>&2
+echo " C compiler used........... $bytecc" 1>&2
+echo " options for compiling..... $bytecccompopts" 1>&2
+echo " options for linking....... $bytecclinkopts $cclibs $dllib $curseslibs $pthread_link" 1>&2
if $shared_libraries_supported; then
-echo " shared libraries are supported"
-echo " options for compiling..... $sharedcccompopts $bytecccompopts"
-echo " command for building...... $mksharedlib -o lib.so $mksharedlibrpath/a/path objs"
+echo " shared libraries are supported" 1>&2
+echo " options for compiling..... $sharedcccompopts $bytecccompopts" 1>&2
+echo " command for building...... $mksharedlib -o lib.so $mksharedlibrpath/a/path objs" 1>&2
else
-echo " shared libraries not supported"
+echo " shared libraries not supported" 1>&2
fi
-echo "Configuration for the native-code compiler:"
+echo "Configuration for the native-code compiler:" 1>&2
if test "$arch" = "none"; then
- echo " (not supported on this platform)"
+ echo " (not supported on this platform)" 1>&2
else
if test "$model" = "default"; then
- echo " hardware architecture..... $arch"
+ echo " hardware architecture..... $arch" 1>&2
else
- echo " hardware architecture..... $arch ($model)"
+ echo " hardware architecture..... $arch ($model)" 1>&2
fi
if test "$system" = "unknown"; then : ; else
- echo " OS variant................ $system"
+ echo " OS variant................ $system" 1>&2
fi
- echo " C compiler used........... $nativecc"
- echo " options for compiling..... $nativecccompopts"
- echo " options for linking....... $nativecclinkopts $cclibs"
- echo " assembler ................ $as"
- echo " preprocessed assembler ... $aspp"
+ echo " C compiler used........... $nativecc" 1>&2
+ echo " options for compiling..... $nativecccompopts" 1>&2
+ echo " options for linking....... $nativecclinkopts $cclibs" 1>&2
+ echo " assembler ................ $as" 1>&2
+ echo " preprocessed assembler ... $aspp" 1>&2
if test "$asm_cfi_supported" = "true"; then
- echo " assembler supports CFI ... yes"
+ echo " assembler supports CFI ... yes" 1>&2
else
- echo " assembler supports CFI ... no"
+ echo " assembler supports CFI ... no" 1>&2
fi
- echo " native dynlink ........... $natdynlink"
+ echo " native dynlink ........... $natdynlink" 1>&2
if test "$profiling" = "prof"; then
- echo " profiling with gprof ..... supported"
+ echo " profiling with gprof ..... supported" 1>&2
else
- echo " profiling with gprof ..... not supported"
+ echo " profiling with gprof ..... not supported" 1>&2
fi
fi
if test "$debugger" = "ocamldebugger"; then
- echo "Source-level replay debugger: supported"
+ echo "Source-level replay debugger: supported" 1>&2
else
- echo "Source-level replay debugger: not supported"
+ echo "Source-level replay debugger: not supported" 1>&2
fi
if test "$debugruntime" = "runtimed"; then
- echo "Debug runtime will be compiled and installed"
+ echo "Debug runtime will be compiled and installed" 1>&2
fi
-echo "Additional libraries supported:"
-echo " $otherlibraries"
+echo "Additional libraries supported:" 1>&2
+echo " $otherlibraries" 1>&2
-echo "Configuration for the \"num\" library:"
-echo " target architecture ...... $bng_arch (asm level $bng_asm_level)"
+echo "Configuration for the \"num\" library:" 1>&2
+echo " target architecture ...... $bng_arch (asm level $bng_asm_level)" 1>&2
if $has_graph; then
-echo "Configuration for the \"graph\" library:"
-echo " options for compiling .... $x11_include"
-echo " options for linking ...... $x11_link"
+echo "Configuration for the \"graph\" library:" 1>&2
+echo " options for compiling .... $x11_include" 1>&2
+echo " options for linking ...... $x11_link" 1>&2
else
-echo "The \"graph\" library: not supported"
+echo "The \"graph\" library: not supported" 1>&2
fi
if test $has_tk = true; then
-echo "Configuration for the \"labltk\" library:"
-echo " use tcl/tk version ....... $tcl_version"
-echo " options for compiling .... $tk_defs $tk_x11_include"
-echo " options for linking ...... $tk_libs $tk_x11_libs"
+echo "Configuration for the \"labltk\" library:" 1>&2
+echo " use tcl/tk version ....... $tcl_version" 1>&2
+echo " options for compiling .... $tk_defs $tk_x11_include" 1>&2
+echo " options for linking ...... $tk_libs $tk_x11_libs" 1>&2
else
-echo "The \"labltk\" library: not supported"
+echo "The \"labltk\" library: not supported" 1>&2
fi
-echo
-echo "** OCaml configuration completed successfully **"
-echo
+echo 1>&2
+echo "** OCaml configuration completed successfully **" 1>&2
+echo 1>&2
if test ! -z "$MACOSX_DEPLOYMENT_TARGET"; then
- echo "WARNING: the environment variable MACOSX_DEPLOYMENT_TARGET is set."
- echo "This will probably prevent compiling the OCaml system."
+ echo "WARNING: the environment variable MACOSX_DEPLOYMENT_TARGET is set." 1>&2
+ echo "This will probably prevent compiling the OCaml system." 1>&2
fi
--
1.7.12.1
0004-build-fix-filename-case.patch [^] (647 bytes) 2012-12-26 22:23 [Show Content] [Hide Content]From a763df7112415368dc40fcbc1312e5cef54d1c89 Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Sat, 15 Dec 2012 18:32:57 +0100
Subject: [PATCH 04/13] build: fix filename case.
---
otherlibs/systhreads/st_win32.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/otherlibs/systhreads/st_win32.h b/otherlibs/systhreads/st_win32.h
index c1c5b87..8d98f52 100644
--- a/otherlibs/systhreads/st_win32.h
+++ b/otherlibs/systhreads/st_win32.h
@@ -15,7 +15,7 @@
#define _WIN32_WINNT 0x0400
#include <windows.h>
-#include <WinError.h>
+#include <winerror.h>
#include <stdio.h>
#include <signal.h>
--
1.7.12.1
0005-build-prefer-forward-slashes-to-backward-slashes.patch [^] (1,487 bytes) 2012-12-26 22:23 [Show Content] [Hide Content]From a687ce7a0a5ac67d444bd996b781119f78dbc8cf Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Sat, 15 Dec 2012 18:42:48 +0100
Subject: [PATCH 05/13] build: prefer forward slashes to backward slashes.
Forward slashes also work on windows and this will be friendlier to
cross-compilation.
---
otherlibs/systhreads/Makefile.nt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/otherlibs/systhreads/Makefile.nt b/otherlibs/systhreads/Makefile.nt
index 93b0f1b..7a0df8b 100644
--- a/otherlibs/systhreads/Makefile.nt
+++ b/otherlibs/systhreads/Makefile.nt
@@ -32,7 +32,7 @@ all: lib$(LIBNAME).$(A) $(LIBNAME).cma $(CMIFILES)
allopt: lib$(LIBNAME).$(A) $(LIBNAME).cmxa $(LIBNAME).cmxs $(CMIFILES)
$(LIBNAME).cma: $(CAMLOBJS)
- $(MKLIB) -o $(LIBNAME) -ocamlc "..\\..\\boot\\ocamlrun ..\\..\\ocamlc" -linkall $(CAMLOBJS) $(LINKOPTS)
+ $(MKLIB) -o $(LIBNAME) -ocamlc "../../boot/ocamlrun ../../ocamlc" -linkall $(CAMLOBJS) $(LINKOPTS)
lib$(LIBNAME).$(A): $(COBJS)
$(MKLIB) -o $(LIBNAME) $(COBJS) $(LDOPTS)
@@ -44,7 +44,7 @@ st_stubs_b.$(O): st_stubs.c st_win32.h
$(LIBNAME).cmxa: $(CAMLOBJS:.cmo=.cmx)
- $(MKLIB) -o $(LIBNAME)nat -ocamlopt "..\\..\\boot\\ocamlrun ..\\..\\ocamlopt" -linkall $(CAMLOBJS:.cmo=.cmx) $(LINKOPTS)
+ $(MKLIB) -o $(LIBNAME)nat -ocamlopt "../../boot/ocamlrun ../../ocamlopt" -linkall $(CAMLOBJS:.cmo=.cmx) $(LINKOPTS)
mv $(LIBNAME)nat.cmxa $(LIBNAME).cmxa
mv $(LIBNAME)nat.$(A) $(LIBNAME).$(A)
--
1.7.12.1
0006-configure-fix-detection-of-non-working-C-compiler.patch [^] (1,581 bytes) 2012-12-26 22:24 [Show Content] [Hide Content]From 830f7b5b75e4ab80bf294ad39aa4f9ea22a883f9 Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Sun, 16 Dec 2012 20:11:53 +0100
Subject: [PATCH 06/13] configure: fix detection of non-working C compiler.
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.
---
configure | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index ca3080d..1dab460 100755
--- a/configure
+++ b/configure
@@ -364,7 +364,14 @@ esac
# Check the sizes of data types
echo "Checking the sizes of integers and pointers..." 1>&2
-set `sh ./runtest sizes.c`
+ret=`sh ./runtest sizes.c`
+if test "$?" -neq 0; then
+ echo "Unable to compile the test program." 1>&2
+ echo "Make sure the C compiler '$cc' is properly installed." 1>&2
+ exit 2;;
+fi
+set $ret
+
case "$2,$3" in
4,4) echo "OK, this is a regular 32 bit architecture." 1>&2
echo "#undef ARCH_SIXTYFOUR" >> m.h
@@ -375,9 +382,6 @@ case "$2,$3" in
*,*) echo "This architecture seems to be neither 32 bits nor 64 bits." 1>&2
echo "OCaml won't run on this architecture." 1>&2
exit 2;;
- *) echo "Unable to compile the test program." 1>&2
- echo "Make sure the C compiler $cc is properly installed." 1>&2
- exit 2;;
esac
if test $1 != 4 && test $2 != 4 && test $4 != 4; then
echo "Sorry, we can't find a 32-bit integer type" 1>&2
--
1.7.12.1
0007-configure-remove-unused-variable-from-case.in-test.patch [^] (2,419 bytes) 2012-12-26 22:24 [Show Content] [Hide Content]From 8d893b9cad3c8ade403a91543a82e07a4c769877 Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Fri, 21 Dec 2012 22:00:15 +0100
Subject: [PATCH 07/13] configure: remove unused variable from case...in test.
---
configure | 52 ++++++++++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/configure b/configure
index 1dab460..fbe6681 100755
--- a/configure
+++ b/configure
@@ -745,32 +745,32 @@ esac
asppprofflags='-DPROFILING'
-case "$arch,$model,$system" in
- amd64,*,macosx) as='as -arch x86_64'
- aspp='gcc -arch x86_64 -c';;
- amd64,*,solaris) as='as --64'
- aspp='gcc -m64 -c';;
- amd64,*,*) as='as'
- aspp='gcc -c';;
- arm,*,*) as='as';
- aspp='gcc -c';;
- i386,*,solaris) as='as'
- aspp='/usr/ccs/bin/as -P';;
- i386,*,*) as='as'
- aspp='gcc -c';;
- power,*,elf) as='as -u -m ppc'
- aspp='gcc -c';;
- power,*,bsd) as='as'
- aspp='gcc -c';;
- power,*,rhapsody) as="as -arch $model"
- aspp="$bytecc -c";;
- sparc,*,solaris) as='as'
- case "$cc" in
- gcc*) aspp='gcc -c';;
- *) aspp='as -P';;
- esac;;
- sparc,*,*) as='as'
- aspp='gcc -c';;
+case "$arch,$system" in
+ amd64,macosx) as='as -arch x86_64'
+ aspp='gcc -arch x86_64 -c';;
+ amd64,solaris) as='as --64'
+ aspp='gcc -m64 -c';;
+ amd64,*) as='as'
+ aspp='gcc -c';;
+ arm,*) as='as';
+ aspp='gcc -c';;
+ i386,solaris) as='as'
+ aspp='/usr/ccs/bin/as -P';;
+ i386,*) as='as'
+ aspp='gcc -c';;
+ power,elf) as='as -u -m ppc'
+ aspp='gcc -c';;
+ power,bsd) as='as'
+ aspp='gcc -c';;
+ power,rhapsody) as="as -arch $model"
+ aspp="$bytecc -c";;
+ sparc,solaris) as='as'
+ case "$cc" in
+ gcc*) aspp='gcc -c';;
+ *) aspp='as -P';;
+ esac;;
+ sparc,*) as='as'
+ aspp='gcc -c';;
esac
if test -n "$asoption"; then as="$asoption"; fi
--
1.7.12.1
0008-configure-remove-unused-variable-from-case.in-test.patch [^] (1,364 bytes) 2012-12-26 22:24 [Show Content] [Hide Content]From 4955887772e3fe2c389862ee742d5b693386f9f1 Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Fri, 21 Dec 2012 22:10:42 +0100
Subject: [PATCH 08/13] configure: remove unused variable from case...in test.
---
configure | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/configure b/configure
index fbe6681..f12ac89 100755
--- a/configure
+++ b/configure
@@ -777,18 +777,18 @@ if test -n "$asoption"; then as="$asoption"; fi
if test -n "$asppoption"; then aspp="$asppoption"; fi
cc_profile='-pg'
-case "$arch,$model,$system" in
- i386,*,linux_elf) profiling='prof';;
- i386,*,gnu) profiling='prof';;
- i386,*,bsd_elf) profiling='prof';;
- amd64,*,macosx) profiling='prof';;
- i386,*,macosx) profiling='prof';;
- sparc,*,solaris)
+case "$arch,$system" in
+ i386,linux_elf) profiling='prof';;
+ i386,gnu) profiling='prof';;
+ i386,bsd_elf) profiling='prof';;
+ amd64,macosx) profiling='prof';;
+ i386,macosx) profiling='prof';;
+ sparc,solaris)
profiling='prof'
case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;;
- amd64,*,linux) profiling='prof';;
- amd64,*,gnu) profiling='prof';;
- arm,*,linux*) profiling='prof';;
+ amd64,linux) profiling='prof';;
+ amd64,gnu) profiling='prof';;
+ arm,linux*) profiling='prof';;
*) profiling='noprof';;
esac
--
1.7.12.1
0009-configure-add-target-and-use-target-instead-of-host-.patch [^] (6,539 bytes) 2012-12-26 22:24 [Show Content] [Hide Content]From 558f7dda709cc1e714e52232d388b012baf97010 Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Tue, 25 Dec 2012 22:54:07 +0100
Subject: [PATCH 09/13] configure: add --target and use "target" instead of
"host" for variables
---
configure | 47 ++++++++++++++++++++++++++++-------------------
1 file changed, 28 insertions(+), 19 deletions(-)
diff --git a/configure b/configure
index f12ac89..fb1c289 100755
--- a/configure
+++ b/configure
@@ -20,6 +20,7 @@ libdir=''
mandir=''
manext=1
host_type=unknown
+target_type=unknown
ccoption=''
asoption=''
asppoption=''
@@ -74,6 +75,8 @@ while : ; do
shift;;
-host*|--host*)
host_type=$2; shift;;
+ -target*|--target*)
+ target_type=$2; shift;;
-cc*)
ccoption="$2"; shift;;
-as)
@@ -192,7 +195,14 @@ if host=`../gnu/config.sub $host_type`; then :; else
echo "Please specify the correct host type with the -host option" 1>&2
exit 2
fi
-echo "Configuring for a $host ..." 1>&2
+echo "Configuring for running on $host ..." 1>&2
+
+if test -n "$target_type"; then
+ target="$target_type"
+ echo "Configuring for target $target ..." 1>&2
+else
+ target="$host"
+fi
# Do we have gcc?
@@ -211,7 +221,7 @@ fi
buggycc="no"
-case "$host,$cc" in
+case "$target,$cc" in
i[3456]86-*-*,gcc*)
case `$cc --version` in
2.7.2.1) cat <<'EOF'
@@ -262,7 +272,7 @@ ostype="Unix"
exe=""
iflexdir=""
-case "$bytecc,$host" in
+case "$bytecc,$target" in
cc,*-*-nextstep*)
# GNU C extensions disabled, but __GNUC__ still defined!
bytecccompopts="-fno-defer-pop $gcc_warnings -U__GNUC__ -posix"
@@ -445,12 +455,11 @@ case $? in
exit 2;;
*) echo "Something went wrong during endianness determination." 1>&2
echo "You'll have to figure out endianness yourself" 1>&2
- echo "(option ARCH_BIG_ENDIAN in m.h)." 1>&2 ;;
-esac
+ echo "(option ARCH_BIG_ENDIAN in m.h)." 1>&2 ;;esac
# Determine alignment constraints
-case "$host" in
+case "$target" in
sparc*-*-*|hppa*-*-*|arm*-*-*|mips*-*-*)
# On Sparc V9 with certain versions of gcc, determination of double
# alignment is not reliable (PR#1521), hence force it.
@@ -483,7 +492,7 @@ case "$host" in
esac
if $int64_native; then
- case "$host" in
+ case "$target" in
# PR#5088: autodetection is unreliable on ARM. PR#5280: also on MIPS.
sparc*-*-*|hppa*-*-*|arm*-*-*|mips*-*-*)
if test $2 = 8; then
@@ -534,7 +543,7 @@ mksharedlibrpath=''
natdynlinkopts=""
if test $withsharedlibs = "yes"; then
- case "$host" in
+ case "$target" in
*-*-cygwin*)
mksharedlib="$flexlink"
mkmaindll="$flexlink -maindll"
@@ -628,7 +637,7 @@ fi
natdynlink=false
if test $withsharedlibs = "yes"; then
- case "$host" in
+ case "$target" in
*-*-cygwin*) natdynlink=true;;
i[3456]86-*-linux*) natdynlink=true;;
i[3456]86-*-gnu*) natdynlink=true;;
@@ -667,7 +676,7 @@ arch=none
model=default
system=unknown
-case "$host" in
+case "$target" in
sparc*-*-solaris2.*) arch=sparc; system=solaris;;
sparc*-*-*bsd*) arch=sparc; system=bsd;;
sparc*-*-linux*) arch=sparc; system=linux;;
@@ -710,7 +719,7 @@ case "$host" in
esac
# Some platforms exist both in 32-bit and 64-bit variants, not distinguished
-# by $host. Turn off native code compilation on platforms where 64-bit mode
+# by $target. Turn off native code compilation on platforms where 64-bit mode
# is not supported. (PR#4441)
if $arch64; then
@@ -730,7 +739,7 @@ nativecccompopts=''
nativecclinkopts=''
nativeccrpath="$byteccrpath"
-case "$arch,$nativecc,$system,$host_type" in
+case "$arch,$nativecc,$system,$target" in
*,*,nextstep,*) nativecccompopts="$gcc_warnings -U__GNUC__ -posix"
nativecclinkopts="-posix";;
*,*,rhapsody,*darwin[1-5].*)
@@ -811,7 +820,7 @@ echo "ARCMD=ar" >> Makefile
if (SHELL=/bin/sh; export SHELL; (./sharpbang || ./sharpbang2) >/dev/null); then
echo "#! appears to work in shell scripts" 1>&2
- case "$host" in
+ case "$target" in
*-*-sunos*|*-*-unicos*)
echo "We won't use it, though, because under SunOS and Unicos it" 1>&2
echo " breaks on pathnames longer than 30 characters" 1>&2
@@ -1081,7 +1090,7 @@ if sh ./hasgot mktime; then
echo "#define HAS_MKTIME" >> s.h
fi
-case "$host" in
+case "$target" in
*-*-cygwin*) ;; # setsid emulation under Cygwin breaks the debugger
*) if sh ./hasgot setsid; then
echo "setsid() found." 1>&2
@@ -1187,7 +1196,7 @@ echo "BNG_ASM_LEVEL=$bng_asm_level" >> Makefile
systhread_support=false
if test "$pthread_wanted" = "yes"; then
- case "$host" in
+ case "$target" in
*-*-solaris*) pthread_link="-lpthread -lposix4"
pthread_caml_link="-cclib -lpthread -cclib -lposix4";;
*-*-freebsd*) pthread_link="-pthread"
@@ -1203,7 +1212,7 @@ if test "$pthread_wanted" = "yes"; then
otherlibraries="$otherlibraries systhreads"
bytecccompopts="$bytecccompopts -D_REENTRANT"
nativecccompopts="$nativecccompopts -D_REENTRANT"
- case "$host" in
+ case "$target" in
*-*-freebsd*)
bytecccompopts="$bytecccompopts -D_THREAD_SAFE"
nativecccompopts="$nativecccompopts -D_THREAD_SAFE";;
@@ -1496,7 +1505,7 @@ if test $has_tk = true; then
-ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin -lpthread $tkauxlibs \
Tcl_DoOneEvent
then
- case "$host" in
+ case "$target" in
*-*-*bsd*) tk_libs="-R/usr/pkg/lib -L/usr/pkg/lib $tk_libs $tk_x11_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin -lpthread $tkauxlibs";;
*) tk_libs="-L/usr/pkg/lib $tk_libs $tk_x11_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin -lpthread $tkauxlibs";;
esac
@@ -1510,14 +1519,14 @@ if test $has_tk = true; then
if sh ./hasgot $tk_libs $tk_x11_libs $tkauxlibs Tk_SetGrid; then
echo "Tcl/Tk libraries found." 1>&2
elif sh ./hasgot -L/sw/lib $tk_libs $tk_x11_libs $tkauxlibs Tk_SetGrid; then
- case "$host" in
+ case "$target" in
*-*-*bsd*) tk_libs="-R/sw/lib -L/sw/lib $tk_libs";;
*) tk_libs="-L/sw/lib $tk_libs";;
esac
echo "Tcl/Tk libraries found." 1>&2
elif sh ./hasgot -L/usr/pkg/lib $tk_libs $tk_x11_libs $tkauxlibs \
Tk_SetGrid; then
- case "$host" in
+ case "$target" in
*-*-*bsd*) tk_libs="-R/usr/pkg/lib -L/usr/pkg/lib $tk_libs";;
*) tk_libs="-L/usr/pkg/lib $tk_libs";;
esac
--
1.7.12.1
0010-configure-when-cross-compiling-set-TOOLPREF-and-use-.patch [^] (6,731 bytes) 2012-12-26 22:24 [Show Content] [Hide Content]From 6703bb3599e0f793aa29a2d08bf37a3df59af09d Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Tue, 25 Dec 2012 22:56:18 +0100
Subject: [PATCH 10/13] configure: when cross-compiling, set $TOOLPREF and use
it.
---
configure | 82 ++++++++++++++++++++++++++++++++-------------------------------
1 file changed, 42 insertions(+), 40 deletions(-)
diff --git a/configure b/configure
index fb1c289..352ac2f 100755
--- a/configure
+++ b/configure
@@ -199,19 +199,26 @@ echo "Configuring for running on $host ..." 1>&2
if test -n "$target_type"; then
target="$target_type"
+ TOOLPREF="${target}-"
echo "Configuring for target $target ..." 1>&2
else
+ TOOLPREF=""
target="$host"
fi
# Do we have gcc?
if test -z "$ccoption"; then
- if sh ./searchpath gcc; then
- echo "gcc found" 1>&2
- cc=gcc
+ if sh ./searchpath "${TOOLPREF}gcc"; then
+ cc="${TOOLPREF}gcc"
else
- cc=cc
+ if test x"$host" = x"$target"; then
+ cc="cc"
+ else
+ echo "No cross-compiler found for ${target}." 1>&2
+ echo "It should be named ${TOOLPREF}gcc and be in the PATH." 1>&2
+ exit 2
+ fi
fi
else
cc="$ccoption"
@@ -293,7 +300,7 @@ case "$bytecc,$target" in
bytecccompopts="-fno-defer-pop $gcc_warnings"
# No -lm library
mathlib="";;
- gcc,alpha*-*-osf*)
+ gcc,alpha*-*-osf*|*-gcc*,alpha*-*-osf*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
if cc="$bytecc" sh ./hasgot -mieee; then
bytecccompopts="-mieee $bytecccompopts";
@@ -304,7 +311,7 @@ case "$bytecc,$target" in
echo "#define ARCH_CODE32" >> m.h;;
cc,alpha*-*-osf*)
bytecccompopts="-std1 -ieee";;
- gcc,alpha*-*-linux*)
+ gcc,alpha*-*-linux*|*-gcc*,alpha*-*-linux*)
if cc="$bytecc" sh ./hasgot -mieee; then
bytecccompopts="-mieee $bytecccompopts";
fi;;
@@ -320,12 +327,12 @@ case "$bytecc,$target" in
*,alpha*-*-unicos*)
# For the Cray T3E
bytecccompopts="-DUMK";;
- gcc*,powerpc-*-aix*)
+ gcc*,powerpc-*-aix*|*-gcc*,powerpc-*-aix*)
# Avoid name-space pollution by requiring Unix98-conformant includes
bytecccompopts="-fno-defer-pop $gcc_warnings -D_XOPEN_SOURCE=500";;
*,powerpc-*-aix*)
bytecccompopts="-D_XOPEN_SOURCE=500";;
- gcc*,*-*-cygwin*)
+ gcc*,*-*-cygwin*|*-gcc*,*-*-cygwin*)
bytecccompopts="-fno-defer-pop $gcc_warnings -U_WIN32"
dllccompopts="-U_WIN32 -DCAML_DLL"
if test $withsharedlibs = yes; then
@@ -342,14 +349,14 @@ case "$bytecc,$target" in
fi
exe=".exe"
ostype="Cygwin";;
- gcc*,x86_64-*-linux*)
+ gcc*,x86_64-*-linux*|*-gcc*,x86_64-*-linux*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
# Tell gcc that we can use 32-bit code addresses for threaded code
# unless we are compiled for a shared library (-fPIC option)
echo "#ifndef __PIC__" >> m.h
echo "# define ARCH_CODE32" >> m.h
echo "#endif" >> m.h;;
- gcc*)
+ gcc*|*-gcc*)
bytecccompopts="-fno-defer-pop $gcc_warnings";;
esac
@@ -543,6 +550,7 @@ mksharedlibrpath=''
natdynlinkopts=""
if test $withsharedlibs = "yes"; then
+ # TODO: handle *-*-mingw* (it has $withsharedlibs=no currently)
case "$target" in
*-*-cygwin*)
mksharedlib="$flexlink"
@@ -558,7 +566,7 @@ if test $withsharedlibs = "yes"; then
shared_libraries_supported=true;;
alpha*-*-osf*)
case "$bytecc" in
- gcc*)
+ gcc*|*-gcc*)
sharedcccompopts="-fPIC"
mksharedlib="$bytecc -shared"
byteccrpath="-Wl,-rpath,"
@@ -573,7 +581,7 @@ if test $withsharedlibs = "yes"; then
esac;;
*-*-solaris2*)
case "$bytecc" in
- gcc*)
+ gcc*|*-gcc*)
sharedcccompopts="-fPIC"
if sh ./solaris-ld; then
mksharedlib="$bytecc -shared"
@@ -597,7 +605,7 @@ if test $withsharedlibs = "yes"; then
mips*-*-irix[56]*)
case "$bytecc" in
cc*) sharedcccompopts="";;
- gcc*) sharedcccompopts="-fPIC";;
+ gcc*|*-gcc*) sharedcccompopts="-fPIC";;
esac
mksharedlib="ld -shared -rdata_shared"
byteccrpath="-Wl,-rpath,"
@@ -637,6 +645,7 @@ fi
natdynlink=false
if test $withsharedlibs = "yes"; then
+ # TODO: handle *-*-mingw* (it has $withsharedlibs=no currently)
case "$target" in
*-*-cygwin*) natdynlink=true;;
i[3456]86-*-linux*) natdynlink=true;;
@@ -755,31 +764,24 @@ esac
asppprofflags='-DPROFILING'
case "$arch,$system" in
- amd64,macosx) as='as -arch x86_64'
- aspp='gcc -arch x86_64 -c';;
- amd64,solaris) as='as --64'
- aspp='gcc -m64 -c';;
- amd64,*) as='as'
- aspp='gcc -c';;
- arm,*) as='as';
- aspp='gcc -c';;
- i386,solaris) as='as'
- aspp='/usr/ccs/bin/as -P';;
- i386,*) as='as'
- aspp='gcc -c';;
- power,elf) as='as -u -m ppc'
- aspp='gcc -c';;
- power,bsd) as='as'
- aspp='gcc -c';;
- power,rhapsody) as="as -arch $model"
+ amd64,macosx) as="${TOOLPREF}as -arch x86_64"
+ aspp="${TOOLPREF}gcc -arch x86_64 -c";;
+ amd64,solaris) as="${TOOLPREF}as --64"
+ aspp="${TOOLPREF}gcc -m64 -c";;
+ i386,solaris) as="${TOOLPREF}as"
+ aspp="/usr/ccs/bin/${TOOLPREF}as -P";;
+ power,elf) as="${TOOLPREF}as -u -m ppc"
+ aspp="${TOOLPREF}gcc -c";;
+ power,rhapsody) as="${TOOLPREF}as -arch $model"
aspp="$bytecc -c";;
- sparc,solaris) as='as'
+ sparc,solaris) as="${TOOLPREF}as"
case "$cc" in
- gcc*) aspp='gcc -c';;
- *) aspp='as -P';;
+ gcc*|*-gcc*) aspp="${TOOLPREF}gcc -c";;
+ *) aspp="${TOOLPREF}as -P";;
esac;;
- sparc,*) as='as'
- aspp='gcc -c';;
+ amd64,*|arm,*|i386,*|power,bsd|sparc,*)
+ as="${TOOLPREF}as"
+ aspp="${TOOLPREF}gcc -c";;
esac
if test -n "$asoption"; then as="$asoption"; fi
@@ -803,17 +805,17 @@ esac
# Where is ranlib?
-if sh ./searchpath ranlib; then
+if sh ./searchpath ${TOOLPREF}ranlib; then
echo "ranlib found" 1>&2
- echo "RANLIB=ranlib" >> Makefile
- echo "RANLIBCMD=ranlib" >> Makefile
+ echo "RANLIB=${TOOLPREF}ranlib" >> Makefile
+ echo "RANLIBCMD=${TOOLPREF}ranlib" >> Makefile
else
echo "ranlib not used" 1>&2
- echo "RANLIB=ar rs" >> Makefile
+ echo "RANLIB=${TOOLPREF}ar rs" >> Makefile
echo "RANLIBCMD=" >> Makefile
fi
-echo "ARCMD=ar" >> Makefile
+echo "ARCMD=${TOOLPREF}ar" >> Makefile
# Do #! scripts work?
--
1.7.12.1
0011-configure-support-cross-compilation-with-mingw.patch [^] (9,166 bytes) 2012-12-26 22:24 [Show Content] [Hide Content]From f3eb2707857ae4fc0c09a46612a7974d21f502cf Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Wed, 26 Dec 2012 21:53:31 +0100
Subject: [PATCH 11/13] configure: support cross-compilation with mingw.
---
configure | 108 +++++++++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 82 insertions(+), 26 deletions(-)
diff --git a/configure b/configure
index 352ac2f..6ee6aa7 100755
--- a/configure
+++ b/configure
@@ -225,6 +225,9 @@ else
fi
# Check for buggy versions of GCC
+# These checks are not done for cross-compilation (yet at least) because after
+# 15 years, I doubt someone will try to use an experimental (2.96) or
+# known-unstable (2.7.2.1) version for cross-compilation.
buggycc="no"
@@ -278,6 +281,8 @@ dllccompopts=""
ostype="Unix"
exe=""
iflexdir=""
+SO=".so"
+toolchain="cc"
case "$bytecc,$target" in
cc,*-*-nextstep*)
@@ -349,6 +354,16 @@ case "$bytecc,$target" in
fi
exe=".exe"
ostype="Cygwin";;
+ gcc*,*-*-mingw*|*-gcc*,*-*-mingw*)
+ bytecccompopts="-fno-defer-pop $gcc_warnings"
+ dllccompopt="-DCAML_DLL"
+ # TODO: use flexlink
+ withsharedlibs=no
+ exe=".exe"
+ ostype="Win32"
+ toolchain="mingw"
+ SO="dll"
+ ;;
gcc*,x86_64-*-linux*|*-gcc*,x86_64-*-linux*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
# Tell gcc that we can use 32-bit code addresses for threaded code
@@ -383,9 +398,20 @@ esac
echo "Checking the sizes of integers and pointers..." 1>&2
ret=`sh ./runtest sizes.c`
if test "$?" -neq 0; then
- echo "Unable to compile the test program." 1>&2
- echo "Make sure the C compiler '$cc' is properly installed." 1>&2
- exit 2;;
+ # For cross-compilation, runtest always fails; add special handling.
+ case "$target" in
+ x86_64-*-mingw*) echo "Wow! A 64 bit architecture!" 1>&2
+ echo "#undef ARCH_SIXTYFOUR" >> m.h
+ ret="4 4 8 2"
+ arch64=true;;
+ i686-*-mingw*) echo "OK, this is a regular 32 bit architecture." 1>&2
+ echo "#undef ARCH_SIXTYFOUR" >> m.h
+ ret="4 4 4 2"
+ arch64=false;;
+ *) echo "Unable to compile the test program." 1>&2
+ echo "Make sure the C compiler '$cc' is properly installed." 1>&2
+ exit 2;;
+ esac
fi
set $ret
@@ -435,11 +461,21 @@ else
echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
int64_native=true;;
- *) echo "No suitable 64-bit integer type found, will use software emulation." 1>&2
- echo "#undef ARCH_INT64_TYPE" >> m.h
- echo "#undef ARCH_UINT64_TYPE" >> m.h
- echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
- int64_native=false;;
+ *)
+ case "$target" in
+ *-*-mingw*)
+ echo "64-bit \"long long\" integer type found (printf with \"%I64\")." 1>&2
+ echo "#define ARCH_INT64_TYPE long long" >> m.h
+ echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
+ echo '#define ARCH_INT64_PRINTF_FORMAT "I64"' >> m.h
+ int64_native=true;;
+ *)
+ echo "No suitable 64-bit integer type found, will use software emulation." 1>&2
+ echo "#undef ARCH_INT64_TYPE" >> m.h
+ echo "#undef ARCH_UINT64_TYPE" >> m.h
+ echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
+ int64_native=false;;
+ esac;;
esac
fi
@@ -460,9 +496,14 @@ case $? in
2) echo "This architecture seems to be neither big endian nor little endian." 1>&2
echo "OCaml won't run on this architecture." 1>&2
exit 2;;
- *) echo "Something went wrong during endianness determination." 1>&2
- echo "You'll have to figure out endianness yourself" 1>&2
- echo "(option ARCH_BIG_ENDIAN in m.h)." 1>&2 ;;esac
+ *) case $target in
+ *-*-mingw*) echo "This is a little-endian architecture." 1>&2
+ echo "#undef ARCH_BIG_ENDIAN" >> m.h;;
+ *) echo "Something went wrong during endianness determination." 1>&2
+ echo "You'll have to figure out endianness yourself" 1>&2
+ echo "(option ARCH_BIG_ENDIAN in m.h)." 1>&2 ;;
+ esac;;
+esac
# Determine alignment constraints
@@ -490,11 +531,15 @@ case "$target" in
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h;;
1) echo "Doubles must be doubleword-aligned." 1>&2
echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
- *) echo "Something went wrong during alignment determination for doubles." 1>&2
- echo "I'm going to assume this architecture has alignment constraints over doubles." 1>&2
- echo "That's a safe bet: OCaml will work even if" 1>&2
- echo "this architecture has actually no alignment constraints." 1>&2
- echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
+ *) case "$target" in
+ *-*-mingw*) echo "Doubles can be word-aligned." 1>&2
+ echo "#undef ARCH_ALIGN_DOUBLE" >> m.h;;
+ *) echo "Something went wrong during alignment determination for doubles." 1>&2
+ echo "I'm going to assume this architecture has alignment constraints over doubles." 1>&2
+ echo "That's a safe bet: OCaml will work even if this" 1>&2
+ echo "architecture has actually no alignment constraints." 1>&2
+ echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
+ esac;;
esac;;
esac
@@ -509,6 +554,7 @@ if $int64_native; then
echo "64-bit integers must be doubleword-aligned." 1>&2
echo "#define ARCH_ALIGN_INT64" >> m.h
fi;;
+ *-*-mingw*) true;; # Nothing is in config/m-nt.h so don't add anything.
*)
sh ./runtest int64align.c
case $? in
@@ -535,8 +581,12 @@ case $? in
echo "#undef NONSTANDARD_DIV_MOD" >> m.h;;
1) echo "Native division and modulus do not have round-towards-zero semantics, will use software emulation." 1>&2
echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
- *) echo "Something went wrong while checking native division and modulus, please report it." 1>&2
- echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
+ *) case $target in
+ *-*-mingw*) echo "Native division and modulus have round-towards-zero semantics, will use them." 1>&2
+ echo "#undef NONSTANDARD_DIV_MOD" >> m.h;;
+ *) echo "Something went wrong while checking native division and modulus, please report it." 1>&2
+ echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
+ esac;;
esac
# Shared library support
@@ -706,6 +756,7 @@ case "$target" in
arch=i386; system=macosx
fi;;
i[3456]86-*-gnu*) arch=i386; system=gnu;;
+ i[3456]86-*-mingw*) arch=i386; system=mingw;;
powerpc*-*-linux*) arch=power; model=ppc; system=elf;;
powerpc-*-netbsd*) arch=power; model=ppc; system=elf;;
powerpc-*-rhapsody*) arch=power; model=ppc; system=rhapsody;;
@@ -725,6 +776,7 @@ case "$target" in
x86_64-*-netbsd*) arch=amd64; system=netbsd;;
x86_64-*-openbsd*) arch=amd64; system=openbsd;;
x86_64-*-darwin*) arch=amd64; system=macosx;;
+ x86_64-*-mingw*) arch=amd64; system=mingw;;
esac
# Some platforms exist both in 32-bit and 64-bit variants, not distinguished
@@ -818,6 +870,11 @@ fi
echo "ARCMD=${TOOLPREF}ar" >> Makefile
+# Write the OS type (Unix or Cygwin)
+
+echo "#define OCAML_OS_TYPE \"$ostype\"" >> s.h
+echo "#define OCAML_STDLIB_DIR \"$libdir\"" >> s.h
+
# Do #! scripts work?
if (SHELL=/bin/sh; export SHELL; (./sharpbang || ./sharpbang2) >/dev/null); then
@@ -831,6 +888,10 @@ if (SHELL=/bin/sh; export SHELL; (./sharpbang || ./sharpbang2) >/dev/null); then
echo "We won't use it, though, because of conflicts with .exe" 1>&2
echo " extension under Cygwin" 1>&2
echo "SHARPBANGSCRIPTS=false" >> Makefile;;
+ *-*-mingw*)
+ echo "We won't use it, though, because that support will be used on" 1>&2
+ echo " the target platform and windows doesn't handle it." 1>&2
+ echo "SHARPBANGSCRIPTS=false" >> Makefile
*)
echo "SHARPBANGSCRIPTS=true" >> Makefile;;
esac
@@ -839,11 +900,6 @@ else
echo "SHARPBANGSCRIPTS=false" >> Makefile
fi
-# Write the OS type (Unix or Cygwin)
-
-echo "#define OCAML_OS_TYPE \"$ostype\"" >> s.h
-echo "#define OCAML_STDLIB_DIR \"$libdir\"" >> s.h
-
# Use 64-bit file offset if possible
bytecccompopts="$bytecccompopts -D_FILE_OFFSET_BITS=64"
@@ -1637,14 +1693,14 @@ echo "DLLCCCOMPOPTS=$dllccompopts" >> Makefile
echo "IFLEXDIR=$iflexdir" >> Makefile
echo "O=o" >> Makefile
echo "A=a" >> Makefile
-echo "SO=so" >> Makefile
+echo "SO=$SO" >> Makefile
echo "EXT_OBJ=.o" >> Makefile
echo "EXT_ASM=.s" >> Makefile
echo "EXT_LIB=.a" >> Makefile
-echo "EXT_DLL=.so" >> Makefile
+echo "EXT_DLL=.$SO" >> Makefile
echo "EXTRALIBS=" >> Makefile
echo "CCOMPTYPE=cc" >> Makefile
-echo "TOOLCHAIN=cc" >> Makefile
+echo "TOOLCHAIN=$toolchain" >> Makefile
echo "NATDYNLINK=$natdynlink" >> Makefile
echo "CMXS=$cmxs" >> Makefile
echo "MKEXE=$mkexe" >> Makefile
--
1.7.12.1
0012-windows-makefiles-remove-unused-DO-variable.patch [^] (1,347 bytes) 2012-12-26 22:24 [Show Content] [Hide Content]From d54c0a8fb0ba8467942079768a120591a6c79bbf Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Wed, 26 Dec 2012 22:15:22 +0100
Subject: [PATCH 12/13] windows makefiles: remove unused DO variable.
---
config/Makefile.mingw | 1 -
config/Makefile.mingw64 | 1 -
config/Makefile.msvc | 1 -
config/Makefile.msvc64 | 1 -
4 files changed, 4 deletions(-)
diff --git a/config/Makefile.mingw b/config/Makefile.mingw
index 7336b59..557a1c3 100644
--- a/config/Makefile.mingw
+++ b/config/Makefile.mingw
@@ -47,7 +47,6 @@ O=o
A=a
S=s
SO=s.o
-DO=d.o
EXE=.exe
EXT_DLL=.dll
EXT_OBJ=.$(O)
diff --git a/config/Makefile.mingw64 b/config/Makefile.mingw64
index 0ff83c2..4a53c48 100644
--- a/config/Makefile.mingw64
+++ b/config/Makefile.mingw64
@@ -47,7 +47,6 @@ O=o
A=a
S=s
SO=s.o
-DO=d.o
EXE=.exe
EXT_DLL=.dll
EXT_OBJ=.$(O)
diff --git a/config/Makefile.msvc b/config/Makefile.msvc
index 0d81752..79edb3f 100644
--- a/config/Makefile.msvc
+++ b/config/Makefile.msvc
@@ -40,7 +40,6 @@ O=obj
A=lib
S=asm
SO=s.obj
-DO=d.obj
EXE=.exe
EXT_DLL=.dll
EXT_OBJ=.$(O)
diff --git a/config/Makefile.msvc64 b/config/Makefile.msvc64
index 1ba9b6f..339c717 100644
--- a/config/Makefile.msvc64
+++ b/config/Makefile.msvc64
@@ -40,7 +40,6 @@ O=obj
A=lib
S=asm
SO=s.obj
-DO=d.obj
DBGO=dbg.obj
EXE=.exe
EXT_DLL=.dll
--
1.7.12.1
0013-windows-makefiles-use-dll-for-the-SO-extension.patch [^] (1,033 bytes) 2012-12-26 22:25 [Show Content] [Hide Content]From 752d6489dcb0ed21f3849edaa585379cbce80408 Mon Sep 17 00:00:00 2001
From: Adrien Nader <adrien@notk.org>
Date: Wed, 26 Dec 2012 22:16:43 +0100
Subject: [PATCH 13/13] windows makefiles: use "dll" for the SO extension.
The variable is seldom used and should probably be removed but for now,
update it.
---
config/Makefile.mingw | 4 ++--
config/Makefile.mingw64 | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/config/Makefile.mingw b/config/Makefile.mingw
index 557a1c3..88804b9 100644
--- a/config/Makefile.mingw
+++ b/config/Makefile.mingw
@@ -46,9 +46,9 @@ CCOMPTYPE=cc
O=o
A=a
S=s
-SO=s.o
+SO=dll
EXE=.exe
-EXT_DLL=.dll
+EXT_DLL=.$(SO)
EXT_OBJ=.$(O)
EXT_LIB=.$(A)
EXT_ASM=.$(S)
diff --git a/config/Makefile.mingw64 b/config/Makefile.mingw64
index 4a53c48..1b6c272 100644
--- a/config/Makefile.mingw64
+++ b/config/Makefile.mingw64
@@ -46,9 +46,9 @@ CCOMPTYPE=cc
O=o
A=a
S=s
-SO=s.o
+SO=dll
EXE=.exe
-EXT_DLL=.dll
+EXT_DLL=.$(SO)
EXT_OBJ=.$(O)
EXT_LIB=.$(A)
EXT_ASM=.$(S)
--
1.7.12.1
cross-patches-rev2-2012-12-29.tar.gz [^] (22,118 bytes) 2012-12-29 13:27
patches_dump.tar.gz [^] (49,294 bytes) 2013-01-23 22:25
cross-patches-rev2-2013-02-17.tar.gz [^] (54,029 bytes) 2013-02-17 22:48
cross-patches-rev4-2013-02-24.tar.gz [^] (46,908 bytes) 2013-02-24 12:49 |