From d11d6e038e2e60c6b876c7018ad181a08e6cef8d Mon Sep 17 00:00:00 2001 From: John Darrington Date: Fri, 29 Oct 2010 20:18:12 +0200 Subject: [PATCH] Conditionally compile in the SIGWINCH handler Not all systems have SIGWINCH. But this isn't an essential feature so only compile it in if its available. --- configure.ac | 10 ++++++++++ src/output/ascii.c | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b06392a5..09a2e3e4 100644 --- a/configure.ac +++ b/configure.ac @@ -288,6 +288,16 @@ PSPP_READLINE dnl Checks for header files. AC_CHECK_HEADERS([sys/wait.h fpu_control.h ieeefp.h fenv.h pwd.h]) +dnl Some systems dont have SIGWINCH +AC_CHECK_DECLS([SIGWINCH], [], [], + [#include + /* NetBSD declares sys_siglist in unistd.h. */ + #ifdef HAVE_UNISTD_H + # include + #endif + ]) + + # For gnulib. gl_INIT diff --git a/src/output/ascii.c b/src/output/ascii.c index 8b48d9bd..00e3f33c 100644 --- a/src/output/ascii.c +++ b/src/output/ascii.c @@ -788,6 +788,8 @@ ascii_layout_cell (struct ascii_driver *a, const struct table_cell *cell, /* ascii_close_page () and support routines. */ + +#if HAVE_DECL_SIGWINCH static struct ascii_driver *the_driver; static void @@ -795,6 +797,7 @@ winch_handler (int signum UNUSED) { update_page_size (the_driver, false); } +#endif static bool ascii_open_page (struct ascii_driver *a) @@ -809,6 +812,7 @@ ascii_open_page (struct ascii_driver *a) a->file = fn_open (a->file_name, a->append ? "a" : "w"); if (a->file != NULL) { +#if HAVE_DECL_SIGWINCH if ( isatty (fileno (a->file))) { struct sigaction action; @@ -820,7 +824,7 @@ ascii_open_page (struct ascii_driver *a) a->auto_length = true; sigaction (SIGWINCH, &action, NULL); } - +#endif if (a->init != NULL) fputs (a->init, a->file); } -- 2.30.2