Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 665 lines (586 sloc) 18.492 kB
fccc685 Initial open-source release
MLstate authored
1 #!/bin/bash -ue
2
3 : ${OPA_SOURCE_DIR:=$(dirname $0)}
4 if [ "${OPA_SOURCE_DIR#/}" = "$OPA_SOURCE_DIR" ]; then OPA_SOURCE_DIR=$PWD/$OPA_SOURCE_DIR; fi
5
6 help() {
7 cat >&2 <<EOF
8 opalang configure script. Options:
9 -prefix <dir> the final installation prefix
10 -release configure for building in release mode
11 -noassert configure for building in noassert mode
12 -ocamldir <dir> where to find the ocaml libraries
13 -ocamlopt <path> the ocaml compiler to use
14 -ocamlfind <path> use the given ocamlfind to locate libraries
15 -no-ocamlfind don't use ocamlfind
16 -no-camlidl disable features based on camlidl
17 -help shows this message
18 EOF
19 # --no-<lib> if available
20 }
21
22 cd "$OPA_SOURCE_DIR"
23
24 while [ $# -gt 0 ]; do
25 case "$1" in
26 -prefix)
27 if [ $# -lt 2 ]; then echo "Error: option $1 requires an argument" >&2; exit 1; fi
28 shift
29 PREFIX=$1
30 ;;
31 -release)
32 IS_RELEASE=1
33 ;;
34 -noassert)
35 OCAMLBUILD_FLAGS="${OCAMLBUILD_FLAGS:-} -tag noassert"
36 ;;
37 -ocamldir)
38 if [ $# -lt 2 ]; then echo "Error: option $1 requires an argument" >&2; exit 1; fi
39 shift
40 OCAMLLIB=$1
41 ;;
42 -ocamlopt)
43 if [ $# -lt 2 ]; then echo "Error: option $1 requires an argument" >&2; exit 1; fi
44 shift
45 OCAMLOPT=$1
46 ;;
47 -ocamlfind)
48 if [ $# -lt 2 ]; then echo "Error: option $1 requires an argument" >&2; exit 1; fi
49 shift
50 OCAMLFIND=$1
51 ;;
52 -no-ocamlfind)
53 NO_OCAMLFIND=1
54 ;;
55 -no-camlidl)
56 NO_CAMLIDL=1
57 ;;
58 -h|-help|--help)
59 help
60 exit 0;;
61 *)
62 echo "Error: unknown option $1" >&2
63 echo
64 help
65 exit 2
66 esac
67 shift
68 done
69
70 : ${PREFIX:=${MLSTATELIBS:-}}
71 : ${PREFIX:=/usr/local}
72 : ${IS_RELEASE:=}
73
74 CONFIG_LOG=$PWD/config.log
75
76 echo -n >$CONFIG_LOG
77
78 echo-check() { echo -n "Checking $*... " >&2 ; echo "# CHECK-START: $*" >>$CONFIG_LOG; }
79 echo-ok() {
80 local opts=; if [ "X$1" = "X-n" ]; then shift; opts="-n"; fi
81 echo $opts "$*" >&2 ; echo $opts -e "# CHECK-OK: $*\n" >>$CONFIG_LOG;
82 }
83 echo-ok-tag() { echo "OK" >&2 ; echo -e "# CHECK-OK\n" >>$CONFIG_LOG; }
84 echo-err() { echo "$*" >&2 ; echo -e "# CHECK-FAIL: $*\n" >>$CONFIG_LOG; }
85
86 # check OS
87 echo-check your OS
88 EXT_LIB="a"
89 EXT_OBJ="o"
90 EXT_SHARED="so"
91 case $(uname) in
92 CYGWIN*)
93 echo-ok Windows/cygwin
94 EXT_LIB="lib"
95 EXT_OBJ="obj"
96 EXT_SHARED="dll"
97 IS_WINDOWS=1;;
98 Darwin*)
99 echo-ok MacOS
100 IS_MAC=1;;
101 Linux*)
102 echo-ok Linux
103 IS_LINUX=1;;
104 *)
105 echo-err "Not sure, probably Unix / Linux"
106 IS_LINUX=1
107 esac
108
109 echo-check your architecture
110 case $(uname -m) in
111 x86_64)
112 echo-ok x86_64;;
113 i?86)
114 echo-ok ix86;;
115 *)
116 echo-err "$(uname -m)"
117 echo "Sorry, this architecture is unsupported at the moment." >&2
118 exit 1
119 esac
120
121 lastresort_hint() {
122 cat <<EOF
123
124 If you have trouble meeting the required dependencies with your distribution,
125 you may want to have a look at the script installation_helper.sh in the
126 dependencies/ directory to build them from source.
127
128 EOF
129 }
130 trap lastresort_hint ERR
131
132 # specific platform checks
133 if [ -n "${IS_MAC:-}" ]; then
29f3038 [fix] gsed: not in GNU coreutils on Mac
Hugo Venturini authored
134 echo-check for gsed
135 if which gsed > /dev/null 2>&1; then echo-ok ok
136 else
137 echo-err Not found
138 echo "gsed is needed to build OPA."
139 if which port >/dev/null 2>&1; then
140 echo -e " You should run:\n\tsudo port install gsed"
141 # else #todo# [add useful suggestion here]
142 fi
143 exit 1
144 fi >&2
fccc685 Initial open-source release
MLstate authored
145 echo-check for GNU coreutils
29f3038 [fix] gsed: not in GNU coreutils on Mac
Hugo Venturini authored
146 if which gtail gmktemp gsort greadlink >/dev/null 2>&1; then echo-ok ok
fccc685 Initial open-source release
MLstate authored
147 else
148 echo-err Not found
149 echo "GNU coreutils are needed to build OPA."
150 if which port >/dev/null 2>&1; then
151 echo -e " You should run:\n\tsudo port install coreutils"
152 # else #todo# [add useful suggestion here]
153 fi
154 exit 1
155 fi >&2
156 . ./platform_helper.sh
157 fi
158
159 # check ocaml version and location
160 echo-check ocamlopt
161 if OCAMLOPT=${OCAMLOPT:-$(which ocamlopt.opt)} || OCAMLOPT=${OCAMLOPT:-$(which ocamlopt)}
162 then echo-ok $OCAMLOPT
163 else
164 echo-err Not found
165 echo "Ocaml 3.12 or newer is required. It's usually found in package 'ocaml'."
166 false
167 fi
168
169 echo-check ocamlbuild
170 : ${OCAMLBUILD:=$(dirname $OCAMLOPT)/ocamlbuild}
171 if [ -n "$IS_RELEASE" ]; then
172 OCAMLBUILD_FLAGS="${OCAMLBUILD_FLAGS:-} -tag release -tag noassert"
173 else
174 OCAMLBUILD_FLAGS="${OCAMLBUILD_FLAGS:-} -tag debug"
175 fi
176 if [ -x "$OCAMLBUILD" ]
177 then echo-ok $OCAMLBUILD
178 else
179 echo-err Not found
180 echo "Ocamlbuild is required. It should come with your ocaml distribution."
181 false
182 fi
183
184 echo-check ocamldir
185 : ${OCAMLLIB:=$($OCAMLOPT -where)}
186 echo-ok $OCAMLLIB
187
188 export OCAMLLIB
189
190 echo-check ocaml version
191 OCAML_VERSION=$($OCAMLOPT -version)
192 OCAML_VERSION_MAJOR=${OCAML_VERSION%%.*}
193 OCAML_VERSION_MIDDLE=${OCAML_VERSION%.*}
194 OCAML_VERSION_MIDDLE=${OCAML_VERSION_MIDDLE#*.}
195 if [ $OCAML_VERSION_MAJOR -eq 3 ] && [ $OCAML_VERSION_MIDDLE -ge 12 ]; then
196 echo-ok $OCAML_VERSION
197 else
198 echo-err $OCAML_VERSION
199 echo "Ocaml 3.12 or newer is required"
200 false
201 fi
202
203 echo-check your ocaml setup
204 check-ocaml () {
205 local DIR=$(mktemp -d /tmp/opa-configure.XXXXX)
206 trap "rm -rf /tmp/${DIR#/tmp/}" EXIT
207 cd $DIR
208 cat >test.ml <<EOF
209 let p = Unix.getpid()
210 let _ = Printf.printf "%s, %s %dbit" Sys.ocaml_version Sys.os_type Sys.word_size
211 let _ =
c24f567 [enhance] build: detect and accept 32bits version
Mathieu Barbin authored
212 exit Sys.word_size
fccc685 Initial open-source release
MLstate authored
213 EOF
214
215 echo "# $OCAMLBUILD$OCAMLBUILD_FLAGS -tag use_unix test.native" >> $CONFIG_LOG
216 R=0; $OCAMLBUILD$OCAMLBUILD_FLAGS -tag use_unix test.native >test.log 2>&1 || R=$?
217
218 cat test.log >> $CONFIG_LOG
219
220 if [ $R -ne 0 ]; then
221 echo-err "could not compile"
222 echo "----------"
223 tail -n 5 test.log | sed 's/^/ /'
224 echo "----------"
225 echo "Your ocaml installation seems broken, please fix it"
226 false
227 fi >&2
c24f567 [enhance] build: detect and accept 32bits version
Mathieu Barbin authored
228 set +e
229 RET=$(_build/test.native);
230 R=$?
231 set -e
232 case $R in
233 32)
234 OCAML_WORD_SIZE=32
235 echo-ok $RET
236 ;;
237 64)
238 OCAML_WORD_SIZE=64
239 echo-ok $RET
240 ;;
241 *)
242 echo-err $RET
243 echo "Your ocaml seems to be neither a 64bit or a 32bit version. Please install a native 64 bit package."
244 false
245 esac >&2
fccc685 Initial open-source release
MLstate authored
246 rm -rf /tmp/${DIR#/tmp/}
247 trap - EXIT
248 cd "$OPA_SOURCE_DIR"
249 }
250 check-ocaml
251
252 echo-check for camlp4
253 : ${CAMLP4O:=$(dirname $OCAMLOPT)/camlp4o}
254 : ${CAMLP4ORF:=$(dirname $OCAMLOPT)/camlp4orf}
255 if [ -x "$CAMLP4O" ] && [ -x "$CAMLP4ORF" ]
256 then echo-ok $CAMLP4O
257 else
258 echo-err Not found
259 echo "You need camlp4 to build this package. It is usually found in packages camlp4, camlp4-extra"
260 false
261 fi
262
263 # check tools:
264 # (*) stuff marked with * could maybe be optional and restrict the build correspondingly
265
266 # - checking for perl
267 echo-check for perl 5
268 if perl -v 2>/dev/null | grep -q 'v5\.'; then
269 echo-ok found
270 else
271 echo-err Not found
272 echo "You need Perl v5 to build this package ; it's usually found in package perl-base"
273 exit 1
274 fi >&2
275
276 # - checking camlidl *
277 echo-check for camlidl
278 if [ -n "${NO_CAMLIDL:-}" ]; then
279 HAS_CAMLIDL=
280 CAMLIDL=
281 echo-ok Disabled
282 elif
283 [ -e $OCAMLLIB/libcamlidl.a ] &&
284 CAMLIDL=${CAMLIDL:-$(dirname "$OCAMLOPT")/camlidl} && [ -x "$CAMLIDL" ] ||
285 CAMLIDL=$(which camlidl)
286 then
287 HAS_CAMLIDL=1
288 echo-ok $CAMLIDL
289 else
290 HAS_CAMLIDL=
291 echo-err Not found
292 fi
293
294
295 # check C libs:
296 # we depend on libssl, libzip and others, but through
297 # ocaml libs, so no need to check them directly
298 check-c-lib () (
299 local LIB=$1; shift
300 [ $# -gt 0 ]
301 local INCLUDES=("$@")
302
303 local LIBNAME=$(basename "$LIB")
304 local LIBDIR=$(dirname "$LIB")
305 local INCLUDE_DIR
306 for d in {"$OCAMLLIB/..","$OCAMLLIB",/usr/lib,/usr/local/lib}{/$LIBDIR,}; do
307 if [ -e $d/lib$LIBNAME.a ]; then
308 LD_DIR=$(readlink -f $d)
309 INCLUDE_DIR=$LD_DIR/
310 INCLUDE_DIR=${INCLUDE_DIR%/lib/*}/include
311 break
312 fi
313 done
314 if [ -z "${LD_DIR:-}" ]; then
315 echo "could not find lib$LIBNAME.a" >>$CONFIG_LOG
316 echo-err Not found
317 return 1
318 fi >&2
319
320 echo-ok -n "$LD_DIR/lib$LIBNAME.a, "
321
322 # Now checking compile, link & run
323 local DIR=$(mktemp -d /tmp/opa-configure.XXXXX)
324 trap "rm -rf /tmp/${DIR#/tmp/}" EXIT
325 cd $DIR
326
327 {
328 for i in "${INCLUDES[@]}"; do echo '#include <'$i'>'; done
329 echo 'int main () { return 0; }'
330 } >test_$LIBNAME.c
331
332 echo "# gcc -L$LD_DIR -I$INCLUDE_DIR -l$LIBNAME test_$LIBNAME.c -o test_$LIBNAME" >> $CONFIG_LOG
333 R=0; gcc -L$LD_DIR -I$INCLUDE_DIR -l$LIBNAME test_$LIBNAME.c -o test_$LIBNAME >check_$LIBNAME.log 2>&1 || R=$?
334
335 cat check_$LIBNAME.log >> $CONFIG_LOG
336
337 if [ $R -ne 0 ]; then
338 echo-err "could not compile"
339 echo "----------"
340 tail -n 5 check_${LIBNAME}.log | sed 's/^/ /'
341 echo "----------"
342 return 1
343 fi >&2
344 if ! ./test_$LIBNAME >> $CONFIG_LOG 2>&1; then
345 echo-err "compiled program doesn't work"
346 return 1
347 fi
348
349 echo-ok-tag
350 echo "$LIBNAME $LD_DIR $INCLUDE_DIR"
351 )
352
353 HAS_LIBNATPMP=
6bb0418 [fix] configure: handling the absence of camlidl correctly
Louis Gesbert authored
354 LIBNATPMP=("")
fccc685 Initial open-source release
MLstate authored
355 HAS_MINIUPNPC=
6bb0418 [fix] configure: handling the absence of camlidl correctly
Louis Gesbert authored
356 MINIUPNPC=("")
fccc685 Initial open-source release
MLstate authored
357 if [ -n "$HAS_CAMLIDL" ]; then
358 # - checking libnatpmp *
359 echo-check libnatpmp
360 if LIBNATPMP=($(check-c-lib libnatpmp/natpmp netinet/in.h arpa/inet.h libnatpmp/getgateway.h libnatpmp/natpmp.h)); then
361 HAS_LIBNATPMP=1
17a5e59 [fix] configure: fix for the 'XXX[@] : undefined variable' under some…
Louis Gesbert authored
362 else
363 LIBNATPMP=("")
fccc685 Initial open-source release
MLstate authored
364 fi
365
366 # - checking miniupnpc *
367 echo-check miniupnpc
368 if MINIUPNPC=($(check-c-lib miniupnpc/miniupnpc miniupnpc/miniwget.h miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h)); then
369 HAS_MINIUPNPC=1
17a5e59 [fix] configure: fix for the 'XXX[@] : undefined variable' under some…
Louis Gesbert authored
370 else
371 MINIUPNPC=("")
fccc685 Initial open-source release
MLstate authored
372 fi
373 fi
374
375 # check ocaml libs:
376 # probably, first try with ocamlfind then fallback to
377 # custom check ; ensure consistency with function
378 # "get_ocamlfind_directory" in build/myocamlbuild_prefix.ml
379 echo-check for ocamlfind
380 if [ -n "${NO_OCAMLFIND:-}" ]; then
381 OCAMLFIND=
382 echo-ok Disabled
383 elif [ -z "${OCAMLFIND:-}" ]; then
384 OCAMLFIND=$(dirname $OCAMLOPT)/ocamlfind
385 if [ ! -x "$OCAMLFIND" ]; then
386 OCAMLFIND=$OCAMLLIB/../../bin/ocamlfind
387 fi
388 if [ ! -x "$OCAMLFIND" ]; then
389 echo-ok "Not found"
390 OCAMLFIND=
391 else
392 echo-ok $OCAMLFIND
393 fi
394 elif [ -x "$OCAMLFIND" ]; then
395 echo-ok $OCAMLFIND
396 else
397 echo-err "Not found"
398 echo "You specified $OCAMLFIND on the command-line, but it doesn't exist or isn't executable" >&2
399 OCAMLFIND=
400 fi
401
402 EXTRA_TAGS="-tag use_unix"
403 check-ocaml-lib () {
404 local MODULE=$1; shift
405 local LIB=$1; shift
406 local LIBDIR=$1; shift
407 [ $# -eq 0 ]
408
409 local DIR=$(mktemp -d /tmp/opa-configure.XXXXX)
410 trap "rm -rf /tmp/${DIR#/tmp/}" EXIT
411 cd $DIR
412
413 echo "module M = $MODULE" >check_${LIB}.ml
414
415 local libdir_ins=""
416 if [ "$LIBDIR" != "$OCAMLLIB" ]; then libdir_ins=' ~dir:"'$LIBDIR'"'; fi
417 cat >myocamlbuild.ml <<EOF
418 let _ = Ocamlbuild_plugin.dispatch (function
419 | Ocamlbuild_plugin.After_rules ->
420 Ocamlbuild_plugin.ocaml_lib ~extern:true$libdir_ins ~tag_name:"use_my_lib" "$LIB"
421 | _ -> ()
422 )
423 EOF
424
425 echo "# $OCAMLBUILD$OCAMLBUILD_FLAGS $EXTRA_TAGS -tag use_my_lib check_${LIB}.native" >> $CONFIG_LOG
426
427 R=0; $OCAMLBUILD$OCAMLBUILD_FLAGS $EXTRA_TAGS -tag use_my_lib check_${LIB}.native >check_${LIB}.log 2>&1 || R=$?
428 cat check_${LIB}.log >> $CONFIG_LOG
429
430 if [ $R -ne 0 ]; then
431 echo-err "could not compile"
432 echo "----------"
433 tail -n 5 check_${LIB}.log | sed 's/^/ /'
434 echo "----------"
435 echo "The installation of $LIB seems broken, please fix it (did it come with a different ocaml compiler ?)"
436 return 1
437 else
438 echo-ok-tag
439 fi >&2
440 rm -rf /tmp/${DIR#/tmp/}
441 trap - EXIT
442 cd "$OPA_SOURCE_DIR"
443 }
444
445 check-cmxa () {
446 local DIR=$1; shift
447 [ $# -gt 0 ]
448 local canonical_name=$1
449 while [ $# -gt 0 ] && [ ! -e "$DIR/$(basename $1).cmxa" ]; do shift; done
450 if [ $# -eq 0 ]; then
451 echo-err "Not found"
452 echo "Please fix your installation of $canonical_name in $LIBDIR: no proper cmxa file was found there." >&2
453 return 1
454 fi
455 echo $1
456 }
457
458 locate-ocaml-lib () {
459 local MODULE=$1; shift # one module that the lib contains, to check
460 [ $# -gt 0 ] # remaining args: possible lib names (may be usual_dir/libname)
461
462 echo-check for $(basename $1)
463
464 local LIBDIR=""
465 local LIB
466 local LIB_NAMES=("$@")
467 while [ $# -gt 0 ] && [ -z "$LIBDIR" ]; do
468 LIB=$(basename $1)
469 USUAL_DIR=$(dirname $1)
470 [ "$USUAL_DIR" = "." ] && USUAL_DIR=$LIB
471 if [ -n "$OCAMLFIND" ] &&
472 LIBDIR=$("$OCAMLFIND" query "$LIB" 2>/dev/null)
473 then
474 LIB=$(check-cmxa $LIBDIR $LIB "${LIB_NAMES[@]}") || return 1
475 echo-ok -n "ocamlfind:$LIBDIR, "
476 elif [ -d "$OCAMLLIB"/"$USUAL_DIR" ]
477 then
478 LIB=$(check-cmxa "$OCAMLLIB"/"$USUAL_DIR" $LIB "${LIB_NAMES[@]}") \
479 || return 1
480 echo-ok -n "+$USUAL_DIR, "
481 LIBDIR=+"$USUAL_DIR"
482 elif [ -e "$OCAMLLIB"/"$LIB".cmxa ]
483 then
484 echo-ok -n "$LIB.cmxa, "
485 LIBDIR="$OCAMLLIB"
486 fi
487 shift
488 done
489 if [ -z "$LIBDIR" ]; then
490 echo-err "Not found"
491 return 1
492 fi
493
494 check-ocaml-lib "$MODULE" "$LIB" "$LIBDIR" || return 1
495 echo "$LIBDIR/$LIB"
496 }
497 # for libs which are needed (fatal warning)
498 LIBS_NOT_FOUND=()
499 lib-not-found () {
500 local lib=$1; shift
501 local package=$1; shift
502 LIBS_NOT_FOUND[${#LIBS_NOT_FOUND[@]}]="$lib (might be found in package $package)"
503 }
504
505 # - checking ocaml-ssl
506 if ! CONFIG_LIB_OCAMLSSL=$(locate-ocaml-lib "Ssl" "ssl")
507 then lib-not-found "ocaml_ssl" "libssl-ocaml-dev"
508 fi
509
510 # - checking cryptokit
511 if ! CONFIG_LIB_CRYPTOKIT=$(EXTRA_TAGS="$EXTRA_TAGS -tag use_nums" locate-ocaml-lib "Cryptokit" "cryptokit")
512 then lib-not-found "cryptokit" "libcryptokit-ocaml-dev"
513 fi
514
515 # - checking camlzip
516 if ! CONFIG_LIB_CAMLZIP=$(locate-ocaml-lib "Zip" "camlzip" "zip")
517 then lib-not-found "camlzip" "libzip-ocaml-dev"
518 fi
519
520 # - checking ocamlgraph
521 if ! CONFIG_LIB_OCAMLGRAPH=$(locate-ocaml-lib "Graph" "ocamlgraph/graph")
522 then lib-not-found "ocamlgraph" "libocamlgraph-ocaml-dev"
523 fi
524
525 # - checking ulex
526 if ! CONFIG_LIB_ULEX=$(locate-ocaml-lib "Ulexing" "ulex" "ulexing")
527 then lib-not-found "ulex" "ocaml-ulex"
528 fi
529
530 # # - checking camlimages *
531 # CONFIG_LIB_CAMLIMAGES=$(EXTRA_TAGS="$EXTRA_TAGS -tag use_graphics" locate-ocaml-lib "Jpeg" "camlimages") || true
532
533 if [ ${#LIBS_NOT_FOUND[@]} -ne 0 ]; then
534 echo
535 echo "Not configured. You need the following libraries installed:" >&2
536 for lib in "${LIBS_NOT_FOUND[@]}"; do
537 echo " - $lib" >&2
538 done
539 false
540 fi
541
542 # Output the configuration
543
544 dir_opt() {
545 local DIR=$(dirname "$1"); shift; [ $# -eq 0 ]
546 if [ "$DIR" = "$OCAMLLIB" ]; then echo 'None'
547 else echo 'Some "'$DIR'"'
548 fi
549 }
550
551 camlbool() { [ $# -eq 1 ]; if [ -n "$1" ]; then echo true; else echo false; fi; }
552
553 camlstrtuple() {
554 echo -n '"'$1'"'; shift
555 while [ $# -gt 0 ]; do
556 echo -n ', "'$1'"'; shift
557 done
558 }
559
560 camlopt() {
561 local cond=$1; shift
562 local val=$1; shift
563 [ $# -eq 0 ]
564 if [ -n "$cond" ]; then echo 'Some ('$val')'
565 else echo 'None'
566 fi
567 }
568
fdba049 [fix] configure: fixed for old bash versions, now providing a list of…
Louis Gesbert authored
569 ALL_TAGS_LIST="camlidl libnatpmp miniupnpc"
7b118ed [feature] configure: generating a list of available optional tags, fo…
Louis Gesbert authored
570 TAGS_LIST=""
fdba049 [fix] configure: fixed for old bash versions, now providing a list of…
Louis Gesbert authored
571 for tag in $ALL_TAGS_LIST; do
572 hasvar=HAS_$(tr '[:lower:]' '[:upper:]' <<<"$tag")
7b118ed [feature] configure: generating a list of available optional tags, fo…
Louis Gesbert authored
573 if [ -n "${!hasvar}" ]; then TAGS_LIST="$TAGS_LIST\"$tag\"; "; fi
574 done
575
fccc685 Initial open-source release
MLstate authored
576 # See config.mli for the documentation and spec of these variables
577 cat >config.ml <<EOF
578 let prefix = "$PREFIX"
579 let ocamllib = "$OCAMLLIB"
580 let ocamlopt = "$OCAMLOPT"
581 let ocamlbuild = "$OCAMLBUILD"
582 let ocamlbuild_flags = "$OCAMLBUILD_FLAGS"
583 let camlp4o = "$CAMLP4O"
584 let camlp4orf = "$CAMLP4ORF"
585
586 let camlidl = $(camlopt "$HAS_CAMLIDL" '"'"$CAMLIDL"'"')
587 let libnatpmp = $(camlopt "$HAS_LIBNATPMP" "$(camlstrtuple "${LIBNATPMP[@]}")")
588 let miniupnpc = $(camlopt "$HAS_MINIUPNPC" "$(camlstrtuple "${MINIUPNPC[@]}")")
589
7b118ed [feature] configure: generating a list of available optional tags, fo…
Louis Gesbert authored
590 let available = [ $TAGS_LIST]
fdba049 [fix] configure: fixed for old bash versions, now providing a list of…
Louis Gesbert authored
591 let all_tags = [ $(for t in $ALL_TAGS_LIST; do echo -n "\"$t\"; "; done)]
7b118ed [feature] configure: generating a list of available optional tags, fo…
Louis Gesbert authored
592
fccc685 Initial open-source release
MLstate authored
593 let is_release = $(camlbool "$IS_RELEASE")
594 type os = Linux | Mac | Win32 | Cygwin
595 let os =
596 $(if [ -n "${IS_LINUX:-}" ]; then echo Linux
597 elif [ -n "${IS_MAC:-}" ]; then echo Mac
598 else echo 'match Sys.os_type with "Win32" -> Win32 | "Cygwin" -> Cygwin | _ -> assert false'
599 fi)
600
601 module Libdir = struct
602 let ssl = $(dir_opt "$CONFIG_LIB_OCAMLSSL")
603 let cryptokit = $(dir_opt "$CONFIG_LIB_CRYPTOKIT")
604 let camlzip_name = "$(basename "$CONFIG_LIB_CAMLZIP")"
605 let camlzip = $(dir_opt "$CONFIG_LIB_CAMLZIP")
606 let graph = $(dir_opt "$CONFIG_LIB_OCAMLGRAPH")
607 let ulex = $(dir_opt "$CONFIG_LIB_ULEX")
608 end
609
610 let ext_lib = "$EXT_LIB"
611 let ext_obj = "$EXT_OBJ"
612 let ext_shared = "$EXT_SHARED"
613
614 EOF
615
616 cat >config.sh <<EOF
617 PREFIX="$PREFIX"
618 OCAMLLIB="$OCAMLLIB"
619 OCAMLOPT="$OCAMLOPT"
620 OCAMLBUILD="$OCAMLBUILD"
621 OCAMLBUILD_FLAGS="$OCAMLBUILD_FLAGS"
622 CAMLP4O="$CAMLP4O"
623 CAMLP4ORF="$CAMLP4ORF"
c24f567 [enhance] build: detect and accept 32bits version
Mathieu Barbin authored
624 OCAML_WORD_SIZE="$OCAML_WORD_SIZE"
fccc685 Initial open-source release
MLstate authored
625
626 HAS_CAMLIDL="$HAS_CAMLIDL"
627 CAMLIDL="$CAMLIDL"
628 HAS_LIBNATPMP="$HAS_LIBNATPMP"
629 LIBNATPMP=(${LIBNATPMP[@]})
630 HAS_MINIUPNPC="$HAS_MINIUPNPC"
631 MINIUPNPC=(${MINIUPNPC[@]})
632 IS_RELEASE="$IS_RELEASE"
633 IS_LINUX="${IS_LINUX:-}"
634 IS_WINDOWS="${IS_WINDOWS:-}"
635 IS_MAC="${IS_MAC:-}"
636 OS=$(if [ -n "${IS_LINUX:-}" ]; then echo '"Linux"'
637 elif [ -n "${IS_MAC:-}" ]; then echo '"Mac"'
638 elif [ -n "${IS_WINDOWS:-}" ]; then echo '"Win32"'
639 else echo "Error: OS inconsistency" >&2; exit 2
640 fi)
641
642 LIB_OCAMLSSL_DIR="$(dirname "$CONFIG_LIB_OCAMLSSL")"
643 LIB_CRYPTOKIT_DIR="$(dirname "$CONFIG_LIB_CRYPTOKIT")"
644 LIB_CAMLZIP_NAME="$(basename "$CONFIG_LIB_CAMLZIP")"
645 LIB_CAMLZIP_DIR="$(dirname "$CONFIG_LIB_CAMLZIP")"
646 LIB_OCAMLGRAPH_DIR="$(dirname "$CONFIG_LIB_OCAMLGRAPH")"
647 LIB_ULEX_DIR="$(dirname "$CONFIG_LIB_ULEX")"
648
649 EXT_LIB="$EXT_LIB"
650 EXT_OBJ="$EXT_OBJ"
651 EXT_SHARED="$EXT_SHARED"
652 EOF
653
654 sed 's/=["(]\(.*\)[)"]$/ := \1/' config.sh > config.make
655 if [ -n "${IS_MAC:-}" ]; then
656 echo "INSTALL := gcp -u -L"
657 fi >>config.make
658
659 {
660 echo
661 echo "Congrats, you're all set. Installation will be done in:"
662 echo " $PREFIX"
663 echo
664 } >&2
Something went wrong with that request. Please try again.