]> granicus.if.org Git - neomutt/commitdiff
simplify sig_atomic_t check
authorRichard Russon <rich@flatcap.org>
Mon, 1 May 2017 03:13:06 +0000 (04:13 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 2 May 2017 16:34:43 +0000 (17:34 +0100)
posix:2001 declares 'sig_atomic_t' in signal.h
We only need to check if it's declared with the 'volatile' symbol.
Streamline the autoconf checking.

configure.ac

index a2e2050cbf5dbb577fcd50cf491ca2de2c11e02f..f18ebd1b42596d59250bbc9ad3da8fe68451dd6b 100644 (file)
@@ -72,7 +72,7 @@ fi
 AC_SUBST([DEBUGGER])
 
 AH_TEMPLATE([sig_atomic_t],
-       [/* Define to `int' if <signal.h> doesn't define.])
+       [Define to `int' if <signal.h> doesn't define.])
 AH_TEMPLATE([HAVE_START_COLOR],
        [Define if you have start_color, as a function or macro.])
 AH_TEMPLATE([HAVE_TYPEAHEAD],
@@ -456,28 +456,14 @@ AC_CHECK_FUNCS(fgets_unlocked fgetc_unlocked)
 AC_CHECK_FUNCS(strcasecmp strncasecmp setenv strdup strsep strtok_r mkdtemp)
 
 AC_MSG_CHECKING(for sig_atomic_t in signal.h)
-AC_EGREP_HEADER(sig_atomic_t,signal.h,
+AC_EGREP_HEADER(volatile.*sig_atomic_t,signal.h,
        [
-               ac_cv_type_sig_atomic_t=yes;
-               AC_EGREP_HEADER(volatile.*sig_atomic_t,
-                       signal.h,
-                       [
-                               is_sig_atomic_t_volatile=yes;
-                               AC_MSG_RESULT([yes, volatile])
-                       ], [
-                               is_sig_atomic_t_volatile=no;
-                               AC_MSG_RESULT([yes, non volatile])
-                       ])
+               AC_MSG_RESULT([yes, volatile])
+               AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
        ], [
-               AC_MSG_RESULT(no)
-               AC_CHECK_TYPE(sig_atomic_t, int)
-               is_sig_atomic_t_volatile=no
+               AC_MSG_RESULT([yes, non volatile])
+               AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
        ])
-if test $is_sig_atomic_t_volatile = 'yes'; then
-       AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
-else
-       AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
-fi
 
 AC_CHECK_DECLS([sys_siglist],[],[],[#include <signal.h>
 /* NetBSD declares sys_siglist in unistd.h.  */