gpgme-tool: wrap fancy headers in #ifdefs.
authorW. Trevor King <wking@tremily.us>
Thu, 11 Oct 2012 18:17:03 +0000 (14:17 -0400)
committerW. Trevor King <wking@tremily.us>
Thu, 11 Oct 2012 18:17:27 +0000 (14:17 -0400)
Signed-off-by: W. Trevor King <wking@tremily.us>
configure.ac
src/gpgme-tool.c

index 3cac8267af0d53183b334acc742241ee5789264a..bf5c15aa67eee8ee2d7a2a9a8f86b08403b615cd 100644 (file)
@@ -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])
 
 
index bcda5f0e90d8531814a1dfdbb33c3b240f86d1fc..d5ce1f70f11bf48754a0db7e69e8279f02030cce 100644 (file)
 #include <getopt.h>
 #include <ctype.h>
 #include <stdarg.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <wordexp.h>
-#include <unistd.h>
+#ifndef HAVE_W32_SYSTEM
+# include <sys/types.h>
+# include <sys/socket.h>
+# include <sys/un.h>
+# include <wordexp.h>
+#endif /*!HAVE_W32_SYSTEM*/
+#ifdef HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #ifdef HAVE_LOCALE_H
 #include <locale.h>
 #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,