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