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