Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 655 lines (576 sloc) 18.282 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 _ =
212 if Sys.word_size <> 64 then exit 1
213 else exit 0
214 EOF
215
216 echo "# $OCAMLBUILD$OCAMLBUILD_FLAGS -tag use_unix test.native" >> $CONFIG_LOG
217 R=0; $OCAMLBUILD$OCAMLBUILD_FLAGS -tag use_unix test.native >test.log 2>&1 || R=$?
218
219 cat test.log >> $CONFIG_LOG
220
221 if [ $R -ne 0 ]; then
222 echo-err "could not compile"
223 echo "----------"
224 tail -n 5 test.log | sed 's/^/ /'
225 echo "----------"
226 echo "Your ocaml installation seems broken, please fix it"
227 false
228 fi >&2
229 if RET=$(_build/test.native); then
230 echo-ok $RET
231 else
232 R=$?
233 echo-err $RET
234 echo "Your ocaml seems to be a 32bit version. Please install a native 64 bit package."
235 false
236 fi >&2
237 rm -rf /tmp/${DIR#/tmp/}
238 trap - EXIT
239 cd "$OPA_SOURCE_DIR"
240 }
241 check-ocaml
242
243 echo-check for camlp4
244 : ${CAMLP4O:=$(dirname $OCAMLOPT)/camlp4o}
245 : ${CAMLP4ORF:=$(dirname $OCAMLOPT)/camlp4orf}
246 if [ -x "$CAMLP4O" ] && [ -x "$CAMLP4ORF" ]
247 then echo-ok $CAMLP4O
248 else
249 echo-err Not found
250 echo "You need camlp4 to build this package. It is usually found in packages camlp4, camlp4-extra"
251 false
252 fi
253
254 # check tools:
255 # (*) stuff marked with * could maybe be optional and restrict the build correspondingly
256
257 # - checking for perl
258 echo-check for perl 5
259 if perl -v 2>/dev/null | grep -q 'v5\.'; then
260 echo-ok found
261 else
262 echo-err Not found
263 echo "You need Perl v5 to build this package ; it's usually found in package perl-base"
264 exit 1
265 fi >&2
266
267 # - checking camlidl *
268 echo-check for camlidl
269 if [ -n "${NO_CAMLIDL:-}" ]; then
270 HAS_CAMLIDL=
271 CAMLIDL=
272 echo-ok Disabled
273 elif
274 [ -e $OCAMLLIB/libcamlidl.a ] &&
275 CAMLIDL=${CAMLIDL:-$(dirname "$OCAMLOPT")/camlidl} && [ -x "$CAMLIDL" ] ||
276 CAMLIDL=$(which camlidl)
277 then
278 HAS_CAMLIDL=1
279 echo-ok $CAMLIDL
280 else
281 HAS_CAMLIDL=
282 echo-err Not found
283 fi
284
285
286 # check C libs:
287 # we depend on libssl, libzip and others, but through
288 # ocaml libs, so no need to check them directly
289 check-c-lib () (
290 local LIB=$1; shift
291 [ $# -gt 0 ]
292 local INCLUDES=("$@")
293
294 local LIBNAME=$(basename "$LIB")
295 local LIBDIR=$(dirname "$LIB")
296 local INCLUDE_DIR
297 for d in {"$OCAMLLIB/..","$OCAMLLIB",/usr/lib,/usr/local/lib}{/$LIBDIR,}; do
298 if [ -e $d/lib$LIBNAME.a ]; then
299 LD_DIR=$(readlink -f $d)
300 INCLUDE_DIR=$LD_DIR/
301 INCLUDE_DIR=${INCLUDE_DIR%/lib/*}/include
302 break
303 fi
304 done
305 if [ -z "${LD_DIR:-}" ]; then
306 echo "could not find lib$LIBNAME.a" >>$CONFIG_LOG
307 echo-err Not found
308 return 1
309 fi >&2
310
311 echo-ok -n "$LD_DIR/lib$LIBNAME.a, "
312
313 # Now checking compile, link & run
314 local DIR=$(mktemp -d /tmp/opa-configure.XXXXX)
315 trap "rm -rf /tmp/${DIR#/tmp/}" EXIT
316 cd $DIR
317
318 {
319 for i in "${INCLUDES[@]}"; do echo '#include <'$i'>'; done
320 echo 'int main () { return 0; }'
321 } >test_$LIBNAME.c
322
323 echo "# gcc -L$LD_DIR -I$INCLUDE_DIR -l$LIBNAME test_$LIBNAME.c -o test_$LIBNAME" >> $CONFIG_LOG
324 R=0; gcc -L$LD_DIR -I$INCLUDE_DIR -l$LIBNAME test_$LIBNAME.c -o test_$LIBNAME >check_$LIBNAME.log 2>&1 || R=$?
325
326 cat check_$LIBNAME.log >> $CONFIG_LOG
327
328 if [ $R -ne 0 ]; then
329 echo-err "could not compile"
330 echo "----------"
331 tail -n 5 check_${LIBNAME}.log | sed 's/^/ /'
332 echo "----------"
333 return 1
334 fi >&2
335 if ! ./test_$LIBNAME >> $CONFIG_LOG 2>&1; then
336 echo-err "compiled program doesn't work"
337 return 1
338 fi
339
340 echo-ok-tag
341 echo "$LIBNAME $LD_DIR $INCLUDE_DIR"
342 )
343
344 HAS_LIBNATPMP=
6bb0418 [fix] configure: handling the absence of camlidl correctly
Louis Gesbert authored
345 LIBNATPMP=("")
fccc685 Initial open-source release
MLstate authored
346 HAS_MINIUPNPC=
6bb0418 [fix] configure: handling the absence of camlidl correctly
Louis Gesbert authored
347 MINIUPNPC=("")
fccc685 Initial open-source release
MLstate authored
348 if [ -n "$HAS_CAMLIDL" ]; then
349 # - checking libnatpmp *
350 echo-check libnatpmp
351 if LIBNATPMP=($(check-c-lib libnatpmp/natpmp netinet/in.h arpa/inet.h libnatpmp/getgateway.h libnatpmp/natpmp.h)); then
352 HAS_LIBNATPMP=1
17a5e59 [fix] configure: fix for the 'XXX[@] : undefined variable' under some…
Louis Gesbert authored
353 else
354 LIBNATPMP=("")
fccc685 Initial open-source release
MLstate authored
355 fi
356
357 # - checking miniupnpc *
358 echo-check miniupnpc
359 if MINIUPNPC=($(check-c-lib miniupnpc/miniupnpc miniupnpc/miniwget.h miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h)); then
360 HAS_MINIUPNPC=1
17a5e59 [fix] configure: fix for the 'XXX[@] : undefined variable' under some…
Louis Gesbert authored
361 else
362 MINIUPNPC=("")
fccc685 Initial open-source release
MLstate authored
363 fi
364 fi
365
366 # check ocaml libs:
367 # probably, first try with ocamlfind then fallback to
368 # custom check ; ensure consistency with function
369 # "get_ocamlfind_directory" in build/myocamlbuild_prefix.ml
370 echo-check for ocamlfind
371 if [ -n "${NO_OCAMLFIND:-}" ]; then
372 OCAMLFIND=
373 echo-ok Disabled
374 elif [ -z "${OCAMLFIND:-}" ]; then
375 OCAMLFIND=$(dirname $OCAMLOPT)/ocamlfind
376 if [ ! -x "$OCAMLFIND" ]; then
377 OCAMLFIND=$OCAMLLIB/../../bin/ocamlfind
378 fi
379 if [ ! -x "$OCAMLFIND" ]; then
380 echo-ok "Not found"
381 OCAMLFIND=
382 else
383 echo-ok $OCAMLFIND
384 fi
385 elif [ -x "$OCAMLFIND" ]; then
386 echo-ok $OCAMLFIND
387 else
388 echo-err "Not found"
389 echo "You specified $OCAMLFIND on the command-line, but it doesn't exist or isn't executable" >&2
390 OCAMLFIND=
391 fi
392
393 EXTRA_TAGS="-tag use_unix"
394 check-ocaml-lib () {
395 local MODULE=$1; shift
396 local LIB=$1; shift
397 local LIBDIR=$1; shift
398 [ $# -eq 0 ]
399
400 local DIR=$(mktemp -d /tmp/opa-configure.XXXXX)
401 trap "rm -rf /tmp/${DIR#/tmp/}" EXIT
402 cd $DIR
403
404 echo "module M = $MODULE" >check_${LIB}.ml
405
406 local libdir_ins=""
407 if [ "$LIBDIR" != "$OCAMLLIB" ]; then libdir_ins=' ~dir:"'$LIBDIR'"'; fi
408 cat >myocamlbuild.ml <<EOF
409 let _ = Ocamlbuild_plugin.dispatch (function
410 | Ocamlbuild_plugin.After_rules ->
411 Ocamlbuild_plugin.ocaml_lib ~extern:true$libdir_ins ~tag_name:"use_my_lib" "$LIB"
412 | _ -> ()
413 )
414 EOF
415
416 echo "# $OCAMLBUILD$OCAMLBUILD_FLAGS $EXTRA_TAGS -tag use_my_lib check_${LIB}.native" >> $CONFIG_LOG
417
418 R=0; $OCAMLBUILD$OCAMLBUILD_FLAGS $EXTRA_TAGS -tag use_my_lib check_${LIB}.native >check_${LIB}.log 2>&1 || R=$?
419 cat check_${LIB}.log >> $CONFIG_LOG
420
421 if [ $R -ne 0 ]; then
422 echo-err "could not compile"
423 echo "----------"
424 tail -n 5 check_${LIB}.log | sed 's/^/ /'
425 echo "----------"
426 echo "The installation of $LIB seems broken, please fix it (did it come with a different ocaml compiler ?)"
427 return 1
428 else
429 echo-ok-tag
430 fi >&2
431 rm -rf /tmp/${DIR#/tmp/}
432 trap - EXIT
433 cd "$OPA_SOURCE_DIR"
434 }
435
436 check-cmxa () {
437 local DIR=$1; shift
438 [ $# -gt 0 ]
439 local canonical_name=$1
440 while [ $# -gt 0 ] && [ ! -e "$DIR/$(basename $1).cmxa" ]; do shift; done
441 if [ $# -eq 0 ]; then
442 echo-err "Not found"
443 echo "Please fix your installation of $canonical_name in $LIBDIR: no proper cmxa file was found there." >&2
444 return 1
445 fi
446 echo $1
447 }
448
449 locate-ocaml-lib () {
450 local MODULE=$1; shift # one module that the lib contains, to check
451 [ $# -gt 0 ] # remaining args: possible lib names (may be usual_dir/libname)
452
453 echo-check for $(basename $1)
454
455 local LIBDIR=""
456 local LIB
457 local LIB_NAMES=("$@")
458 while [ $# -gt 0 ] && [ -z "$LIBDIR" ]; do
459 LIB=$(basename $1)
460 USUAL_DIR=$(dirname $1)
461 [ "$USUAL_DIR" = "." ] && USUAL_DIR=$LIB
462 if [ -n "$OCAMLFIND" ] &&
463 LIBDIR=$("$OCAMLFIND" query "$LIB" 2>/dev/null)
464 then
465 LIB=$(check-cmxa $LIBDIR $LIB "${LIB_NAMES[@]}") || return 1
466 echo-ok -n "ocamlfind:$LIBDIR, "
467 elif [ -d "$OCAMLLIB"/"$USUAL_DIR" ]
468 then
469 LIB=$(check-cmxa "$OCAMLLIB"/"$USUAL_DIR" $LIB "${LIB_NAMES[@]}") \
470 || return 1
471 echo-ok -n "+$USUAL_DIR, "
472 LIBDIR=+"$USUAL_DIR"
473 elif [ -e "$OCAMLLIB"/"$LIB".cmxa ]
474 then
475 echo-ok -n "$LIB.cmxa, "
476 LIBDIR="$OCAMLLIB"
477 fi
478 shift
479 done
480 if [ -z "$LIBDIR" ]; then
481 echo-err "Not found"
482 return 1
483 fi
484
485 check-ocaml-lib "$MODULE" "$LIB" "$LIBDIR" || return 1
486 echo "$LIBDIR/$LIB"
487 }
488 # for libs which are needed (fatal warning)
489 LIBS_NOT_FOUND=()
490 lib-not-found () {
491 local lib=$1; shift
492 local package=$1; shift
493 LIBS_NOT_FOUND[${#LIBS_NOT_FOUND[@]}]="$lib (might be found in package $package)"
494 }
495
496 # - checking ocaml-ssl
497 if ! CONFIG_LIB_OCAMLSSL=$(locate-ocaml-lib "Ssl" "ssl")
498 then lib-not-found "ocaml_ssl" "libssl-ocaml-dev"
499 fi
500
501 # - checking cryptokit
502 if ! CONFIG_LIB_CRYPTOKIT=$(EXTRA_TAGS="$EXTRA_TAGS -tag use_nums" locate-ocaml-lib "Cryptokit" "cryptokit")
503 then lib-not-found "cryptokit" "libcryptokit-ocaml-dev"
504 fi
505
506 # - checking camlzip
507 if ! CONFIG_LIB_CAMLZIP=$(locate-ocaml-lib "Zip" "camlzip" "zip")
508 then lib-not-found "camlzip" "libzip-ocaml-dev"
509 fi
510
511 # - checking ocamlgraph
512 if ! CONFIG_LIB_OCAMLGRAPH=$(locate-ocaml-lib "Graph" "ocamlgraph/graph")
513 then lib-not-found "ocamlgraph" "libocamlgraph-ocaml-dev"
514 fi
515
516 # - checking ulex
517 if ! CONFIG_LIB_ULEX=$(locate-ocaml-lib "Ulexing" "ulex" "ulexing")
518 then lib-not-found "ulex" "ocaml-ulex"
519 fi
520
521 # # - checking camlimages *
522 # CONFIG_LIB_CAMLIMAGES=$(EXTRA_TAGS="$EXTRA_TAGS -tag use_graphics" locate-ocaml-lib "Jpeg" "camlimages") || true
523
524 if [ ${#LIBS_NOT_FOUND[@]} -ne 0 ]; then
525 echo
526 echo "Not configured. You need the following libraries installed:" >&2
527 for lib in "${LIBS_NOT_FOUND[@]}"; do
528 echo " - $lib" >&2
529 done
530 false
531 fi
532
533 # Output the configuration
534
535 dir_opt() {
536 local DIR=$(dirname "$1"); shift; [ $# -eq 0 ]
537 if [ "$DIR" = "$OCAMLLIB" ]; then echo 'None'
538 else echo 'Some "'$DIR'"'
539 fi
540 }
541
542 camlbool() { [ $# -eq 1 ]; if [ -n "$1" ]; then echo true; else echo false; fi; }
543
544 camlstrtuple() {
545 echo -n '"'$1'"'; shift
546 while [ $# -gt 0 ]; do
547 echo -n ', "'$1'"'; shift
548 done
549 }
550
551 camlopt() {
552 local cond=$1; shift
553 local val=$1; shift
554 [ $# -eq 0 ]
555 if [ -n "$cond" ]; then echo 'Some ('$val')'
556 else echo 'None'
557 fi
558 }
559
fdba049 [fix] configure: fixed for old bash versions, now providing a list of…
Louis Gesbert authored
560 ALL_TAGS_LIST="camlidl libnatpmp miniupnpc"
7b118ed [feature] configure: generating a list of available optional tags, fo…
Louis Gesbert authored
561 TAGS_LIST=""
fdba049 [fix] configure: fixed for old bash versions, now providing a list of…
Louis Gesbert authored
562 for tag in $ALL_TAGS_LIST; do
563 hasvar=HAS_$(tr '[:lower:]' '[:upper:]' <<<"$tag")
7b118ed [feature] configure: generating a list of available optional tags, fo…
Louis Gesbert authored
564 if [ -n "${!hasvar}" ]; then TAGS_LIST="$TAGS_LIST\"$tag\"; "; fi
565 done
566
fccc685 Initial open-source release
MLstate authored
567 # See config.mli for the documentation and spec of these variables
568 cat >config.ml <<EOF
569 let prefix = "$PREFIX"
570 let ocamllib = "$OCAMLLIB"
571 let ocamlopt = "$OCAMLOPT"
572 let ocamlbuild = "$OCAMLBUILD"
573 let ocamlbuild_flags = "$OCAMLBUILD_FLAGS"
574 let camlp4o = "$CAMLP4O"
575 let camlp4orf = "$CAMLP4ORF"
576
577 let camlidl = $(camlopt "$HAS_CAMLIDL" '"'"$CAMLIDL"'"')
578 let libnatpmp = $(camlopt "$HAS_LIBNATPMP" "$(camlstrtuple "${LIBNATPMP[@]}")")
579 let miniupnpc = $(camlopt "$HAS_MINIUPNPC" "$(camlstrtuple "${MINIUPNPC[@]}")")
580
7b118ed [feature] configure: generating a list of available optional tags, fo…
Louis Gesbert authored
581 let available = [ $TAGS_LIST]
fdba049 [fix] configure: fixed for old bash versions, now providing a list of…
Louis Gesbert authored
582 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
583
fccc685 Initial open-source release
MLstate authored
584 let is_release = $(camlbool "$IS_RELEASE")
585 type os = Linux | Mac | Win32 | Cygwin
586 let os =
587 $(if [ -n "${IS_LINUX:-}" ]; then echo Linux
588 elif [ -n "${IS_MAC:-}" ]; then echo Mac
589 else echo 'match Sys.os_type with "Win32" -> Win32 | "Cygwin" -> Cygwin | _ -> assert false'
590 fi)
591
592 module Libdir = struct
593 let ssl = $(dir_opt "$CONFIG_LIB_OCAMLSSL")
594 let cryptokit = $(dir_opt "$CONFIG_LIB_CRYPTOKIT")
595 let camlzip_name = "$(basename "$CONFIG_LIB_CAMLZIP")"
596 let camlzip = $(dir_opt "$CONFIG_LIB_CAMLZIP")
597 let graph = $(dir_opt "$CONFIG_LIB_OCAMLGRAPH")
598 let ulex = $(dir_opt "$CONFIG_LIB_ULEX")
599 end
600
601 let ext_lib = "$EXT_LIB"
602 let ext_obj = "$EXT_OBJ"
603 let ext_shared = "$EXT_SHARED"
604
605 EOF
606
607 cat >config.sh <<EOF
608 PREFIX="$PREFIX"
609 OCAMLLIB="$OCAMLLIB"
610 OCAMLOPT="$OCAMLOPT"
611 OCAMLBUILD="$OCAMLBUILD"
612 OCAMLBUILD_FLAGS="$OCAMLBUILD_FLAGS"
613 CAMLP4O="$CAMLP4O"
614 CAMLP4ORF="$CAMLP4ORF"
615
616 HAS_CAMLIDL="$HAS_CAMLIDL"
617 CAMLIDL="$CAMLIDL"
618 HAS_LIBNATPMP="$HAS_LIBNATPMP"
619 LIBNATPMP=(${LIBNATPMP[@]})
620 HAS_MINIUPNPC="$HAS_MINIUPNPC"
621 MINIUPNPC=(${MINIUPNPC[@]})
622 IS_RELEASE="$IS_RELEASE"
623 IS_LINUX="${IS_LINUX:-}"
624 IS_WINDOWS="${IS_WINDOWS:-}"
625 IS_MAC="${IS_MAC:-}"
626 OS=$(if [ -n "${IS_LINUX:-}" ]; then echo '"Linux"'
627 elif [ -n "${IS_MAC:-}" ]; then echo '"Mac"'
628 elif [ -n "${IS_WINDOWS:-}" ]; then echo '"Win32"'
629 else echo "Error: OS inconsistency" >&2; exit 2
630 fi)
631
632 LIB_OCAMLSSL_DIR="$(dirname "$CONFIG_LIB_OCAMLSSL")"
633 LIB_CRYPTOKIT_DIR="$(dirname "$CONFIG_LIB_CRYPTOKIT")"
634 LIB_CAMLZIP_NAME="$(basename "$CONFIG_LIB_CAMLZIP")"
635 LIB_CAMLZIP_DIR="$(dirname "$CONFIG_LIB_CAMLZIP")"
636 LIB_OCAMLGRAPH_DIR="$(dirname "$CONFIG_LIB_OCAMLGRAPH")"
637 LIB_ULEX_DIR="$(dirname "$CONFIG_LIB_ULEX")"
638
639 EXT_LIB="$EXT_LIB"
640 EXT_OBJ="$EXT_OBJ"
641 EXT_SHARED="$EXT_SHARED"
642 EOF
643
644 sed 's/=["(]\(.*\)[)"]$/ := \1/' config.sh > config.make
645 if [ -n "${IS_MAC:-}" ]; then
646 echo "INSTALL := gcp -u -L"
647 fi >>config.make
648
649 {
650 echo
651 echo "Congrats, you're all set. Installation will be done in:"
652 echo " $PREFIX"
653 echo
654 } >&2
Something went wrong with that request. Please try again.