diff --git a/ChangeLog b/ChangeLog index b53af82..0f79d89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ v.0.5dev (ongoing development) * Make all drivers using parallel port fail if they cannot get IO permission * Include instead of everywhere (found by S. Klauer) * configure: Fix de-selecting of drivers + * Build system: Add a check testing if SA_RESTART flag is available. v0.5.3 + lcdexec: notification when called program finishes diff --git a/acinclude.m4 b/acinclude.m4 index fc7e4ec..a47a88e 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -884,6 +884,7 @@ AC_SUBST(enable_latex_dox) ]) +dnl Check if a given flag is understood and add it to CFLAGS. dnl From: http://autoconf-archive.cryp.to/ax_cflags_gcc_option.html dnl Author: Guido Draheim dnl Last Modified: 2003-11-04 @@ -1029,3 +1030,17 @@ AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1, AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1, [AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])]) +dnl +dnl Check if system has SA_RESTART defined. Copied from GNU's make configure. +dnl +AC_DEFUN([LCD_SA_RESTART], [ +AC_CACHE_CHECK([for SA_RESTART], lcd_cv_sa_restart, [ + AC_TRY_COMPILE([#include ], + [return SA_RESTART;], + lcd_cv_sa_restart=yes, + lcd_cv_sa_restart=no)]) +if test "$lcd_cv_sa_restart" != no; then + AC_DEFINE([HAVE_SA_RESTART], [1], + [Define to 1 if defines the SA_RESTART constant.]) +fi +]) diff --git a/clients/lcdexec/lcdexec.c b/clients/lcdexec/lcdexec.c index 4e8669e..5954e98 100644 --- a/clients/lcdexec/lcdexec.c +++ b/clients/lcdexec/lcdexec.c @@ -157,7 +157,9 @@ int main(int argc, char **argv) /* setup signal handlers for common signals */ sigemptyset(&sa.sa_mask); +#ifdef HAVE_SA_RESTART sa.sa_flags = SA_RESTART; +#endif sa.sa_handler = exit_program; sigaction(SIGINT, &sa, NULL); // Ctrl-C sigaction(SIGTERM, &sa, NULL); // "regular" kill diff --git a/clients/lcdvc/lcdvc.c b/clients/lcdvc/lcdvc.c index 90404e4..edf48a2 100644 --- a/clients/lcdvc/lcdvc.c +++ b/clients/lcdvc/lcdvc.c @@ -120,7 +120,9 @@ int main(int argc, char **argv) /* setup signal handlers for common signals */ sigemptyset(&sa.sa_mask); +#ifdef HAVE_SA_RESTART sa.sa_flags = SA_RESTART; +#endif sa.sa_handler = exit_program; sigaction(SIGINT, &sa, NULL); // Ctrl-C sigaction(SIGTERM, &sa, NULL); // "regular" kill diff --git a/configure.in b/configure.in index e694edb..e9e39f6 100644 --- a/configure.in +++ b/configure.in @@ -174,6 +174,7 @@ AC_CHECK_HEADERS([sys/sysctl.h], [], [], ]]) dnl Check for particular preprocessor macros +LCD_SA_RESTART dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST diff --git a/server/main.c b/server/main.c index b4659d9..ab5b32a 100644 --- a/server/main.c +++ b/server/main.c @@ -559,7 +559,9 @@ install_signal_handlers(int allow_reload) sigaction(SIGPIPE, &sa, NULL); sa.sa_handler = exit_program; +#ifdef HAVE_SA_RESTART sa.sa_flags = SA_RESTART; +#endif sigaction(SIGINT, &sa, NULL); /* Ctrl-C will cause a clean exit...*/ sigaction(SIGTERM, &sa, NULL); /* and "kill"...*/