diff --git a/configure.ac b/configure.ac index 798a6b6ee..cccbbd142 100644 --- a/configure.ac +++ b/configure.ac @@ -208,6 +208,40 @@ AC_TYPE_MODE_T AC_TYPE_PID_T AC_TYPE_UID_T +AH_TEMPLATE([sig_atomic_t], + [/* Define to `int' if doesn't define.]) +AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T], + [Some systems declare sig_atomic_t as volatile, some others -- no. + This define will have value `sig_atomic_t' or + `volatile sig_atomic_t' accordingly.]) + +AC_MSG_CHECKING(for sig_atomic_t in signal.h) +AC_EGREP_HEADER(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(no) + AC_CHECK_TYPE(sig_atomic_t, int) + is_sig_atomic_t_volatile=no + ]) +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_FUNC_STRCOLL mc_AC_GET_FS_INFO diff --git a/lib/global.h b/lib/global.h index 505100dca..36af0e7c5 100644 --- a/lib/global.h +++ b/lib/global.h @@ -261,7 +261,7 @@ typedef struct gboolean alternate_plus_minus; /* Set if the window has changed it's size */ - volatile sig_atomic_t winch_flag; + SIG_ATOMIC_VOLATILE_T winch_flag; } tty; struct diff --git a/lib/tty/tty.c b/lib/tty/tty.c index 39d7ea352..e4011e614 100644 --- a/lib/tty/tty.c +++ b/lib/tty/tty.c @@ -62,7 +62,7 @@ int mc_tty_frm[MC_TTY_FRM_MAX]; /*** file scope variables ************************************************************************/ -static volatile sig_atomic_t got_interrupt = 0; +static SIG_ATOMIC_VOLATILE_T got_interrupt = 0; /*** file scope functions ************************************************************************/ /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/vfs/netutil.c b/lib/vfs/netutil.c index cd51906cb..6d6ed6660 100644 --- a/lib/vfs/netutil.c +++ b/lib/vfs/netutil.c @@ -36,7 +36,7 @@ /*** global variables ****************************************************************************/ -volatile sig_atomic_t got_sigpipe = 0; +SIG_ATOMIC_VOLATILE_T got_sigpipe = 0; /*** file scope macro definitions ****************************************************************/ diff --git a/lib/vfs/netutil.h b/lib/vfs/netutil.h index 18fdbc283..9a1274584 100644 --- a/lib/vfs/netutil.h +++ b/lib/vfs/netutil.h @@ -16,7 +16,7 @@ /*** global variables defined in .c file *********************************************************/ -extern volatile sig_atomic_t got_sigpipe; +extern SIG_ATOMIC_VOLATILE_T got_sigpipe; /*** declarations of public functions ************************************************************/