1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "fix@me" <fix@me>
Date: Sun, 17 Jun 2012 17:42:39 +0200
Subject: [PATCH 1/1] use of ocaml.m4 from ocaml-autoconf ; modifications for
cross-compilation
taken from
https://bugs.freedesktop.org/show_bug.cgi?id=51994
diff --git a/META b/META
new file mode 100644
index 1111111..2222222
--- /dev/null
+++ b/META
@@ -0,0 +1,17 @@
+name = "cairo-ocaml"
+description = "Bindings to the cairo library."
+archive(byte) = "cairo.cma"
+archive(native) = "cairo.cmxa"
+requires = "bigarray"
+
+package "lablgtk2" (
+ requires = "cairo lablgtk2"
+ archive(byte) = "cairo_lablgtk.cma"
+ archive(native) = "cairo_lablgtk.cmxa"
+)
+
+package "pango" (
+ requires = "cairo lablgtk2"
+ archive(byte) = "pango_cairo.cma"
+ archive(native) = "pango_cairo.cmxa"
+)
\ No newline at end of file
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@ AC_ARG_VAR(LABLGTKDIR,[Location of the LablGTK library])
if test $use_gtk = yes ; then
# Check for LablGTK
- AC_CHECK_OCAML_MODULE(lablgtk, LABLGTKDIR, Gobject, +lablgtk2 +lablgtk)
+ AC_CHECK_OCAML_MODULE(LABLGTKDIR, lablgtk, Gobject, +lablgtk2 +lablgtk)
if test "$LABLGTKDIR" ; then
# Check for gdk-pixbuf
diff --git a/src/Makefile b/src/Makefile
index 1111111..2222222 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -92,10 +92,10 @@ install: all
ifdef OCAMLOPT
install -m644 *.cmxa *.a *.cmx $(DESTDIR)$(INSTALLDIR)
endif
- install -m 755 dll*.so $(DESTDIR)$(INSTALLDIR)
- if test -w $(DESTDIR)$(OCAMLLIB)/stublibs ; then \
- for lib in dll*.so ; do \
- ln -s $(INSTALLDIR)/$$lib $(DESTDIR)$(OCAMLLIB)/stublibs ; done ; fi
+# install -m 755 dll*.so $(DESTDIR)$(INSTALLDIR)
+# if test -w $(DESTDIR)$(OCAMLLIB)/stublibs ; then \
+# for lib in dll*.so ; do \
+# ln -s $(INSTALLDIR)/$$lib $(DESTDIR)$(OCAMLLIB)/stublibs ; done ; fi
DOCFILES = cairo.mli cairo_bigarray.mli cairo_png.mli cairo_pdf.mli cairo_ps.mli cairo_ft.mli
ifdef LABLGTKDIR
diff --git a/support/ocaml.m4 b/support/ocaml.m4
index 1111111..2222222 100644
--- a/support/ocaml.m4
+++ b/support/ocaml.m4
@@ -11,10 +11,10 @@ dnl For documentation, please read the ocaml.m4 man page.
AC_DEFUN([AC_PROG_OCAML],
[dnl
# checking for ocamlc
- AC_CHECK_TOOL([OCAMLC],[ocamlc],[no])
+ AC_CHECK_TOOLS([OCAMLC],[ocamlc.opt ocamlc],[no])
if test "$OCAMLC" != "no"; then
- OCAMLVERSION=$($OCAMLC -version)
+ OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'`
AC_MSG_RESULT([OCaml version is $OCAMLVERSION])
# If OCAMLLIB is set, use it
if test "$OCAMLLIB" = ""; then
@@ -28,14 +28,14 @@ AC_DEFUN([AC_PROG_OCAML],
AC_SUBST([OCAMLLIB])
# checking for ocamlopt
- AC_CHECK_TOOL([OCAMLOPT],[ocamlopt],[no])
+ AC_CHECK_TOOLS([OCAMLOPT],[ocamlopt.opt ocamlopt],[no])
OCAMLBEST=byte
if test "$OCAMLOPT" = "no"; then
AC_MSG_WARN([Cannot find ocamlopt; bytecode compilation only.])
else
- TMPVERSION=$($OCAMLOPT -version)
+ TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
- AC_MSG_RESULT([versions differs from ocamlc; ocamlopt discarded.])
+ AC_MSG_RESULT([versions differs from $OCAMLC; $OCAMLOPT discarded.])
OCAMLOPT=no
else
OCAMLBEST=opt
@@ -44,33 +44,11 @@ AC_DEFUN([AC_PROG_OCAML],
AC_SUBST([OCAMLBEST])
- # checking for ocamlc.opt
- AC_CHECK_TOOL([OCAMLCDOTOPT],[ocamlc.opt],[no])
- if test "$OCAMLCDOTOPT" != "no"; then
- TMPVERSION=$($OCAMLCDOTOPT -version)
- if test "$TMPVERSION" != "$OCAMLVERSION" ; then
- AC_MSG_RESULT([versions differs from ocamlc; ocamlc.opt discarded.])
- else
- OCAMLC=$OCAMLCDOTOPT
- fi
- fi
-
- # checking for ocamlopt.opt
- if test "$OCAMLOPT" != "no" ; then
- AC_CHECK_TOOL([OCAMLOPTDOTOPT],[ocamlopt.opt],[no])
- if test "$OCAMLOPTDOTOPT" != "no"; then
- TMPVERSION=$($OCAMLOPTDOTOPT -version)
- if test "$TMPVERSION" != "$OCAMLVERSION" ; then
- AC_MSG_RESULT([version differs from ocamlc; ocamlopt.opt discarded.])
- else
- OCAMLOPT=$OCAMLOPTDOTOPT
- fi
- fi
- fi
+ AC_SUBST([OCAMLOPT])
fi
# checking for ocaml toplevel
- AC_CHECK_TOOL([OCAML],[ocaml],[no])
+ AC_CHECK_PROG([OCAML],[ocaml],[ocaml],[no])
# checking for ocamldep
AC_CHECK_TOOL([OCAMLDEP],[ocamldep],[no])
@@ -82,7 +60,7 @@ AC_DEFUN([AC_PROG_OCAML],
AC_CHECK_TOOL([OCAMLMKLIB],[ocamlmklib],[no])
# checking for ocamldoc
- AC_CHECK_TOOL([OCAMLDOC],[ocamldoc],[no])
+ AC_CHECK_PROG([OCAMLDOC],[ocamldoc],[ocamldoc],[no])
# checking for ocamlbuild
AC_CHECK_TOOL([OCAMLBUILD],[ocamlbuild],[no])
@@ -92,18 +70,12 @@ AC_DEFUN([AC_PROG_OCAML],
AC_DEFUN([AC_PROG_OCAMLLEX],
[dnl
# checking for ocamllex
- AC_CHECK_TOOL([OCAMLLEX],[ocamllex],[no])
- if test "$OCAMLLEX" != "no"; then
- AC_CHECK_TOOL([OCAMLLEXDOTOPT],[ocamllex.opt],[no])
- if test "$OCAMLLEXDOTOPT" != "no"; then
- OCAMLLEX=$OCAMLLEXDOTOPT
- fi
- fi
+ AC_CHECK_PROGS([OCAMLLEX],[ocamllex.opt ocamllex],[no])
])
AC_DEFUN([AC_PROG_OCAMLYACC],
[dnl
- AC_CHECK_TOOL([OCAMLYACC],[ocamlyacc],[no])
+ AC_CHECK_PROG([OCAMLYACC],[ocamlyacc],[ocamlyacc],[no])
])
@@ -112,24 +84,25 @@ AC_DEFUN([AC_PROG_CAMLP4],
AC_REQUIRE([AC_PROG_OCAML])dnl
# checking for camlp4
- AC_CHECK_TOOL([CAMLP4],[camlp4],[no])
+ AC_CHECK_PROG([CAMLP4],[camlp4],[camlp4],[no])
if test "$CAMLP4" != "no"; then
- TMPVERSION=$($CAMLP4 -version)
+ TMPVERSION=`$CAMLP4 -v 2>&1| sed -n -e 's|.*version *\(.*\)$|\1|p'`
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT([versions differs from ocamlc])
CAMLP4=no
fi
fi
+ AC_SUBST([CAMLP4])
# checking for companion tools
- AC_CHECK_TOOL([CAMLP4BOOT],[camlp4boot],[no])
- AC_CHECK_TOOL([CAMLP4O],[camlp4o],[no])
- AC_CHECK_TOOL([CAMLP4OF],[camlp4of],[no])
- AC_CHECK_TOOL([CAMLP4OOF],[camlp4oof],[no])
- AC_CHECK_TOOL([CAMLP4ORF],[camlp4orf],[no])
- AC_CHECK_TOOL([CAMLP4PROF],[camlp4prof],[no])
- AC_CHECK_TOOL([CAMLP4R],[camlp4r],[no])
- AC_CHECK_TOOL([CAMLP4RF],[camlp4rf],[no])
+ AC_CHECK_PROG([CAMLP4BOOT],[camlp4boot],[camlp4boot],[no])
+ AC_CHECK_PROG([CAMLP4O],[camlp4o],[camlp4o],[no])
+ AC_CHECK_PROG([CAMLP4OF],[camlp4of],[camlp4of],[no])
+ AC_CHECK_PROG([CAMLP4OOF],[camlp4oof],[camlp4oof],[no])
+ AC_CHECK_PROG([CAMLP4ORF],[camlp4orf],[camlp4orf],[no])
+ AC_CHECK_PROG([CAMLP4PROF],[camlp4prof],[camlp4prof],[no])
+ AC_CHECK_PROG([CAMLP4R],[camlp4r],[camlp4r],[no])
+ AC_CHECK_PROG([CAMLP4RF],[camlp4rf],[camlp4rf],[no])
])
@@ -173,26 +146,26 @@ AC_DEFUN([AC_CHECK_OCAML_PKG],
AC_DEFUN([AC_CHECK_OCAML_MODULE],
[dnl
- AC_MSG_CHECKING([for OCaml module $1])
+ AC_MSG_CHECKING([for OCaml module $2])
cat > conftest.ml <<EOF
open $3
EOF
unset found
- for $2 in $$2 $4 ; do
- if $OCAMLC -c -I "$$2" conftest.ml >&5 2>&5 ; then
+ for $1 in $$1 $4 ; do
+ if $OCAMLC -c -I "$$1" conftest.ml >&5 2>&5 ; then
found=yes
break
fi
done
if test "$found" ; then
- AC_MSG_RESULT([$$2])
+ AC_MSG_RESULT([$$1])
else
AC_MSG_RESULT([not found])
$1=no
fi
- AC_SUBST([$2])
+ AC_SUBST([$1])
])
|