3
# $Id: configure 1149 2007-11-01 22:09:25Z gerd $
5
#######################################################################
8
# Split $PATH into words:
11
spacepath=`echo $PATH`
16
# Does $1 exist in $PATH?
17
for d in $spacepath; do
18
if test -x "$d/$1"; then
27
for d in $spacepath; do
28
if test -x "$d/$1"; then
35
#######################################################################
52
bindir=`dirname $ocamlc`
61
ocamlc=`get_path ocamlc`
67
#######################################################################
70
ehelp_gtk="Enable/disable parts that depend on lablgtk"
71
ehelp_gtk2="Enable/disable parts that depend on lablgtk2"
72
ehelp_tcl="Enable/disable parts that depend on tcl/tk"
73
ehelp_ssl="Enable/disable parts that depend on SSL"
74
ehelp_apache="Enable/disable Apache mod connector (EXPERIMENTAL)"
75
whelp_nethttpd="Enable/disable nethttpd web server component (GPL!)"
76
whelp_rpc_auth_dh="Enable/disable support for SecureRPC (Diffie-Hellman auth)"
78
# Which options exist? eoptions for enable/disable, woptions for with/without:
79
eoptions="gtk gtk2 tcl ssl apache"
80
woptions="nethttpd rpc_auth_dh"
82
# Packages to include anyway:
85
# Directory where to install data files:
86
net_db_dir="<library directory>"
90
# $1: the name of the library (findlib)
91
# # $2: a typical file in $incdirs
92
# if [ "$enable_findlib" -gt 0 ]; then
93
ocamlfind query "$1" >/dev/null 2>/dev/null
96
# stdlib=`ocamlc -where`
97
# for dir in $incdirs; do
100
# dir=`echo "$dir" | sed -e "s|^\+|$stdlib/|"` ;;
102
# if [ -f "$dir/$2" ]; then
112
for opt in $eoptions; do
115
uopt=`echo $opt | sed -e 's/_/-/g'`
116
if [ $o -gt 0 ]; then
117
echo " -enable-$uopt"
119
echo " -disable-$uopt"
122
for opt in $woptions; do
125
uopt=`echo $opt | sed -e 's/_/-/g'`
126
if [ $o -gt 0 ]; then
129
echo " -without-$uopt"
132
echo " -bindir $bindir"
133
echo " -datadir $net_db_dir"
134
if [ $enable_tcl -gt 0 ]; then
135
echo " -equeue-tcl-defs \"$tcl_defs\""
136
echo " -equeue-tcl-libs \"$tcl_libs\""
138
if [ $with_rpc_auth_dh -gt 0 ]; then
139
if [ -n "$adh_style" ]; then
140
echo " -auth-dh-style $adh_style"
143
if [ -n "$apxs" ]; then
146
if [ -n "$apache" ]; then
147
echo " -apache $apache"
149
if [ $prefer_netcgi2 -gt 0 ]; then
150
echo " -prefer-netcgi2"
158
usage: ./configure [ options ]
161
for opt in $eoptions; do
162
e="help=\$ehelp_$opt"
164
uopt=`echo $opt | sed -e 's/_/-/g'`
165
echo "-enable-$uopt:" >&2
166
echo "-disable-$uopt:" >&2
169
for opt in $woptions; do
170
e="help=\$whelp_$opt"
172
uopt=`echo $opt | sed -e 's/_/-/g'`
173
echo "-with-$uopt:" >&2
174
echo "-without-$uopt:" >&2
179
Install binaries into this directory
182
Install the run-time data file into this directory
184
-equeue-tcl-defs <opts>
185
Set C compiler options to find tcl.h (for -enable-tcl)
187
-equeue-tcl-libs <opts>
188
Set C compiler options to link against libtcl (for -enable-tcl)
190
-auth-dh-style (keyenvoy|unixdomain|tirpc)
191
Set style of keyserv connector (see README.authdh)
194
Set which apxs to use for -enable-apache
196
-apache /path/to/apache
197
Set which apache executable to use for -enable-apache
200
Use netcgi2 as default CGI implementation instead of netcgi1.
201
This affects nethttpd.
212
for x in $eoptions; do
213
if [ "$x" = "$1" ]; then
217
echo "Unknown option: $1" >&2
223
for x in $woptions; do
224
if [ "$x" = "$1" ]; then
228
echo "Unknown option: $1" >&2
233
echo "Welcome to Ocamlnet version $version" >&2
235
while [ "$#" -gt 0 ]; do
238
opt=`echo "$1" | sed -e 's/-enable-//' -e 's/-/_/g'`
244
# Intentionally undocumented.
249
opt=`echo "$1" | sed -e 's/-disable-//' -e 's/-/_/g'`
251
eval "enable_$opt=-1"
255
opt=`echo "$1" | sed -e 's/-with-//' -e 's/-/_/g'`
261
opt=`echo "$1" | sed -e 's/-without-//' -e 's/-/_/g'`
277
tcl_defs="$tcl_defs $2"
282
tcl_libs="$tcl_libs $2"
313
######################################################################
316
printf "%s" "Checking for findlib... "
317
if ocamlfind query stdlib >/dev/null 2>/dev/null; then
319
if [ "$net_db_dir_set" -eq 0 ]; then
320
net_db_dir=`ocamlfind printconf destdir`/netstring
325
echo "Make sure that ocamlfind is in your PATH, or download findlib"
326
echo "from www.ocaml-programming.de"
330
if [ "$net_db_dir_set" -eq 0 ]; then
336
######################################################################
337
# Does ocamlopt support multi-threading?
339
printf "%s" "Checking multi-threading support... "
341
mt_switch="-vmthread"
342
mt_comment="(unsupported)"
344
cat <<_EOF_ >tmp/t.ml
345
let _ = Mutex.create();;
347
if ocamlopt -thread -o tmp/t threads.cmxa tmp/t.ml 2>/dev/null; then
348
if tmp/t 2>/dev/null; then
354
echo "$mt_type $mt_comment"
356
######################################################################
357
# Check that pcre is available:
359
printf "%s" "Checking for PCRE... "
360
if check_library pcre pcre.cmi; then
364
echo "Sorry, installation is not possible without PCRE."
365
echo "Get the PCRE-OCaml library from:"
366
echo "http://www.ocaml.info/home/ocaml_sources.html"
370
######################################################################
373
with_rpc_auth_local=0
376
printf "%s" "Checking operating system... "
381
exec_suffix=".exe" ;;
384
with_rpc_auth_local=1
385
[ -n "$adh_style" ] || adh_style=unixdomain
389
[ -n "$adh_style" ] || adh_style=unixdomain
393
[ -n "$adh_style" ] || adh_style=unixdomain
402
[ -n "$adh_style" ] || adh_style=tirpc
409
if [ $with_rpc_auth_local -gt 0 ]; then
410
echo " This OS supports passing credentials over Unix domain sockets"
411
echo " Building rpc-auth-local"
414
if [ $with_rpc_xti -gt 0 ]; then
415
echo " This OS supports XTI networking"
416
echo " Building rpc-xti"
419
######################################################################
422
( cd src/netsys; ./configure )
424
######################################################################
429
if [ $enable_tcl -gt 0 ]; then
430
printf "%s" "Checking switches for tcl.h... "
433
for d in $tcl_defs; do
434
tcl_defs_1="$tcl_defs_1 -ccopt '$d'"
447
if ( cd tmp; ocamlc $tcl_defs_1 -c t.c >/dev/null 2>/dev/null ) then
452
echo "Please check -equeue-tcl-defs!"
456
printf "%s" "Checking switches to link libtcl... "
475
ocamlc $tcl_defs_1 -c t.c >/dev/null 2>/dev/null &&
476
ocamlc -c t.ml >/dev/null 2>/dev/null &&
477
ocamlc -o t -custom t.o t.cmo -cclib "$tcl_libs"
483
echo "not ok (check ldd output of tmp/t)"
485
echo "Please check -equeue-tcl-libs!"
491
echo "Please check -equeue-tcl-libs!"
498
######################################################################
503
if [ $enable_gtk -gt 0 ]; then
504
printf "%s" "Checking for lablgtk... "
505
if ocamlfind query lablgtk >/dev/null 2>/dev/null; then
510
echo "Required library lablgtk not found!"
515
######################################################################
519
gtk2_io_add_watch_supports_lists=""
521
if [ $enable_gtk2 -gt 0 ]; then
522
printf "%s" "Checking for lablgtk2... "
523
if ocamlfind query lablgtk2 >/dev/null 2>/dev/null; then
527
echo "Required library lablgtk2 not found!"
531
printf "%s" "Checking whether lablgtk2 has GMain.Io.remove... "
533
cat <<EOF >tmp/gtk.ml
534
let _ = GMain.Io.remove;;
537
if ocamlfind ocamlc -package lablgtk2 -c tmp/gtk.ml >/dev/null 2>/dev/null;
542
echo "Your version of lablgtk2 is too old!"
546
printf "%s" "Checking whether lablgtk2 has GMain.Io.add_watch with list support... "
548
cat <<'EOF' >tmp/gtk.ml
550
let _ = (add_watch : cond:condition list -> callback:(condition list -> bool) -> ?prio:int -> channel -> id);;
553
# Note: this newer API is never broken in the sense checked below, i.e.
554
# such lablgtk2 versions do not exist.
555
if ocamlfind ocamlc -package unix,lablgtk2 -linkpkg -o tmp/gtk tmp/gtk.ml >/dev/null 2>/dev/null && tmp/gtk; then
557
gtk2_io_add_watch_supports_lists="-ppopt -DGTK2_IO_ADD_WATCH_SUPPORTS_LISTS"
560
printf "%s" "Checking whether lablgtk2's GMain.Io.add_watch is broken... "
562
cat <<'EOF' >tmp/gtk.ml
564
let ch = GMain.Io.channel_of_descr (Unix.stdout) in
565
let w = GMain.Io.add_watch
566
~cond:`OUT ~callback:(fun () -> true) ch in
567
(* add_watch is broken when it just returns Val_unit, and ok when it
568
* returns a positive int
570
if (Obj.magic w : int) > 0 then
575
if ocamlfind ocamlc -package unix,lablgtk2 -linkpkg -o tmp/gtk tmp/gtk.ml >/dev/null 2>/dev/null && tmp/gtk; then
579
echo "You should apply the patch-ab-ml_glib.c to lablgtk2 to fix this!"
584
for f in Makefile uq_gtk.ml uq_gtk.mli; do
585
rm -f src/equeue-gtk2/$f
586
ln -s ../equeue-gtk1/$f src/equeue-gtk2
592
######################################################################
598
if [ $enable_ssl -gt 0 ]; then
599
printf "%s" "Checking for ssl... "
600
if ocamlfind query ssl >/dev/null 2>/dev/null; then
606
echo "Required library ssl not found!"
611
######################################################################
616
if [ $with_rpc_auth_dh -gt 0 ]; then
617
echo "Checking SecureRPC"
618
printf " %s" "Checking for cryptgps... "
619
if ocamlfind query cryptgps >/dev/null 2>/dev/null; then
623
echo "Required library cryptgps not found!"
627
if [ -z "$adh_style" ]; then
628
echo " No -auth-dh-style passed and no OS default known. Falling back to keyenvoy"
632
if [ "$adh_style" = "tirpc" ]; then
633
if [ $with_rpc_xti -eq 0 ]; then
634
echo "-auth-dh-style tirpc needs rpc-xti which is missing"
640
echo " SecureRPC is supported"
643
######################################################################
646
if [ $enable_apache -gt 0 ]; then
647
printf "Apache mod connector... "
649
# echo "CURRENTLY BROKEN - disabling for now"
652
if [ -z "$apxs" ]; then
656
if [ -z "$apache" ]; then
658
apache=`get_path apache`
661
if [ -x "$apxs" ] ; then
663
apache_libdir="`$apxs -q LIBEXECDIR`"
664
apache_incdir="`$apxs -q INCLUDEDIR`"
665
apache_confdir="`$apxs -q SYSCONFDIR`"
666
apache_ldflags_shlib="`$apxs -q LDFLAGS_SHLIB`"
667
apache_cc="`$apxs -q CC`"
668
apache_cflags="-I \$(APACHE_INCDIR) \
669
`$apxs -q CFLAGS` `$apxs -q CFLAGS_SHLIB`"
670
# This is to allow modules residing in the standard ocaml library
671
# directory to be loaded with relative paths.
672
#apache_ocamllibdir=`ocamlfind printconf destdir`
673
apache_ocamllibdir=`ocamlc -where`
674
echo "enabled (Apache $apache_major)"
678
echo "apxs or apache not found"
679
echo " Maybe you need to use the -apache option?"
685
######################################################################
688
preferred_cgi_pkg=netcgi1
689
inc_netcgi1or2='$(INC_NETCGI1)'
691
if [ $prefer_netcgi2 -gt 0 ]; then
692
preferred_cgi_pkg=netcgi2
693
inc_netcgi1or2='$(INC_NETCGI2)'
696
######################################################################
700
echo "Effective options:"
704
pkglist="netsys netshm equeue shell netstring rpc-generator rpc pop smtp netclient netcgi1 netcgi2 cgi netplex netcgi2-plex"
706
if [ $enable_apache -gt 0 ]; then
707
pkglist="$pkglist netcgi2-apache"
710
full_pkglist="$pkglist rpc-auth-local rpc-xti equeue-tcl equeue-gtk1 equeue-gtk2 equeue-ssl rpc-ssl rpc-auth-dh nethttpd nethttpd-for-netcgi1 nethttpd-for-netcgi2"
712
if [ $disable_core -gt 0 ]; then
713
# Omit the core packages:
715
with_rpc_auth_local=0
719
if [ $with_nethttpd -gt 0 ]; then
720
pkglist="$pkglist nethttpd-for-netcgi1 nethttpd-for-netcgi2"
723
for opt in $woptions rpc_auth_local rpc_xti equeue_tcl equeue_gtk1 equeue_gtk2 equeue_ssl rpc_ssl; do
726
if [ $o -gt 0 ]; then
727
uopt=`echo "$opt" | sed -e 's/_/-/g'`
728
pkglist="$pkglist $uopt"
732
######################################################################
733
# Write Makefile.conf
735
echo "Writing Makefile.conf"
736
cat <<_EOF_ >Makefile.conf
737
# Makefike.conf written by configure
738
# The Ocamlnet version
741
# The packages to build in the right order:
745
FULL_PKGLIST = $full_pkglist
747
# Whether the OS needs an .exe suffix for executables:
748
EXEC_SUFFIX = $exec_suffix
750
# Required packages (findlib):
753
# Additional options only for ocamlc:
756
# Additional options only for ocamlopt:
759
# Where the ocamlnet lookup tables are to be installed (both findlib
761
NET_DB_DIR = $net_db_dir
763
# Where binaries are installed:
766
# Method of installation:
769
# Multi-threading type:
772
# Compiler switch to enable multi-threading:
776
EQUEUE_TCL_DEFS = $tcl_defs_1
777
EQUEUE_TCL_LIBS = $tcl_libs
780
GTK_EXTRA_DEFINES = $gtk2_io_add_watch_supports_lists
783
RPC_AUTH_DH_CONNECTOR = $adh_style
784
AUTHDHREQS = $adh_reqs
787
APACHE_MAJOR = $apache_major
788
APACHE_LIBDIR = $apache_libdir
789
APACHE_OCAMLLIBS = -lcamlrun -ltermcap -lunix -lstr
790
APACHE_INCDIR = $apache_incdir
791
APACHE_CONFDIR = $apache_confdir
792
APACHE_LDFLAGS_SHLIB = $apache_ldflags_shlib
793
APACHE_CC = $apache_cc
794
APACHE_CFLAGS = $apache_cflags
795
APACHE_OCAMLLIBDIR = $apache_ocamllibdir
798
# Preferred CGI implementation
799
PREFERRED_CGI_PKG=$preferred_cgi_pkg
800
INC_NETCGI1OR2=$inc_netcgi1or2
804
######################################################################
808
echo "Please check Makefile.conf."
810
echo "You can now compile Ocamlnet by invoking"
812
echo "for the bytecode compiler, and optionally by invoking"
814
echo "for the native-code compiler (if supported on your architecture)."
817
echo "will install the package(s)."