~ubuntu-branches/ubuntu/trusty/ocamlnet/trusty

« back to all changes in this revision

Viewing changes to .pc/0012-Use-OCaml-version-to-guess-str-stubs-link-options.patch/configure

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-09-02 14:12:33 UTC
  • mfrom: (18.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110902141233-zbj0ygxb92u6gy4z
Tags: 3.4-1
* New upstream release
  - add a new NetcgiRequire directive to ease dependency management
    (Closes: #637147)
  - remove patches that were applied upstream:
    + Added-missing-shebang-lines-in-example-shell-scripts
    + Try-also-ocamlc-for-POSIX-threads

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
 
3
 
# $Id: configure 1149 2007-11-01 22:09:25Z gerd $
4
 
 
5
 
#######################################################################
6
 
# Helpers:
7
 
 
8
 
# Split $PATH into words:
9
 
oldifs="$IFS"
10
 
IFS="   :"
11
 
spacepath=`echo $PATH`
12
 
IFS="$oldifs"
13
 
 
14
 
 
15
 
in_path () {
16
 
    # Does $1 exist in $PATH?
17
 
    for d in $spacepath; do
18
 
        if test -x "$d/$1"; then
19
 
            return 0
20
 
        fi
21
 
    done
22
 
    return 1
23
 
}
24
 
 
25
 
 
26
 
get_path () {
27
 
    for d in $spacepath; do
28
 
        if test -x "$d/$1"; then
29
 
            echo "$d/$1"
30
 
            return
31
 
        fi
32
 
    done
33
 
}
34
 
 
35
 
#######################################################################
36
 
# Defaults
37
 
 
38
 
#--- Options ---
39
 
# value 0: off
40
 
# value 1: on
41
 
# defaults:
42
 
 
43
 
set_defaults () {
44
 
    enable_gtk=0
45
 
    enable_gtk2=0
46
 
    enable_tcl=0
47
 
    enable_ssl=0
48
 
    enable_apache=0
49
 
    with_nethttpd=0
50
 
    with_rpc_auth_dh=0
51
 
    prefer_netcgi2=0
52
 
    bindir=`dirname $ocamlc`
53
 
    tcl_defs=""
54
 
    tcl_libs=""
55
 
    adh_style=""
56
 
    disable_core=0
57
 
    apxs=""
58
 
    apache=""
59
 
}
60
 
 
61
 
ocamlc=`get_path ocamlc`
62
 
set_defaults
63
 
 
64
 
version="2.2.9"
65
 
exec_suffix=""
66
 
 
67
 
#######################################################################
68
 
# Option parsing
69
 
 
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)"
77
 
 
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"
81
 
 
82
 
# Packages to include anyway:
83
 
requires="unix pcre"
84
 
 
85
 
# Directory where to install data files:
86
 
net_db_dir="<library directory>"
87
 
net_db_dir_set=0
88
 
 
89
 
check_library () {
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
94
 
        return
95
 
#    else
96
 
#       stdlib=`ocamlc -where`
97
 
#       for dir in $incdirs; do
98
 
#           case "$dir" in
99
 
#               +*)
100
 
#                   dir=`echo "$dir" | sed -e "s|^\+|$stdlib/|"` ;;
101
 
#           esac
102
 
#           if [ -f "$dir/$2" ]; then
103
 
#               return 0
104
 
#           fi 
105
 
#       done
106
 
        return 1   # not found
107
 
#    fi
108
 
}
109
 
 
110
 
 
111
 
print_options () {
112
 
        for opt in $eoptions; do
113
 
                e="o=\$enable_$opt"
114
 
                eval "$e"
115
 
                uopt=`echo $opt | sed -e 's/_/-/g'`
116
 
                if [ $o -gt 0 ]; then
117
 
                        echo "    -enable-$uopt"
118
 
                else
119
 
                        echo "    -disable-$uopt"
120
 
                fi
121
 
        done
122
 
        for opt in $woptions; do
123
 
                e="o=\$with_$opt"
124
 
                eval "$e"
125
 
                uopt=`echo $opt | sed -e 's/_/-/g'`
126
 
                if [ $o -gt 0 ]; then
127
 
                        echo "    -with-$uopt"
128
 
                else
129
 
                        echo "    -without-$uopt"
130
 
                fi
131
 
        done
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\""
137
 
        fi
138
 
        if [ $with_rpc_auth_dh -gt 0 ]; then
139
 
            if [ -n "$adh_style" ]; then
140
 
                echo "    -auth-dh-style $adh_style"
141
 
            fi
142
 
        fi
143
 
        if [ -n "$apxs" ]; then
144
 
            echo "    -apxs $apxs"
145
 
        fi
146
 
        if [ -n "$apache" ]; then
147
 
            echo "    -apache $apache"
148
 
        fi
149
 
        if [ $prefer_netcgi2 -gt 0 ]; then
150
 
            echo "    -prefer-netcgi2"
151
 
        fi
152
 
}
153
 
 
154
 
 
155
 
usage () {
156
 
        set_defaults
157
 
        cat <<_EOF_ >&2
158
 
usage: ./configure [ options ]
159
 
 
160
 
_EOF_
161
 
        for opt in $eoptions; do
162
 
                e="help=\$ehelp_$opt"
163
 
                eval "$e"
164
 
                uopt=`echo $opt | sed -e 's/_/-/g'`
165
 
                echo "-enable-$uopt:" >&2
166
 
                echo "-disable-$uopt:" >&2
167
 
                echo "        $help" >&2
168
 
        done
169
 
        for opt in $woptions; do
170
 
                e="help=\$whelp_$opt"
171
 
                eval "$e"
172
 
                uopt=`echo $opt | sed -e 's/_/-/g'`
173
 
                echo "-with-$uopt:" >&2
174
 
                echo "-without-$uopt:" >&2
175
 
                echo "        $help" >&2
176
 
        done
177
 
        cat <<_EOF_ >&2
178
 
-bindir dir
179
 
        Install binaries into this directory
180
 
 
181
 
-datadir dir
182
 
        Install the run-time data file into this directory
183
 
 
184
 
-equeue-tcl-defs <opts>
185
 
        Set C compiler options to find tcl.h (for -enable-tcl)
186
 
 
187
 
-equeue-tcl-libs <opts>
188
 
        Set C compiler options to link against libtcl (for -enable-tcl)
189
 
 
190
 
-auth-dh-style (keyenvoy|unixdomain|tirpc)
191
 
        Set style of keyserv connector (see README.authdh)
192
 
 
193
 
-apxs /path/to/apxs
194
 
        Set which apxs to use for -enable-apache
195
 
 
196
 
-apache /path/to/apache
197
 
        Set which apache executable to use for -enable-apache
198
 
 
199
 
-prefer-netcgi2
200
 
        Use netcgi2 as default CGI implementation instead of netcgi1.
201
 
        This affects nethttpd.
202
 
 
203
 
Defaults are:
204
 
 
205
 
_EOF_
206
 
        print_options >&2
207
 
        exit 1
208
 
}
209
 
 
210
 
 
211
 
check_eopt () {
212
 
        for x in $eoptions; do
213
 
                if [ "$x" = "$1" ]; then
214
 
                        return 0
215
 
                fi
216
 
        done
217
 
        echo "Unknown option: $1" >&2
218
 
        exit 1
219
 
}
220
 
 
221
 
 
222
 
check_wopt () {
223
 
        for x in $woptions; do
224
 
                if [ "$x" = "$1" ]; then
225
 
                        return 0
226
 
                fi
227
 
        done
228
 
        echo "Unknown option: $1" >&2
229
 
        exit 1
230
 
}
231
 
 
232
 
 
233
 
echo "Welcome to Ocamlnet version $version" >&2
234
 
 
235
 
while [ "$#" -gt 0 ]; do
236
 
        case "$1" in
237
 
                -enable-*)
238
 
                        opt=`echo "$1" | sed -e 's/-enable-//' -e 's/-/_/g'`
239
 
                        check_eopt "$opt"
240
 
                        eval "enable_$opt=2"
241
 
                        shift
242
 
                        ;;
243
 
                -disable-core)
244
 
                        # Intentionally undocumented.
245
 
                        disable_core=1
246
 
                        shift
247
 
                        ;;
248
 
                -disable-*)
249
 
                        opt=`echo "$1" | sed -e 's/-disable-//' -e 's/-/_/g'`
250
 
                        check_eopt "$opt"
251
 
                        eval "enable_$opt=-1"
252
 
                        shift
253
 
                        ;;
254
 
                -with-*)
255
 
                        opt=`echo "$1" | sed -e 's/-with-//' -e 's/-/_/g'`
256
 
                        check_wopt "$opt"
257
 
                        eval "with_$opt=2"
258
 
                        shift
259
 
                        ;;
260
 
                -without-*)
261
 
                        opt=`echo "$1" | sed -e 's/-without-//' -e 's/-/_/g'`
262
 
                        check_wopt "$opt"
263
 
                        eval "with_$opt=-1"
264
 
                        shift
265
 
                        ;;
266
 
                -bindir)
267
 
                        bindir="$2"
268
 
                        shift
269
 
                        shift
270
 
                        ;;
271
 
                -datadir)
272
 
                        net_db_dir="$2"
273
 
                        net_db_dir_set=1
274
 
                        shift; shift
275
 
                        ;;
276
 
                -equeue-tcl-defs)
277
 
                        tcl_defs="$tcl_defs $2"
278
 
                        shift
279
 
                        shift
280
 
                        ;;
281
 
                -equeue-tcl-libs)
282
 
                        tcl_libs="$tcl_libs $2"
283
 
                        shift
284
 
                        shift
285
 
                        ;;
286
 
                -auth-dh-style)
287
 
                        adh_style="$2"
288
 
                        shift
289
 
                        shift
290
 
                        ;;
291
 
                -apxs)
292
 
                        apxs="$2"
293
 
                        shift
294
 
                        shift
295
 
                        ;;
296
 
                -apache)
297
 
                        apache="$2"
298
 
                        shift
299
 
                        shift
300
 
                        ;;
301
 
                -prefer-netcgi2)
302
 
                        prefer_netcgi2=1
303
 
                        shift ;;
304
 
                -version)
305
 
                        echo "$version"
306
 
                        exit 0
307
 
                        ;;
308
 
                *)
309
 
                        usage
310
 
        esac
311
 
done
312
 
 
313
 
######################################################################
314
 
# Check ocamlfind
315
 
 
316
 
printf "%s" "Checking for findlib... "
317
 
if ocamlfind query stdlib >/dev/null 2>/dev/null; then
318
 
    echo "found"
319
 
    if [ "$net_db_dir_set" -eq 0 ]; then
320
 
        net_db_dir=`ocamlfind printconf destdir`/netstring
321
 
        net_db_dir_set=1
322
 
    fi
323
 
else
324
 
    echo "not found"
325
 
    echo "Make sure that ocamlfind is in your PATH, or download findlib"
326
 
    echo "from www.ocaml-programming.de"
327
 
    exit 1
328
 
fi
329
 
 
330
 
if [ "$net_db_dir_set" -eq 0 ]; then
331
 
    net_db_dir="$libdir"
332
 
    net_db_dir_set=1
333
 
fi
334
 
 
335
 
 
336
 
######################################################################
337
 
# Does ocamlopt support multi-threading?
338
 
 
339
 
printf "%s" "Checking multi-threading support... "
340
 
mt_type=vm
341
 
mt_switch="-vmthread"
342
 
mt_comment="(unsupported)"
343
 
mkdir -p tmp
344
 
cat <<_EOF_ >tmp/t.ml
345
 
let _ = Mutex.create();;
346
 
_EOF_
347
 
if ocamlopt -thread -o tmp/t threads.cmxa tmp/t.ml 2>/dev/null; then
348
 
    if tmp/t 2>/dev/null; then
349
 
        mt_type=posix
350
 
        mt_switch="-thread"
351
 
        mt_comment="(ok)"
352
 
    fi
353
 
fi
354
 
echo "$mt_type $mt_comment"
355
 
 
356
 
######################################################################
357
 
# Check that pcre is available:
358
 
 
359
 
printf "%s" "Checking for PCRE... "
360
 
if check_library pcre pcre.cmi; then
361
 
    echo "found"
362
 
else
363
 
    echo "not found"
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"
367
 
    exit 1
368
 
fi
369
 
 
370
 
######################################################################
371
 
# Check OS
372
 
 
373
 
with_rpc_auth_local=0
374
 
with_rpc_xti=0
375
 
 
376
 
printf "%s" "Checking operating system... "
377
 
u=`uname`
378
 
case "$u" in
379
 
        CYGWIN*)
380
 
                echo "Cygwin"
381
 
                exec_suffix=".exe" ;;
382
 
        Linux)
383
 
                echo "Linux"
384
 
                with_rpc_auth_local=1
385
 
                [ -n "$adh_style" ] || adh_style=unixdomain
386
 
                ;;
387
 
        *FreeBSD)
388
 
                echo "FreeBSD"
389
 
                [ -n "$adh_style" ] || adh_style=unixdomain
390
 
                ;;
391
 
        NetBSD)
392
 
                echo "NetBSD"
393
 
                [ -n "$adh_style" ] || adh_style=unixdomain
394
 
                ;;
395
 
        SunOS)
396
 
                case `uname -r` in
397
 
                    [1234]*)
398
 
                        echo "SunOS" ;;
399
 
                    *)
400
 
                        echo "Solaris"
401
 
                        with_rpc_xti=1
402
 
                        [ -n "$adh_style" ] || adh_style=tirpc
403
 
                        ;;
404
 
                esac ;;
405
 
        *)
406
 
                echo "Generic" ;;
407
 
esac
408
 
 
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"
412
 
fi
413
 
 
414
 
if [ $with_rpc_xti -gt 0 ]; then
415
 
    echo "    This OS supports XTI networking"
416
 
    echo "    Building rpc-xti"
417
 
fi
418
 
 
419
 
######################################################################
420
 
# Netsys
421
 
 
422
 
( cd src/netsys; ./configure )
423
 
 
424
 
######################################################################
425
 
# TCL
426
 
 
427
 
with_equeue_tcl=0
428
 
 
429
 
if [ $enable_tcl -gt 0 ]; then
430
 
    printf "%s" "Checking switches for tcl.h... "
431
 
 
432
 
    tcl_defs_1=""
433
 
    for d in $tcl_defs; do
434
 
        tcl_defs_1="$tcl_defs_1 -ccopt '$d'"
435
 
    done
436
 
 
437
 
    rm -rf tmp
438
 
    mkdir -p tmp
439
 
 
440
 
    cat <<EOF >tmp/t.c
441
 
#include "tcl.h"
442
 
 
443
 
main () {
444
 
}
445
 
EOF
446
 
 
447
 
    if ( cd tmp; ocamlc $tcl_defs_1 -c t.c >/dev/null 2>/dev/null ) then
448
 
        echo "ok"
449
 
    else
450
 
        echo "not ok"
451
 
        echo
452
 
        echo "Please check -equeue-tcl-defs!"
453
 
        exit 1
454
 
    fi
455
 
 
456
 
    printf "%s" "Checking switches to link libtcl... "
457
 
 
458
 
    cat <<EOF >tmp/t.c
459
 
#include <stdlib.h>
460
 
#include <stdio.h>
461
 
#include "tcl.h"
462
 
 
463
 
do_something () {
464
 
    void (*x)(int);
465
 
    x = Tcl_Exit;
466
 
    exit(0);
467
 
}
468
 
EOF
469
 
 
470
 
    cat <<EOF >tmp/t.ml
471
 
exit 0
472
 
EOF
473
 
 
474
 
    if ( cd tmp
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"
478
 
       )
479
 
    then
480
 
        if tmp/t; then
481
 
            echo "ok"
482
 
        else
483
 
            echo "not ok (check ldd output of tmp/t)"
484
 
            echo
485
 
            echo "Please check -equeue-tcl-libs!"
486
 
            exit 1
487
 
        fi
488
 
    else
489
 
        echo "not ok"
490
 
        echo
491
 
        echo "Please check -equeue-tcl-libs!"
492
 
        exit 1
493
 
    fi
494
 
 
495
 
    with_equeue_tcl=1
496
 
fi
497
 
 
498
 
######################################################################
499
 
# Check lablgtk
500
 
 
501
 
with_equeue_gtk1=0
502
 
 
503
 
if [ $enable_gtk -gt 0 ]; then
504
 
    printf "%s" "Checking for lablgtk... "
505
 
    if ocamlfind query lablgtk >/dev/null 2>/dev/null; then
506
 
        echo "found"
507
 
        with_equeue_gtk1=1
508
 
    else
509
 
        echo "not found"
510
 
        echo "Required library lablgtk not found!"
511
 
        exit 1
512
 
    fi
513
 
fi
514
 
 
515
 
######################################################################
516
 
# Check lablgtk2
517
 
 
518
 
with_equeue_gtk2=0
519
 
gtk2_io_add_watch_supports_lists=""
520
 
 
521
 
if [ $enable_gtk2 -gt 0 ]; then
522
 
    printf "%s" "Checking for lablgtk2... "
523
 
    if ocamlfind query lablgtk2 >/dev/null 2>/dev/null; then
524
 
        echo "found"
525
 
    else
526
 
        echo "not found"
527
 
        echo "Required library lablgtk2 not found!"
528
 
        exit 1
529
 
    fi
530
 
 
531
 
    printf "%s" "Checking whether lablgtk2 has GMain.Io.remove... "
532
 
    mkdir -p tmp
533
 
    cat <<EOF >tmp/gtk.ml
534
 
let _ = GMain.Io.remove;;
535
 
EOF
536
 
 
537
 
    if ocamlfind ocamlc -package lablgtk2 -c tmp/gtk.ml >/dev/null 2>/dev/null;
538
 
    then
539
 
        echo "yes"
540
 
    else
541
 
        echo "no"
542
 
        echo "Your version of lablgtk2 is too old!"
543
 
        exit 1
544
 
    fi
545
 
    
546
 
    printf "%s" "Checking whether lablgtk2 has GMain.Io.add_watch with list support... "
547
 
    mkdir -p tmp
548
 
    cat <<'EOF' >tmp/gtk.ml
549
 
open GMain.Io
550
 
let _ = (add_watch : cond:condition list -> callback:(condition list -> bool) -> ?prio:int -> channel -> id);;
551
 
exit 0
552
 
EOF
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
556
 
        echo "yes"
557
 
        gtk2_io_add_watch_supports_lists="-ppopt -DGTK2_IO_ADD_WATCH_SUPPORTS_LISTS"
558
 
    else
559
 
        echo "no"
560
 
        printf "%s" "Checking whether lablgtk2's GMain.Io.add_watch is broken... "
561
 
        mkdir -p tmp
562
 
        cat <<'EOF' >tmp/gtk.ml
563
 
GMain.Main.init();;
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
569
 
 *)
570
 
if (Obj.magic w : int) > 0 then
571
 
  exit 0
572
 
else
573
 
  exit 1
574
 
EOF
575
 
        if ocamlfind ocamlc -package unix,lablgtk2 -linkpkg -o tmp/gtk tmp/gtk.ml >/dev/null 2>/dev/null && tmp/gtk; then
576
 
            echo "no"
577
 
        else
578
 
            echo "yes"
579
 
            echo "You should apply the patch-ab-ml_glib.c to lablgtk2 to fix this!"
580
 
            exit 1
581
 
        fi
582
 
    fi
583
 
 
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
587
 
    done
588
 
    
589
 
    with_equeue_gtk2=1
590
 
fi
591
 
 
592
 
######################################################################
593
 
# Check SSL
594
 
 
595
 
with_equeue_ssl=0
596
 
with_rpc_ssl=0
597
 
 
598
 
if [ $enable_ssl -gt 0 ]; then
599
 
    printf "%s" "Checking for ssl... "
600
 
    if ocamlfind query ssl >/dev/null 2>/dev/null; then
601
 
        echo "found"
602
 
        with_equeue_ssl=1
603
 
        with_rpc_ssl=1
604
 
    else
605
 
        echo "not found"
606
 
        echo "Required library ssl not found!"
607
 
        exit 1
608
 
    fi
609
 
fi
610
 
 
611
 
######################################################################
612
 
# Check SecureRPC
613
 
 
614
 
adh_reqs=""
615
 
 
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
620
 
        echo "found"
621
 
    else
622
 
        echo "not found"
623
 
        echo "Required library cryptgps not found!"
624
 
        exit 1
625
 
    fi
626
 
 
627
 
    if [ -z "$adh_style" ]; then
628
 
        echo "    No -auth-dh-style passed and no OS default known. Falling back to keyenvoy"
629
 
        adh_style="keyenvoy"
630
 
    fi
631
 
 
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"
635
 
            exit 1
636
 
        fi
637
 
        adh_reqs="rpc-xti"
638
 
    fi
639
 
 
640
 
    echo "    SecureRPC is supported"
641
 
fi
642
 
 
643
 
######################################################################
644
 
# Check Apache
645
 
 
646
 
if [ $enable_apache -gt 0 ]; then
647
 
    printf "Apache mod connector... "
648
 
 
649
 
#     echo "CURRENTLY BROKEN - disabling for now"
650
 
#     enable_apache=0
651
 
 
652
 
    if [ -z "$apxs" ]; then
653
 
        # guess
654
 
        apxs=`get_path apxs`
655
 
    fi
656
 
    if [ -z "$apache" ]; then
657
 
        # guess
658
 
        apache=`get_path apache`
659
 
    fi
660
 
 
661
 
    if [ -x "$apxs" ] ; then
662
 
        apache_major=2
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)"
675
 
    else
676
 
        apache_major=
677
 
        enable_apache=0
678
 
        echo "apxs or apache not found"
679
 
        echo "    Maybe you need to use the -apache option?"
680
 
        exit 1
681
 
    fi
682
 
 
683
 
fi
684
 
 
685
 
######################################################################
686
 
# NETCGI1 or NETCGI2
687
 
 
688
 
preferred_cgi_pkg=netcgi1
689
 
inc_netcgi1or2='$(INC_NETCGI1)'
690
 
 
691
 
if [ $prefer_netcgi2 -gt 0 ]; then
692
 
    preferred_cgi_pkg=netcgi2
693
 
    inc_netcgi1or2='$(INC_NETCGI2)'
694
 
fi
695
 
 
696
 
######################################################################
697
 
# Summary
698
 
 
699
 
echo
700
 
echo "Effective options:"
701
 
print_options
702
 
echo
703
 
 
704
 
pkglist="netsys netshm equeue shell netstring rpc-generator rpc pop smtp netclient netcgi1 netcgi2 cgi netplex netcgi2-plex"
705
 
 
706
 
if [ $enable_apache -gt 0 ]; then
707
 
    pkglist="$pkglist netcgi2-apache"
708
 
fi
709
 
 
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"
711
 
 
712
 
if [ $disable_core -gt 0 ]; then
713
 
    # Omit the core packages:
714
 
    pkglist=""
715
 
    with_rpc_auth_local=0
716
 
    with_rpc_xti=0
717
 
fi
718
 
 
719
 
if [ $with_nethttpd -gt 0 ]; then
720
 
    pkglist="$pkglist nethttpd-for-netcgi1 nethttpd-for-netcgi2"
721
 
fi
722
 
 
723
 
for opt in $woptions rpc_auth_local rpc_xti equeue_tcl equeue_gtk1 equeue_gtk2 equeue_ssl rpc_ssl; do
724
 
        e="o=\$with_$opt"
725
 
        eval "$e"
726
 
        if [ $o -gt 0 ]; then
727
 
                uopt=`echo "$opt" | sed -e 's/_/-/g'`
728
 
                pkglist="$pkglist $uopt"
729
 
        fi
730
 
done
731
 
 
732
 
######################################################################
733
 
# Write Makefile.conf
734
 
 
735
 
echo "Writing Makefile.conf"
736
 
cat <<_EOF_ >Makefile.conf
737
 
# Makefike.conf written by configure
738
 
# The Ocamlnet version
739
 
VERSION = $version
740
 
 
741
 
# The packages to build in the right order:
742
 
PKGLIST = $pkglist
743
 
 
744
 
# All packages:
745
 
FULL_PKGLIST = $full_pkglist
746
 
 
747
 
# Whether the OS needs an .exe suffix for executables:
748
 
EXEC_SUFFIX = $exec_suffix
749
 
 
750
 
# Required packages (findlib):
751
 
REQUIRES = $requires
752
 
 
753
 
# Additional options only for ocamlc:
754
 
OCAMLC_OPTIONS =
755
 
 
756
 
# Additional options only for ocamlopt:
757
 
OCAMLOPT_OPTIONS =
758
 
 
759
 
# Where the ocamlnet lookup tables are to be installed (both findlib
760
 
# and non-findlib):
761
 
NET_DB_DIR = $net_db_dir
762
 
 
763
 
# Where binaries are installed:
764
 
BINDIR = $bindir
765
 
 
766
 
# Method of installation:
767
 
INSTMETHOD = findlib
768
 
 
769
 
# Multi-threading type:
770
 
MT_TYPE = $mt_type
771
 
 
772
 
# Compiler switch to enable multi-threading:
773
 
THREAD = $mt_switch
774
 
 
775
 
# For -enable-tcl:
776
 
EQUEUE_TCL_DEFS = $tcl_defs_1
777
 
EQUEUE_TCL_LIBS = $tcl_libs
778
 
 
779
 
# For -enable-gtk2:
780
 
GTK_EXTRA_DEFINES = $gtk2_io_add_watch_supports_lists
781
 
 
782
 
# For -with-auth-dh:
783
 
RPC_AUTH_DH_CONNECTOR = $adh_style
784
 
AUTHDHREQS = $adh_reqs
785
 
 
786
 
# For -enable-apache
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
796
 
APXS = $apxs
797
 
 
798
 
# Preferred CGI implementation
799
 
PREFERRED_CGI_PKG=$preferred_cgi_pkg
800
 
INC_NETCGI1OR2=$inc_netcgi1or2
801
 
 
802
 
_EOF_
803
 
 
804
 
######################################################################
805
 
# Finish
806
 
 
807
 
echo
808
 
echo "Please check Makefile.conf."
809
 
echo
810
 
echo "You can now compile Ocamlnet by invoking"
811
 
echo "   make all"
812
 
echo "for the bytecode compiler, and optionally by invoking"
813
 
echo "   make opt"
814
 
echo "for the native-code compiler (if supported on your architecture)."
815
 
echo "Finally, a"
816
 
echo "   make install"
817
 
echo "will install the package(s)."