]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
Added a check in configure that verifies if <signal.h> is available,
authorYang Tse <yangsita@gmail.com>
Wed, 22 Nov 2006 18:41:34 +0000 (18:41 +0000)
committerYang Tse <yangsita@gmail.com>
Wed, 22 Nov 2006 18:41:34 +0000 (18:41 +0000)
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.

acinclude.m4
ares/acinclude.m4
ares/configure.ac
ares/setup_once.h
configure.ac
lib/setup_once.h

index 820e3ac208428980836d3825748f014739587f8a..e213841dcdfb1ebcfdd52b0cde3104b22d8bdc5a 100644 (file)
@@ -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
index 9a2840401d173ac957a05b3d7b579d0c427975d4..7cfaec46ef441f3206ade9db619eda5f0879a859 100644 (file)
@@ -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
index 79292cebcd1c18bcdfd07de217fd955f58e2e9f3..71d4a015236c9c89be9027d8574cdd6f5f20bf34 100644 (file)
@@ -297,6 +297,8 @@ TYPE_IN_ADDR_T
 
 TYPE_SOCKADDR_STORAGE
 
+TYPE_SIG_ATOMIC_T
+
 CURL_CHECK_FUNC_RECV
 
 CURL_CHECK_FUNC_SEND
index 224ab692aeebee847fe9260e83f8e4fb4cf36dac..23d75ca0d9137121e514a40e25915e5af518543f 100644 (file)
 #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 */
 
index 8c96873e88e70b7a671ce4c6d8ab39961ee7d222..74e74eda92c7f8301f11ba826beb8e8fd442dff9 100644 (file)
@@ -1631,6 +1631,8 @@ TYPE_IN_ADDR_T
 
 TYPE_SOCKADDR_STORAGE
 
+TYPE_SIG_ATOMIC_T
+
 AC_FUNC_SELECT_ARGTYPES
 
 CURL_CHECK_FUNC_RECV
index 04640707c051f6ae092aff07d8a963b3861b9f94..07909475c942560a005528951c23cc544fd0b1f6 100644 (file)
 #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 */