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