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