1232
|
1 dnl aclocal.m4 -- extra macros for configuring Octave |
|
2 dnl |
2847
|
3 dnl Copyright (C) 1996, 1997 John W. Eaton |
1232
|
4 dnl |
|
5 dnl This file is part of Octave. |
|
6 dnl |
|
7 dnl Octave is free software; you can redistribute it and/or modify it |
|
8 dnl under the terms of the GNU General Public License as published by the |
|
9 dnl Free Software Foundation; either version 2, or (at your option) any |
|
10 dnl later version. |
|
11 dnl |
|
12 dnl Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 dnl for more details. |
|
16 dnl |
|
17 dnl You should have received a copy of the GNU General Public License |
|
18 dnl along with Octave; see the file COPYING. If not, write to the Free |
2548
|
19 dnl Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
|
20 dnl 02111-1307, USA. |
|
21 dnl |
2813
|
22 dnl ---------------------------------------------------------------------- |
|
23 dnl |
|
24 dnl Figure out the hardware-vendor-os info. |
|
25 dnl |
|
26 dnl OCTAVE_HOST_TYPE |
|
27 AC_DEFUN(OCTAVE_HOST_TYPE, |
|
28 [AC_CANONICAL_HOST |
|
29 if test -z "$host"; then |
|
30 host=unknown |
|
31 fi |
|
32 canonical_host_type=$host |
|
33 if test "$host" = unknown; then |
|
34 AC_MSG_WARN([configuring Octave for unknown system type |
|
35 ]) |
|
36 fi |
3130
|
37 AC_SUBST(canonical_host_type)]) |
2813
|
38 dnl |
|
39 dnl Set default value for a variable and substitute it. |
|
40 dnl |
|
41 dnl OCTAVE_SET_DEFAULT |
|
42 AC_DEFUN(OCTAVE_SET_DEFAULT, |
|
43 [ifelse($#, 2, [$1=$2 |
|
44 ])dnl |
|
45 AC_MSG_RESULT([defining $1 to be $$1]) |
|
46 AC_SUBST($1)]) |
|
47 dnl |
|
48 dnl |
|
49 dnl OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS |
|
50 AC_DEFUN(OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS, |
|
51 [if test "${with_$1+set}" = set; then |
|
52 if test "${with_$2+set}" = set; then |
|
53 if test "$with_$2" = no; then |
|
54 true |
|
55 else |
|
56 $3 |
|
57 fi |
|
58 fi |
|
59 fi]) |
|
60 dnl |
3130
|
61 dnl Check for ar. |
|
62 dnl |
|
63 AC_DEFUN(OCTAVE_PROG_AR, |
|
64 [if test -z "$AR"; then |
|
65 AR=ar |
|
66 fi |
|
67 AC_SUBST(AR) |
|
68 |
|
69 if test -z "$ARFLAGS"; then |
|
70 ARFLAGS="rc" |
|
71 fi |
|
72 AC_SUBST(ARFLAGS) |
|
73 ]) |
|
74 dnl |
|
75 dnl See if $F77 is the GNU Fortran compiler |
|
76 dnl |
|
77 AC_DEFUN(OCTAVE_PROG_G77, |
|
78 [AC_CACHE_CHECK([whether ${F77-f77} is the GNU Fortran compiler], |
|
79 octave_cv_f77_is_g77, |
|
80 [if $use_g77; then |
|
81 octave_cv_f77_is_g77=yes |
|
82 else |
|
83 f77_output=`$F77 -v 2>&1 | grep "GNU F77"` |
|
84 if test -n "$f77_output"; then |
|
85 octave_cv_f77_is_g77=yes |
3141
|
86 else |
|
87 octave_cv_f77_is_g77=no |
3130
|
88 fi |
|
89 fi]) |
|
90 ]) |
|
91 dnl |
1232
|
92 dnl See what libraries are used by the Fortran compiler. |
|
93 dnl |
|
94 dnl Write a minimal program and compile it with -v. I don't know what |
|
95 dnl to do if your compiler doesn't have -v... |
|
96 dnl |
|
97 dnl OCTAVE_FLIBS() |
|
98 AC_DEFUN(OCTAVE_FLIBS, |
2039
|
99 [AC_MSG_CHECKING([for Fortran libraries]) |
2854
|
100 AC_REQUIRE([OCTAVE_HOST_TYPE]) |
1232
|
101 AC_CACHE_VAL(octave_cv_flibs, |
|
102 [changequote(, )dnl |
|
103 echo " END" > conftest.f |
|
104 foutput=`${F77-f77} -v -o conftest conftest.f 2>&1` |
|
105 dnl |
|
106 dnl The easiest thing to do for xlf output is to replace all the commas |
|
107 dnl with spaces. Try to only do that if the output is really from xlf, |
|
108 dnl since doing that causes problems on other systems. |
|
109 dnl |
|
110 xlf_p=`echo $foutput | grep xlfentry` |
|
111 if test -n "$xlf_p"; then |
|
112 foutput=`echo $foutput | sed 's/,/ /g'` |
|
113 fi |
|
114 dnl |
|
115 ld_run_path=`echo $foutput | \ |
2638
|
116 sed -n -e 's/^.*LD_RUN_PATH *= *\([^ ]*\).*/\1/p'` |
1232
|
117 dnl |
3074
|
118 dnl We are only supposed to find this on Solaris systems... |
|
119 dnl Uh, the run path should be absolute, shouldn't it? |
1232
|
120 dnl |
3074
|
121 case "$ld_run_path" in |
|
122 /*) |
|
123 if test "$ac_cv_prog_gcc" = yes; then |
|
124 ld_run_path="-Xlinker -R -Xlinker $ld_run_path" |
|
125 else |
|
126 ld_run_path="-R $ld_run_path" |
|
127 fi |
|
128 ;; |
3143
|
129 *) |
|
130 ld_run_path= |
|
131 ;; |
3074
|
132 esac |
1232
|
133 dnl |
|
134 flibs= |
|
135 lflags= |
|
136 dnl |
|
137 dnl If want_arg is set, we know we want the arg to be added to the list, |
|
138 dnl so we don't have to examine it. |
|
139 dnl |
|
140 want_arg= |
|
141 dnl |
|
142 for arg in $foutput; do |
|
143 old_want_arg=$want_arg |
|
144 want_arg= |
3069
|
145 dnl |
|
146 dnl None of the options that take arguments expect the argument to |
|
147 dnl start with a -, so pretend we didn't see anything special. |
|
148 dnl |
|
149 if test -n "$old_want_arg"; then |
|
150 case "$arg" in |
|
151 -*) |
|
152 old_want_arg= |
|
153 ;; |
|
154 esac |
|
155 fi |
1232
|
156 case "$old_want_arg" in |
|
157 '') |
|
158 case $arg in |
2641
|
159 /*.a) |
1232
|
160 exists=false |
|
161 for f in $lflags; do |
|
162 if test x$arg = x$f; then |
|
163 exists=true |
|
164 fi |
|
165 done |
|
166 if $exists; then |
|
167 arg= |
|
168 else |
|
169 lflags="$lflags $arg" |
|
170 fi |
|
171 ;; |
2351
|
172 -bI:*) |
|
173 exists=false |
|
174 for f in $lflags; do |
|
175 if test x$arg = x$f; then |
|
176 exists=true |
|
177 fi |
|
178 done |
|
179 if $exists; then |
|
180 arg= |
|
181 else |
2600
|
182 if test "$ac_cv_prog_gcc" = yes; then |
|
183 lflags="$lflags -Xlinker $arg" |
|
184 else |
|
185 lflags="$lflags $arg" |
|
186 fi |
2351
|
187 fi |
|
188 ;; |
3089
|
189 -lang* | -lcrt0.o | -lc | -lgcc) |
1232
|
190 arg= |
|
191 ;; |
|
192 -[lLR]) |
|
193 want_arg=$arg |
|
194 arg= |
|
195 ;; |
|
196 -[lLR]*) |
|
197 exists=false |
|
198 for f in $lflags; do |
|
199 if test x$arg = x$f; then |
|
200 exists=true |
|
201 fi |
|
202 done |
2862
|
203 if $exists; then |
1232
|
204 arg= |
|
205 else |
2854
|
206 case "$arg" in |
|
207 -lkernel32) |
|
208 case "$canonical_host_type" in |
|
209 *-*-cygwin32) |
|
210 ;; |
|
211 *) |
|
212 lflags="$lflags $arg" |
|
213 ;; |
|
214 esac |
|
215 ;; |
3089
|
216 -lm) |
2854
|
217 ;; |
|
218 *) |
|
219 lflags="$lflags $arg" |
|
220 ;; |
|
221 esac |
1232
|
222 fi |
|
223 ;; |
|
224 -u) |
|
225 want_arg=$arg |
3069
|
226 arg= |
1232
|
227 ;; |
|
228 -Y) |
|
229 want_arg=$arg |
|
230 arg= |
|
231 ;; |
|
232 *) |
|
233 arg= |
|
234 ;; |
|
235 esac |
|
236 ;; |
|
237 -[lLR]) |
|
238 arg="$old_want_arg $arg" |
|
239 ;; |
3069
|
240 -u) |
|
241 arg="-u $arg" |
|
242 ;; |
1232
|
243 -Y) |
|
244 dnl |
|
245 dnl Should probably try to ensure unique directory options here too. |
|
246 dnl This probably only applies to Solaris systems, and then will only |
|
247 dnl work with gcc... |
|
248 dnl |
|
249 arg=`echo $arg | sed -e 's%^P,%%'` |
|
250 SAVE_IFS=$IFS |
|
251 IFS=: |
|
252 list= |
|
253 for elt in $arg; do |
2641
|
254 list="$list -L$elt" |
1232
|
255 done |
|
256 IFS=$SAVE_IFS |
|
257 arg="$list" |
|
258 ;; |
|
259 esac |
|
260 dnl |
|
261 if test -n "$arg"; then |
|
262 flibs="$flibs $arg" |
|
263 fi |
|
264 done |
1953
|
265 if test -n "$ld_run_path"; then |
|
266 flibs_result="$ld_run_path $flibs" |
|
267 else |
|
268 flibs_result="$flibs" |
|
269 fi |
1232
|
270 changequote([, ])dnl |
1953
|
271 octave_cv_flibs="$flibs_result"]) |
1232
|
272 FLIBS="$octave_cv_flibs" |
|
273 AC_MSG_RESULT([$FLIBS])]) |
2548
|
274 dnl |
3130
|
275 dnl This is apparently needed on some Linux systems. |
|
276 dnl |
|
277 AC_DEFUN(OCTAVE_F77_MAIN_FLAG, |
|
278 [FORTRAN_MAIN_FLAG= |
|
279 case "$canonical_host_type" in |
|
280 *-linux-*) |
|
281 FORTRAN_MAIN_FLAG="-u MAIN__" |
|
282 ;; |
|
283 esac |
|
284 if test -n "$FORTRAN_MAIN_FLAG"; then |
|
285 AC_MSG_RESULT([defining FORTRAN_MAIN_FLAG to be $FORTRAN_MAIN_FLAG]) |
|
286 fi |
|
287 AC_SUBST(FORTRAN_MAIN_FLAG) |
|
288 ]) |
|
289 dnl |
1257
|
290 dnl See if the Fortran compiler uses uppercase external names. |
|
291 dnl |
|
292 dnl OCTAVE_F77_UPPERCASE_NAMES() |
|
293 AC_DEFUN(OCTAVE_F77_UPPERCASE_NAMES, |
|
294 [AC_MSG_CHECKING([whether $F77 uses uppercase external names]) |
|
295 AC_CACHE_VAL(octave_cv_f77_uppercase_names, |
|
296 [octave_cv_f77_uppercase_names=no |
|
297 cat > conftest.f <<EOF |
|
298 subroutine xxyyzz () |
|
299 return |
|
300 end |
|
301 EOF |
|
302 if ${F77-f77} -c conftest.f 1>&AC_FD_CC 2>&AC_FD_CC; then |
|
303 if test "`${NM-nm} conftest.o | grep XXYYZZ`" != ""; then |
|
304 octave_cv_f77_uppercase_names=yes |
|
305 fi |
|
306 fi]) |
|
307 AC_MSG_RESULT([$octave_cv_f77_uppercase_names]) |
|
308 if test "$octave_cv_f77_uppercase_names" = yes; then |
|
309 AC_DEFINE(F77_UPPERCASE_NAMES, 1) |
|
310 fi]) |
2548
|
311 dnl |
1232
|
312 dnl See if the Fortran compiler appends underscores to external names. |
|
313 dnl |
|
314 dnl OCTAVE_F77_APPEND_UNDERSCORE() |
|
315 AC_DEFUN(OCTAVE_F77_APPEND_UNDERSCORE, |
|
316 [AC_MSG_CHECKING([whether $F77 appends underscores to external names]) |
1257
|
317 AC_REQUIRE([OCTAVE_F77_UPPERCASE_NAMES]) |
1232
|
318 AC_CACHE_VAL(octave_cv_f77_append_underscore, |
|
319 [octave_cv_f77_append_underscore=no |
|
320 cat > conftest.f <<EOF |
|
321 subroutine xxyyzz () |
|
322 return |
|
323 end |
|
324 EOF |
|
325 if ${F77-f77} -c conftest.f 1>&AC_FD_CC 2>&AC_FD_CC; then |
1257
|
326 if test "$octave_cv_f77_uppercase_names" = yes; then |
|
327 if test "`${NM-nm} conftest.o | grep XXYYZZ_`" != ""; then |
|
328 octave_cv_f77_append_underscore=yes |
|
329 fi |
|
330 else |
|
331 if test "`${NM-nm} conftest.o | grep xxyyzz_`" != ""; then |
|
332 octave_cv_f77_append_underscore=yes |
|
333 fi |
1232
|
334 fi |
|
335 fi]) |
|
336 AC_MSG_RESULT([$octave_cv_f77_append_underscore]) |
|
337 if test "$octave_cv_f77_append_underscore" = yes; then |
|
338 AC_DEFINE(F77_APPEND_UNDERSCORE, 1) |
|
339 fi]) |
2548
|
340 dnl |
1232
|
341 dnl See if the Fortran compiler is compatible with f2c. |
|
342 dnl |
|
343 dnl Write a minimal program, compile it, and see if it works as |
|
344 dnl expected. |
|
345 dnl |
|
346 dnl OCTAVE_F2C_F77_COMPAT() |
|
347 AC_DEFUN(OCTAVE_F2C_F77_COMPAT, |
3130
|
348 [AC_REQUIRE([OCTAVE_PROG_G77]) |
|
349 AC_REQUIRE([OCTAVE_FLIBS]) |
1232
|
350 AC_REQUIRE([OCTAVE_F77_APPEND_UNDERSCORE]) |
3130
|
351 if test "$cross_compiling" = yes; then |
|
352 octave_cv_f2c_f77_compat=yes |
|
353 if test "$octave_cv_f77_is_g77" = yes; then |
|
354 AC_MSG_RESULT([assuming ${F77-f77} cross compiler is f2c compatible]) |
|
355 else |
|
356 AC_MSG_WARN([assuming ${F77-f77} cross compiler is f2c compatible]) |
|
357 fi |
|
358 else |
|
359 AC_CACHE_CHECK([$F77/f2c compatibility], octave_cv_f2c_f77_compat, |
|
360 [trap 'rm -f ftest* ctest* core; exit 1' 1 3 15 |
|
361 octave_cv_f2c_f77_compat=no |
|
362 cat > ftest.f <<EOF |
3162
|
363 SUBROUTINE FORSUB (C, I, D) |
1232
|
364 CHARACTER *(*) C |
3162
|
365 INTEGER L, I |
1232
|
366 DOUBLE PRECISION D |
|
367 L = LEN (C) |
|
368 WRITE (*, '(A,1X,I2)') C(1:L), INT (D) |
3162
|
369 I = 0 |
1232
|
370 RETURN |
|
371 END |
|
372 EOF |
3130
|
373 ${F77-f77} -c ftest.f 1>&AC_FD_CC 2>&AC_FD_CC |
|
374 changequote(, ) |
|
375 cat > ctest.c <<EOF |
1232
|
376 #include "confdefs.h" |
3162
|
377 #ifdef F77_APPEND_UNDERSCORE |
|
378 extern int forsub_ (const char*, int*, double*, long int); |
|
379 #else |
|
380 extern int forsub (const char*, int*, double*, long int); |
|
381 #endif |
1232
|
382 static char s[14]; |
|
383 int main () |
|
384 { |
|
385 double d = 10.0; |
3162
|
386 int len, i = 1; |
1232
|
387 strcpy (s, "FOO-I-HITHERE"); |
|
388 len = strlen (s); |
|
389 #ifdef F77_APPEND_UNDERSCORE |
3162
|
390 forsub_ (s, &i, &d, len); |
1232
|
391 #else |
3162
|
392 forsub (s, &i, &d, len); |
1232
|
393 #endif |
3162
|
394 return i; |
1232
|
395 } |
2218
|
396 #if defined (sun) |
1232
|
397 int MAIN_ () { return 0; } |
2126
|
398 #elif defined (linux) && defined (__ELF__) |
|
399 int MAIN__ () { return 0; } |
1232
|
400 #endif |
|
401 EOF |
3130
|
402 changequote([, ]) |
|
403 if ${CC-cc} -c ctest.c 1>&AC_FD_CC 2>&AC_FD_CC; then |
|
404 if ${CC-cc} -o ctest ctest.o ftest.o $FLIBS -lm 1>&AC_FD_CC 2>&AC_FD_CC; then |
|
405 ctest_output=`./ctest 2>&1` |
|
406 status=$? |
|
407 if test $status -eq 0 && test "$ctest_output" = "FOO-I-HITHERE 10"; then |
|
408 octave_cv_f2c_f77_compat=yes |
|
409 fi |
1232
|
410 fi |
3130
|
411 fi]) |
|
412 fi |
1232
|
413 rm -f ftest* ctest* core |
3130
|
414 ]) |
2548
|
415 dnl |
|
416 dnl See if struct group has a gr_passwd field. |
|
417 dnl |
|
418 AC_DEFUN(OCTAVE_STRUCT_GR_PASSWD, |
|
419 [AC_CACHE_CHECK([for gr_passwd in struct group], octave_cv_struct_gr_passwd, |
|
420 [AC_TRY_COMPILE([#include <sys/types.h> |
|
421 #include <grp.h>], [struct group s; s.gr_passwd;], |
|
422 octave_cv_struct_gr_passwd=yes, octave_cv_struct_gr_passwd=no)]) |
|
423 if test $octave_cv_struct_gr_passwd = yes; then |
|
424 AC_DEFINE(HAVE_GR_PASSWD) |
|
425 fi |
|
426 ]) |
|
427 dnl |
2574
|
428 dnl See if the standard string class has npos as a member. |
|
429 dnl |
|
430 AC_DEFUN(OCTAVE_STRING_NPOS, |
|
431 [AC_CACHE_CHECK([whether including <string> defines NPOS], |
|
432 octave_cv_string_npos, |
|
433 [AC_LANG_SAVE |
|
434 AC_LANG_CPLUSPLUS |
|
435 AC_TRY_COMPILE([#include <string>], |
|
436 [size_t foo = NPOS], |
|
437 octave_cv_string_npos=yes, octave_cv_string_npos=no)]) |
|
438 if test $octave_cv_string_npos = no; then |
|
439 AC_DEFINE(NPOS, string::npos) |
|
440 fi |
|
441 AC_LANG_RESTORE |
|
442 ]) |
|
443 dnl |
1707
|
444 dnl The following test is from Karl Berry's Kpathseach library. I'm |
|
445 dnl including it here in case we someday want to make the use of |
|
446 dnl kpathsea optional. |
1708
|
447 dnl |
|
448 dnl Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment. |
|
449 dnl This test program is due to Mike Hibler <mike@cs.utah.edu>. |
|
450 dnl We don't actually need to run this if we don't have putenv, but it |
|
451 dnl doesn't hurt. |
|
452 AC_DEFUN(OCTAVE_SMART_PUTENV, |
|
453 [AC_MSG_CHECKING(whether putenv uses malloc) |
1707
|
454 AC_CACHE_VAL(octave_cv_func_putenv_malloc, |
|
455 [AC_TRY_RUN([ |
|
456 #define VAR "YOW_VAR" |
|
457 #define STRING1 "GabbaGabbaHey" |
|
458 #define STRING2 "Yow!!" /* should be shorter than STRING1 */ |
|
459 extern char *getenv (); /* in case char* and int don't mix gracefully */ |
|
460 main () |
|
461 { |
|
462 char *str1, *rstr1, *str2, *rstr2; |
|
463 str1 = getenv (VAR); |
|
464 if (str1) |
|
465 exit (1); |
|
466 str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1); |
|
467 if (str1 == 0) |
|
468 exit (2); |
|
469 strcpy (str1, VAR); |
|
470 strcat (str1, "="); |
|
471 strcat (str1, STRING1); |
|
472 if (putenv (str1) < 0) |
|
473 exit (3); |
|
474 rstr1 = getenv (VAR); |
|
475 if (rstr1 == 0) |
|
476 exit (4); |
|
477 rstr1 -= strlen (VAR) + 1; |
|
478 if (strncmp (rstr1, VAR, strlen (VAR))) |
|
479 exit (5); |
|
480 str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1); |
|
481 if (str2 == 0 || str1 == str2) |
|
482 exit (6); |
|
483 strcpy (str2, VAR); |
|
484 strcat (str2, "="); |
|
485 strcat (str2, STRING2); |
|
486 if (putenv (str2) < 0) |
|
487 exit (7); |
|
488 rstr2 = getenv (VAR); |
|
489 if (rstr2 == 0) |
|
490 exit (8); |
|
491 rstr2 -= strlen (VAR) + 1; |
|
492 #if 0 |
|
493 printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2); |
|
494 /* |
|
495 * If string from first call was reused for the second call, |
|
496 * you had better not do a free on the first string! |
|
497 */ |
|
498 if (rstr1 == rstr2) |
|
499 printf ("#define SMART_PUTENV\n"); |
|
500 else |
|
501 printf ("#undef SMART_PUTENV\n"); |
|
502 #endif |
|
503 exit (rstr1 == rstr2 ? 0 : 1); |
|
504 }], octave_cv_func_putenv_malloc=yes, octave_cv_func_putenv_malloc=no, |
|
505 octave_cv_func_putenv_malloc=no)])dnl |
|
506 AC_MSG_RESULT($octave_cv_func_putenv_malloc) |
|
507 if test $octave_cv_func_putenv_malloc = yes; then |
|
508 AC_DEFINE(SMART_PUTENV) |
1708
|
509 fi]) |
1788
|
510 dnl |
2469
|
511 dnl These two checks for signal functions were originally part of the |
|
512 dnl aclocal.m4 file distributed with bash 2.0. |
|
513 dnl |
|
514 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) |
|
515 AC_DEFUN(OCTAVE_SIGNAL_CHECK, |
|
516 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
517 AC_MSG_CHECKING(for type of signal functions) |
|
518 AC_CACHE_VAL(octave_cv_signal_vintage, |
|
519 [ |
|
520 AC_TRY_LINK([#include <signal.h>],[ |
|
521 sigset_t ss; |
|
522 struct sigaction sa; |
|
523 sigemptyset(&ss); sigsuspend(&ss); |
|
524 sigaction(SIGINT, &sa, (struct sigaction *) 0); |
|
525 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); |
|
526 ], octave_cv_signal_vintage=posix, |
|
527 [ |
|
528 AC_TRY_LINK([#include <signal.h>], [ |
|
529 int mask = sigmask(SIGINT); |
|
530 sigsetmask(mask); sigblock(mask); sigpause(mask); |
|
531 ], octave_cv_signal_vintage=4.2bsd, |
|
532 [ |
|
533 AC_TRY_LINK([ |
|
534 #include <signal.h> |
|
535 RETSIGTYPE foo() { }], [ |
|
536 int mask = sigmask(SIGINT); |
|
537 sigset(SIGINT, foo); sigrelse(SIGINT); |
|
538 sighold(SIGINT); sigpause(SIGINT); |
2491
|
539 ], octave_cv_signal_vintage=svr3, octave_cv_signal_vintage=v7 |
2469
|
540 )] |
|
541 )] |
|
542 ) |
|
543 ]) |
|
544 AC_MSG_RESULT($octave_cv_signal_vintage) |
2491
|
545 if test "$octave_cv_signal_vintage" = posix; then |
2469
|
546 AC_DEFINE(HAVE_POSIX_SIGNALS) |
2491
|
547 elif test "$octave_cv_signal_vintage" = "4.2bsd"; then |
2469
|
548 AC_DEFINE(HAVE_BSD_SIGNALS) |
2491
|
549 elif test "$octave_cv_signal_vintage" = svr3; then |
2469
|
550 AC_DEFINE(HAVE_USG_SIGHOLD) |
|
551 fi |
|
552 ]) |
|
553 dnl |
|
554 AC_DEFUN(OCTAVE_REINSTALL_SIGHANDLERS, |
|
555 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
556 AC_REQUIRE([OCTAVE_SIGNAL_CHECK]) |
|
557 AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked]) |
|
558 AC_CACHE_VAL(octave_cv_must_reinstall_sighandlers, |
|
559 [AC_TRY_RUN([ |
|
560 #include <signal.h> |
|
561 #ifdef HAVE_UNISTD_H |
|
562 #include <unistd.h> |
|
563 #endif |
|
564 typedef RETSIGTYPE sigfunc(); |
|
565 int nsigint; |
|
566 #ifdef HAVE_POSIX_SIGNALS |
|
567 sigfunc * |
|
568 set_signal_handler(sig, handler) |
|
569 int sig; |
|
570 sigfunc *handler; |
|
571 { |
|
572 struct sigaction act, oact; |
|
573 act.sa_handler = handler; |
|
574 act.sa_flags = 0; |
|
575 sigemptyset (&act.sa_mask); |
|
576 sigemptyset (&oact.sa_mask); |
|
577 sigaction (sig, &act, &oact); |
|
578 return (oact.sa_handler); |
|
579 } |
|
580 #else |
|
581 #define set_signal_handler(s, h) signal(s, h) |
|
582 #endif |
|
583 RETSIGTYPE |
|
584 sigint(s) |
|
585 int s; |
|
586 { |
|
587 nsigint++; |
|
588 } |
|
589 main() |
|
590 { |
|
591 nsigint = 0; |
|
592 set_signal_handler(SIGINT, sigint); |
|
593 kill((int)getpid(), SIGINT); |
|
594 kill((int)getpid(), SIGINT); |
|
595 exit(nsigint != 2); |
|
596 } |
|
597 ], octave_cv_must_reinstall_sighandlers=no, octave_cv_must_reinstall_sighandlers=yes, |
3130
|
598 if test "$octave_cv_signal_vintage" = svr3; then |
|
599 octave_cv_must_reinstall_sighandlers=yes |
|
600 else |
|
601 octave_cv_must_reinstall_sighandlers=no |
|
602 fi)]) |
|
603 if test "$cross_compiling" = yes; then |
|
604 AC_MSG_RESULT([$octave_cv_must_reinstall_sighandlers assumed for cross compilation]) |
|
605 else |
|
606 AC_MSG_RESULT($octave_cv_must_reinstall_sighandlers) |
|
607 fi |
2491
|
608 if test "$octave_cv_must_reinstall_sighandlers" = yes; then |
3130
|
609 AC_DEFINE(MUST_REINSTALL_SIGHANDLERS) |
2469
|
610 fi |
|
611 ]) |
2626
|
612 dnl |
|
613 dnl This check originally from bash 2.0. |
|
614 dnl |
|
615 dnl Check for typedef'd symbols in header files, but allow the caller to |
|
616 dnl specify the include files to be checked in addition to the default. |
|
617 dnl |
|
618 dnl OCTAVE_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND]) |
|
619 AC_DEFUN(OCTAVE_CHECK_TYPE, |
|
620 [AC_REQUIRE([AC_HEADER_STDC])dnl |
|
621 AC_MSG_CHECKING(for $1) |
|
622 AC_CACHE_VAL(octave_cv_type_$1, |
|
623 [AC_EGREP_CPP($1, [#include <sys/types.h> |
|
624 #if STDC_HEADERS |
|
625 #include <stdlib.h> |
|
626 #endif |
|
627 $2 |
|
628 ], octave_cv_type_$1=yes, octave_cv_type_$1=no)]) |
|
629 AC_MSG_RESULT($octave_cv_type_$1) |
|
630 ifelse($#, 4, [if test $octave_cv_type_$1 = yes; then |
|
631 AC_DEFINE($4) |
|
632 fi]) |
|
633 if test $octave_cv_type_$1 = no; then |
|
634 AC_DEFINE($1, $3) |
|
635 fi |
|
636 ]) |
3107
|
637 dnl |
|
638 dnl Check to see if C++ compiler needs the new friend template declaration |
|
639 dnl syntax. |
|
640 dnl |
|
641 dnl OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL |
|
642 AC_DEFUN(OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL, [ |
|
643 AC_REQUIRE([AC_PROG_CXX]) |
|
644 AC_MSG_CHECKING([for C++ support for new friend template declaration]) |
|
645 AC_CACHE_VAL(octave_cv_cxx_new_friend_template_decl, [ |
|
646 AC_LANG_SAVE |
|
647 AC_LANG_CPLUSPLUS |
|
648 rm -f conftest.h |
|
649 cat > conftest.h <<EOB |
|
650 struct A { |
|
651 friend int operator== (const A&, const A&); |
|
652 A (int) { } |
|
653 }; |
|
654 |
|
655 template <class T> int |
|
656 operator== (const T&, const T&) |
|
657 { |
|
658 return 0; |
|
659 } |
|
660 EOB |
|
661 AC_TRY_LINK([#include "conftest.h"], [ |
|
662 A a (1); |
|
663 return a == A(1); |
|
664 ], |
|
665 octave_cv_cxx_new_friend_template_decl=no, |
|
666 octave_cv_cxx_new_friend_template_decl=yes |
|
667 ) |
|
668 AC_LANG_RESTORE |
|
669 ]) |
|
670 AC_MSG_RESULT($octave_cv_cxx_new_friend_template_decl) |
|
671 if test $octave_cv_cxx_new_friend_template_decl = yes; then |
|
672 AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL) |
|
673 fi |
|
674 ]) |
3126
|
675 dnl |
|
676 dnl Check to see if C compiler handles FLAG command line option and |
|
677 dnl add it to CFLAGS if it does. |
|
678 dnl |
|
679 dnl OCTAVE_CC_FLAG |
|
680 AC_DEFUN(OCTAVE_CC_FLAG, [ |
|
681 ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` |
|
682 AC_MSG_CHECKING(whether ${CC-cc} accepts $1) |
|
683 AC_CACHE_VAL(octave_cv_cc_flag_$ac_safe, [ |
|
684 AC_LANG_SAVE |
|
685 AC_LANG_C |
|
686 XCFLAGS="$CFLAGS" |
|
687 CFLAGS="$CFLAGS $1" |
|
688 AC_TRY_LINK([], [], |
|
689 eval "octave_cv_cc_flag_$ac_safe=yes", |
|
690 eval "octave_cv_cc_flag_$ac_safe=no") |
|
691 CFLAGS="$XCFLAGS" |
|
692 AC_LANG_RESTORE |
|
693 ]) |
|
694 if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then |
|
695 AC_MSG_RESULT(yes) |
3131
|
696 ifelse([$2], , [ |
|
697 CFLAGS="$CFLAGS $1" |
|
698 AC_MSG_RESULT([adding $1 to CFLAGS])], [$2]) |
3126
|
699 else |
|
700 AC_MSG_RESULT(no) |
|
701 ifelse([$3], , , [$3]) |
|
702 fi |
|
703 ]) |
|
704 dnl |
|
705 dnl Check to see if C++ compiler handles FLAG command line option and |
|
706 dnl add it to CXXFLAGS if it does. |
|
707 dnl |
|
708 dnl OCTAVE_CXX_FLAG |
|
709 AC_DEFUN(OCTAVE_CXX_FLAG, [ |
|
710 ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` |
|
711 AC_MSG_CHECKING(whether ${CXX-c++} accepts $1) |
|
712 AC_CACHE_VAL(octave_cv_cxx_flag_$ac_safe, [ |
|
713 AC_LANG_SAVE |
|
714 AC_LANG_CPLUSPLUS |
|
715 XCXXFLAGS="$CXXFLAGS" |
|
716 CXXFLAGS="$CXXFLAGS $1" |
|
717 AC_TRY_LINK([], [], |
|
718 eval "octave_cv_cxx_flag_$ac_safe=yes", |
|
719 eval "octave_cv_cxx_flag_$ac_safe=no") |
|
720 CXXFLAGS="$XCXXFLAGS" |
|
721 AC_LANG_RESTORE |
|
722 ]) |
|
723 if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then |
|
724 AC_MSG_RESULT(yes) |
3131
|
725 ifelse([$2], , [ |
|
726 CXXFLAGS="$CXXFLAGS $1" |
|
727 AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2]) |
3126
|
728 else |
|
729 AC_MSG_RESULT(no) |
|
730 ifelse([$3], , , [$3]) |
|
731 fi |
|
732 ]) |
3130
|
733 dnl |
|
734 dnl What pager should we use? |
|
735 dnl |
|
736 AC_DEFUN(OCTAVE_PROG_PAGER, |
|
737 [if test "$cross_compiling" = yes; then |
|
738 DEFAULT_PAGER=less |
|
739 AC_MSG_RESULT(assuming $DEFAULT_PAGER exists on $canonical_host_type host) |
|
740 AC_SUBST(DEFAULT_PAGER) |
|
741 else |
|
742 octave_possible_pagers="less more page pg" |
|
743 case "$canonical_host_type" in |
|
744 *-*-cygwin32) |
|
745 octave_possible_pagers="$octave_possible_pagers more.com" |
|
746 ;; |
|
747 esac |
|
748 |
|
749 AC_CHECK_PROGS(DEFAULT_PAGER, $octave_possible_pagers, []) |
|
750 if test -z "$DEFAULT_PAGER"; then |
|
751 warn_less="I couldn't find \`less', \`more', \`page', or \`pg'" |
|
752 AC_MSG_WARN($warn_less) |
|
753 fi |
|
754 fi |
|
755 ]) |
|
756 dnl |
|
757 dnl Does gnuplot exist? Is it a recent version? |
|
758 dnl |
|
759 AC_DEFUN(OCTAVE_PROG_GNUPLOT, |
|
760 [if test "$cross_compiling" = yes; then |
|
761 GNUPLOT_BINARY=gnuplot |
|
762 AC_MSG_RESULT(assuming $GNUPLOT_BINARY exists on $canonical_host_type host) |
|
763 AC_SUBST(DEFAULT_PAGER) |
|
764 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiplot mode) |
|
765 AC_DEFINE(GNUPLOT_HAS_MULTIPLOT, 1) |
|
766 AC_MSG_RESULT(assuming $GNUPLOT_BINARY supports multiple frams) |
|
767 AC_DEFINE(GNUPLOT_HAS_FRAMES, 1) |
|
768 else |
|
769 AC_CHECK_PROG(GNUPLOT_BINARY, gnuplot, gnuplot, []) |
|
770 if test -n "$GNUPLOT_BINARY"; then |
|
771 AC_MSG_CHECKING([to see if your gnuplot supports multiplot]) |
|
772 if test -z "`echo 'set term unknown; set multiplot' | \ |
|
773 $GNUPLOT_BINARY 2>&1`"; then |
|
774 AC_MSG_RESULT([yes]) |
|
775 AC_DEFINE(GNUPLOT_HAS_MULTIPLOT, 1) |
|
776 else |
|
777 AC_MSG_RESULT([no]) |
|
778 fi |
|
779 AC_MSG_CHECKING([to see if your gnuplot supports multiple plot windows]) |
|
780 if test -z "`echo 'set term x11 2' | $GNUPLOT_BINARY 2>&1`"; then |
|
781 AC_MSG_RESULT([yes]) |
|
782 AC_DEFINE(GNUPLOT_HAS_FRAMES, 1) |
|
783 else |
|
784 AC_MSG_RESULT([no]) |
|
785 fi |
|
786 else |
|
787 warn_gnuplot="yes" |
|
788 |
|
789 ## If you change this text, be sure to also copy it to the set of |
|
790 ## warnings at the end of the script |
|
791 |
|
792 AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot]) |
|
793 AC_MSG_WARN([installed, but you won't be able to use any of Octave's]) |
|
794 AC_MSG_WARN([plotting commands without it.]) |
|
795 AC_MSG_WARN([]) |
|
796 AC_MSG_WARN([If gnuplot is installed but it isn't in your path, you can]) |
|
797 AC_MSG_WARN([tell Octave where to find it by typing the command]) |
|
798 AC_MSG_WARN([]) |
|
799 AC_MSG_WARN([gnuplot_binary = "/full/path/to/gnuplot/binary"]) |
|
800 AC_MSG_WARN([]) |
|
801 AC_MSG_WARN([at the Octave prompt.]) |
|
802 fi |
|
803 fi |
|
804 ]) |
|
805 dnl |
|
806 dnl Is DejaGNU installed? |
|
807 dnl |
|
808 AC_DEFUN(OCTAVE_PROG_RUNTEST, |
|
809 [if test "$cross_compiling" = yes; then |
|
810 RUNTEST=runtest |
|
811 AC_MSG_RESULT(assuming $RUNTEST exists on $canonical_host_type host) |
|
812 AC_SUBST(RUNTEST) |
|
813 else |
|
814 AC_CHECK_PROG(RUNTEST, runtest, runtest, []) |
|
815 if test -z "$RUNTEST"; then |
|
816 warn_runtest="I didn't find runtest -- install DejaGNU if you want to run \`make check'" |
|
817 AC_MSG_WARN($warn_runtest) |
|
818 fi |
|
819 AC_SUBST(RUNTEST) |
|
820 fi |
|
821 ]) |