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