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