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 |
|
80 AC_AIX |
|
81 |
|
82 # Do special things for gcc. |
|
83 |
|
84 case "$CC" in |
|
85 gcc*) |
|
86 CFLAGS="-g -O -Wall" |
|
87 LDFLAGS="-g -O" |
|
88 gcc_version=`gcc -v 2>&1 | grep "^gcc version" | sed 's/^gcc version *//'` |
|
89 case "$gcc_version" in |
|
90 1.*) |
|
91 cat << EOF |
|
92 warning: gcc version $gcc_version is likely to cause problems -- |
|
93 you should probably consider getting version 2.x |
|
94 EOF |
|
95 ;; |
|
96 esac |
|
97 ;; |
|
98 *) |
|
99 CFLAGS="-g" |
|
100 LDFLAGS="-g" |
|
101 ;; |
|
102 esac |
|
103 AC_SUBST(CFLAGS)dnl |
|
104 AC_SUBST(LDFLAGS)dnl |
|
105 |
|
106 AC_PROGRAM_CHECK(GXX, g++, g++, [])dnl |
|
107 if test "$GXX" = g++ ; then |
|
108 CXXFLAGS="-g -O -Wall" |
|
109 gxx_version=`g++ -v 2>&1 | grep "^g.. version" | sed 's/^g.. version *//'` |
|
110 case "$gxx_version" in |
|
111 1.*) |
|
112 cat << EOF |
|
113 warning: g++ version $gxx_version is likely to cause problems -- |
|
114 you should probably consider getting version 2.x |
|
115 EOF |
|
116 ;; |
|
117 esac |
|
118 else |
|
119 cat << EOF |
|
120 warning: Octave has only been tested with g++, and I can't |
|
121 seem to find it. |
|
122 EOF |
|
123 fi |
|
124 AC_SUBST(CXXFLAGS)dnl |
|
125 |
|
126 # If we haven't been forced to use f2c, try to find a Fortran compiler |
|
127 # under any one of several common Un*x Fortran compiler names. |
|
128 # Put fc last to avoid confusion with some vendor's /bin/sh fc |
|
129 # builtin. |
|
130 # |
|
131 # g77 : GNU Fortran (someday...) |
|
132 # xlf : IBM / AIX |
|
133 # cf77 : Cray / Unicos |
|
134 # fc : Convex |
|
135 # |
|
136 # I don't think the Cray compiler will ever work like f2c... |
|
137 |
|
138 if $use_f2c; then |
|
139 true |
|
140 else |
|
141 F77= |
|
142 AC_PROGRAMS_CHECK(F77, g77 xlf cf77 f77 fc)dnl |
|
143 |
|
144 # If it looks like we have a Fortran compiler, try to determine |
|
145 # whether it might be compatible with f2c. |
|
146 |
|
147 if test -n "$F77"; then |
|
148 echo "checking $F77/f2c compatibility" |
|
149 export F77 |
|
150 export CC |
|
151 tmpdef=`sh $srcdir/f2c-compat.sh $srcdir/flibs.sh` |
|
152 status=$? |
|
153 if test $status -eq 0; then |
|
154 if test "$tmpdef" = '-DF77_APPEND_UNDERSCORE=1'; then |
|
155 DEFS="$DEFS $tmpdef" |
|
156 fi |
|
157 else |
|
158 F77= |
|
159 fi |
|
160 fi |
|
161 fi |
|
162 |
|
163 # If we can't find a Fortran compiler, or if it looks like it isn't |
|
164 # compatible with f2c, try to find f2c. |
|
165 |
|
166 if test -z "$F77"; then |
|
167 AC_PROGRAM_CHECK(F2C, f2c, f2c, [])dnl |
|
168 fi |
|
169 |
|
170 F2CFLAGS= |
|
171 FFLAGS="-O" |
|
172 if test -n "$F77"; then |
|
173 export F77 |
|
174 FLIBS=`sh $srcdir/flibs.sh` |
|
175 DOT_O_DOT_F_C1= |
|
176 DOT_O_DOT_F_C2= |
|
177 DOT_O_DOT_F_C3= |
|
178 DOT_O_DOT_F_C4= |
|
179 DEFAULT_DOT_C_FROM_DOT_F= |
|
180 DEFAULT_DOT_O_FROM_DOT_F= |
|
181 elif test -n "$F2C" || $use_f2c; then |
|
182 AC_HAVE_LIBRARY(f2c, FLIBS=-lf2c, [])dnl |
|
183 if test -z "$FLIBS" ; then |
|
184 AC_HAVE_LIBRARY(F77, FLIBS=-lF77, [])dnl |
|
185 if test -n "$FLIBS" ; then |
|
186 AC_HAVE_LIBRARY(I77, FLIBS="$FLIBS -lI77", [])dnl |
|
187 fi |
|
188 fi |
|
189 if test -z "$FLIBS" ; then |
|
190 cat << EOF |
|
191 warning: I found f2c but I couldn't find libf2c.a, or |
|
192 libF77.a and libI77.a |
|
193 EOF |
|
194 fi |
|
195 DEFAULT_DOT_C_FROM_DOT_F='# A rule for making C source from Fortran source.\ |
|
196 # If we are using f2c we should also turn off the default rule for\ |
|
197 # making objects from .f files so that we do not invoke the fortran\ |
|
198 # compiler by mistake.\ |
|
199 \ |
|
200 \%.c : \%.f\ |
|
201 cat $< | $(F2C) $(F2CFLAGS) > $(@F)' |
|
202 DEFAULT_DOT_O_FROM_DOT_F='\%.o : \%.f' |
|
203 DEFS="$DEFS -DF77_APPEND_UNDERSCORE=1" |
|
204 else |
|
205 cat << EOF |
|
206 warning: in order to build octave, you must have a compatible |
|
207 Fortran compiler or f2c installed and in your path. |
|
208 See the file INSTALL for more information. |
|
209 Continuing anyway... |
|
210 EOF |
|
211 fi |
|
212 |
|
213 AC_SUBST(FFLAGS)dnl |
|
214 AC_SUBST(FLIBS)dnl |
|
215 AC_SUBST(F2C)dnl |
|
216 AC_SUBST(F2CFLAGS)dnl |
|
217 AC_SUBST(DEFAULT_DOT_C_FROM_DOT_F)dnl |
|
218 AC_SUBST(DEFAULT_DOT_O_FROM_DOT_F)dnl |
|
219 |
|
220 AC_PROG_INSTALL |
|
221 AC_PROG_RANLIB |
|
222 AC_STDC_HEADERS |
|
223 AC_UNISTD_H |
|
224 AC_DIR_HEADER |
|
225 |
|
226 # For now, don't define LEXLIB to be -lfl -- we don't use anything in |
|
227 # it, and it might not be installed. |
|
228 # |
|
229 # Also make sure that we generate an interactive scanner if we are |
|
230 # using flex. |
|
231 |
|
232 AC_PROG_LEX |
|
233 case "$LEX" in |
|
234 flex*) |
|
235 LFLAGS="-t -I" |
|
236 LEXLIB= |
|
237 ;; |
|
238 *) |
|
239 LFLAGS="-t" |
|
240 cat << EOF |
|
241 warning: I didn't find flex, but that's only a problem |
|
242 if you need to reconstruct lex.cc |
|
243 EOF |
|
244 ;; |
|
245 esac |
|
246 AC_SUBST(LFLAGS)dnl |
|
247 |
|
248 AC_PROG_YACC |
|
249 case "$YACC" in |
|
250 bison*) |
|
251 ;; |
|
252 *) |
|
253 cat << EOF |
|
254 warning: I didn't find bison, but that's only a problem |
|
255 if you need to reconstruct parse.cc |
|
256 EOF |
|
257 ;; |
|
258 esac |
|
259 |
|
260 # Define VOID_SIGHANDLER for readline. |
|
261 |
|
262 AC_RETSIGTYPE |
|
263 case "$RETSIGTYPE" in |
|
264 int) |
|
265 ;; |
|
266 *) |
|
267 VOID_SIGHANDLER="-DVOID_SIGHANDLER=1" |
|
268 ;; |
|
269 esac |
|
270 AC_SUBST(VOID_SIGHANDLER)dnl |
|
271 |
|
272 AC_HAVE_HEADERS(termio.h)dnl |
|
273 case "$DEFS" in |
|
274 *HAVE_TERMIO_H*) |
|
275 ;; |
|
276 *) |
|
277 AC_HAVE_HEADERS(sgtty.h)dnl |
|
278 case "$DEFS" in |
|
279 *HAVE_SGTTY_H*) |
|
280 ;; |
|
281 *) |
|
282 echo "I couldn't find either termio.h or sgtty.h!" |
|
283 exit 1 |
|
284 ;; |
|
285 esac |
|
286 ;; |
|
287 esac |
|
288 |
|
289 # Hack for readline's sysdep.h |
|
290 |
|
291 case "$target_host_type" in |
|
292 *next*) |
|
293 echo "using BSD version of readline/sysdep.h on the NeXT" |
|
294 rm -f readline/sysdep.h |
|
295 cp readline/sysdep-obsd.h readline/sysdep.h |
|
296 ;; |
|
297 esac |
|
298 |
|
299 # Check to see if we have IEEE math functions, and if so, which ones. |
|
300 # |
|
301 # Also check for some additional trig functions that aren't ANSI but |
|
302 # are often available. If they are missing, we try to replace them |
|
303 # with functions from the BSD/NET2 math library. |
|
304 |
|
305 XLIBS="$LIBS" |
|
306 LIBS="$XLIBS -lm" |
|
307 AC_HAVE_FUNCS(finite isnan isinf)dnl |
|
308 AC_REPLACE_FUNCS(acosh asinh atanh)dnl |
|
309 LIBS="$XLIBS" |
|
310 |
|
311 if test -n "$LIBOBJS"; then |
|
312 for func in $LIBOBJS |
|
313 do |
|
314 case "$func" in |
|
315 *acosh.o*) |
|
316 DEFS="$DEFS -DACOSH_MISSING=1" |
|
317 ;; |
|
318 *asinh.o*) |
|
319 DEFS="$DEFS -DASINH_MISSING=1" |
|
320 ;; |
|
321 *atanh.o*) |
|
322 DEFS="$DEFS -DATANH_MISSING=1" |
|
323 ;; |
|
324 esac |
|
325 done |
|
326 |
|
327 case $LIBOBJS in |
|
328 *acosh.o* | *asinh.o*) |
|
329 AC_REPLACE_FUNCS(copysign)dnl |
|
330 ;; |
|
331 esac |
|
332 |
|
333 case $LIBOBJS in |
|
334 *acosh.o* | *asinh.o* | *atanh.o*) |
|
335 AC_REPLACE_FUNCS(log1p)dnl |
|
336 ;; |
|
337 esac |
|
338 |
|
339 case $LIBOBJS in |
|
340 *log1p*) |
|
341 AC_REPLACE_FUNCS(log__L)dnl |
|
342 ;; |
|
343 esac |
|
344 |
|
345 case $LIBOBJS in |
|
346 *log1p*) |
|
347 AC_REPLACE_FUNCS(finite)dnl |
|
348 ;; |
|
349 esac |
|
350 |
|
351 case $LIBOBJS in |
|
352 *copysign* | *finite* | *log1p*) |
|
353 AC_REPLACE_FUNCS(logb scalb)dnl |
|
354 ;; |
|
355 esac |
|
356 fi |
|
357 |
|
358 AC_PROGRAM_CHECK(GNUPLOT_BINARY, gnuplot, gnuplot, [])dnl |
|
359 if test -z "$GNUPLOT_BINARY"; then |
|
360 cat << EOF |
|
361 warning: I didn't find gnuplot. It isn't necessary to have gnuplot |
|
362 installed, but you won't be able to use any of Octave's |
|
363 plotting commands without it. |
|
364 |
|
365 If gnuplot is installed but it isn't in your path, you can |
|
366 tell Octave where to find it by typing the command |
|
367 |
|
368 gnuplot_binary = '/full/path/to/gnuplot/binary' |
|
369 |
|
370 at the Octave prompt. |
|
371 EOF |
|
372 fi |
|
373 |
|
374 AC_PROGRAM_CHECK(DEFAULT_PAGER, less, less, [])dnl |
|
375 if test -z "$DEFAULT_PAGER"; then |
|
376 AC_PROGRAM_CHECK(DEFAULT_PAGER, more, more, [])dnl |
|
377 fi |
|
378 if test -z "$DEFAULT_PAGER"; then |
|
379 AC_PROGRAM_CHECK(DEFAULT_PAGER, page, page, [])dnl |
|
380 fi |
|
381 if test -z "$DEFAULT_PAGER"; then |
|
382 AC_PROGRAM_CHECK(DEFAULT_PAGER, pg, pg, [])dnl |
|
383 fi |
|
384 if test -z "$DEFAULT_PAGER"; then |
|
385 echo "warning: I couldn't find less(1), more(1), page(1), or pg(1)" |
|
386 fi |
|
387 AC_SUBST(DEFAULT_PAGER)dnl |
|
388 |
|
389 AC_PROGRAM_CHECK(RUNTEST, runtest, runtest, [])dnl |
|
390 AC_PROGRAM_CHECK(EXPECT, expect, expect, [])dnl |
|
391 if test -z "$EXPECT" ; then |
|
392 RUNTEST= |
|
393 fi |
|
394 AC_SUBST(RUNTEST)dnl |
|
395 |
|
396 define([tmpa], [libcruft/blas/Makefile libcruft/dassl/Makefile])dnl |
|
397 define([tmpb], [libcruft/fftpack/Makefile])dnl |
|
398 define([tmpc], [libcruft/fsqp/Makefile libcruft/lapack/Makefile])dnl |
|
399 define([tmpd], [libcruft/linpack/Makefile libcruft/minpack/Makefile])dnl |
|
400 define([tmpe], [libcruft/misc/Makefile libcruft/npsol/Makefile])dnl |
|
401 define([tmpf], [libcruft/odepack/Makefile libcruft/qpsol/Makefile])dnl |
|
402 define([tmpg], [libcruft/quadpack/Makefile libcruft/ranlib/Makefile])dnl |
|
403 define([tmph], [libcruft/villad/Makefile])dnl |
|
404 define([cruftdirs], [tmpa tmpb tmpc tmpd tmpe tmpf tmpg tmph])dnl |
|
405 define([tmpA], [Makefile Makeconf libcruft/Makefile libcruft/Makerules])dnl |
|
406 define([tmpB], [liboctave/Makefile src/Makefile])dnl |
|
407 define([tmpC], [dld/Makefile readline/Makefile readline/doc/Makefile])dnl |
|
408 define([tmpD], [readline/examples/Makefile doc/Makefile])dnl |
|
409 define([tmpE], [scripts/Makefile test/Makefile])dnl |
|
410 define([tmpF], [test/config/Makefile test/octave/Makefile])dnl |
|
411 define([srcdirs], [tmpA tmpB tmpC tmpD tmpE tmpF])dnl |
|
412 AC_OUTPUT([srcdirs cruftdirs])dnl |