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