5
|
1 dnl Process this file with autoconf to produce a configure script. |
|
2 dnl |
|
3 AC_INIT([[src]]/octave.cc)dnl |
|
4 |
|
5 # See if we were given the target host type. If not, guess. |
|
6 |
|
7 if test $# -gt 0; then |
|
8 TARGET=`eval echo $\{\`echo $#\`\}` |
|
9 case $TARGET in |
|
10 -*) target_host_type= ;; |
|
11 *) target_host_type=$TARGET ;; |
|
12 esac |
|
13 fi |
|
14 |
|
15 if test -z "$target_host_type" -o "$target_host_type" = unknown; then |
|
16 target_host_type=`sh $srcdir/config.guess` |
|
17 if test -z "$target_host_type"; then |
|
18 echo "warning: unable to guess system type" |
|
19 target_host_type=unknown |
|
20 fi |
|
21 fi |
|
22 |
|
23 case "$target_host_type" in |
|
24 unknown) |
|
25 echo "configuring Octave for an unknown system type" |
|
26 ;; |
|
27 *) |
|
28 echo "configuring Octave for a $target_host_type" |
|
29 ;; |
|
30 esac |
|
31 AC_SUBST(target_host_type)dnl |
|
32 |
|
33 # Set up to handle --with-FOO options. |
|
34 |
|
35 AC_WITH(f2c, use_f2c=true, use_f2c=false)dnl |
|
36 AC_WITH(dld, use_dld=true, use_dld=false)dnl |
|
37 |
|
38 DYNAMIC_LD_OBJ= |
|
39 DLD_DIR= |
|
40 LIBDLD= |
|
41 DLD_OBJECTS='$(DLD_OBJECTS)' |
|
42 LD_STATIC_FLAG= |
|
43 if $use_dld; then |
|
44 DYNAMIC_LD_OBJ='dynamic-ld.o' |
|
45 DLD_DIR=dld |
|
46 LIBDLD='../libdld.a' |
|
47 DLD_OBJECTS= : # don't link them in if doing dynamic linking |
|
48 DEFS="$DEFS -DWITH_DLD=1" |
|
49 LD_STATIC_FLAG=-static |
|
50 fi |
|
51 AC_SUBST(DYNAMIC_LD_OBJ)dnl |
|
52 AC_SUBST(DLD_DIR)dnl |
|
53 AC_SUBST(LIBDLD)dnl |
|
54 AC_SUBST(DLD_OBJECTS)dnl |
|
55 AC_SUBST(LD_STATIC_FLAG)dnl |
|
56 |
|
57 echo "checking for npsol" |
|
58 if test -f $srcdir/libcruft/npsol/npsol.f; then |
|
59 : |
|
60 else |
|
61 DEFS="$DEFS -DNPSOL_MISSING=1" |
|
62 fi |
|
63 |
|
64 echo "checking for qpsol" |
|
65 if test -f $srcdir/libcruft/qpsol/qpsol.f; then |
|
66 : |
|
67 else |
|
68 DEFS="$DEFS -DQPSOL_MISSING=1" |
|
69 fi |
|
70 |
|
71 echo "checking for fsqp" |
|
72 if test -f $srcdir/libcruft/fsqp/fsqpd.f; then |
|
73 : |
|
74 else |
|
75 DEFS="$DEFS -DFSQP_MISSING=1" |
|
76 fi |
|
77 |
|
78 AC_PROG_CC |
|
79 AC_GCC_TRADITIONAL |
179
|
80 AC_MINIX |
|
81 AC_ISC_POSIX |
5
|
82 AC_AIX |
80
|
83 AC_DYNIX_SEQ |
|
84 AC_ALLOCA |
|
85 AC_CONST |
5
|
86 |
|
87 # Do special things for gcc. |
|
88 |
|
89 case "$CC" in |
179
|
90 gcc* | */gcc*) |
5
|
91 CFLAGS="-g -O -Wall" |
|
92 LDFLAGS="-g -O" |
|
93 gcc_version=`gcc -v 2>&1 | grep "^gcc version" | sed 's/^gcc version *//'` |
|
94 case "$gcc_version" in |
|
95 1.*) |
|
96 cat << EOF |
|
97 warning: gcc version $gcc_version is likely to cause problems -- |
|
98 you should probably consider getting version 2.x |
|
99 EOF |
|
100 ;; |
|
101 esac |
|
102 ;; |
|
103 *) |
179
|
104 cat << EOF |
|
105 warning: found environment variable CC = \`$CC'. If this is not a |
|
106 derivative of GCC, you should probably consider using GCC |
|
107 version 2.x instead. |
|
108 EOF |
5
|
109 CFLAGS="-g" |
|
110 LDFLAGS="-g" |
|
111 ;; |
|
112 esac |
|
113 AC_SUBST(CFLAGS)dnl |
|
114 AC_SUBST(LDFLAGS)dnl |
|
115 |
196
|
116 AC_PROGRAM_CHECK(CXX, g++, g++, [])dnl |
|
117 if test "$CXX" = g++ ; then |
5
|
118 CXXFLAGS="-g -O -Wall" |
|
119 gxx_version=`g++ -v 2>&1 | grep "^g.. version" | sed 's/^g.. version *//'` |
|
120 case "$gxx_version" in |
|
121 1.*) |
|
122 cat << EOF |
|
123 warning: g++ version $gxx_version is likely to cause problems -- |
|
124 you should probably consider getting version 2.x |
|
125 EOF |
|
126 ;; |
|
127 esac |
|
128 else |
|
129 cat << EOF |
|
130 warning: Octave has only been tested with g++, and I can't |
|
131 seem to find it. |
|
132 EOF |
|
133 fi |
|
134 AC_SUBST(CXXFLAGS)dnl |
|
135 |
|
136 # If we haven't been forced to use f2c, try to find a Fortran compiler |
|
137 # under any one of several common Un*x Fortran compiler names. |
|
138 # Put fc last to avoid confusion with some vendor's /bin/sh fc |
|
139 # builtin. |
|
140 # |
|
141 # g77 : GNU Fortran (someday...) |
|
142 # xlf : IBM / AIX |
|
143 # cf77 : Cray / Unicos |
|
144 # fc : Convex |
|
145 # |
|
146 # I don't think the Cray compiler will ever work like f2c... |
|
147 |
|
148 if $use_f2c; then |
|
149 true |
|
150 else |
|
151 F77= |
|
152 AC_PROGRAMS_CHECK(F77, g77 xlf cf77 f77 fc)dnl |
|
153 |
|
154 # If it looks like we have a Fortran compiler, try to determine |
|
155 # whether it might be compatible with f2c. |
|
156 |
|
157 if test -n "$F77"; then |
|
158 echo "checking $F77/f2c compatibility" |
|
159 export F77 |
|
160 export CC |
|
161 tmpdef=`sh $srcdir/f2c-compat.sh $srcdir/flibs.sh` |
|
162 status=$? |
|
163 if test $status -eq 0; then |
|
164 if test "$tmpdef" = '-DF77_APPEND_UNDERSCORE=1'; then |
|
165 DEFS="$DEFS $tmpdef" |
|
166 fi |
|
167 else |
|
168 F77= |
|
169 fi |
|
170 fi |
|
171 fi |
|
172 |
|
173 # If we can't find a Fortran compiler, or if it looks like it isn't |
|
174 # compatible with f2c, try to find f2c. |
|
175 |
|
176 if test -z "$F77"; then |
|
177 AC_PROGRAM_CHECK(F2C, f2c, f2c, [])dnl |
|
178 fi |
|
179 |
|
180 F2CFLAGS= |
|
181 FFLAGS="-O" |
|
182 if test -n "$F77"; then |
|
183 export F77 |
|
184 FLIBS=`sh $srcdir/flibs.sh` |
|
185 DOT_O_DOT_F_C1= |
|
186 DOT_O_DOT_F_C2= |
|
187 DOT_O_DOT_F_C3= |
|
188 DOT_O_DOT_F_C4= |
|
189 DEFAULT_DOT_C_FROM_DOT_F= |
|
190 DEFAULT_DOT_O_FROM_DOT_F= |
|
191 elif test -n "$F2C" || $use_f2c; then |
|
192 AC_HAVE_LIBRARY(f2c, FLIBS=-lf2c, [])dnl |
|
193 if test -z "$FLIBS" ; then |
|
194 AC_HAVE_LIBRARY(F77, FLIBS=-lF77, [])dnl |
|
195 if test -n "$FLIBS" ; then |
|
196 AC_HAVE_LIBRARY(I77, FLIBS="$FLIBS -lI77", [])dnl |
|
197 fi |
|
198 fi |
|
199 if test -z "$FLIBS" ; then |
|
200 cat << EOF |
|
201 warning: I found f2c but I couldn't find libf2c.a, or |
|
202 libF77.a and libI77.a |
|
203 EOF |
|
204 fi |
|
205 DEFAULT_DOT_C_FROM_DOT_F='# A rule for making C source from Fortran source.\ |
|
206 # If we are using f2c we should also turn off the default rule for\ |
|
207 # making objects from .f files so that we do not invoke the fortran\ |
|
208 # compiler by mistake.\ |
|
209 \ |
|
210 \%.c : \%.f\ |
|
211 cat $< | $(F2C) $(F2CFLAGS) > $(@F)' |
|
212 DEFAULT_DOT_O_FROM_DOT_F='\%.o : \%.f' |
|
213 DEFS="$DEFS -DF77_APPEND_UNDERSCORE=1" |
|
214 else |
|
215 cat << EOF |
|
216 warning: in order to build octave, you must have a compatible |
|
217 Fortran compiler or f2c installed and in your path. |
|
218 See the file INSTALL for more information. |
|
219 Continuing anyway... |
|
220 EOF |
|
221 fi |
|
222 |
|
223 AC_SUBST(FFLAGS)dnl |
|
224 AC_SUBST(FLIBS)dnl |
|
225 AC_SUBST(F2C)dnl |
|
226 AC_SUBST(F2CFLAGS)dnl |
|
227 AC_SUBST(DEFAULT_DOT_C_FROM_DOT_F)dnl |
|
228 AC_SUBST(DEFAULT_DOT_O_FROM_DOT_F)dnl |
|
229 |
|
230 AC_PROG_INSTALL |
|
231 AC_PROG_RANLIB |
|
232 AC_STDC_HEADERS |
179
|
233 AC_HAVE_HEADERS(string.h varargs.h) |
219
|
234 AC_HAVE_HEADERS(sys/time.h sys/fcntl.h sys/ttold.h sys/ptem.h unistd.h) |
5
|
235 AC_DIR_HEADER |
179
|
236 AC_HAVE_FUNCS(setvbuf getcwd bzero rindex vfprintf vsprintf) |
|
237 AC_STRUCT_TM |
|
238 AC_SETVBUF_REVERSED |
|
239 TERMLIBS="" |
|
240 for termlib in termcap terminfo curses termlib ; do |
|
241 AC_HAVE_LIBRARY(${termlib}, [TERMLIBS="${TERMLIBS} -l${termlib}"]) |
|
242 case "${TERMLIBS}" in |
|
243 *-l${termlib}*) |
|
244 break |
|
245 ;; |
|
246 esac |
|
247 done |
|
248 AC_SUBST(TERMLIBS) |
5
|
249 |
|
250 # For now, don't define LEXLIB to be -lfl -- we don't use anything in |
|
251 # it, and it might not be installed. |
|
252 # |
|
253 # Also make sure that we generate an interactive scanner if we are |
|
254 # using flex. |
|
255 |
|
256 AC_PROG_LEX |
|
257 case "$LEX" in |
|
258 flex*) |
|
259 LFLAGS="-t -I" |
|
260 LEXLIB= |
|
261 ;; |
|
262 *) |
|
263 LFLAGS="-t" |
|
264 cat << EOF |
|
265 warning: I didn't find flex, but that's only a problem |
|
266 if you need to reconstruct lex.cc |
|
267 EOF |
|
268 ;; |
|
269 esac |
|
270 AC_SUBST(LFLAGS)dnl |
|
271 |
|
272 AC_PROG_YACC |
|
273 case "$YACC" in |
|
274 bison*) |
|
275 ;; |
|
276 *) |
|
277 cat << EOF |
|
278 warning: I didn't find bison, but that's only a problem |
|
279 if you need to reconstruct parse.cc |
|
280 EOF |
|
281 ;; |
|
282 esac |
|
283 |
|
284 # Define VOID_SIGHANDLER for readline. |
|
285 |
|
286 AC_RETSIGTYPE |
|
287 case "$RETSIGTYPE" in |
|
288 int) |
|
289 ;; |
|
290 *) |
|
291 VOID_SIGHANDLER="-DVOID_SIGHANDLER=1" |
|
292 ;; |
|
293 esac |
|
294 AC_SUBST(VOID_SIGHANDLER)dnl |
|
295 |
137
|
296 AC_HEADER_CHECK(termios.h, DEFS="$DEFS -DHAVE_TERMIOS_H=1", |
|
297 AC_HEADER_CHECK(termio.h, DEFS="$DEFS -DHAVE_TERMIO_H=1", |
|
298 AC_HEADER_CHECK(sgtty.h, DEFS="$DEFS -DHAVE_SGTTY_H=1", [])))dnl |
5
|
299 case "$DEFS" in |
136
|
300 *HAVE_TERMIOS_H* | *HAVE_TERMIO_H* | *HAVE_SGTTY_H*) |
5
|
301 ;; |
|
302 *) |
137
|
303 cat << EOF |
|
304 error: I couldn't find termios.h, termio.h, or sgtty.h, and I can't |
|
305 continue without them. To compile Octave, your system must |
|
306 have at least one of these header files. |
|
307 EOF |
136
|
308 exit 1 |
|
309 ;; |
5
|
310 esac |
|
311 |
137
|
312 |
5
|
313 # Hack for readline's sysdep.h |
|
314 |
|
315 case "$target_host_type" in |
|
316 *next*) |
|
317 echo "using BSD version of readline/sysdep.h on the NeXT" |
|
318 rm -f readline/sysdep.h |
|
319 cp readline/sysdep-obsd.h readline/sysdep.h |
|
320 ;; |
|
321 esac |
|
322 |
|
323 # Check to see if we have IEEE math functions, and if so, which ones. |
|
324 # |
|
325 # Also check for some additional trig functions that aren't ANSI but |
|
326 # are often available. If they are missing, we try to replace them |
|
327 # with functions from the BSD/NET2 math library. |
|
328 |
28
|
329 AC_HAVE_LIBRARY(-lm)dnl |
5
|
330 AC_HAVE_FUNCS(finite isnan isinf)dnl |
|
331 AC_REPLACE_FUNCS(acosh asinh atanh)dnl |
|
332 |
|
333 if test -n "$LIBOBJS"; then |
|
334 for func in $LIBOBJS |
|
335 do |
|
336 case "$func" in |
|
337 *acosh.o*) |
|
338 DEFS="$DEFS -DACOSH_MISSING=1" |
|
339 ;; |
|
340 *asinh.o*) |
|
341 DEFS="$DEFS -DASINH_MISSING=1" |
|
342 ;; |
|
343 *atanh.o*) |
|
344 DEFS="$DEFS -DATANH_MISSING=1" |
|
345 ;; |
|
346 esac |
|
347 done |
|
348 |
|
349 case $LIBOBJS in |
|
350 *acosh.o* | *asinh.o*) |
|
351 AC_REPLACE_FUNCS(copysign)dnl |
|
352 ;; |
|
353 esac |
|
354 |
|
355 case $LIBOBJS in |
|
356 *acosh.o* | *asinh.o* | *atanh.o*) |
|
357 AC_REPLACE_FUNCS(log1p)dnl |
|
358 ;; |
|
359 esac |
|
360 |
|
361 case $LIBOBJS in |
|
362 *log1p*) |
|
363 AC_REPLACE_FUNCS(log__L)dnl |
|
364 ;; |
|
365 esac |
|
366 |
|
367 case $LIBOBJS in |
|
368 *log1p*) |
|
369 AC_REPLACE_FUNCS(finite)dnl |
|
370 ;; |
|
371 esac |
|
372 |
|
373 case $LIBOBJS in |
|
374 *copysign* | *finite* | *log1p*) |
|
375 AC_REPLACE_FUNCS(logb scalb)dnl |
|
376 ;; |
|
377 esac |
|
378 fi |
|
379 |
|
380 AC_PROGRAM_CHECK(GNUPLOT_BINARY, gnuplot, gnuplot, [])dnl |
|
381 if test -z "$GNUPLOT_BINARY"; then |
|
382 cat << EOF |
|
383 warning: I didn't find gnuplot. It isn't necessary to have gnuplot |
|
384 installed, but you won't be able to use any of Octave's |
|
385 plotting commands without it. |
|
386 |
|
387 If gnuplot is installed but it isn't in your path, you can |
|
388 tell Octave where to find it by typing the command |
|
389 |
|
390 gnuplot_binary = '/full/path/to/gnuplot/binary' |
|
391 |
|
392 at the Octave prompt. |
|
393 EOF |
|
394 fi |
|
395 |
28
|
396 AC_PROGRAMS_CHECK(DEFAULT_PAGER, less more page pg, [])dnl |
5
|
397 if test -z "$DEFAULT_PAGER"; then |
|
398 echo "warning: I couldn't find less(1), more(1), page(1), or pg(1)" |
28
|
399 elif test "$DEFAULT_PAGER" = less; then |
|
400 DEFAULT_PAGER="less -e" |
5
|
401 fi |
|
402 |
|
403 AC_PROGRAM_CHECK(RUNTEST, runtest, runtest, [])dnl |
|
404 AC_PROGRAM_CHECK(EXPECT, expect, expect, [])dnl |
|
405 if test -z "$EXPECT" ; then |
|
406 RUNTEST= |
|
407 fi |
|
408 AC_SUBST(RUNTEST)dnl |
|
409 |
39
|
410 define([tmpa], [libcruft/blas/Makefile libcruft/balgen/Makefile])dnl |
80
|
411 define([tmpb], [libcruft/dassl/Makefile libcruft/eispack/Makefile])dnl |
|
412 define([tmpc], [libcruft/fftpack/Makefile libcruft/fsqp/Makefile])dnl |
|
413 define([tmpd], [libcruft/lapack/Makefile libcruft/linpack/Makefile])dnl |
|
414 define([tmpe], [libcruft/minpack/Makefile libcruft/misc/Makefile])dnl |
|
415 define([tmpf], [libcruft/npsol/Makefile libcruft/odepack/Makefile])dnl |
|
416 define([tmpg], [libcruft/qpsol/Makefile libcruft/quadpack/Makefile])dnl |
|
417 define([tmph], [libcruft/ranlib/Makefile libcruft/villad/Makefile])dnl |
5
|
418 define([cruftdirs], [tmpa tmpb tmpc tmpd tmpe tmpf tmpg tmph])dnl |
|
419 define([tmpA], [Makefile Makeconf libcruft/Makefile libcruft/Makerules])dnl |
179
|
420 define([tmpB], [liboctave/Makefile src/Makefile dld/Makefile])dnl |
|
421 define([tmpC], [info/Makefile readline/Makefile readline/doc/Makefile])dnl |
5
|
422 define([tmpD], [readline/examples/Makefile doc/Makefile])dnl |
|
423 define([tmpE], [scripts/Makefile test/Makefile])dnl |
196
|
424 define([srcdirs], [tmpA tmpB tmpC tmpD tmpE])dnl |
5
|
425 AC_OUTPUT([srcdirs cruftdirs])dnl |