-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·232 lines (202 loc) · 4.2 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
#!/bin/sh
#
# pfamannot
# Protein Family Annotator
#
# configure
# Copyright (c) 2020 Jan Hamalčík
#
# Generates Makefile
#
version_major=0
version_minor=1
version_patch=5
echo "Welcome to pfamannot - Protein Family Annotator! Version ${version_major}.${version_minor}.${version_patch}"
echo "Configuring..."
echo
prefix=/usr/local
debugsym=false
for arg in $@;
do
case "$arg" in
--prefix=*)
prefix=`echo $arg | sed 's/--prefix=//'`
;;
--enable-debug)
debugsym=true
;;
--disable-debug)
debugsym=false
;;
--help)
echo 'Usage: ./configure [options]'
echo 'Options:'
echo ' --prefix=<path>: Installation prefix (DEFAULT = "/usr/local")'
echo ' --enable-debug: Include debug symbols'
echo ' --disable-debug: Do not include debug symbols (DEFAULT)'
echo 'All invalid options are silently ignored.'
exit 0
;;
esac
done
##################################
# Get cpp info
cpp -v /dev/null -o /dev/null > cpp_info 2>&1
include_path=""
library_path=""
inside_include=false
while IFS= read -r line;
do
if $inside_include;
then
if [ "`echo $line`" = "End of search list." ] ;
then
inside_include=false
continue
fi
path="`echo $line`"
include_path="${path}:${include_path}"
else
if [ "$line" = "#include <...> search starts here:" ] ;
then
inside_include=true
elif [ "`echo $line | head -c13`" = "LIBRARY_PATH=" ] ;
then
library_path="`echo $line | tail -c+14`"
fi
fi
done < cpp_info
rm cpp_info
if [ "$include_path" = "" ] ;
then
include_path="/usr/include:/usr/local/include"
else
include_path="`echo $include_path | rev | tail -c+2 | rev`"
fi
if [ "$library_path" = "" ] ;
then
library_path="/usr/lib:/usr/local/lib"
fi
##################################
# Check for curl
printf "Checking for curl..."
curl_exists=false
include_curl_exists=false
library_curl_exists=false
IFS=:
for path in $include_path;
do
if [ -f "${path}/curl/curl.h" ];
then
include_curl_exists=true
break
fi
done
for path in $library_path;
do
for file in ${path}/libcurl.*;
do
if [ -f "$file" ];
then
library_curl_exists=true
break
fi
done
if $library_curl_exists;
then
break
fi
done
IFS=$'\n'
if $include_curl_exists && $library_curl_exists;
then
curl_exists=true
echo " -> yes"
else
echo " -> no"
fi
##################################
# Check for zlib
printf "Checking for zlib..."
zlib_exists=false
include_zlib_exists=false
library_zlib_exists=false
IFS=:
for path in $include_path;
do
if [ -f "${path}/zlib.h" ];
then
include_zlib_exists=true
break
fi
done
for path in $library_path;
do
for file in ${path}/libz.*;
do
if [ -f "$file" ];
then
library_zlib_exists=true
break
fi
done
if $library_zlib_exists;
then
break
fi
done
IFS=$'\n'
if $include_zlib_exists && $library_zlib_exists;
then
zlib_exists=true
echo " -> yes"
else
echo " -> no"
fi
##################################
# Create pfamannotConfig.hpp
awk -v NEWFILENAME="pfamannotConfig.hpp" -v MAJOR="$version_major" -v MINOR="$version_minor" -v PATCH="$version_patch" -v HOME="$HOME" '{
sub(/pfamannotConfig.hpp.in/, NEWFILENAME);
sub(/§major§/, MAJOR);
sub(/§minor§/, MINOR);
sub(/§patch§/, PATCH);
sub(/§home§/, HOME);
print;
}' source/pfamannotConfig.hpp.in > source/pfamannotConfig.hpp
##################################
# Create Makefile
echo
echo 'Generating makefile...'
# Header
echo '# pfamannot' > Makefile
echo '# Protein Family Annotator' >> Makefile
echo '#' >> Makefile
echo '# Makefile' >> Makefile
echo '# Copyright (c) 2020 Jan Hamalčík' >> Makefile
echo '#' >> Makefile
echo '# Makefile for pfamannot' >> Makefile
echo '#' >> Makefile
echo >> Makefile
# Body
echo 'PREFIX =' $prefix >> Makefile
if $debugsym;
then
echo 'DEBUG = -g3' >> Makefile
else
echo 'DEBUG =' >> Makefile
fi
if $curl_exists;
then
echo 'CURL_EXISTS = true' >> Makefile
else
echo 'CURL_EXISTS = false' >> Makefile
fi
if $zlib_exists;
then
echo 'ZLIB_EXISTS = true' >> Makefile
else
echo 'ZLIB_EXISTS = false' >> Makefile
fi
tail -n+10 Makefile.in >> Makefile
echo
echo 'Configuration complete, type make to build.'