1232
|
1 dnl aclocal.m4 -- extra macros for configuring Octave |
|
2 dnl |
1885
|
3 dnl Copyright (C) 1996 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 target_host_type=$host |
|
33 canonical_host_type=$host |
|
34 if test "$host" = unknown; then |
|
35 AC_MSG_WARN([configuring Octave for unknown system type |
|
36 ]) |
|
37 fi |
|
38 AC_SUBST(target_host_type)]) |
|
39 dnl |
|
40 dnl Set default value for a variable and substitute it. |
|
41 dnl |
|
42 dnl OCTAVE_SET_DEFAULT |
|
43 AC_DEFUN(OCTAVE_SET_DEFAULT, |
|
44 [ifelse($#, 2, [$1=$2 |
|
45 ])dnl |
|
46 AC_MSG_RESULT([defining $1 to be $$1]) |
|
47 AC_SUBST($1)]) |
|
48 dnl |
|
49 dnl |
|
50 dnl OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS |
|
51 AC_DEFUN(OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS, |
|
52 [if test "${with_$1+set}" = set; then |
|
53 if test "${with_$2+set}" = set; then |
|
54 if test "$with_$2" = no; then |
|
55 true |
|
56 else |
|
57 $3 |
|
58 fi |
|
59 fi |
|
60 fi]) |
|
61 dnl |
|
62 dnl |
1232
|
63 dnl See what libraries are used by the C++ compiler. Need this for |
|
64 dnl dynamic linking. |
|
65 dnl |
|
66 dnl Write a minimal program and compile it with -v. I don't know what |
|
67 dnl to do if your compiler doesn't have -v... |
|
68 dnl |
|
69 dnl OCTAVE_CXXLIBS() |
|
70 AC_DEFUN(OCTAVE_CXXLIBS, |
|
71 [AC_REQUIRE([AC_PROG_CXXCPP]) |
|
72 AC_REQUIRE([AC_PROG_CXX]) |
|
73 AC_MSG_CHECKING([for C++ libraries]) |
|
74 AC_CACHE_VAL(octave_cv_cxxlibs, |
|
75 [AC_LANG_SAVE |
|
76 AC_LANG_CPLUSPLUS |
|
77 XCXXFLAGS="$CXXFLAGS" |
|
78 CXXFLAGS="$XCXXFLAGS -v" |
|
79 export CXXFLAGS |
|
80 dnl |
|
81 dnl This may be too tricky and break with future autoconf releases, |
|
82 dnl but it works with version 2.3, even with the Ultrix /bin/sh. |
|
83 dnl |
|
84 dnl I don't think that stripping commas out of this will ever hurt. |
|
85 dnl |
|
86 coutput=`( AC_TRY_LINK([], [], []) ) AC_FD_CC>&1 | sed 's/,/ /g'` |
|
87 CXXFLAGS="$XCXXFLAGS" |
|
88 AC_LANG_RESTORE |
|
89 changequote(, )dnl |
|
90 dnl |
|
91 octave_cv_cxxlibs= |
|
92 lflags= |
|
93 want_arg= |
|
94 dnl |
|
95 for arg in $coutput; do |
|
96 if test x$want_arg = x; then |
|
97 want_arg= |
|
98 case $arg in |
|
99 /*.a) |
|
100 exists=false |
|
101 for f in $lflags; do |
|
102 if test x$arg = x$f; then |
|
103 exists=true |
|
104 fi |
|
105 done |
|
106 if $exists; then |
|
107 arg= |
|
108 else |
|
109 lflags="$lflags $arg" |
|
110 fi |
|
111 ;; |
|
112 -[LR]*) |
|
113 exists=false |
|
114 for f in $lflags; do |
|
115 if test x$arg = x$f; then |
|
116 exists=true |
|
117 fi |
|
118 done |
|
119 ;; |
|
120 -l*) |
|
121 if test x$arg = x-lang-c++; then |
|
122 arg= |
|
123 else |
|
124 lflags="$lflags $arg" |
|
125 fi |
|
126 ;; |
|
127 -u) |
|
128 want_arg=$arg |
|
129 ;; |
|
130 *) |
|
131 arg= |
|
132 ;; |
|
133 esac |
|
134 else |
|
135 want_arg= |
|
136 fi |
|
137 if test x$arg != x; then |
|
138 octave_cv_cxxlibs="$octave_cv_cxxlibs $arg" |
|
139 fi |
|
140 done |
|
141 dnl |
|
142 changequote([, ])]) |
|
143 AC_MSG_RESULT([$octave_cv_cxxlibs]) |
|
144 CXXLIBS="$octave_cv_cxxlibs" |
|
145 AC_SUBST(CXXLIBS)]) |
2548
|
146 dnl |
1232
|
147 dnl See what libraries are used by the Fortran compiler. |
|
148 dnl |
|
149 dnl Write a minimal program and compile it with -v. I don't know what |
|
150 dnl to do if your compiler doesn't have -v... |
|
151 dnl |
|
152 dnl OCTAVE_FLIBS() |
|
153 AC_DEFUN(OCTAVE_FLIBS, |
2039
|
154 [AC_MSG_CHECKING([for Fortran libraries]) |
1232
|
155 AC_CACHE_VAL(octave_cv_flibs, |
|
156 [changequote(, )dnl |
|
157 echo " END" > conftest.f |
|
158 foutput=`${F77-f77} -v -o conftest conftest.f 2>&1` |
|
159 dnl |
|
160 dnl The easiest thing to do for xlf output is to replace all the commas |
|
161 dnl with spaces. Try to only do that if the output is really from xlf, |
|
162 dnl since doing that causes problems on other systems. |
|
163 dnl |
|
164 xlf_p=`echo $foutput | grep xlfentry` |
|
165 if test -n "$xlf_p"; then |
|
166 foutput=`echo $foutput | sed 's/,/ /g'` |
|
167 fi |
|
168 dnl |
|
169 ld_run_path=`echo $foutput | \ |
2638
|
170 sed -n -e 's/^.*LD_RUN_PATH *= *\([^ ]*\).*/\1/p'` |
1232
|
171 dnl |
|
172 dnl We are only supposed to find this on Solaris systems, and this |
|
173 dnl substitution is probably only going to work with gcc on those |
|
174 dnl systems... |
|
175 dnl |
|
176 if test -n "$ld_run_path"; then |
2600
|
177 if test "$ac_cv_prog_gcc" = yes; then |
|
178 ld_run_path="-Xlinker -R -Xlinker $ld_run_path" |
|
179 else |
|
180 ld_run_path="-R $ld_run_path" |
|
181 fi |
1232
|
182 fi |
|
183 dnl |
|
184 flibs= |
|
185 lflags= |
|
186 dnl |
|
187 dnl If want_arg is set, we know we want the arg to be added to the list, |
|
188 dnl so we don't have to examine it. |
|
189 dnl |
|
190 want_arg= |
|
191 dnl |
|
192 for arg in $foutput; do |
|
193 old_want_arg=$want_arg |
|
194 want_arg= |
|
195 case "$old_want_arg" in |
|
196 '') |
|
197 case $arg in |
2641
|
198 /*.a) |
1232
|
199 exists=false |
|
200 for f in $lflags; do |
|
201 if test x$arg = x$f; then |
|
202 exists=true |
|
203 fi |
|
204 done |
|
205 if $exists; then |
|
206 arg= |
|
207 else |
|
208 lflags="$lflags $arg" |
|
209 fi |
|
210 ;; |
2351
|
211 -bI:*) |
|
212 exists=false |
|
213 for f in $lflags; do |
|
214 if test x$arg = x$f; then |
|
215 exists=true |
|
216 fi |
|
217 done |
|
218 if $exists; then |
|
219 arg= |
|
220 else |
2600
|
221 if test "$ac_cv_prog_gcc" = yes; then |
|
222 lflags="$lflags -Xlinker $arg" |
|
223 else |
|
224 lflags="$lflags $arg" |
|
225 fi |
2351
|
226 fi |
|
227 ;; |
1232
|
228 -lang*) |
|
229 arg= |
|
230 ;; |
|
231 -[lLR]) |
|
232 want_arg=$arg |
|
233 arg= |
|
234 ;; |
|
235 -[lLR]*) |
|
236 exists=false |
|
237 for f in $lflags; do |
|
238 if test x$arg = x$f; then |
|
239 exists=true |
|
240 fi |
|
241 done |
|
242 if $exists || test x$arg = x-lm -o x$arg = x-lc; then |
|
243 arg= |
|
244 else |
|
245 lflags="$lflags $arg" |
|
246 fi |
|
247 ;; |
|
248 -u) |
|
249 want_arg=$arg |
|
250 ;; |
|
251 -Y) |
|
252 want_arg=$arg |
|
253 arg= |
|
254 ;; |
|
255 *) |
|
256 arg= |
|
257 ;; |
|
258 esac |
|
259 ;; |
|
260 -[lLR]) |
|
261 arg="$old_want_arg $arg" |
|
262 ;; |
|
263 -Y) |
|
264 dnl |
|
265 dnl Should probably try to ensure unique directory options here too. |
|
266 dnl This probably only applies to Solaris systems, and then will only |
|
267 dnl work with gcc... |
|
268 dnl |
|
269 arg=`echo $arg | sed -e 's%^P,%%'` |
|
270 SAVE_IFS=$IFS |
|
271 IFS=: |
|
272 list= |
|
273 for elt in $arg; do |
2641
|
274 list="$list -L$elt" |
1232
|
275 done |
|
276 IFS=$SAVE_IFS |
|
277 arg="$list" |
|
278 ;; |
|
279 esac |
|
280 dnl |
|
281 if test -n "$arg"; then |
|
282 flibs="$flibs $arg" |
|
283 fi |
|
284 done |
1953
|
285 if test -n "$ld_run_path"; then |
|
286 flibs_result="$ld_run_path $flibs" |
|
287 else |
|
288 flibs_result="$flibs" |
|
289 fi |
1232
|
290 changequote([, ])dnl |
1953
|
291 octave_cv_flibs="$flibs_result"]) |
1232
|
292 FLIBS="$octave_cv_flibs" |
|
293 AC_MSG_RESULT([$FLIBS])]) |
2548
|
294 dnl |
1257
|
295 dnl See if the Fortran compiler uses uppercase external names. |
|
296 dnl |
|
297 dnl OCTAVE_F77_UPPERCASE_NAMES() |
|
298 AC_DEFUN(OCTAVE_F77_UPPERCASE_NAMES, |
|
299 [AC_MSG_CHECKING([whether $F77 uses uppercase external names]) |
|
300 AC_CACHE_VAL(octave_cv_f77_uppercase_names, |
|
301 [octave_cv_f77_uppercase_names=no |
|
302 cat > conftest.f <<EOF |
|
303 subroutine xxyyzz () |
|
304 return |
|
305 end |
|
306 EOF |
|
307 if ${F77-f77} -c conftest.f 1>&AC_FD_CC 2>&AC_FD_CC; then |
|
308 if test "`${NM-nm} conftest.o | grep XXYYZZ`" != ""; then |
|
309 octave_cv_f77_uppercase_names=yes |
|
310 fi |
|
311 fi]) |
|
312 AC_MSG_RESULT([$octave_cv_f77_uppercase_names]) |
|
313 if test "$octave_cv_f77_uppercase_names" = yes; then |
|
314 AC_DEFINE(F77_UPPERCASE_NAMES, 1) |
|
315 fi]) |
2548
|
316 dnl |
1232
|
317 dnl See if the Fortran compiler appends underscores to external names. |
|
318 dnl |
|
319 dnl OCTAVE_F77_APPEND_UNDERSCORE() |
|
320 AC_DEFUN(OCTAVE_F77_APPEND_UNDERSCORE, |
|
321 [AC_MSG_CHECKING([whether $F77 appends underscores to external names]) |
1257
|
322 AC_REQUIRE([OCTAVE_F77_UPPERCASE_NAMES]) |
1232
|
323 AC_CACHE_VAL(octave_cv_f77_append_underscore, |
|
324 [octave_cv_f77_append_underscore=no |
|
325 cat > conftest.f <<EOF |
|
326 subroutine xxyyzz () |
|
327 return |
|
328 end |
|
329 EOF |
|
330 if ${F77-f77} -c conftest.f 1>&AC_FD_CC 2>&AC_FD_CC; then |
1257
|
331 if test "$octave_cv_f77_uppercase_names" = yes; then |
|
332 if test "`${NM-nm} conftest.o | grep XXYYZZ_`" != ""; then |
|
333 octave_cv_f77_append_underscore=yes |
|
334 fi |
|
335 else |
|
336 if test "`${NM-nm} conftest.o | grep xxyyzz_`" != ""; then |
|
337 octave_cv_f77_append_underscore=yes |
|
338 fi |
1232
|
339 fi |
|
340 fi]) |
|
341 AC_MSG_RESULT([$octave_cv_f77_append_underscore]) |
|
342 if test "$octave_cv_f77_append_underscore" = yes; then |
|
343 AC_DEFINE(F77_APPEND_UNDERSCORE, 1) |
|
344 fi]) |
2548
|
345 dnl |
1232
|
346 dnl See if the Fortran compiler is compatible with f2c. |
|
347 dnl |
|
348 dnl Write a minimal program, compile it, and see if it works as |
|
349 dnl expected. |
|
350 dnl |
|
351 dnl OCTAVE_F2C_F77_COMPAT() |
|
352 AC_DEFUN(OCTAVE_F2C_F77_COMPAT, |
|
353 [AC_REQUIRE([OCTAVE_FLIBS]) |
|
354 AC_REQUIRE([OCTAVE_F77_APPEND_UNDERSCORE]) |
|
355 AC_MSG_CHECKING([$F77/f2c compatibility]) |
|
356 AC_CACHE_VAL(octave_cv_f2c_f77_compat, |
|
357 [trap 'rm -f ftest* ctest* core; exit 1' 1 3 15 |
|
358 octave_cv_f2c_f77_compat=no |
|
359 cat > ftest.f <<EOF |
|
360 INTEGER FUNCTION FORSUB (C, D) |
|
361 CHARACTER *(*) C |
|
362 INTEGER L |
|
363 DOUBLE PRECISION D |
|
364 L = LEN (C) |
|
365 WRITE (*, '(A,1X,I2)') C(1:L), INT (D) |
|
366 FORSUB = 1 |
|
367 RETURN |
|
368 END |
|
369 EOF |
|
370 ${F77-f77} -c ftest.f 1>&AC_FD_CC 2>&AC_FD_CC |
|
371 dnl |
|
372 changequote(, ) |
|
373 cat > ctest.c <<EOF |
|
374 #include "confdefs.h" |
|
375 static char s[14]; |
|
376 int main () |
|
377 { |
|
378 double d = 10.0; |
|
379 int len; |
|
380 strcpy (s, "FOO-I-HITHERE"); |
|
381 len = strlen (s); |
|
382 #ifdef F77_APPEND_UNDERSCORE |
|
383 return (! forsub_ (s, &d, len)); |
|
384 #else |
|
385 return (! forsub (s, &d, len)); |
|
386 #endif |
|
387 } |
2218
|
388 #if defined (sun) |
1232
|
389 int MAIN_ () { return 0; } |
2126
|
390 #elif defined (linux) && defined (__ELF__) |
|
391 int MAIN__ () { return 0; } |
1232
|
392 #endif |
|
393 EOF |
|
394 changequote([, ]) |
|
395 dnl |
|
396 if ${CC-cc} -c ctest.c 1>&AC_FD_CC 2>&AC_FD_CC; then |
|
397 if ${CC-cc} -o ctest ctest.o ftest.o $FLIBS -lm 1>&AC_FD_CC 2>&AC_FD_CC; then |
|
398 ctest_output=`./ctest 2>&1` |
|
399 status=$? |
|
400 if test $status -eq 0 && test "$ctest_output" = "FOO-I-HITHERE 10"; then |
|
401 octave_cv_f2c_f77_compat=yes |
|
402 fi |
|
403 fi |
|
404 fi]) |
|
405 rm -f ftest* ctest* core |
|
406 AC_MSG_RESULT([$octave_cv_f2c_f77_compat])]) |
2548
|
407 dnl |
|
408 dnl See if struct group has a gr_passwd field. |
|
409 dnl |
|
410 AC_DEFUN(OCTAVE_STRUCT_GR_PASSWD, |
|
411 [AC_CACHE_CHECK([for gr_passwd in struct group], octave_cv_struct_gr_passwd, |
|
412 [AC_TRY_COMPILE([#include <sys/types.h> |
|
413 #include <grp.h>], [struct group s; s.gr_passwd;], |
|
414 octave_cv_struct_gr_passwd=yes, octave_cv_struct_gr_passwd=no)]) |
|
415 if test $octave_cv_struct_gr_passwd = yes; then |
|
416 AC_DEFINE(HAVE_GR_PASSWD) |
|
417 fi |
|
418 ]) |
|
419 dnl |
2574
|
420 dnl See if the standard string class has npos as a member. |
|
421 dnl |
|
422 AC_DEFUN(OCTAVE_STRING_NPOS, |
|
423 [AC_CACHE_CHECK([whether including <string> defines NPOS], |
|
424 octave_cv_string_npos, |
|
425 [AC_LANG_SAVE |
|
426 AC_LANG_CPLUSPLUS |
|
427 AC_TRY_COMPILE([#include <string>], |
|
428 [size_t foo = NPOS], |
|
429 octave_cv_string_npos=yes, octave_cv_string_npos=no)]) |
|
430 if test $octave_cv_string_npos = no; then |
|
431 AC_DEFINE(NPOS, string::npos) |
|
432 fi |
|
433 AC_LANG_RESTORE |
|
434 ]) |
|
435 dnl |
1707
|
436 dnl The following test is from Karl Berry's Kpathseach library. I'm |
|
437 dnl including it here in case we someday want to make the use of |
|
438 dnl kpathsea optional. |
1708
|
439 dnl |
|
440 dnl Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment. |
|
441 dnl This test program is due to Mike Hibler <mike@cs.utah.edu>. |
|
442 dnl We don't actually need to run this if we don't have putenv, but it |
|
443 dnl doesn't hurt. |
|
444 AC_DEFUN(OCTAVE_SMART_PUTENV, |
|
445 [AC_MSG_CHECKING(whether putenv uses malloc) |
1707
|
446 AC_CACHE_VAL(octave_cv_func_putenv_malloc, |
|
447 [AC_TRY_RUN([ |
|
448 #define VAR "YOW_VAR" |
|
449 #define STRING1 "GabbaGabbaHey" |
|
450 #define STRING2 "Yow!!" /* should be shorter than STRING1 */ |
|
451 extern char *getenv (); /* in case char* and int don't mix gracefully */ |
|
452 main () |
|
453 { |
|
454 char *str1, *rstr1, *str2, *rstr2; |
|
455 str1 = getenv (VAR); |
|
456 if (str1) |
|
457 exit (1); |
|
458 str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1); |
|
459 if (str1 == 0) |
|
460 exit (2); |
|
461 strcpy (str1, VAR); |
|
462 strcat (str1, "="); |
|
463 strcat (str1, STRING1); |
|
464 if (putenv (str1) < 0) |
|
465 exit (3); |
|
466 rstr1 = getenv (VAR); |
|
467 if (rstr1 == 0) |
|
468 exit (4); |
|
469 rstr1 -= strlen (VAR) + 1; |
|
470 if (strncmp (rstr1, VAR, strlen (VAR))) |
|
471 exit (5); |
|
472 str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1); |
|
473 if (str2 == 0 || str1 == str2) |
|
474 exit (6); |
|
475 strcpy (str2, VAR); |
|
476 strcat (str2, "="); |
|
477 strcat (str2, STRING2); |
|
478 if (putenv (str2) < 0) |
|
479 exit (7); |
|
480 rstr2 = getenv (VAR); |
|
481 if (rstr2 == 0) |
|
482 exit (8); |
|
483 rstr2 -= strlen (VAR) + 1; |
|
484 #if 0 |
|
485 printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2); |
|
486 /* |
|
487 * If string from first call was reused for the second call, |
|
488 * you had better not do a free on the first string! |
|
489 */ |
|
490 if (rstr1 == rstr2) |
|
491 printf ("#define SMART_PUTENV\n"); |
|
492 else |
|
493 printf ("#undef SMART_PUTENV\n"); |
|
494 #endif |
|
495 exit (rstr1 == rstr2 ? 0 : 1); |
|
496 }], octave_cv_func_putenv_malloc=yes, octave_cv_func_putenv_malloc=no, |
|
497 octave_cv_func_putenv_malloc=no)])dnl |
|
498 AC_MSG_RESULT($octave_cv_func_putenv_malloc) |
|
499 if test $octave_cv_func_putenv_malloc = yes; then |
|
500 AC_DEFINE(SMART_PUTENV) |
1708
|
501 fi]) |
1788
|
502 dnl |
|
503 dnl This is a GNU libc invention, and this check is also from Karl |
|
504 dnl Berry's kpathsea library. |
|
505 dnl |
|
506 AC_DEFUN(OCTAVE_PROGRAM_INVOCATION_NAME, |
|
507 [AC_MSG_CHECKING(whether program_invocation_name is predefined) |
|
508 AC_CACHE_VAL(octave_cv_var_program_inv_name, |
|
509 [AC_TRY_LINK(, [main() { program_invocation_name = "love"; }], |
|
510 octave_cv_var_program_inv_name=yes, octave_cv_var_program_inv_name=no)])dnl |
|
511 AC_MSG_RESULT($octave_cv_var_program_inv_name) |
|
512 if test $octave_cv_var_program_inv_name = yes; then |
|
513 AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME) |
|
514 fi]) |
2469
|
515 dnl |
|
516 dnl These two checks for signal functions were originally part of the |
|
517 dnl aclocal.m4 file distributed with bash 2.0. |
|
518 dnl |
|
519 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) |
|
520 AC_DEFUN(OCTAVE_SIGNAL_CHECK, |
|
521 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
522 AC_MSG_CHECKING(for type of signal functions) |
|
523 AC_CACHE_VAL(octave_cv_signal_vintage, |
|
524 [ |
|
525 AC_TRY_LINK([#include <signal.h>],[ |
|
526 sigset_t ss; |
|
527 struct sigaction sa; |
|
528 sigemptyset(&ss); sigsuspend(&ss); |
|
529 sigaction(SIGINT, &sa, (struct sigaction *) 0); |
|
530 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); |
|
531 ], octave_cv_signal_vintage=posix, |
|
532 [ |
|
533 AC_TRY_LINK([#include <signal.h>], [ |
|
534 int mask = sigmask(SIGINT); |
|
535 sigsetmask(mask); sigblock(mask); sigpause(mask); |
|
536 ], octave_cv_signal_vintage=4.2bsd, |
|
537 [ |
|
538 AC_TRY_LINK([ |
|
539 #include <signal.h> |
|
540 RETSIGTYPE foo() { }], [ |
|
541 int mask = sigmask(SIGINT); |
|
542 sigset(SIGINT, foo); sigrelse(SIGINT); |
|
543 sighold(SIGINT); sigpause(SIGINT); |
2491
|
544 ], octave_cv_signal_vintage=svr3, octave_cv_signal_vintage=v7 |
2469
|
545 )] |
|
546 )] |
|
547 ) |
|
548 ]) |
|
549 AC_MSG_RESULT($octave_cv_signal_vintage) |
2491
|
550 if test "$octave_cv_signal_vintage" = posix; then |
2469
|
551 AC_DEFINE(HAVE_POSIX_SIGNALS) |
2491
|
552 elif test "$octave_cv_signal_vintage" = "4.2bsd"; then |
2469
|
553 AC_DEFINE(HAVE_BSD_SIGNALS) |
2491
|
554 elif test "$octave_cv_signal_vintage" = svr3; then |
2469
|
555 AC_DEFINE(HAVE_USG_SIGHOLD) |
|
556 fi |
|
557 ]) |
|
558 dnl |
|
559 AC_DEFUN(OCTAVE_REINSTALL_SIGHANDLERS, |
|
560 [AC_REQUIRE([AC_TYPE_SIGNAL]) |
|
561 AC_REQUIRE([OCTAVE_SIGNAL_CHECK]) |
|
562 AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked]) |
|
563 AC_CACHE_VAL(octave_cv_must_reinstall_sighandlers, |
|
564 [AC_TRY_RUN([ |
|
565 #include <signal.h> |
|
566 #ifdef HAVE_UNISTD_H |
|
567 #include <unistd.h> |
|
568 #endif |
|
569 typedef RETSIGTYPE sigfunc(); |
|
570 int nsigint; |
|
571 #ifdef HAVE_POSIX_SIGNALS |
|
572 sigfunc * |
|
573 set_signal_handler(sig, handler) |
|
574 int sig; |
|
575 sigfunc *handler; |
|
576 { |
|
577 struct sigaction act, oact; |
|
578 act.sa_handler = handler; |
|
579 act.sa_flags = 0; |
|
580 sigemptyset (&act.sa_mask); |
|
581 sigemptyset (&oact.sa_mask); |
|
582 sigaction (sig, &act, &oact); |
|
583 return (oact.sa_handler); |
|
584 } |
|
585 #else |
|
586 #define set_signal_handler(s, h) signal(s, h) |
|
587 #endif |
|
588 RETSIGTYPE |
|
589 sigint(s) |
|
590 int s; |
|
591 { |
|
592 nsigint++; |
|
593 } |
|
594 main() |
|
595 { |
|
596 nsigint = 0; |
|
597 set_signal_handler(SIGINT, sigint); |
|
598 kill((int)getpid(), SIGINT); |
|
599 kill((int)getpid(), SIGINT); |
|
600 exit(nsigint != 2); |
|
601 } |
|
602 ], octave_cv_must_reinstall_sighandlers=no, octave_cv_must_reinstall_sighandlers=yes, |
|
603 AC_MSG_ERROR(cannot check signal handling if cross compiling))]) |
|
604 AC_MSG_RESULT($octave_cv_must_reinstall_sighandlers) |
2491
|
605 if test "$octave_cv_must_reinstall_sighandlers" = yes; then |
2469
|
606 AC_DEFINE(MUST_REINSTALL_SIGHANDLERS) |
|
607 fi |
|
608 ]) |
2626
|
609 dnl |
|
610 dnl This check originally from bash 2.0. |
|
611 dnl |
|
612 dnl Check for typedef'd symbols in header files, but allow the caller to |
|
613 dnl specify the include files to be checked in addition to the default. |
|
614 dnl |
|
615 dnl OCTAVE_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND]) |
|
616 AC_DEFUN(OCTAVE_CHECK_TYPE, |
|
617 [AC_REQUIRE([AC_HEADER_STDC])dnl |
|
618 AC_MSG_CHECKING(for $1) |
|
619 AC_CACHE_VAL(octave_cv_type_$1, |
|
620 [AC_EGREP_CPP($1, [#include <sys/types.h> |
|
621 #if STDC_HEADERS |
|
622 #include <stdlib.h> |
|
623 #endif |
|
624 $2 |
|
625 ], octave_cv_type_$1=yes, octave_cv_type_$1=no)]) |
|
626 AC_MSG_RESULT($octave_cv_type_$1) |
|
627 ifelse($#, 4, [if test $octave_cv_type_$1 = yes; then |
|
628 AC_DEFINE($4) |
|
629 fi]) |
|
630 if test $octave_cv_type_$1 = no; then |
|
631 AC_DEFINE($1, $3) |
|
632 fi |
|
633 ]) |