From 73b439a9a8fe371669a6c1a4ecb198d1f31a0917 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 11 Oct 2012 14:17:03 -0400 Subject: [PATCH] gpgme-tool: wrap fancy headers in #ifdefs. Signed-off-by: W. Trevor King --- configure.ac | 2 +- src/gpgme-tool.c | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 3cac826..bf5c15a 100644 --- a/configure.ac +++ b/configure.ac @@ -218,7 +218,7 @@ AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes") # Checks for header files. -AC_CHECK_HEADERS_ONCE([locale.h sys/select.h sys/uio.h argp.h +AC_CHECK_HEADERS_ONCE([locale.h signal.h sys/select.h sys/uio.h argp.h unistd.h sys/time.h sys/types.h sys/stat.h]) diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index bcda5f0..d5ce1f7 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -29,12 +29,18 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#ifndef HAVE_W32_SYSTEM +# include +# include +# include +# include +#endif /*!HAVE_W32_SYSTEM*/ +#ifdef HAVE_SIGNAL_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif #ifdef HAVE_LOCALE_H #include #endif @@ -3516,8 +3522,10 @@ gpgme_server (gpgme_tool_t gt, int socket_server) exit (EXIT_FAILURE); } +#ifdef HAVE_SIGNAL_H signal (SIGINT, &cleanup_handler); signal (SIGTERM, &cleanup_handler); +#endif listen (socket_fd, 5); @@ -3543,9 +3551,11 @@ gpgme_server (gpgme_tool_t gt, int socket_server) /* parent; continue listening for other connections */ } +#ifdef HAVE_SIGNAL_H /* the child doesn't need cleanup handlers */ signal (SIGINT, SIG_DFL); signal (SIGTERM, SIG_DFL); +#endif err = assuan_init_socket_server ( server.assuan_ctx, sock, -- 2.26.2