405
|
1 dnl configure.in |
|
2 dnl |
5
|
3 dnl Process this file with autoconf to produce a configure script. |
405
|
4 dnl Requires GNU autoconf 1.8 or later. |
5
|
5 dnl |
405
|
6 dnl Copyright (C) 1992, 1993, 1994 John W. Eaton |
|
7 dnl |
|
8 dnl This file is part of Octave. |
|
9 dnl |
|
10 dnl Octave is free software; you can redistribute it and/or modify it |
|
11 dnl under the terms of the GNU General Public License as published by the |
|
12 dnl Free Software Foundation; either version 2, or (at your option) any |
|
13 dnl later version. |
|
14 dnl |
|
15 dnl Octave is distributed in the hope that it will be useful, but WITHOUT |
|
16 dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
17 dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
18 dnl for more details. |
|
19 dnl |
|
20 dnl You should have received a copy of the GNU General Public License |
|
21 dnl along with Octave; see the file COPYING. If not, write to the Free |
|
22 dnl Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
23 dnl |
859
|
24 AC_REVISION($Revision: 1.69 $)dnl |
|
25 AC_PREREQ(2.0) |
405
|
26 AC_INIT(src/octave.cc) |
679
|
27 AC_CONFIG_HEADER(config.h kpathsea/c-auto.h) |
369
|
28 dnl |
236
|
29 AC_DEFINE(OCTAVE_SOURCE, 1)dnl |
369
|
30 dnl |
405
|
31 dnl See if we were given the target host type. If not, use |
|
32 dnl config.guess to try to guess the target host type. |
369
|
33 dnl |
859
|
34 AC_CANONICAL_HOST |
|
35 target_host_type=${host:=unknown} |
|
36 canonical_host_type=${host:=unknown} |
|
37 if test "$host" = "unknown"; then |
|
38 AC_MSG_WARN([configuring Octave for unknown system type |
|
39 ]) |
294
|
40 fi |
5
|
41 AC_SUBST(target_host_type)dnl |
369
|
42 dnl |
405
|
43 dnl Allow the user to force us to use f2c. |
369
|
44 dnl |
832
|
45 AC_ARG_WITH(f2c, |
|
46 [ --with-f2c use f2c even if Fortran compiler is available], |
|
47 use_f2c=true, use_f2c=false)dnl |
405
|
48 dnl |
|
49 dnl Allow the user to experiment with dynamic linking using GNU dld. |
|
50 dnl |
832
|
51 AC_ARG_ENABLE(dld, |
|
52 [ --enable-dld use DLD for dynamic linking (not all systems)], |
|
53 use_dld=true, use_dld=false)dnl |
702
|
54 AC_SUBST(use_dld)dnl |
|
55 dnl |
|
56 dnl Allow compilation of smaller kernel. This only works if some form |
|
57 dnl of dynamic linking is also supported and used. |
|
58 dnl |
832
|
59 AC_ARG_ENABLE(lite-kernel, |
|
60 [ --enable-lite-kernel compile smaller kernel (requires DLD)], |
|
61 lite_kernel=true, lite_kernel=false)dnl |
702
|
62 if $lite_kernel; then |
|
63 AC_DEFINE(OCTAVE_LITE, 1)dnl |
|
64 fi |
|
65 AC_SUBST(lite_kernel)dnl |
369
|
66 dnl |
666
|
67 dnl some defaults |
424
|
68 dnl |
859
|
69 AC_PREFIX_DEFAULT(/usr/local) |
|
70 dnl |
666
|
71 exec_prefix='$(prefix)' |
|
72 bindir='$(exec_prefix)/bin' |
|
73 datadir='$(prefix)/lib' |
|
74 libdir='$(exec_prefix)/lib' |
765
|
75 includedir='$(prefix)/include/octave' |
666
|
76 mandir='$(prefix)/man/man1' |
|
77 infodir='$(prefix)/info' |
684
|
78 fcnfiledir='$(datadir)/octave/$(version)/m' |
827
|
79 localfcnfiledir='$(datadir)/octave/site/m' |
|
80 localfcnfilepath='$(localfcnfiledir)//' |
795
|
81 archlibdir='$(libdir)/octave/$(version)/exec/$(target_host_type)' |
|
82 octfiledir='$(libdir)/octave/$(version)/oct/$(target_host_type)' |
827
|
83 localoctfiledir='$(datadir)/octave/site/oct/$(target_host_type)' |
|
84 localoctfilepath='$(localoctfiledir)//' |
765
|
85 fcnfilepath='.:$(localoctfilepath):$(localfcnfilepath):$(octfiledir)//:$(fcnfiledir)//' |
827
|
86 imagedir='$(datadir)/octave/$(version)/imagelib' |
|
87 imagepath='.:$(imagedir)//' |
666
|
88 dnl |
832
|
89 AC_MSG_RESULT([defining prefix to be $prefix]) |
|
90 AC_MSG_RESULT([defining exec_prefix to be $exec_prefix]) |
|
91 AC_MSG_RESULT([defining bindir to be $bindir]) |
|
92 AC_MSG_RESULT([defining datadir to be $datadir]) |
|
93 AC_MSG_RESULT([defining libdir to be $libdir]) |
|
94 AC_MSG_RESULT([defining includedir to be $includedir]) |
|
95 AC_MSG_RESULT([defining mandir to be $mandir]) |
|
96 AC_MSG_RESULT([defining infodir to be $infodir]) |
|
97 AC_MSG_RESULT([defining fcnfiledir to be $fcnfiledir]) |
|
98 AC_MSG_RESULT([defining localfcnfiledir to be $localfcnfiledir]) |
|
99 AC_MSG_RESULT([defining localfcnfilepath to be $localfcnfilepath]) |
|
100 AC_MSG_RESULT([defining archlibdir to be $archlibdir]) |
|
101 AC_MSG_RESULT([defining octfiledir to be $octfiledir]) |
|
102 AC_MSG_RESULT([defining localoctfiledir to be $localoctfiledir]) |
|
103 AC_MSG_RESULT([defining localoctfilepath to be $localoctfilepath]) |
|
104 AC_MSG_RESULT([defining fcnfilepath to be $fcnfilepath]) |
|
105 AC_MSG_RESULT([defining imagedir to be $imagedir]) |
|
106 AC_MSG_RESULT([defining imagepath to be $imagepath]) |
666
|
107 AC_SUBST(exec_prefix) |
|
108 AC_SUBST(bindir) |
|
109 AC_SUBST(datadir) |
|
110 AC_SUBST(libdir) |
|
111 AC_SUBST(includedir) |
|
112 AC_SUBST(mandir) |
|
113 AC_SUBST(infodir) |
|
114 AC_SUBST(fcnfiledir) |
827
|
115 AC_SUBST(localfcnfiledir) |
666
|
116 AC_SUBST(localfcnfilepath) |
|
117 AC_SUBST(archlibdir) |
|
118 AC_SUBST(octfiledir) |
827
|
119 AC_SUBST(localoctfiledir) |
666
|
120 AC_SUBST(localoctfilepath) |
|
121 AC_SUBST(fcnfilepath) |
827
|
122 AC_SUBST(imagedir) |
684
|
123 AC_SUBST(imagepath) |
424
|
124 dnl |
781
|
125 dnl Do special stuff if using dld. |
|
126 dnl |
5
|
127 DLD_DIR= |
|
128 LIBDLD= |
759
|
129 LIBOCTDLD='liboctdld.a' |
5
|
130 LD_STATIC_FLAG= |
|
131 if $use_dld; then |
518
|
132 DLD_DIR=dld |
759
|
133 LIBDLD='../dld/libdld.a' |
702
|
134 # don't link them in only if doing dynamic linking and small kernel |
|
135 # requested. |
|
136 if $lite_kernel; then |
|
137 LIBOCTDLD= |
|
138 fi |
518
|
139 LD_STATIC_FLAG=-static |
|
140 AC_DEFINE(WITH_DLD, 1)dnl |
|
141 fi |
781
|
142 dnl |
|
143 dnl Also use -static if compiling on Alpha OSF/1 1.3 systems. |
|
144 dnl |
|
145 case "$canonical_host_type" in |
|
146 alpha-dec-osf1.3) |
|
147 LD_STATIC_FLAG=-static |
|
148 ;; |
|
149 esac |
|
150 dnl |
518
|
151 if test -n "$DLD_DIR"; then |
832
|
152 AC_MSG_RESULT([defining DLD_DIR to be $DLD_DIR]) |
518
|
153 fi |
|
154 if test -n "$LIBDLD"; then |
832
|
155 AC_MSG_RESULT([defining LIBDLD to be $LIBDLD]) |
518
|
156 fi |
|
157 if test -n "$LIBOCTDLD"; then |
832
|
158 AC_MSG_RESULT([defining LIBOCTDLD to be $LIBOCTDLD]) |
518
|
159 fi |
|
160 if test -n "$LD_STATIC_FLAG"; then |
832
|
161 AC_MSG_RESULT([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG]) |
5
|
162 fi |
|
163 AC_SUBST(DLD_DIR)dnl |
|
164 AC_SUBST(LIBDLD)dnl |
518
|
165 AC_SUBST(LIBOCTDLD)dnl |
5
|
166 AC_SUBST(LD_STATIC_FLAG)dnl |
369
|
167 dnl |
405
|
168 dnl See if the optional nonlinear programming code is present. |
|
169 dnl |
832
|
170 AC_MSG_CHECKING([for npsol]) |
5
|
171 if test -f $srcdir/libcruft/npsol/npsol.f; then |
832
|
172 AC_MSG_RESULT([yes]) |
5
|
173 else |
832
|
174 AC_MSG_RESULT([no]) |
236
|
175 AC_DEFINE(NPSOL_MISSING, 1)dnl |
5
|
176 fi |
369
|
177 dnl |
832
|
178 AC_MSG_CHECKING([for qpsol]) |
5
|
179 if test -f $srcdir/libcruft/qpsol/qpsol.f; then |
832
|
180 AC_MSG_RESULT([yes]) |
5
|
181 else |
832
|
182 AC_MSG_RESULT([no]) |
236
|
183 AC_DEFINE(QPSOL_MISSING, 1)dnl |
5
|
184 fi |
369
|
185 dnl |
832
|
186 AC_MSG_CHECKING([for fsqp]) |
5
|
187 if test -f $srcdir/libcruft/fsqp/fsqpd.f; then |
832
|
188 AC_MSG_RESULT([yes]) |
5
|
189 else |
832
|
190 AC_MSG_RESULT([no]) |
236
|
191 AC_DEFINE(FSQP_MISSING, 1)dnl |
5
|
192 fi |
369
|
193 dnl |
405
|
194 dnl See which C++ compiler to use (we expect to find g++). |
|
195 dnl |
|
196 AC_PROG_CXX |
|
197 AC_PROG_CXXCPP |
|
198 dnl |
|
199 dnl Do special things for g++. |
|
200 dnl |
|
201 ADD_CXX_WALL=false |
759
|
202 NO_IMPLICIT_TEMPLATES= |
405
|
203 gxx_version=`$CXX -v 2>&1 | grep "^g.. version" | sed 's/^g.. version *//'` |
|
204 case "$gxx_version" in |
832
|
205 changequote(,)dnl |
|
206 2.[6789].*|2.[123456789][0123456789].*) |
|
207 changequote([,])dnl |
405
|
208 CXXFLAGS="-g -O" |
832
|
209 AC_MSG_RESULT([defining CXXFLAGS to be $CXXFLAGS]) |
759
|
210 NO_IMPLICIT_TEMPLATES="-fno-implicit-templates" |
832
|
211 AC_MSG_RESULT([defining NO_IMPLICIT_TEMPLATES to be $NO_IMPLICIT_TEMPLATES]) |
405
|
212 ADD_CXX_WALL=true |
|
213 ;; |
832
|
214 changequote(,)dnl |
|
215 1.*|2.[012345].*) |
|
216 changequote([,])dnl |
|
217 AC_MSG_WARN([g++ version $gxx_version will not work to compile Octave]) |
405
|
218 ;; |
|
219 *) |
832
|
220 AC_MSG_WARN([Octave has only been tested with g++, and I can't find it]) |
405
|
221 ;; |
|
222 esac |
|
223 dnl |
708
|
224 dnl See what libraries are used by the C++ compiler. Need this for |
|
225 dnl dynamic linking. |
|
226 dnl |
|
227 CXXLIBS=`sh $srcdir/cxxlibs.sh` |
832
|
228 AC_MSG_RESULT([defining CXXLIBS to be $CXXLIBS]) |
708
|
229 dnl |
405
|
230 AC_SUBST(CXXFLAGS)dnl |
759
|
231 AC_SUBST(NO_IMPLICIT_TEMPLATES)dnl |
708
|
232 AC_SUBST(CXXLIBS)dnl |
405
|
233 dnl |
|
234 dnl See which C compiler to use (we expect to find gcc). |
|
235 dnl |
5
|
236 AC_PROG_CC |
405
|
237 AC_PROG_CPP |
832
|
238 AC_PROG_GCC_TRADITIONAL |
369
|
239 dnl |
|
240 dnl Do special things for gcc. |
|
241 dnl |
405
|
242 ADD_CC_WALL=false |
|
243 gcc_version=`$CC -v 2>&1 | grep "^gcc version" | sed 's/^gcc version *//'` |
|
244 case "$gcc_version" in |
|
245 2.*) |
|
246 CFLAGS="-g -O" |
832
|
247 AC_MSG_RESULT([defining CFLAGS to be $CFLAGS]) |
638
|
248 LDFLAGS="-g" |
832
|
249 AC_MSG_RESULT([defining LDFLAGS to be $LDFLAGS]) |
405
|
250 ADD_CC_WALL=true |
|
251 ;; |
|
252 1.*) |
832
|
253 AC_MSG_WARN([gcc version $gcc_version is likely to cause problems]) |
405
|
254 ;; |
5
|
255 *) |
832
|
256 AC_MSG_WARN([Octave has only been tested with gcc, and I can't find it]) |
405
|
257 ;; |
5
|
258 esac |
405
|
259 dnl |
5
|
260 AC_SUBST(CFLAGS)dnl |
|
261 AC_SUBST(LDFLAGS)dnl |
369
|
262 dnl |
405
|
263 dnl On Linux systems we need to compile with -mieee-fp to get full |
|
264 dnl support for IEEE floating point. |
369
|
265 dnl |
350
|
266 case "$canonical_host_type" in |
|
267 i386-*-linux | i486-*-linux | i586-*-linux) |
|
268 GCC_IEEE_FP_FLAG="-mieee-fp" |
832
|
269 AC_MSG_RESULT([defining GCC_IEEE_FP_FLAG to be $GCC_IEEE_FP_FLAG]) |
324
|
270 ;; |
|
271 esac |
405
|
272 dnl |
324
|
273 AC_SUBST(GCC_IEEE_FP_FLAG)dnl |
369
|
274 dnl |
405
|
275 dnl Special checks for odd OS specific things. |
|
276 dnl |
|
277 AC_ISC_POSIX |
|
278 AC_MINIX |
|
279 AC_AIX |
832
|
280 AC_FUNC_STRFTIME |
|
281 AC_CHECK_LIB(sun, getpwnam) |
405
|
282 dnl |
832
|
283 dnl How big are ints and how are they oriented? These could probably |
|
284 dnl be eliminated in favor of run-time checks. |
589
|
285 dnl |
832
|
286 AC_CHECK_SIZEOF(short) |
|
287 AC_CHECK_SIZEOF(int) |
|
288 AC_CHECK_SIZEOF(long) |
|
289 AC_C_BIGENDIAN |
589
|
290 dnl |
832
|
291 dnl Try to determine the floating point format. This could probably |
|
292 dnl be eliminated in favor of run-time checks. |
588
|
293 dnl |
832
|
294 AC_MSG_CHECKING([floating point format]) |
602
|
295 changequote(,)dnl |
|
296 XCFLAGS=`echo $CFLAGS | sed 's/-O[^ \t]*//'` |
|
297 changequote([,])dnl |
|
298 ${CC-cc} -DDP $XCFLAGS $LDFLAGS $srcdir/float-type.c -o conftest >/dev/null 2>&1 |
588
|
299 FLOAT_FORMAT=`./conftest` |
|
300 case "$FLOAT_FORMAT" in |
|
301 IEEE_BIG_ENDIAN) |
832
|
302 AC_MSG_RESULT([IEEE big endian]) |
588
|
303 AC_DEFINE(IEEE_BIG_ENDIAN, 1)dnl |
|
304 ;; |
|
305 IEEE_LITTLE_ENDIAN) |
832
|
306 AC_MSG_RESULT([IEEE little endian]) |
588
|
307 AC_DEFINE(IEEE_LITTLE_ENDIAN, 1)dnl |
|
308 ;; |
|
309 VAX_D_FLOAT) |
832
|
310 AC_MSG_RESULT([VAX D floating]) |
588
|
311 AC_DEFINE(VAX_D_FLOAT, 1)dnl |
|
312 ;; |
|
313 VAX_G_FLOAT) |
832
|
314 AC_MSG_RESULT([VAX G floating]) |
588
|
315 AC_DEFINE(VAX_G_FLOAT, 1)dnl |
|
316 ;; |
|
317 *) |
832
|
318 AC_MSG_RESULT() |
|
319 AC_MSG_WARN("unrecognized floating point format!") |
588
|
320 ;; |
|
321 esac |
|
322 dnl |
405
|
323 dnl Does the C compiler handle alloca() and const correctly? |
|
324 dnl |
|
325 AC_ALLOCA |
679
|
326 dnl |
832
|
327 dnl This one is for kpathsea. |
|
328 dnl |
679
|
329 dnl It would be nicer to test for the requisite putenv features directly, |
|
330 dnl but can't figure out how to do that. |
|
331 dnl |
|
332 if test "`(uname) 2>/dev/null`" = NetBSD \ |
|
333 || test "`(uname) 2>/dev/null`" = FreeBSD; then |
|
334 AC_DEFINE(SMART_PUTENV) |
|
335 fi |
|
336 dnl |
832
|
337 AC_C_CONST |
405
|
338 dnl |
369
|
339 dnl If we haven't been forced to use f2c, try to find a Fortran compiler |
|
340 dnl under any one of several common Un*x Fortran compiler names. |
|
341 dnl Put fc last to avoid confusion with some vendor's /bin/sh fc |
|
342 dnl builtin. |
|
343 dnl |
|
344 dnl xlf : IBM / AIX |
|
345 dnl cf77 : Cray / Unicos |
405
|
346 dnl g77 : GNU Fortran (someday...) |
369
|
347 dnl fc : Convex |
|
348 dnl |
|
349 dnl I don't think the Cray compiler will ever work like f2c... |
|
350 dnl |
5
|
351 if $use_f2c; then |
|
352 true |
|
353 else |
|
354 F77= |
832
|
355 AC_CHECK_PROGS(F77, xlf cf77 f77 g77 fc)dnl |
5
|
356 |
|
357 # If it looks like we have a Fortran compiler, try to determine |
|
358 # whether it might be compatible with f2c. |
|
359 |
|
360 if test -n "$F77"; then |
832
|
361 AC_MSG_CHECKING([$F77/f2c compatibility]) |
5
|
362 export F77 |
|
363 export CC |
|
364 tmpdef=`sh $srcdir/f2c-compat.sh $srcdir/flibs.sh` |
|
365 status=$? |
|
366 if test $status -eq 0; then |
832
|
367 AC_MSG_RESULT([yes]) |
5
|
368 if test "$tmpdef" = '-DF77_APPEND_UNDERSCORE=1'; then |
236
|
369 AC_DEFINE(F77_APPEND_UNDERSCORE, 1)dnl |
5
|
370 fi |
|
371 else |
832
|
372 AC_MSG_RESULT([no]) |
5
|
373 F77= |
|
374 fi |
|
375 fi |
|
376 fi |
369
|
377 dnl |
|
378 dnl If we can't find a Fortran compiler, or if it looks like it isn't |
|
379 dnl compatible with f2c, try to find f2c. |
|
380 dnl |
5
|
381 if test -z "$F77"; then |
832
|
382 AC_CHECK_PROG(F2C, f2c, f2c, [])dnl |
5
|
383 fi |
369
|
384 dnl |
5
|
385 F2CFLAGS= |
|
386 FFLAGS="-O" |
832
|
387 AC_MSG_RESULT([defining FFLAGS to be $FFLAGS]) |
5
|
388 if test -n "$F77"; then |
|
389 export F77 |
|
390 FLIBS=`sh $srcdir/flibs.sh` |
832
|
391 AC_MSG_RESULT([defining FLIBS to be $FLIBS]) |
5
|
392 DOT_O_DOT_F_C1= |
|
393 DOT_O_DOT_F_C2= |
|
394 DOT_O_DOT_F_C3= |
|
395 DOT_O_DOT_F_C4= |
|
396 DEFAULT_DOT_C_FROM_DOT_F= |
|
397 DEFAULT_DOT_O_FROM_DOT_F= |
|
398 elif test -n "$F2C" || $use_f2c; then |
832
|
399 AC_CHECK_LIB(f2c, main, FLIBS=-lf2c, [])dnl |
5
|
400 if test -z "$FLIBS" ; then |
832
|
401 AC_CHECK_LIB(F77, main, FLIBS=-lF77, [])dnl |
5
|
402 if test -n "$FLIBS" ; then |
832
|
403 AC_CHECK_LIB(I77, main, FLIBS="$FLIBS -lI77", [])dnl |
5
|
404 fi |
|
405 fi |
|
406 if test -z "$FLIBS" ; then |
832
|
407 AC_MSG_WARN([I found f2c but not libf2c.a, or libF77.a and libI77.a]) |
5
|
408 fi |
|
409 DEFAULT_DOT_C_FROM_DOT_F='# A rule for making C source from Fortran source.\ |
|
410 # If we are using f2c we should also turn off the default rule for\ |
|
411 # making objects from .f files so that we do not invoke the fortran\ |
|
412 # compiler by mistake.\ |
|
413 \ |
|
414 \%.c : \%.f\ |
|
415 cat $< | $(F2C) $(F2CFLAGS) > $(@F)' |
832
|
416 AC_MSG_RESULT([defining DEFAULT_DOT_C_FROM_DOT_F to be $DEFAULT_DOT_C_FROM_DOT_F]) |
5
|
417 DEFAULT_DOT_O_FROM_DOT_F='\%.o : \%.f' |
832
|
418 AC_MSG_RESULT([defining DEFAULT_DOT_O_FROM_DOT_F to be $DEFAULT_DOT_O_FROM_DOT_F]) |
236
|
419 AC_DEFINE(F77_APPEND_UNDERSCORE, 1)dnl |
5
|
420 else |
832
|
421 AC_MSG_WARN([in order to build octave, you must have a compatible]) |
|
422 AC_MSG_WARN([Fortran compiler or f2c installed and in your path.]) |
|
423 AC_MSG_WARN([See the file INSTALL for more information.]) |
|
424 AC_MSG_WARN([Continuing anyway...]) |
5
|
425 fi |
369
|
426 dnl |
794
|
427 AC_SUBST(F77)dnl |
5
|
428 AC_SUBST(FFLAGS)dnl |
|
429 AC_SUBST(FLIBS)dnl |
|
430 AC_SUBST(F2C)dnl |
|
431 AC_SUBST(F2CFLAGS)dnl |
|
432 AC_SUBST(DEFAULT_DOT_C_FROM_DOT_F)dnl |
|
433 AC_SUBST(DEFAULT_DOT_O_FROM_DOT_F)dnl |
369
|
434 dnl |
708
|
435 dnl Extract libraries and directories from FLIBS and CXXLIBS. |
|
436 dnl |
|
437 dnl Leave only libraries, with -lfoo converted to libfoo.a: |
|
438 dnl |
|
439 changequote(,)dnl |
843
|
440 FLIB_LIST=`echo " $FLIBS " | sed -e 's/ -Xlinker *[^ ]*/ /g' \ |
842
|
441 -e 's/ -L *[^ ]*/ /g' \ |
843
|
442 -e 's/ -l *\([^ ]*\)/ lib\1.a/g' -e 's/ -u *[^ ]*/ /g' \ |
832
|
443 -e 's/^ *//' -e 's/ *$//' -e 's/ */:/g'` |
708
|
444 dnl |
843
|
445 CXXLIB_LIST=`echo " $CXXLIBS " | sed -e 's/ -Xlinker *[^ ]*/ /g' \ |
842
|
446 -e 's/ -L *[^ ]*/ /g' \ |
843
|
447 -e 's/ -l *\([^ ]*\)/ lib\1.a/g' -e 's/ -u *[^ ]*/ /g' \ |
708
|
448 -e 's/^ *//' -e 's/ *$//' -e 's/ */:/g'` |
|
449 dnl |
|
450 dnl Leave only directories where libraries might be found: |
|
451 dnl |
843
|
452 FLIB_PATH=`echo " $FLIBS " | sed \ |
|
453 -e 's/ / /g' -e 's/ -Xlinker *[^ ]*/ /g' \ |
|
454 -e 's/ -L *\([^ ]*\)/ \1/g' -e 's, /[^ ]*\.a , ,g' \ |
|
455 -e 's/ -l *[^ ]*/ /g' -e 's/ -u *[^ ]*/ /g' -e 's/^ *//' \ |
708
|
456 -e 's/ *$//' -e 's/ */:/g'` |
|
457 dnl |
843
|
458 CXXLIB_PATH=`echo " $CXXLIBS " | sed -e 's/ -Xlinker *[^ ]*/ /g' \ |
|
459 -e 's/ -L *\([^ ]*\)/ \1/g' -e 's, /[^ ]*\.a , ,g' \ |
|
460 -e 's/ / /g' -e 's/ -Xlinker *[^ ]*/ /g' \ |
|
461 -e 's/ -l *[^ ]*/ /g' -e 's/ -u *[^ ]*/ /g' -e 's/^ *//' \ |
832
|
462 -e 's/ *$//' -e 's/ */:/g'` |
708
|
463 changequote([,])dnl |
|
464 dnl |
832
|
465 AC_MSG_RESULT([defining FLIB_LIST to be $FLIB_LIST]) |
|
466 AC_MSG_RESULT([defining FLIB_PATH to be $FLIB_PATH]) |
708
|
467 dnl |
832
|
468 AC_MSG_RESULT([defining CXXLIB_LIST to be $CXXLIB_LIST]) |
|
469 AC_MSG_RESULT([defining CXXLIB_PATH to be $CXXLIB_PATH]) |
708
|
470 dnl |
|
471 AC_SUBST(FLIB_LIST)dnl |
|
472 AC_SUBST(FLIB_PATH)dnl |
|
473 dnl |
|
474 AC_SUBST(CXXLIB_LIST)dnl |
|
475 AC_SUBST(CXXLIB_PATH)dnl |
|
476 dnl |
405
|
477 dnl Checks for header files. |
|
478 dnl |
832
|
479 AC_HEADER_STDC |
|
480 AC_CHECK_HEADERS(assert.h float.h limits.h memory.h pwd.h stdlib.h)dnl |
|
481 AC_CHECK_HEADERS(string.h varargs.h unistd.h floatingpoint.h)dnl |
|
482 AC_CHECK_HEADERS(sys/utsname.h sys/time.h sys/fcntl.h)dnl |
|
483 AC_CHECK_HEADERS(sys/ttold.h sys/ptem.h sys/select.h)dnl |
|
484 AC_HEADER_DIRENT |
792
|
485 AC_TIME_WITH_SYS_TIME |
369
|
486 dnl |
|
487 dnl Use sgtty on Ultrix so that using DEC Migrate to convert a Mips |
832
|
488 dnl binary to an Alpha binary will work. Also on Alpha/OSF to avoid |
|
489 dnl a readline bug. |
369
|
490 dnl |
832
|
491 OCTAVE_HAVE_TERM_HEADER=false |
294
|
492 case "$canonical_host_type" in |
521
|
493 mips-dec-ultrix* | alpha-dec-osf*) |
832
|
494 AC_CHECK_HEADER(sgtty.h, [AC_DEFINE(HAVE_SGTTY_H, 1) |
|
495 OCTAVE_HAVE_TERM_HEADER=true], []) |
294
|
496 ;; |
|
497 esac |
369
|
498 dnl |
832
|
499 if $OCTAVE_HAVE_TERM_HEADER; then |
|
500 true |
|
501 else |
|
502 AC_CHECK_HEADER(termios.h, [AC_DEFINE(HAVE_TERMIOS_H, 1) |
|
503 OCTAVE_HAVE_TERM_HEADER=true], |
|
504 AC_CHECK_HEADER(termio.h, [AC_DEFINE(HAVE_TERMIO_H, 1) |
|
505 OCTAVE_HAVE_TERM_HEADER=true], |
|
506 AC_CHECK_HEADER(sgtty.h, [AC_DEFINE(HAVE_SGTTY_H, 1) |
|
507 OCTAVE_HAVE_TERM_HEADER=true], []))) |
|
508 fi |
|
509 if $OCTAVE_HAVE_TERM_HEADER; then |
|
510 true |
|
511 else |
|
512 AC_MSG_ERROR([I couldn't find termios.h, termio.h, or sgtty.h!]) |
|
513 fi |
405
|
514 dnl |
|
515 dnl Checks for functions. |
|
516 dnl |
832
|
517 AC_CHECK_FUNCS(setvbuf getcwd gethostname bzero rindex vfprintf vsprintf)dnl |
|
518 AC_CHECK_FUNCS(stricmp strnicmp strcasecmp strncasecmp strerror)dnl |
|
519 AC_CHECK_FUNCS(atexit on_exit tempnam memmove putenv gettimeofday)dnl |
|
520 dnl |
|
521 dnl Would like to get rid of this cruft, and just have |
|
522 dnl |
|
523 dnl AC_CHECK_FUNCS(finite isnan isinf) |
|
524 dnl |
|
525 dnl instead, but that used to fail on some systems... |
369
|
526 dnl |
|
527 dnl Check to see if we have IEEE math functions, and if so, which ones. |
|
528 dnl |
|
529 dnl For Linux: add -mieee-fp flag to CFLAGS when checking for IEEE FP |
|
530 dnl functions, otherwise we may not find them. |
|
531 dnl |
832
|
532 dnl Also just using AC_CHECK_FUNCS doesn't seem to work to find isinf |
|
533 dnl and isnan on Linux systems, so we use AC_CHECK_FUNC, and if that |
369
|
534 dnl fails, we try again by including math.h and invoking the function |
|
535 dnl with an argument. |
|
536 dnl |
|
537 dnl Also check for some additional trig functions that aren't ANSI but |
|
538 dnl are often available. If they are missing, we try to replace them |
|
539 dnl with functions from the BSD/NET2 math library. |
|
540 dnl |
832
|
541 AC_CHECK_LIB(sunmath, main)dnl |
|
542 AC_CHECK_LIB(m, main)dnl |
405
|
543 dnl |
360
|
544 XCFLAGS="$CFLAGS" |
351
|
545 CFLAGS="$CFLAGS $GCC_IEEE_FP_FLAG" |
764
|
546 dnl |
832
|
547 AC_CHECK_FUNCS(finite isnan isinf infinity quiet_nan erf erfc lgamma)dnl |
369
|
548 dnl |
832
|
549 AC_MSG_CHECKING([for signgam declaration in math.h]) |
|
550 AC_TRY_LINK([#include <math.h>], |
706
|
551 [int foo = signgam + 1;], |
832
|
552 AC_MSG_RESULT(yes) |
|
553 AC_DEFINE(SIGNGAM_DECLARED, 1), |
|
554 AC_MSG_RESULT(no))dnl |
706
|
555 dnl |
360
|
556 CFLAGS="$XCFLAGS" |
405
|
557 dnl |
|
558 dnl Check for nonstandard but common trig functions that we need. |
|
559 dnl If they are missing, we replace them using functions from the BSD |
|
560 dnl math library, and we may need to replace some other functions too. |
|
561 dnl |
|
562 AC_REPLACE_FUNCS(acosh asinh atanh) |
369
|
563 dnl |
5
|
564 if test -n "$LIBOBJS"; then |
|
565 for func in $LIBOBJS |
|
566 do |
|
567 case "$func" in |
|
568 *acosh.o*) |
236
|
569 AC_DEFINE(ACOSH_MISSING, 1)dnl |
405
|
570 ;; |
5
|
571 *asinh.o*) |
236
|
572 AC_DEFINE(ASINH_MISSING, 1)dnl |
405
|
573 ;; |
5
|
574 *atanh.o*) |
236
|
575 AC_DEFINE(ATANH_MISSING, 1)dnl |
405
|
576 ;; |
5
|
577 esac |
|
578 done |
|
579 case $LIBOBJS in |
|
580 *acosh.o* | *asinh.o*) |
405
|
581 AC_REPLACE_FUNCS(copysign) |
|
582 ;; |
5
|
583 esac |
|
584 case $LIBOBJS in |
|
585 *acosh.o* | *asinh.o* | *atanh.o*) |
405
|
586 AC_REPLACE_FUNCS(log1p) |
|
587 ;; |
5
|
588 esac |
|
589 case $LIBOBJS in |
|
590 *log1p*) |
405
|
591 AC_REPLACE_FUNCS(log__L) |
|
592 ;; |
5
|
593 esac |
|
594 case $LIBOBJS in |
|
595 *log1p*) |
405
|
596 AC_REPLACE_FUNCS(finite) |
|
597 ;; |
5
|
598 esac |
|
599 case $LIBOBJS in |
|
600 *copysign* | *finite* | *log1p*) |
405
|
601 AC_REPLACE_FUNCS(logb scalb) |
|
602 ;; |
5
|
603 esac |
|
604 fi |
369
|
605 dnl |
405
|
606 dnl Checks for OS specific cruft. |
|
607 dnl |
|
608 AC_STRUCT_TM |
832
|
609 AC_FUNC_SETVBUF_REVERSED |
405
|
610 TERMLIBS="" |
|
611 for termlib in termcap terminfo curses termlib ; do |
832
|
612 AC_CHECK_LIB(${termlib}, main, [TERMLIBS="${TERMLIBS} -l${termlib}"]) |
405
|
613 case "${TERMLIBS}" in |
|
614 *-l${termlib}*) |
832
|
615 AC_MSG_RESULT([defining TERMLIBS to be $TERMLIBS]) |
405
|
616 break |
|
617 ;; |
|
618 esac |
|
619 done |
505
|
620 dnl |
832
|
621 AC_MSG_CHECKING([for struct exception in math.h]) |
|
622 AC_TRY_LINK([#include <math.h>], |
|
623 [struct exception *x; x->type; x->name;], |
835
|
624 AC_MSG_RESULT(yes) |
832
|
625 AC_DEFINE(EXCEPTION_IN_MATH, 1), |
|
626 AC_MSG_RESULT(no))dnl |
505
|
627 dnl |
405
|
628 AC_SUBST(TERMLIBS) |
|
629 dnl |
834
|
630 dnl Signal stuff. |
|
631 dnl |
|
632 AC_TYPE_SIGNAL |
|
633 AC_SYS_SIGLIST_DECLARED |
|
634 dnl |
405
|
635 dnl Define VOID_SIGHANDLER for readline. |
|
636 dnl |
|
637 case "$RETSIGTYPE" in |
|
638 int) |
|
639 ;; |
|
640 *) |
|
641 VOID_SIGHANDLER="-DVOID_SIGHANDLER=1" |
832
|
642 AC_MSG_RESULT([defining VOID_SIGHANDLER to be 1]) |
405
|
643 ;; |
|
644 esac |
|
645 AC_SUBST(VOID_SIGHANDLER)dnl |
|
646 dnl |
|
647 dnl Checks for other programs used for building, testing, installing, |
|
648 dnl and running Octave. |
369
|
649 dnl |
405
|
650 dnl For now, don't define LEXLIB to be -lfl -- we don't use anything in |
|
651 dnl it, and it might not be installed. |
|
652 dnl |
|
653 dnl Also make sure that we generate an interactive scanner if we are |
|
654 dnl using flex. |
|
655 dnl |
|
656 AC_PROG_LEX |
|
657 case "$LEX" in |
|
658 flex*) |
|
659 LFLAGS="-t -I" |
832
|
660 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) |
405
|
661 LEXLIB= |
|
662 ;; |
|
663 *) |
|
664 LFLAGS="-t" |
832
|
665 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) |
|
666 AC_MSG_WARN([I didn't find flex, but that's only a problem]) |
|
667 AC_MSG_WARN([if you need to reconstruct lex.cc]) |
405
|
668 ;; |
|
669 esac |
|
670 AC_SUBST(LFLAGS)dnl |
|
671 dnl |
|
672 AC_PROG_YACC |
|
673 case "$YACC" in |
|
674 bison*) |
|
675 ;; |
|
676 *) |
832
|
677 AC_MSG_WARN([I didn't find bison, but that's only a problem]) |
|
678 AC_MSG_WARN([if you need to reconstruct parse.cc]) |
405
|
679 ;; |
|
680 esac |
|
681 dnl |
|
682 AC_PROG_RANLIB |
369
|
683 dnl |
832
|
684 AC_CHECK_PROG(RUNTEST, runtest, runtest, [])dnl |
|
685 AC_CHECK_PROG(EXPECT, expect, expect, [])dnl |
5
|
686 if test -z "$EXPECT" ; then |
|
687 RUNTEST= |
|
688 fi |
|
689 AC_SUBST(RUNTEST)dnl |
369
|
690 dnl |
405
|
691 AC_PROG_INSTALL |
|
692 dnl |
832
|
693 AC_CHECK_PROG(GNUPLOT_BINARY, gnuplot, gnuplot, [])dnl |
405
|
694 if test -z "$GNUPLOT_BINARY"; then |
832
|
695 AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot]) |
|
696 AC_MSG_WARN([installed, but you won't be able to use any of Octave's]) |
|
697 AC_MSG_WARN([plotting commands without it.]) |
|
698 AC_MSG_WARN([]) |
|
699 AC_MSG_WARN([If gnuplot is installed but it isn't in your path, you can]) |
|
700 AC_MSG_WARN([tell Octave where to find it by typing the command]) |
|
701 AC_MSG_WARN([]) |
|
702 AC_MSG_WARN([gnuplot_binary = "/full/path/to/gnuplot/binary"]) |
|
703 AC_MSG_WARN([]) |
|
704 AC_MSG_WARN([at the Octave prompt.]) |
405
|
705 fi |
|
706 dnl |
832
|
707 AC_CHECK_PROGS(DEFAULT_PAGER, less more page pg, [])dnl |
405
|
708 if test -z "$DEFAULT_PAGER"; then |
832
|
709 AC_MSG_WARN([I couldn't find `less', `more', `page', or `pg']) |
405
|
710 elif test "$DEFAULT_PAGER" = less; then |
|
711 DEFAULT_PAGER="less -e" |
832
|
712 AC_MSG_RESULT([defining DEFAULT_PAGER to be $DEFAULT_PAGER]) |
405
|
713 fi |
|
714 dnl |
|
715 dnl Even though we include config.h in most files, some need to be |
|
716 dnl compiled with the -D options on the compiler command line. Use |
|
717 dnl UGLY_DEFS for that. |
|
718 dnl |
832
|
719 AC_OUTPUT_MAKE_DEFS |
236
|
720 UGLY_DEFS="$DEFS" |
832
|
721 AC_MSG_RESULT([defining UGLY_DEFS to be $UGLY_DEFS]) |
236
|
722 AC_SUBST(UGLY_DEFS)dnl |
369
|
723 dnl |
405
|
724 dnl Maybe add -Wall to compiler flags now that we're done feature |
|
725 dnl testing. |
|
726 dnl |
670
|
727 dnl To get gcc and g++ to be really picky, try these adding these |
|
728 dnl options to CFLAGS and CXXFLAGS along with -Wall: |
|
729 dnl |
|
730 dnl -ansi |
|
731 dnl -pedantic |
|
732 dnl -Wwrite-strings |
|
733 dnl -Wid-clash-31 |
|
734 dnl -Wpointer-arith |
|
735 dnl -Wcast-qual |
|
736 dnl -Wenum-clash |
|
737 dnl -Wcast-align |
|
738 dnl -Wtraditional |
|
739 dnl -Wstrict-prototypes |
|
740 dnl -Wmissing-prototypes |
|
741 dnl -Wnested-externs |
|
742 dnl -Woverloaded-virtual |
|
743 dnl -Winline |
|
744 dnl -felide-constructors |
|
745 dnl -fnonnull-objects |
|
746 dnl |
405
|
747 if $ADD_CXX_WALL; then |
|
748 CXXFLAGS="$CXXFLAGS -Wall" |
832
|
749 AC_MSG_RESULT([adding -Wall to CXXFLAGS]) |
405
|
750 fi |
|
751 if $ADD_CC_WALL; then |
|
752 CFLAGS="$CFLAGS -Wall" |
832
|
753 AC_MSG_RESULT([adding -Wall to CFLAGS]) |
405
|
754 fi |
|
755 dnl |
|
756 dnl Do the substitutions in all the Makefiles. |
|
757 dnl |
837
|
758 define([tmpA], [Makefile octMakefile Makeconf])dnl |
|
759 define([tmpB], [libcruft/Makefile libcruft/Makerules])dnl |
|
760 define([tmpC], [liboctave/Makefile src/Makefile dld/Makefile])dnl |
|
761 define([tmpD], [info/Makefile readline/Makefile readline/doc/Makefile])dnl |
|
762 define([tmpE], [readline/examples/Makefile doc/Makefile])dnl |
|
763 define([tmpF], [test/Makefile kpathsea/Makefile])dnl |
|
764 define([srcdirs], [tmpA tmpB tmpC tmpD tmpE tmpF])dnl |
684
|
765 dnl |
39
|
766 define([tmpa], [libcruft/blas/Makefile libcruft/balgen/Makefile])dnl |
80
|
767 define([tmpb], [libcruft/dassl/Makefile libcruft/eispack/Makefile])dnl |
|
768 define([tmpc], [libcruft/fftpack/Makefile libcruft/fsqp/Makefile])dnl |
|
769 define([tmpd], [libcruft/lapack/Makefile libcruft/linpack/Makefile])dnl |
|
770 define([tmpe], [libcruft/minpack/Makefile libcruft/misc/Makefile])dnl |
|
771 define([tmpf], [libcruft/npsol/Makefile libcruft/odepack/Makefile])dnl |
|
772 define([tmpg], [libcruft/qpsol/Makefile libcruft/quadpack/Makefile])dnl |
|
773 define([tmph], [libcruft/ranlib/Makefile libcruft/villad/Makefile])dnl |
684
|
774 dnl |
5
|
775 define([cruftdirs], [tmpa tmpb tmpc tmpd tmpe tmpf tmpg tmph])dnl |
684
|
776 define([tmpSA], [scripts/Makefile scripts/control/Makefile])dnl |
|
777 define([tmpSB], [scripts/general/Makefile scripts/image/Makefile])dnl |
|
778 define([tmpSC], [scripts/linear-algebra/Makefile])dnl |
|
779 define([tmpSD], [scripts/miscellaneous/Makefile scripts/plot/Makefile])dnl |
|
780 define([tmpSE], [scripts/polynomial/Makefile scripts/set/Makefile])dnl |
|
781 define([tmpSF], [scripts/signal/Makefile scripts/special-matrix/Makefile])dnl |
733
|
782 define([tmpSG], [scripts/startup/Makefile scripts/statistics/Makefile])dnl |
717
|
783 define([tmpSH], [scripts/elfun/Makefile scripts/specfun/Makefile])dnl |
|
784 define([scriptdirs], [tmpSA tmpSB tmpSC tmpSD tmpSE tmpSF tmpSG tmpSH])dnl |
684
|
785 dnl |
|
786 AC_OUTPUT([srcdirs cruftdirs scriptdirs])dnl |