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