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