-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure
executable file
·150 lines (127 loc) · 2.97 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/bash
# This file creates the necessary Makefiles for building Turtl core for your
# platform.
ECL_BIN_PATH=""
ECL_INC_PATH=""
ECL_LIB_PATH=""
function guess_ecl_bin_path {
if [ "$ECL_BIN_PATH" != "" ]; then
return
fi
ECL_WHICH=`which ecl 2> /dev/null`
if [ "$ECL_WHICH" != "" ]; then
ECL_BIN_PATH=`dirname $ECL_WHICH`
return
fi
CHECK=("/usr/local/ecl/bin/ecl" "/opt/ecl/bin/ecl" "/usr/local/ecl/ecl.exe" "/c/usr/local/ecl/ecl.exe" "/d/usr/local/ecl/ecl.exe")
for i in "${CHECK[@]}"; do
if [ -x $i ]; then
ECL_BIN_PATH=`dirname $i`
return
fi
done
}
function guess_ecl_include_path {
if [ "$ECL_INC_PATH" != "" ]; then
return
fi
if [ "$ECL_BIN_PATH" == "" ]; then
return
fi
if [ -d "$ECL_BIN_PATH/../include" ]; then
ECL_INC_PATH="$ECL_BIN_PATH/../include"
return
fi
if [ -f "$ECL_BIN_PATH/ecl/ecl.h" ]; then
ECL_INC_PATH=$ECL_BIN_PATH
return
fi
}
function guess_ecl_lib_path {
if [ "$ECL_LIB_PATH" != "" ]; then
return
fi
if [ "$ECL_BIN_PATH" == "" ]; then
return
fi
if [ -d "$ECL_BIN_PATH/../lib" ]; then
ECL_LIB_PATH="$ECL_BIN_PATH/../lib"
return
fi
if [ -f "$ECL_BIN_PATH/ecl.dll" ]; then
ECL_LIB_PATH=$ECL_BIN_PATH
return
fi
}
guess_ecl_bin_path
function print_help {
echo "Welcome to Turtl's (probably foolishly) hand-generated configure script."
echo "Usage:"
echo " ./configure [OPTIONS]"
echo
echo "Options:"
echo " --help Show this help"
echo " --ecl-bin-path [path] Set the path that contains the ECL binaries."
echo " --ecl-include-path [path] Set the path to ECL's headers."
echo " --ecl-lib-path [path] Set the path to ECL's libs (libecl.so/ecl.dll)."
echo
echo "Note that setting --ecl-bin-path will help the configure script find the"
echo "rest of the ECL directories, assuming you didn't split them up."
echo
}
while test -n "$1"; do
case "$1" in
--help)
print_help
exit 0
;;
--ecl-bin-path)
ECL_BIN_PATH=$2
shift
;;
--ecl-include-path)
ECL_INC_PATH=$2
shift
;;
--ecl-lib-path)
ECL_LIB_PATH=$2
shift
;;
*)
CFG_ARGS="$*"
break;
;;
esac
shift
done
guess_ecl_include_path
guess_ecl_lib_path
ECL_EXE=$ECL_BIN_PATH/ecl
if [ -d $ECL_EXE ]; then
ECL_EXE=$ECL_BIN_PATH/ecl.exe
fi
if [ "$CC" == "" ]; then
CC="gcc"
fi
echo "Found the following paths:"
echo " ECL bin: $ECL_BIN_PATH"
echo " ECL include: $ECL_INC_PATH"
echo " ECL lib: $ECL_LIB_PATH"
echo " ECL exe: $ECL_EXE"
echo
echo "Generating Makefiles."
MAKEFILES=(./Makefile.in ./src/Makefile.in ./app/Makefile.in)
for mf in "${MAKEFILES[@]}"; do
if [ ! -f $mf ]; then
echo "Missing makefile: $mf"
continue
fi
real="`echo $mf | sed 's|\.in$||'`"
cp $mf $real
sed -i "s|@cc@|${CC}|g" $real
sed -i "s|@ecl_bin@|${ECL_BIN_PATH}|g" $real
sed -i "s|@ecl_inc@|${ECL_INC_PATH}|g" $real
sed -i "s|@ecl_lib@|${ECL_LIB_PATH}|g" $real
sed -i "s|@ecl_exe@|${ECL_EXE}|g" $real
echo " generated $real"
done