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