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