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