Emeric Vigier | 2f62582 | 2012-08-06 11:09:52 -0400 | [diff] [blame] | 1 | dnl Copyright (C) 1999-2005 Open Source Telecom Corporation. |
| 2 | dnl Copyright (C) 2006-2010 David Sugar, Tycho Softworks. |
| 3 | dnl |
| 4 | dnl This program is free software; you can redistribute it and/or modify |
| 5 | dnl it under the terms of the GNU General Public License as published by |
| 6 | dnl the Free Software Foundation; either version 2 of the License, or |
| 7 | dnl (at your option) any later version. |
| 8 | dnl |
| 9 | dnl This program is distributed in the hope that it will be useful, |
| 10 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | dnl GNU General Public License for more details. |
| 13 | dnl |
| 14 | dnl You should have received a copy of the GNU General Public License |
| 15 | dnl along with this program; if not, write to the Free Software |
| 16 | dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | dnl |
| 18 | dnl As a special exception to the GNU General Public License, if you |
| 19 | dnl distribute this file as part of a program that contains a configuration |
| 20 | dnl script generated by Autoconf, you may include it under the same |
| 21 | dnl distribution terms that you use for the rest of that program. |
| 22 | |
| 23 | AC_DEFUN([OST_CC_SIGNAL],[ |
| 24 | AC_REQUIRE([OST_SYS_POSIX]) |
| 25 | AC_CHECK_FUNCS(sigaction) |
| 26 | AC_CHECK_FUNCS(setitimer) |
| 27 | AC_CHECK_FUNCS(sigwait) |
| 28 | AC_CHECK_HEADERS(bsd/signal.h) |
| 29 | AC_TYPE_SIGNAL |
| 30 | AC_CACHE_CHECK(whether sigwait has 2 arguments, |
| 31 | ac_cv_ost_sigwait2, |
| 32 | AC_TRY_COMPILE([ |
| 33 | #ifndef _POSIX_PTHREAD_SEMANTICS |
| 34 | #define _POSIX_PTHREAD_SEMANTICS |
| 35 | #endif |
| 36 | #ifndef _GNU_SOURCE |
| 37 | #define _GNU_SOURCE |
| 38 | #endif |
| 39 | #include <stdio.h> |
| 40 | #include <signal.h> |
| 41 | ],[ |
| 42 | sigset_t sigs; int signo; sigwait(&sigs, &signo);], |
| 43 | ac_cv_ost_sigwait2=yes, |
| 44 | ac_cv_ost_sigwait2=no |
| 45 | ) |
| 46 | ) |
| 47 | if test "$ac_cv_ost_sigwait2" = "yes" ; then |
| 48 | AC_DEFINE(HAVE_SIGWAIT2, [1], [2 argument form]) |
| 49 | fi |
| 50 | AH_BOTTOM([ |
| 51 | #ifdef HAVE_SIGACTION |
| 52 | #ifdef HAVE_BSD_SIGNAL_H |
| 53 | #undef HAVE_BSD_SIGNAL_H |
| 54 | #endif |
| 55 | #endif |
| 56 | |
| 57 | /* Cause problem with Solaris... and perhaps Digital Unix? |
| 58 | However, the autoconf test in ost_signal defines _POSIX_PTHREAD_SEMANTICS |
| 59 | when trying to compile sigwait2. */ |
| 60 | |
| 61 | #ifdef HAVE_SIGWAIT2 |
| 62 | #ifndef _POSIX_PTHREAD_SEMANTICS |
| 63 | #define _POSIX_PTHREAD_SEMANTICS |
| 64 | #endif |
| 65 | #endif |
| 66 | |
| 67 | #ifdef HAVE_BSD_SIGNAL_H |
| 68 | #include <bsd/signal.h> |
| 69 | #else |
| 70 | #include <signal.h> |
| 71 | #endif |
| 72 | #ifndef SA_ONESHOT |
| 73 | #define SA_ONESHOT SA_RESETHAND |
| 74 | #endif |
| 75 | |
| 76 | ]) |
| 77 | ]) |