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 |
1010
|
6 dnl Copyright (C) 1992, 1993, 1994, 1995 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 |
1070
|
24 AC_REVISION($Revision: 1.88 $) |
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 |
1018
|
224 HOST_CXXFLAGS= |
965
|
225 case "$gxx_version" in |
|
226 2.6.*) |
|
227 case "$canonical_host_type" in |
|
228 rs6000-ibm-aix*) |
1018
|
229 HOST_CXXFLAGS="-Wa,-u" |
|
230 AC_MSG_RESULT([defining HOST_CXXFLAGS to be $HOST_CXXFLAGS]) |
965
|
231 ;; |
|
232 esac |
|
233 ;; |
|
234 esac |
|
235 |
1018
|
236 AC_SUBST(HOST_CXXFLAGS) |
|
237 |
869
|
238 ### See what libraries are used by the C++ compiler. Need this for |
|
239 ### dynamic linking. |
|
240 |
708
|
241 CXXLIBS=`sh $srcdir/cxxlibs.sh` |
832
|
242 AC_MSG_RESULT([defining CXXLIBS to be $CXXLIBS]) |
869
|
243 |
|
244 AC_SUBST(CXXFLAGS) |
|
245 AC_SUBST(NO_IMPLICIT_TEMPLATES) |
|
246 AC_SUBST(CXXLIBS) |
|
247 |
|
248 ### See which C compiler to use (we expect to find gcc). |
|
249 |
5
|
250 AC_PROG_CC |
405
|
251 AC_PROG_CPP |
832
|
252 AC_PROG_GCC_TRADITIONAL |
869
|
253 |
|
254 ### Do special things for gcc. |
|
255 |
405
|
256 ADD_CC_WALL=false |
|
257 gcc_version=`$CC -v 2>&1 | grep "^gcc version" | sed 's/^gcc version *//'` |
|
258 case "$gcc_version" in |
|
259 2.*) |
|
260 CFLAGS="-g -O" |
832
|
261 AC_MSG_RESULT([defining CFLAGS to be $CFLAGS]) |
638
|
262 LDFLAGS="-g" |
832
|
263 AC_MSG_RESULT([defining LDFLAGS to be $LDFLAGS]) |
405
|
264 ADD_CC_WALL=true |
|
265 ;; |
|
266 1.*) |
832
|
267 AC_MSG_WARN([gcc version $gcc_version is likely to cause problems]) |
405
|
268 ;; |
5
|
269 *) |
832
|
270 AC_MSG_WARN([Octave has only been tested with gcc, and I can't find it]) |
405
|
271 ;; |
5
|
272 esac |
869
|
273 |
|
274 AC_SUBST(CFLAGS) |
|
275 AC_SUBST(LDFLAGS) |
|
276 |
|
277 ### On Linux systems we need to compile with -mieee-fp to get full |
|
278 ### support for IEEE floating point. |
|
279 |
350
|
280 case "$canonical_host_type" in |
|
281 i386-*-linux | i486-*-linux | i586-*-linux) |
|
282 GCC_IEEE_FP_FLAG="-mieee-fp" |
832
|
283 AC_MSG_RESULT([defining GCC_IEEE_FP_FLAG to be $GCC_IEEE_FP_FLAG]) |
324
|
284 ;; |
|
285 esac |
869
|
286 |
|
287 AC_SUBST(GCC_IEEE_FP_FLAG) |
|
288 |
|
289 ### Special checks for odd OS specific things. |
|
290 |
405
|
291 AC_ISC_POSIX |
|
292 AC_MINIX |
|
293 AC_AIX |
832
|
294 AC_FUNC_STRFTIME |
|
295 AC_CHECK_LIB(sun, getpwnam) |
869
|
296 |
|
297 ### How big are ints and how are they oriented? These could probably |
|
298 ### be eliminated in favor of run-time checks. |
|
299 |
832
|
300 AC_CHECK_SIZEOF(short) |
|
301 AC_CHECK_SIZEOF(int) |
|
302 AC_CHECK_SIZEOF(long) |
|
303 AC_C_BIGENDIAN |
869
|
304 |
|
305 ### Try to determine the floating point format. This could probably |
|
306 ### be eliminated in favor of run-time checks. |
|
307 |
832
|
308 AC_MSG_CHECKING([floating point format]) |
602
|
309 changequote(,)dnl |
|
310 XCFLAGS=`echo $CFLAGS | sed 's/-O[^ \t]*//'` |
|
311 changequote([,])dnl |
|
312 ${CC-cc} -DDP $XCFLAGS $LDFLAGS $srcdir/float-type.c -o conftest >/dev/null 2>&1 |
588
|
313 FLOAT_FORMAT=`./conftest` |
|
314 case "$FLOAT_FORMAT" in |
|
315 IEEE_BIG_ENDIAN) |
832
|
316 AC_MSG_RESULT([IEEE big endian]) |
869
|
317 AC_DEFINE(IEEE_BIG_ENDIAN, 1) |
588
|
318 ;; |
|
319 IEEE_LITTLE_ENDIAN) |
832
|
320 AC_MSG_RESULT([IEEE little endian]) |
869
|
321 AC_DEFINE(IEEE_LITTLE_ENDIAN, 1) |
588
|
322 ;; |
|
323 VAX_D_FLOAT) |
832
|
324 AC_MSG_RESULT([VAX D floating]) |
869
|
325 AC_DEFINE(VAX_D_FLOAT, 1) |
588
|
326 ;; |
|
327 VAX_G_FLOAT) |
832
|
328 AC_MSG_RESULT([VAX G floating]) |
869
|
329 AC_DEFINE(VAX_G_FLOAT, 1) |
588
|
330 ;; |
|
331 *) |
832
|
332 AC_MSG_RESULT() |
|
333 AC_MSG_WARN("unrecognized floating point format!") |
588
|
334 ;; |
|
335 esac |
869
|
336 |
|
337 ### Does the C compiler handle alloca() and const correctly? |
|
338 |
405
|
339 AC_ALLOCA |
869
|
340 |
|
341 ### This one is for kpathsea. |
|
342 ### |
|
343 ### It would be nicer to test for the requisite putenv features directly, |
|
344 ### but can't figure out how to do that. |
|
345 |
679
|
346 if test "`(uname) 2>/dev/null`" = NetBSD \ |
|
347 || test "`(uname) 2>/dev/null`" = FreeBSD; then |
|
348 AC_DEFINE(SMART_PUTENV) |
|
349 fi |
869
|
350 |
832
|
351 AC_C_CONST |
869
|
352 |
|
353 ### If we haven't been forced to use f2c, try to find a Fortran compiler |
|
354 ### under any one of several common Un*x Fortran compiler names. |
|
355 ### Put fc last to avoid confusion with some vendor's /bin/sh fc |
|
356 ### builtin. |
|
357 ### |
|
358 ### xlf : IBM / AIX |
|
359 ### cf77 : Cray / Unicos |
|
360 ### g77 : GNU Fortran (someday...) |
|
361 ### fc : Convex |
|
362 ### |
|
363 ### I don't think the Cray compiler will ever work like f2c... |
|
364 |
5
|
365 if $use_f2c; then |
|
366 true |
|
367 else |
|
368 F77= |
869
|
369 AC_CHECK_PROGS(F77, xlf cf77 f77 g77 fc) |
5
|
370 |
|
371 # If it looks like we have a Fortran compiler, try to determine |
|
372 # whether it might be compatible with f2c. |
|
373 |
|
374 if test -n "$F77"; then |
832
|
375 AC_MSG_CHECKING([$F77/f2c compatibility]) |
5
|
376 export F77 |
|
377 export CC |
|
378 tmpdef=`sh $srcdir/f2c-compat.sh $srcdir/flibs.sh` |
|
379 status=$? |
|
380 if test $status -eq 0; then |
832
|
381 AC_MSG_RESULT([yes]) |
5
|
382 if test "$tmpdef" = '-DF77_APPEND_UNDERSCORE=1'; then |
869
|
383 AC_DEFINE(F77_APPEND_UNDERSCORE, 1) |
5
|
384 fi |
|
385 else |
832
|
386 AC_MSG_RESULT([no]) |
5
|
387 F77= |
|
388 fi |
|
389 fi |
|
390 fi |
869
|
391 |
|
392 ### If we can't find a Fortran compiler, or if it looks like it isn't |
|
393 ### compatible with f2c, try to find f2c. |
|
394 |
5
|
395 if test -z "$F77"; then |
869
|
396 AC_CHECK_PROG(F2C, f2c, f2c, []) |
5
|
397 fi |
869
|
398 |
5
|
399 F2CFLAGS= |
|
400 FFLAGS="-O" |
832
|
401 AC_MSG_RESULT([defining FFLAGS to be $FFLAGS]) |
5
|
402 if test -n "$F77"; then |
|
403 export F77 |
|
404 FLIBS=`sh $srcdir/flibs.sh` |
832
|
405 AC_MSG_RESULT([defining FLIBS to be $FLIBS]) |
995
|
406 DOT_C_FROM_DOT_F_CMD= |
|
407 DOT_O_FROM_DOT_F_PAT= |
5
|
408 elif test -n "$F2C" || $use_f2c; then |
869
|
409 AC_CHECK_LIB(f2c, main, FLIBS=-lf2c, []) |
5
|
410 if test -z "$FLIBS" ; then |
869
|
411 AC_CHECK_LIB(F77, main, FLIBS=-lF77, []) |
5
|
412 if test -n "$FLIBS" ; then |
869
|
413 AC_CHECK_LIB(I77, main, FLIBS="$FLIBS -lI77", []) |
5
|
414 fi |
|
415 fi |
|
416 if test -z "$FLIBS" ; then |
832
|
417 AC_MSG_WARN([I found f2c but not libf2c.a, or libF77.a and libI77.a]) |
5
|
418 fi |
995
|
419 DOT_C_FROM_DOT_F_CMD=' cat $< | $(F2C) $(F2CFLAGS) > $(@F)' |
|
420 AC_MSG_RESULT([defining DOT_C_FROM_DOT_F_CMD to be $DOT_C_FROM_DOT_F_CMD]) |
|
421 DOT_O_FROM_DOT_F_PAT='%.o : %.f' |
|
422 AC_MSG_RESULT([defining DOT_O_FROM_DOT_F_PAT to be $DOT_O_FROM_DOT_F_PAT]) |
869
|
423 AC_DEFINE(F77_APPEND_UNDERSCORE, 1) |
5
|
424 else |
832
|
425 AC_MSG_WARN([in order to build octave, you must have a compatible]) |
|
426 AC_MSG_WARN([Fortran compiler or f2c installed and in your path.]) |
|
427 AC_MSG_WARN([See the file INSTALL for more information.]) |
|
428 AC_MSG_WARN([Continuing anyway...]) |
5
|
429 fi |
869
|
430 |
|
431 AC_SUBST(F77) |
|
432 AC_SUBST(FFLAGS) |
|
433 AC_SUBST(FLIBS) |
|
434 AC_SUBST(F2C) |
|
435 AC_SUBST(F2CFLAGS) |
995
|
436 AC_SUBST(DOT_C_FROM_DOT_F_CMD) |
|
437 AC_SUBST(DOT_O_FROM_DOT_F_PAT) |
869
|
438 |
|
439 ### Extract libraries and directories from FLIBS and CXXLIBS. |
|
440 ### |
|
441 ### Leave only libraries, with -lfoo converted to libfoo.a: |
|
442 |
708
|
443 changequote(,)dnl |
843
|
444 FLIB_LIST=`echo " $FLIBS " | sed -e 's/ -Xlinker *[^ ]*/ /g' \ |
842
|
445 -e 's/ -L *[^ ]*/ /g' \ |
843
|
446 -e 's/ -l *\([^ ]*\)/ lib\1.a/g' -e 's/ -u *[^ ]*/ /g' \ |
1068
|
447 -e 's/ [^ ]*\.o//g' \ |
832
|
448 -e 's/^ *//' -e 's/ *$//' -e 's/ */:/g'` |
869
|
449 |
843
|
450 CXXLIB_LIST=`echo " $CXXLIBS " | sed -e 's/ -Xlinker *[^ ]*/ /g' \ |
842
|
451 -e 's/ -L *[^ ]*/ /g' \ |
843
|
452 -e 's/ -l *\([^ ]*\)/ lib\1.a/g' -e 's/ -u *[^ ]*/ /g' \ |
1068
|
453 -e 's/ [^ ]*\.o//g' \ |
708
|
454 -e 's/^ *//' -e 's/ *$//' -e 's/ */:/g'` |
869
|
455 |
|
456 ### Leave only directories where libraries might be found: |
|
457 |
843
|
458 FLIB_PATH=`echo " $FLIBS " | sed \ |
|
459 -e 's/ / /g' -e 's/ -Xlinker *[^ ]*/ /g' \ |
|
460 -e 's/ -L *\([^ ]*\)/ \1/g' -e 's, /[^ ]*\.a , ,g' \ |
1069
|
461 -e 's/ -l *[^ ]*/ /g' -e 's/ -u *[^ ]*/ /g' \ |
|
462 -e 's/ [^ ]*\.o//g' \ |
|
463 -e 's/^ *//' -e 's/ *$//' -e 's/ */:/g'` |
869
|
464 |
843
|
465 CXXLIB_PATH=`echo " $CXXLIBS " | sed -e 's/ -Xlinker *[^ ]*/ /g' \ |
|
466 -e 's/ -L *\([^ ]*\)/ \1/g' -e 's, /[^ ]*\.a , ,g' \ |
|
467 -e 's/ / /g' -e 's/ -Xlinker *[^ ]*/ /g' \ |
1069
|
468 -e 's/ -l *[^ ]*/ /g' -e 's/ -u *[^ ]*/ /g' \ |
|
469 -e 's/ [^ ]*\.o//g' \ |
|
470 -e 's/^ *//' -e 's/ *$//' -e 's/ */:/g'` |
708
|
471 changequote([,])dnl |
869
|
472 |
832
|
473 AC_MSG_RESULT([defining FLIB_LIST to be $FLIB_LIST]) |
|
474 AC_MSG_RESULT([defining FLIB_PATH to be $FLIB_PATH]) |
869
|
475 |
832
|
476 AC_MSG_RESULT([defining CXXLIB_LIST to be $CXXLIB_LIST]) |
|
477 AC_MSG_RESULT([defining CXXLIB_PATH to be $CXXLIB_PATH]) |
869
|
478 |
|
479 AC_SUBST(FLIB_LIST) |
|
480 AC_SUBST(FLIB_PATH) |
|
481 |
|
482 AC_SUBST(CXXLIB_LIST) |
|
483 AC_SUBST(CXXLIB_PATH) |
|
484 |
|
485 ### Checks for header files. |
|
486 |
832
|
487 AC_HEADER_STDC |
869
|
488 AC_CHECK_HEADERS(assert.h float.h limits.h memory.h pwd.h stdlib.h) |
|
489 AC_CHECK_HEADERS(string.h varargs.h unistd.h floatingpoint.h) |
|
490 AC_CHECK_HEADERS(sys/utsname.h sys/time.h sys/fcntl.h) |
936
|
491 AC_CHECK_HEADERS(sys/ttold.h sys/ptem.h sys/select.h sys/resource.h) |
832
|
492 AC_HEADER_DIRENT |
792
|
493 AC_TIME_WITH_SYS_TIME |
869
|
494 |
|
495 ### Use sgtty on Ultrix so that using DEC Migrate to convert a Mips |
|
496 ### binary to an Alpha binary will work. Also on Alpha/OSF to avoid |
|
497 ### a readline bug. |
|
498 |
294
|
499 case "$canonical_host_type" in |
521
|
500 mips-dec-ultrix* | alpha-dec-osf*) |
869
|
501 AC_CHECK_HEADER(sgtty.h, [AC_DEFINE(HAVE_SGTTY_H, 1)], []) |
|
502 |
|
503 if test "$ac_cv_header_sgtty_h" = no; then |
|
504 AC_CHECK_HEADERS(termios.h termio.h sgtty.h, [break], []) |
|
505 fi |
|
506 ;; |
|
507 *) |
|
508 AC_CHECK_HEADERS(termios.h termio.h sgtty.h, [break], []) |
294
|
509 ;; |
|
510 esac |
869
|
511 |
|
512 if test "$ac_cv_header_termios_h" = yes \ |
|
513 || test "$ac_cv_header_termio_h" = yes \ |
|
514 || test "$ac_cv_header_sgtty_h" = yes; then |
832
|
515 true |
|
516 else |
|
517 AC_MSG_ERROR([I couldn't find termios.h, termio.h, or sgtty.h!]) |
|
518 fi |
869
|
519 |
|
520 ### Checks for functions. |
|
521 |
966
|
522 AC_CHECK_FUNCS(setvbuf getcwd gethostname bzero bcopy rindex vfprintf vsprintf) |
903
|
523 AC_CHECK_FUNCS(stricmp strnicmp strcasecmp strncasecmp strerror atexit) |
|
524 AC_CHECK_FUNCS(on_exit tempnam memmove putenv gettimeofday getrusage) |
869
|
525 |
832
|
526 dnl Would like to get rid of this cruft, and just have |
|
527 dnl |
|
528 dnl AC_CHECK_FUNCS(finite isnan isinf) |
|
529 dnl |
|
530 dnl instead, but that used to fail on some systems... |
369
|
531 dnl |
832
|
532 dnl Also just using AC_CHECK_FUNCS doesn't seem to work to find isinf |
|
533 dnl and isnan on Linux systems, so we use AC_CHECK_FUNC, and if that |
369
|
534 dnl fails, we try again by including math.h and invoking the function |
|
535 dnl with an argument. |
869
|
536 |
|
537 ### Check to see if we have IEEE math functions, and if so, which ones. |
|
538 ### |
|
539 ### For Linux: add -mieee-fp flag to CFLAGS when checking for IEEE FP |
|
540 ### functions, otherwise we may not find them. |
|
541 ### |
|
542 ### Also check for some additional trig functions that aren't ANSI but |
|
543 ### are often available. If they are missing, we try to replace them |
|
544 ### with functions from the BSD/NET2 math library. |
|
545 |
|
546 AC_CHECK_LIB(sunmath, main) |
1070
|
547 |
|
548 dnl This is bogus. We shouldn't have to explicitly add libc too! |
|
549 |
|
550 case "$canonical_host_type" in |
|
551 *-*-linux*) |
|
552 AC_CHECK_LIB(m, main, , , -lc) |
|
553 ;; |
|
554 *) |
|
555 AC_CHECK_LIB(m, main) |
|
556 ;; |
|
557 esac |
869
|
558 |
360
|
559 XCFLAGS="$CFLAGS" |
351
|
560 CFLAGS="$CFLAGS $GCC_IEEE_FP_FLAG" |
869
|
561 |
956
|
562 ### Inf and NaN don't work with gcc on the Alpha yet. |
|
563 |
|
564 case "$canonical_host_type" in |
|
565 alpha-dec-osf*) |
|
566 ;; |
|
567 *) |
|
568 AC_CHECK_FUNCS(finite isnan isinf infinity quiet_nan) |
|
569 ;; |
|
570 esac |
|
571 |
998
|
572 AC_CHECK_FUNCS(erf erfc lgamma) |
869
|
573 |
832
|
574 AC_MSG_CHECKING([for signgam declaration in math.h]) |
|
575 AC_TRY_LINK([#include <math.h>], |
706
|
576 [int foo = signgam + 1;], |
832
|
577 AC_MSG_RESULT(yes) |
|
578 AC_DEFINE(SIGNGAM_DECLARED, 1), |
869
|
579 AC_MSG_RESULT(no)) |
|
580 |
360
|
581 CFLAGS="$XCFLAGS" |
869
|
582 |
|
583 ### Check for nonstandard but common trig functions that we need. |
|
584 ### If they are missing, we replace them using functions from the BSD |
|
585 ### math library, and we may need to replace some other functions too. |
|
586 |
405
|
587 AC_REPLACE_FUNCS(acosh asinh atanh) |
869
|
588 |
5
|
589 if test -n "$LIBOBJS"; then |
|
590 for func in $LIBOBJS |
|
591 do |
|
592 case "$func" in |
|
593 *acosh.o*) |
869
|
594 AC_DEFINE(ACOSH_MISSING, 1) |
405
|
595 ;; |
5
|
596 *asinh.o*) |
869
|
597 AC_DEFINE(ASINH_MISSING, 1) |
405
|
598 ;; |
5
|
599 *atanh.o*) |
869
|
600 AC_DEFINE(ATANH_MISSING, 1) |
405
|
601 ;; |
5
|
602 esac |
|
603 done |
|
604 case $LIBOBJS in |
|
605 *acosh.o* | *asinh.o*) |
405
|
606 AC_REPLACE_FUNCS(copysign) |
|
607 ;; |
5
|
608 esac |
|
609 case $LIBOBJS in |
|
610 *acosh.o* | *asinh.o* | *atanh.o*) |
405
|
611 AC_REPLACE_FUNCS(log1p) |
|
612 ;; |
5
|
613 esac |
|
614 case $LIBOBJS in |
|
615 *log1p*) |
405
|
616 AC_REPLACE_FUNCS(log__L) |
|
617 ;; |
5
|
618 esac |
|
619 case $LIBOBJS in |
|
620 *log1p*) |
405
|
621 AC_REPLACE_FUNCS(finite) |
|
622 ;; |
5
|
623 esac |
|
624 case $LIBOBJS in |
|
625 *copysign* | *finite* | *log1p*) |
405
|
626 AC_REPLACE_FUNCS(logb scalb) |
|
627 ;; |
5
|
628 esac |
|
629 fi |
869
|
630 |
|
631 ### Checks for OS specific cruft. |
|
632 |
405
|
633 AC_STRUCT_TM |
832
|
634 AC_FUNC_SETVBUF_REVERSED |
405
|
635 TERMLIBS="" |
|
636 for termlib in termcap terminfo curses termlib ; do |
832
|
637 AC_CHECK_LIB(${termlib}, main, [TERMLIBS="${TERMLIBS} -l${termlib}"]) |
405
|
638 case "${TERMLIBS}" in |
|
639 *-l${termlib}*) |
832
|
640 AC_MSG_RESULT([defining TERMLIBS to be $TERMLIBS]) |
405
|
641 break |
|
642 ;; |
|
643 esac |
|
644 done |
869
|
645 |
832
|
646 AC_MSG_CHECKING([for struct exception in math.h]) |
|
647 AC_TRY_LINK([#include <math.h>], |
|
648 [struct exception *x; x->type; x->name;], |
835
|
649 AC_MSG_RESULT(yes) |
832
|
650 AC_DEFINE(EXCEPTION_IN_MATH, 1), |
869
|
651 AC_MSG_RESULT(no)) |
|
652 |
405
|
653 AC_SUBST(TERMLIBS) |
869
|
654 |
|
655 ### Signal stuff. |
|
656 |
834
|
657 AC_TYPE_SIGNAL |
885
|
658 AC_DECL_SYS_SIGLIST |
|
659 AC_MSG_CHECKING([for sys_siglist variable]) |
|
660 AC_TRY_LINK([#include <stdio.h>], |
|
661 [extern char *sys_siglist[]; printf ("%s\n", sys_siglist[1]);], |
|
662 AC_MSG_RESULT(yes) |
|
663 AC_DEFINE(HAVE_SYS_SIGLIST, 1), |
|
664 AC_MSG_RESULT(no)) |
869
|
665 |
|
666 ### Define VOID_SIGHANDLER for readline. |
|
667 |
405
|
668 case "$RETSIGTYPE" in |
|
669 int) |
|
670 ;; |
|
671 *) |
|
672 VOID_SIGHANDLER="-DVOID_SIGHANDLER=1" |
832
|
673 AC_MSG_RESULT([defining VOID_SIGHANDLER to be 1]) |
405
|
674 ;; |
|
675 esac |
869
|
676 AC_SUBST(VOID_SIGHANDLER) |
|
677 |
|
678 ### Checks for other programs used for building, testing, installing, |
|
679 ### and running Octave. |
|
680 ### |
|
681 ### For now, don't define LEXLIB to be -lfl -- we don't use anything in |
|
682 ### it, and it might not be installed. |
|
683 ### |
|
684 ### Also make sure that we generate an interactive scanner if we are |
|
685 ### using flex. |
|
686 |
405
|
687 AC_PROG_LEX |
|
688 case "$LEX" in |
|
689 flex*) |
|
690 LFLAGS="-t -I" |
832
|
691 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) |
405
|
692 LEXLIB= |
|
693 ;; |
|
694 *) |
|
695 LFLAGS="-t" |
832
|
696 AC_MSG_RESULT([defining LFLAGS to be $LFLAGS]) |
|
697 AC_MSG_WARN([I didn't find flex, but that's only a problem]) |
|
698 AC_MSG_WARN([if you need to reconstruct lex.cc]) |
405
|
699 ;; |
|
700 esac |
869
|
701 AC_SUBST(LFLAGS) |
|
702 |
405
|
703 AC_PROG_YACC |
|
704 case "$YACC" in |
|
705 bison*) |
|
706 ;; |
|
707 *) |
832
|
708 AC_MSG_WARN([I didn't find bison, but that's only a problem]) |
|
709 AC_MSG_WARN([if you need to reconstruct parse.cc]) |
405
|
710 ;; |
|
711 esac |
869
|
712 |
405
|
713 AC_PROG_RANLIB |
869
|
714 |
|
715 AC_CHECK_PROG(RUNTEST, runtest, runtest, []) |
|
716 AC_CHECK_PROG(EXPECT, expect, expect, []) |
5
|
717 if test -z "$EXPECT" ; then |
|
718 RUNTEST= |
|
719 fi |
869
|
720 AC_SUBST(RUNTEST) |
|
721 |
405
|
722 AC_PROG_INSTALL |
869
|
723 |
|
724 AC_CHECK_PROG(GNUPLOT_BINARY, gnuplot, gnuplot, []) |
405
|
725 if test -z "$GNUPLOT_BINARY"; then |
832
|
726 AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot]) |
|
727 AC_MSG_WARN([installed, but you won't be able to use any of Octave's]) |
|
728 AC_MSG_WARN([plotting commands without it.]) |
|
729 AC_MSG_WARN([]) |
|
730 AC_MSG_WARN([If gnuplot is installed but it isn't in your path, you can]) |
|
731 AC_MSG_WARN([tell Octave where to find it by typing the command]) |
|
732 AC_MSG_WARN([]) |
|
733 AC_MSG_WARN([gnuplot_binary = "/full/path/to/gnuplot/binary"]) |
|
734 AC_MSG_WARN([]) |
|
735 AC_MSG_WARN([at the Octave prompt.]) |
405
|
736 fi |
869
|
737 |
|
738 AC_CHECK_PROGS(DEFAULT_PAGER, less more page pg, []) |
405
|
739 if test -z "$DEFAULT_PAGER"; then |
832
|
740 AC_MSG_WARN([I couldn't find `less', `more', `page', or `pg']) |
405
|
741 elif test "$DEFAULT_PAGER" = less; then |
|
742 DEFAULT_PAGER="less -e" |
832
|
743 AC_MSG_RESULT([defining DEFAULT_PAGER to be $DEFAULT_PAGER]) |
405
|
744 fi |
869
|
745 |
|
746 ### Even though we include config.h in most files, some need to be |
|
747 ### compiled with the -D options on the compiler command line. Use |
|
748 ### UGLY_DEFS for that. |
|
749 |
832
|
750 AC_OUTPUT_MAKE_DEFS |
236
|
751 UGLY_DEFS="$DEFS" |
832
|
752 AC_MSG_RESULT([defining UGLY_DEFS to be $UGLY_DEFS]) |
869
|
753 AC_SUBST(UGLY_DEFS) |
|
754 |
|
755 ### Maybe add -Wall to compiler flags now that we're done feature |
|
756 ### testing. |
|
757 ### |
|
758 ### To get gcc and g++ to be really picky, try these adding these |
|
759 ### options to CFLAGS and CXXFLAGS along with -Wall: |
|
760 ### |
|
761 ### -ansi |
|
762 ### -pedantic |
|
763 ### -Wwrite-strings |
|
764 ### -Wid-clash-31 |
|
765 ### -Wpointer-arith |
|
766 ### -Wcast-qual |
|
767 ### -Wenum-clash |
|
768 ### -Wcast-align |
|
769 ### -Wtraditional |
|
770 ### -Wstrict-prototypes |
|
771 ### -Wmissing-prototypes |
|
772 ### -Wnested-externs |
|
773 ### -Woverloaded-virtual |
|
774 ### -Winline |
|
775 ### -felide-constructors |
|
776 ### -fnonnull-objects |
|
777 |
405
|
778 if $ADD_CXX_WALL; then |
|
779 CXXFLAGS="$CXXFLAGS -Wall" |
832
|
780 AC_MSG_RESULT([adding -Wall to CXXFLAGS]) |
405
|
781 fi |
|
782 if $ADD_CC_WALL; then |
|
783 CFLAGS="$CFLAGS -Wall" |
832
|
784 AC_MSG_RESULT([adding -Wall to CFLAGS]) |
405
|
785 fi |
869
|
786 |
|
787 ### Do the substitutions in all the Makefiles. |
|
788 |
837
|
789 define([tmpA], [Makefile octMakefile Makeconf])dnl |
|
790 define([tmpB], [libcruft/Makefile libcruft/Makerules])dnl |
|
791 define([tmpC], [liboctave/Makefile src/Makefile dld/Makefile])dnl |
|
792 define([tmpD], [info/Makefile readline/Makefile readline/doc/Makefile])dnl |
|
793 define([tmpE], [readline/examples/Makefile doc/Makefile])dnl |
|
794 define([tmpF], [test/Makefile kpathsea/Makefile])dnl |
|
795 define([srcdirs], [tmpA tmpB tmpC tmpD tmpE tmpF])dnl |
869
|
796 |
39
|
797 define([tmpa], [libcruft/blas/Makefile libcruft/balgen/Makefile])dnl |
80
|
798 define([tmpb], [libcruft/dassl/Makefile libcruft/eispack/Makefile])dnl |
|
799 define([tmpc], [libcruft/fftpack/Makefile libcruft/fsqp/Makefile])dnl |
|
800 define([tmpd], [libcruft/lapack/Makefile libcruft/linpack/Makefile])dnl |
|
801 define([tmpe], [libcruft/minpack/Makefile libcruft/misc/Makefile])dnl |
|
802 define([tmpf], [libcruft/npsol/Makefile libcruft/odepack/Makefile])dnl |
|
803 define([tmpg], [libcruft/qpsol/Makefile libcruft/quadpack/Makefile])dnl |
869
|
804 define([tmph], [libcruft/ranlib/Makefile libcruft/villad/Makefile])dnl |
|
805 |
5
|
806 define([cruftdirs], [tmpa tmpb tmpc tmpd tmpe tmpf tmpg tmph])dnl |
684
|
807 define([tmpSA], [scripts/Makefile scripts/control/Makefile])dnl |
869
|
808 define([tmpSB], [scripts/general/Makefile scripts/image/Makefile]) |
684
|
809 define([tmpSC], [scripts/linear-algebra/Makefile])dnl |
|
810 define([tmpSD], [scripts/miscellaneous/Makefile scripts/plot/Makefile])dnl |
|
811 define([tmpSE], [scripts/polynomial/Makefile scripts/set/Makefile])dnl |
|
812 define([tmpSF], [scripts/signal/Makefile scripts/special-matrix/Makefile])dnl |
733
|
813 define([tmpSG], [scripts/startup/Makefile scripts/statistics/Makefile])dnl |
717
|
814 define([tmpSH], [scripts/elfun/Makefile scripts/specfun/Makefile])dnl |
937
|
815 define([tmpSI], [scripts/strings/Makefile])dnl |
|
816 define([mdirs], [tmpSA tmpSB tmpSC tmpSD tmpSE tmpSF tmpSG tmpSH tmpSI])dnl |
869
|
817 |
937
|
818 AC_OUTPUT([srcdirs cruftdirs mdirs]) |