--- src/util.c.orig	2017-05-18 19:39:59.000000000 +0200
+++ src/util.c	2018-05-23 09:14:34.600854500 +0200
@@ -43,6 +43,15 @@
 # define SA_RESTART 0
 #endif
 
+/* Out-of-range substitutes make a good fallback for uncatchable
+   signals.  */
+#ifndef SIGKILL
+# define SIGKILL (-1)
+#endif
+#ifndef SIGSTOP
+# define SIGSTOP (-1)
+#endif
+
 char const pr_program[] = PR_PROGRAM;
 
 /* Queue up one-line messages to be printed at the end,
@@ -244,10 +253,32 @@
   static int const sig[] =
     {
       /* This one is handled specially.  */
+#ifdef SIGTSTP
       SIGTSTP,
+#endif
 
+#ifdef SIGALRM
       /* The usual suspects.  */
-      SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM,
+      SIGALRM,
+#endif
+
+#ifdef SIGHUP
+      SIGHUP, 
+#endif
+
+#ifdef SIGINT 
+      SIGINT, 
+#endif
+#ifdef SIGPIPE 
+      SIGPIPE, 
+#endif
+#ifdef SIGQUIT 
+      SIGQUIT, 
+#endif
+#ifdef SIGTERM 
+      SIGTERM,
+#endif
+
 #ifdef SIGPOLL
       SIGPOLL,
 #endif
@@ -297,7 +328,11 @@
         caught_sig[j] = (signal (sig[j], SIG_IGN) != SIG_IGN);
         if (caught_sig[j])
           {
+#ifdef SIGTSTP
             signal (sig[j], sig[j] == SIGTSTP ? stophandler : sighandler);
+#else
+            signal (sig[j], sighandler);
+#endif
             siginterrupt (sig[j], 0);
           }
       }
