-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·93 lines (81 loc) · 2.73 KB
/
configure
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
#! /bin/sh
#########################################################################
# #
# CamlDBM #
# #
# Xavier Leroy, projet Gallium, INRIA Rocquencourt #
# #
# Copyright 2011 Institut National de Recherche en Informatique et #
# en Automatique. All rights reserved. This file is distributed #
# under the terms of the GNU Library General Public License, with #
# the special exception on linking described in file LICENSE. #
# #
#########################################################################
version=`ocamlc -version`
if test $? -ne 0; then
echo "ocamlc not found, aborting."
exit 2
fi
echo "Configuring for OCaml version $version"
echo
stdlib=`ocamlc -where`
hasgot() {
rm -f hasgot.c
(echo "#include <$2>"
echo 'int main() {'
echo ' (void) dbm_open("foo", 0, 0);'
echo ' return 0;'
echo '}') > hasgot.c
${CC:-cc} -I$1 -o hasgot.exe hasgot.c $3 $4
res=$?
rm -f hasgot.c hasgot.exe
return $?
}
dbm_include="not found"
dbm_link="not found"
dbm_defines=""
for dir in /usr/include /usr/include/db1 /usr/include/gdbm; do
if test -f $dir/ndbm.h; then
dbm_include=$dir
if hasgot $dir ndbm.h; then
dbm_link=""
elif hasgot $dir ndbm.h -lndbm; then
dbm_link="-lndbm"
elif hasgot $dir ndbm.h -ldb1; then
dbm_link="-ldb1"
elif hasgot $dir ndbm.h -lgdbm; then
dbm_link="-lgdbm"
elif hasgot $dir ndbm.h -lgdbm_compat -lgdbm; then
dbm_link="-lgdbm_compat -lgdbm"
fi
break
fi
if test -f $dir/gdbm-ndbm.h; then
dbm_include=$dir
dbm_defines="-DDBM_USES_GDBM_NDBM"
if hasgot $dir gdbm-ndbm.h -lgdbm_compat -lgdbm; then
dbm_link="-lgdbm_compat -lgdbm"
fi
break
fi
done
if test "$dbm_include" = "not found" || test "$dbm_link" = "not found"; then
echo "NDBM not found, the \"camldbm\" library cannot be built."
exit 2
fi
echo "Configuration for the \"camldbm\" library:"
echo " headers found in ......... $dbm_include"
echo " options for compiling .... $dbm_defines"
echo " options for linking ...... $dbm_link"
echo
echo "Configuration successful"
echo
if test "$dbm_include" = "/usr/include"; then
dbm_include=""
else
dbm_include="-I$dbm_include"
fi
echo "OCAML_STDLIB=$stdlib" > Makefile.config
echo "DBM_INCLUDES=$dbm_include" >> Makefile.config
echo "DBM_LINK=$dbm_link" >> Makefile.config
echo "DBM_DEFINES=$dbm_defines" >> Makefile.config