-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·336 lines (291 loc) · 10.3 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
#!/bin/sh
#
# Installation script for Pyxplot version 0.9.2
#
# The code in this file is part of Pyxplot
# <http://www.pyxplot.org.uk>
#
# Copyright (C) 2006-2013 Dominic Ford <coders@pyxplot.org.uk>
# 2008-2013 Ross Church
#
# $Id$
#
# Pyxplot is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# You should have received a copy of the GNU General Public License along with
# Pyxplot; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301, USA
# ----------------------------------------------------------------------------
# 0. START CONSTRUCTING A MAKEFILE
rm -f conf.*
echo "" > Makefile
echo "PATHLINK=/" > Makefile
# 1. TEST THE ECHO COMMAND TO SEE WHICH VARIANT WE HAVE
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
*c*,-n*) ECHO_N= ECHO_C='
' ECHO_T=' ' ;;
*c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
*) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
# 2. CHECK FOR LATEX
echo $ECHO_N "Checking for latex ............. $ECHO_C"
whichout=`which latex 2> conf.stderr`
rm -f conf.*
if test "`echo $whichout | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout="" ; fi
if test "$whichout" != "" ; then
echo "YES"
echo "LATEX_COMMAND=${whichout}" >> Makefile
else
echo "NO" ; echo "ERROR: Required program latex could not be found." >&2 ; exit
fi
# 3. CHECK FOR CONVERT
echo $ECHO_N "Checking for ImageMagick convert............ $ECHO_C"
whichout=`which convert 2> conf.stderr`
rm -f conf.*
if test "`echo $whichout | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout="" ; fi
if test "$whichout" != "" ; then
echo "YES"
echo "CONVERT_COMMAND=${whichout}" >> Makefile
else
echo "NO" ; echo "ERROR: Required program convert could not be found." >&2 ; exit
fi
# 4. CHECK FOR SED
echo $ECHO_N "Checking for sed ............. $ECHO_C"
whichout=`which sed 2> conf.stderr`
rm -f conf.*
if test "`echo $whichout | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout="" ; fi
if test "$whichout" != "" ; then
echo "YES"
echo "SED_COMMAND=${whichout}" >> Makefile
else
echo "NO" ; echo "ERROR: Required program sed could not be found." >&2 ; exit
fi
# 5. CHECK FOR GUNZIP
echo $ECHO_N "Checking for gunzip ............. $ECHO_C"
whichout=`which gunzip 2> conf.stderr`
rm -f conf.*
if test "`echo $whichout | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout="" ; fi
if test "$whichout" != "" ; then
echo "YES"
echo "GUNZIP_COMMAND=-D GUNZIP_COMMAND=\"\\\"${whichout} -c\\\"\"" >> Makefile
else
echo "NO"
echo "GUNZIP_COMMAND=" >> Makefile
echo "WARNING: Gunzip could not be found. Installation will proceed, but Pyxplot will not be able to plot .gz files." >&2
fi
# 6. CHECK FOR WGET
echo $ECHO_N "Checking for wget ............. $ECHO_C"
whichout=`which wget 2> conf.stderr`
rm -f conf.*
if test "`echo $whichout | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout="" ; fi
if test "$whichout" != "" ; then
echo "YES"
echo "WGET_COMMAND=-D WGET_COMMAND=\"\\\"${whichout} -O -\\\"\"" >> Makefile
else
echo "NO"
echo "WGET_COMMAND=" >> Makefile
echo "WARNING: wget could not be found. Installation will proceed, but Pyxplot will not be able to plot files directly from URLs." >&2
fi
# 7. CHECK FOR GHOSTSCRIPT
echo $ECHO_N "Checking for ghostscript ............. $ECHO_C"
whichout=`which gs 2> conf.stderr`
rm -f conf.*
if test "`echo $whichout | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout="" ; fi
if test "$whichout" != "" ; then
echo "YES"
echo "GS_COMMAND=${whichout}" >> Makefile
else
echo "NO" ; echo "ERROR: Required program ghostscript could not be found." >&2 ; exit
fi
# 8. FIND GHOSTVIEW
echo $ECHO_N "Checking for ghostview ............. $ECHO_C"
whichout_gv=`which gv 2> conf.stderr`
rm -f conf.*
if test "`echo $whichout_gv | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout_gv="" ; fi
if test "$whichout_gv" != "" ; then
echo $ECHO_N "YES (gv$ECHO_C"
echo "GV_COMMAND=${whichout_gv}" >> Makefile
if test "`gv --v 2> conf.stderr`" = "" ; then
rm -f conf.*
echo ", single hyphen options)"
echo "GV_OPT=-" >> Makefile
else
rm -f conf.*
echo ", double hyphen options)"
echo "GV_OPT=--" >> Makefile
fi
else
echo "NO"
echo "GV_COMMAND=/bin/false" >> Makefile
fi
# 9. FIND GGV
echo $ECHO_N "Checking for ggv ............. $ECHO_C"
whichout_ggv=`which ggv 2> conf.stderr`
rm -f conf.*
if test "`echo $whichout_ggv | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout_ggv="" ; fi
if test "$whichout_ggv" != "" ; then
echo "YES (ggv, don't forget to set \"watch file\" in the viewer preferences!)"
echo "GGV_COMMAND=${whichout_ggv}" >> Makefile
else
echo "NO"
echo "GGV_COMMAND=/bin/false" >> Makefile
fi
# 10. FIND MAKE
echo $ECHO_N "Checking for GNU make ............. $ECHO_C"
whichout_make=`which make 2> conf.stderr`
whichout_gmake=`which gmake 2> conf.stderr2`
rm -f conf.*
if test "`echo $whichout_make | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout_make="" ; fi
if test "`echo $whichout_gmake | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout_gmake="" ; fi
if test "$whichout_gmake" != "" ; then
echo "YES (gmake)"
echo "MAKE_COMMAND=${whichout_gmake}" >> Makefile
MAKE_COMMAND="gmake"
elif test "$whichout_make" != "" ; then
echo "YES (make)"
echo "MAKE_COMMAND=${whichout_make}" >> Makefile
MAKE_COMMAND="make"
else
echo "NO"
echo "ERROR: Required program 'make' could not be found." >&2
exit
fi
# 11. CHECK TO SEE WHETHER THIS SYSTEM HAS GCC INSTALLED
echo $ECHO_N "Checking for gcc ............. $ECHO_C"
whichout=`which gcc 2> conf.stderr`
rm -f conf.*
if test "`echo $whichout | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout="" ; fi
if test "$whichout" != "" ; then
echo "YES"
else
echo "NO" ; echo "ERROR: Required program gcc could not be found." >&2 ; exit
fi
# 12. CHECK TO SEE WHETHER THIS SYSTEM HAS GNU READLINE HEADERS
echo $ECHO_N "Checking for libreadline-dev ............. $ECHO_C"
if printf '#include <stdio.h>\n#include <readline/readline.h>\nint main() { return 0; }\n' | gcc -x c - -o conf.out > conf.stdout 2> conf.stderr
then
rm -f conf.*
echo "YES"
echo "HAVE_READLINE=-D HAVE_READLINE=1" >> Makefile
echo "LINK_READLINE=-ltermcap -lreadline" >> Makefile
else
rm -f conf.*
echo "NO"
echo "HAVE_READLINE=-D NOHAVE_READLINE=1" >> Makefile
echo "LINK_READLINE=" >> Makefile
fi
# 13. CHECK TO SEE WHETHER THIS SYSTEM HAS CFITSIO HEADERS
echo $ECHO_N "Checking for libcfitsio-dev ............. $ECHO_C"
if printf '#include <fitsio.h>\nint main() { return 0; }\n' | gcc -x c - -o conf.out > conf.stdout 2> conf.stderr
then
rm -f conf.*
echo "YES"
echo "HAVE_FITSIO=-D HAVE_FITSIO=1" >> Makefile
echo "LINK_FITSIO=-lcfitsio" >> Makefile
else
rm -f conf.*
echo "NO"
echo "HAVE_FITSIO=-D NOHAVE_FITSIO=1" >> Makefile
echo "LINK_FITSIO=" >> Makefile
fi
# 14. CHECK TO SEE WHETHER THIS SYSTEM HAS GSL HEADERS
echo $ECHO_N "Checking for libgsl0-dev ............. $ECHO_C"
if printf '#include <gsl/gsl_version.h>\nint main() { return 0; }\n' | gcc `gsl-config --cflags` -x c - -o conf.out > conf.stdout 2> conf.stderr
then
rm -f conf.*
echo "YES"
else
rm -f conf.*
echo "NO"
echo "ERROR: Header files for required library 'libgsl' could not be found." >&2
exit
fi
echo $ECHO_N "Checking version of libgsl0-dev ............ $ECHO_C"
if expr `gsl-config --version` \>= 1.10 > conf.stdout
then
rm -f conf.*
echo "YES"
else
rm -f conf.*
echo "NO"
echo "ERROR: Pyxplot requires a version of gsl >= 1.10. Installed version is `gsl-config --version`." >&2
exit
fi
# 15. CHECK TO SEE WHETHER THIS SYSTEM HAS FFTW HEADERS
echo $ECHO_N "Checking for libfftw3-dev ............. $ECHO_C"
if printf '#include <fftw3.h>\nint main() { return 0; }\n' | gcc -x c - -o conf.out > conf.stdout 2> conf.stderr
then
rm -f conf.*
echo "YES"
echo "HAVE_FFTW3=-D HAVE_FFTW3=1" >> Makefile
echo "LINK_FFTW=-lfftw3" >> Makefile
else
rm -f conf.*
echo "NO"
echo $ECHO_N "Checking for libfftw2-dev ............. $ECHO_C"
if printf '#include <fftw.h>\nint main() { return 0; }\n' | gcc -x c - -o conf.out > conf.stdout 2> conf.stderr
then
rm -f conf.*
echo "YES"
echo "LINK_FFTW=-lfftw" >> Makefile
else
rm -f conf.*
echo "NO"
echo "ERROR: Header files for required library 'libfftw' could not be found." >&2
exit
fi
fi
# 16. CHECK TO SEE WHETHER THIS SYSTEM HAS LIBXML2 HEADERS
echo $ECHO_N "Checking for libxml2-dev ............. $ECHO_C"
if pkg-config --exists libxml-2.0 ; then
echo "YES"
else
echo "NO"
echo "ERROR: Header files for required library 'libxml2' could not be found." >&2
exit
fi
# 17. CHECK TO SEE WHETHER THIS SYSTEM HAS LIBPNG HEADERS
echo $ECHO_N "Checking for libpng-dev ............. $ECHO_C"
if printf '#include <stdlib.h>\n#include <stdio.h>\n#include <png.h>\nint main() { return 0; }\n' | gcc -x c - -o conf.out > conf.stdout 2> conf.stderr
then
rm -f conf.*
echo "YES"
else
rm -f conf.*
echo "NO"
echo "ERROR: Header files for required library 'libpng' could not be found." >&2
exit
fi
# 18. CHECK TO SEE WHETHER THIS SYSTEM HAS KPATHSEA HEADERS
echo $ECHO_N "Checking for libkpathsea-dev ............. $ECHO_C"
if printf '#include <stdlib.h>\n#include <stdio.h>\n#include <kpathsea/kpathsea.h>\nint main() { return 0; }\n' | gcc -x c - -o conf.out > conf.stdout 2> conf.stderr
then
rm -f conf.*
echo "YES"
echo "HAVE_KPATHSEA=-D HAVE_KPATHSEA=1" >> Makefile
echo "LINK_KPATHSEA=-lkpathsea" >> Makefile
echo "KPSE_COMMAND=/dev/null" >> Makefile
else
rm -f conf.*
echo "NO"
echo "HAVE_KPATHSEA=-D NOHAVE_KPATHSEA=1" >> Makefile
echo "LINK_KPATHSEA=" >> Makefile
# If we don't have libkpathsea, check that we do have kpsewhich
echo $ECHO_N "Checking for kpsewhich ............. $ECHO_C"
whichout=`which kpsewhich 2> conf.stderr`
rm -f conf.*
if test "`echo $whichout | sed 's/\([a-z]*\).*/\1/'`" = "no" ; then whichout="" ; fi
if test "$whichout" != "" ; then
echo "YES"
echo "KPSE_COMMAND=${whichout}" >> Makefile
else
echo "NO" ; echo "ERROR: Neither the header files for the library 'libkpathsea-dev', nor the program kpsewhich could not be found." >&2 ; exit
fi
fi
# 19. OUTPUT MAKEFILE
cat Makefile.skel >> Makefile
echo "Configuration successful."
echo "To continue installation, type '${MAKE_COMMAND}'."