diff options
author | Yang Tse <yangsita@gmail.com> | 2006-11-22 18:41:34 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2006-11-22 18:41:34 +0000 |
commit | 73226415fc51cdfbfa730eae80119411d65dd124 (patch) | |
tree | f73b524b831d846a98d09e6ff015746b76651392 | |
parent | ab160ef445433f8d4767fafd2efa5361835f8b71 (diff) | |
download | curl-73226415fc51cdfbfa730eae80119411d65dd124.tar.gz |
Added a check in configure that verifies if <signal.h> is available,
defining HAVE_SIGNAL_H if the header is available.
Added a check in configure that tests if the sig_atomic_t type is
available, defining HAVE_SIG_ATOMIC_T if it is available. Providing
a suitable default in setup_once.h if not available.
Added a check in configure that tests if the sig_atomic_t type is
already defined as volatile, defining HAVE_SIG_ATOMIC_T_VOLATILE
if it is available and already defined as volatile.
-rw-r--r-- | acinclude.m4 | 42 | ||||
-rw-r--r-- | ares/acinclude.m4 | 42 | ||||
-rw-r--r-- | ares/configure.ac | 2 | ||||
-rw-r--r-- | ares/setup_once.h | 10 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | lib/setup_once.h | 10 |
6 files changed, 108 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 820e3ac20..e213841dc 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1035,6 +1035,48 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ ]) # AC_DEFUN +dnl TYPE_SIG_ATOMIC_T +dnl ------------------------------------------------- +dnl Check if the sig_atomic_t type is available, and +dnl verify if it is already defined as volatile. + +AC_DEFUN([TYPE_SIG_ATOMIC_T], [ + AC_CHECK_HEADERS(signal.h) + AC_CHECK_TYPE([sig_atomic_t],[ + AC_DEFINE(HAVE_SIG_ATOMIC_T, 1, + [Define to 1 if sig_atomic_t is an available typedef.]) + ], ,[ +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif + ]) + case "$ac_cv_type_sig_atomic_t" in + yes) + # + AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile]) + AC_TRY_LINK([ +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif + ],[ + static volatile sig_atomic_t dummy = 0; + ],[ + AC_MSG_RESULT([no]) + ac_cv_sig_atomic_t_volatile="no" + ],[ + AC_MSG_RESULT([yes]) + ac_cv_sig_atomic_t_volatile="yes" + ]) + # + if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then + AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1, + [Define to 1 if sig_atomic_t is already defined as volatile.]) + fi + ;; + esac +]) # AC_DEFUN + + dnl CURL_CHECK_NONBLOCKING_SOCKET dnl ------------------------------------------------- dnl Check for how to set a socket to non-blocking state. There seems to exist diff --git a/ares/acinclude.m4 b/ares/acinclude.m4 index 9a2840401..7cfaec46e 100644 --- a/ares/acinclude.m4 +++ b/ares/acinclude.m4 @@ -1013,6 +1013,48 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ ]) # AC_DEFUN +dnl TYPE_SIG_ATOMIC_T +dnl ------------------------------------------------- +dnl Check if the sig_atomic_t type is available, and +dnl verify if it is already defined as volatile. + +AC_DEFUN([TYPE_SIG_ATOMIC_T], [ + AC_CHECK_HEADERS(signal.h) + AC_CHECK_TYPE([sig_atomic_t],[ + AC_DEFINE(HAVE_SIG_ATOMIC_T, 1, + [Define to 1 if sig_atomic_t is an available typedef.]) + ], ,[ +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif + ]) + case "$ac_cv_type_sig_atomic_t" in + yes) + # + AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile]) + AC_TRY_LINK([ +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif + ],[ + static volatile sig_atomic_t dummy = 0; + ],[ + AC_MSG_RESULT([no]) + ac_cv_sig_atomic_t_volatile="no" + ],[ + AC_MSG_RESULT([yes]) + ac_cv_sig_atomic_t_volatile="yes" + ]) + # + if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then + AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1, + [Define to 1 if sig_atomic_t is already defined as volatile.]) + fi + ;; + esac +]) # AC_DEFUN + + dnl CURL_CHECK_NONBLOCKING_SOCKET dnl ------------------------------------------------- dnl Check for how to set a socket to non-blocking state. There seems to exist diff --git a/ares/configure.ac b/ares/configure.ac index 79292cebc..71d4a0152 100644 --- a/ares/configure.ac +++ b/ares/configure.ac @@ -297,6 +297,8 @@ TYPE_IN_ADDR_T TYPE_SOCKADDR_STORAGE +TYPE_SIG_ATOMIC_T + CURL_CHECK_FUNC_RECV CURL_CHECK_FUNC_SEND diff --git a/ares/setup_once.h b/ares/setup_once.h index 224ab692a..23d75ca0d 100644 --- a/ares/setup_once.h +++ b/ares/setup_once.h @@ -123,5 +123,15 @@ #define ISPRINT(x) (isprint((int) ((unsigned char)x))) +/* + * Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type. + */ + +#ifndef HAVE_SIG_ATOMIC_T +typedef int sig_atomic_t; +#define HAVE_SIG_ATOMIC_T +#endif + + #endif /* __SETUP_ONCE_H */ diff --git a/configure.ac b/configure.ac index 8c96873e8..74e74eda9 100644 --- a/configure.ac +++ b/configure.ac @@ -1631,6 +1631,8 @@ TYPE_IN_ADDR_T TYPE_SOCKADDR_STORAGE +TYPE_SIG_ATOMIC_T + AC_FUNC_SELECT_ARGTYPES CURL_CHECK_FUNC_RECV diff --git a/lib/setup_once.h b/lib/setup_once.h index 04640707c..07909475c 100644 --- a/lib/setup_once.h +++ b/lib/setup_once.h @@ -130,5 +130,15 @@ #define ISPRINT(x) (isprint((int) ((unsigned char)x))) +/* + * Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type. + */ + +#ifndef HAVE_SIG_ATOMIC_T +typedef int sig_atomic_t; +#define HAVE_SIG_ATOMIC_T +#endif + + #endif /* __SETUP_ONCE_H */ |