blob: 49b3dafca56b0648b1388bc18c41b8b90a6a68c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#! /bin/sh
# $Id$
prefix=/usr/local
bindir=''
libdir=''
mandir=''
ocaml_top=../ocaml_stuff
# Parse command-line arguments
while : ; do
case "$1" in
"") break;;
-prefix|--prefix)
prefix=$2; shift;;
-bindir|--bindir)
bindir=$2; shift;;
-libdir|--libdir)
libdir=$2; shift;;
-mandir|--mandir)
mandir=$2; shift;;
-ocaml-top)
ocaml_top=$2; shift;;
*) echo "Unknown option \"$1\"." 1>&2; exit 2;;
esac
shift
done
# Sanity checks
case "$prefix" in
/*) ;;
*) echo "The -prefix directory must be absolute." 1>&2; exit 2;;
esac
case "$bindir" in
/*) ;;
"") ;;
*) echo "The -bindir directory must be absolute." 1>&2; exit 2;;
esac
case "$libdir" in
/*) ;;
"") ;;
*) echo "The -libdir directory must be absolute." 1>&2; exit 2;;
esac
case "$mandir" in
/*) ;;
"") ;;
*) echo "The -mandir directory must be absolute." 1>&2; exit 2;;
esac
# Generate the files
rm -f Makefile.cnf
touch Makefile.cnf
# Check Ocaml
for i in utils parsing otherlibs/dynlink; do
if test ! -d "$ocaml_top/$i"; then
echo "Bad value $ocaml_top for option -ocaml-top"
echo "There is no directory $ocaml_top/$i"
echo "Configuration script failed"
exit 1
fi
done
echo "EXE=$EXE" >> Makefile.cnf
echo "O=o" >> Makefile.cnf
echo "A=a" >> Makefile.cnf
echo "OPT=" >> Makefile.cnf
echo "OTOP=$ocaml_top" >> Makefile.cnf
if test "$ocaml_top" = "../ocaml_stuff"; then
if ocamlc -v >/dev/null 2>&1; then
:
else
echo "You need the command ocamlc accessible in the path!"
echo "Configuration script failed!"
exit 1
fi
OLIBDIR=`ocamlc -where`
echo "OLIBDIR=$OLIBDIR" >> Makefile.cnf
else
echo "OLIBDIR=\$(OTOP)/boot" >> Makefile.cnf
fi
# Where to install
echo "PREFIX=$prefix" >> Makefile.cnf
case "$bindir" in
"") echo 'BINDIR=$(PREFIX)/bin' >> Makefile.cnf
bindir="$prefix/bin";;
*) echo "BINDIR=$bindir" >> Makefile.cnf;;
esac
case "$libdir" in
"") echo 'LIBDIR=$(PREFIX)/lib/camlp4' >> Makefile.cnf
libdir="$prefix/lib/camlp4";;
*) echo "LIBDIR=$libdir" >> Makefile.cnf;;
esac
case "$mandir" in
"") echo 'MANDIR=$(PREFIX)/man/man1' >> Makefile.cnf
mandir="$prefix/man/man1";;
*) echo "MANDIR=$mandir" >> Makefile.cnf;;
esac
rm -f Makefile
cat Makefile.tpl > Makefile
cat Makefile.cnf >> Makefile
echo "Resulting configuration file (Makefile.cnf):"
echo
cat Makefile.cnf
|