Include required headers into pth.h.
authorWerner Koch <wk@gnupg.org>
Thu, 10 May 2012 16:47:00 +0000 (18:47 +0200)
committerWerner Koch <wk@gnupg.org>
Thu, 10 May 2012 16:47:00 +0000 (18:47 +0200)
* src/npth.h.in: Include sys/time.h and signal.h.  Include time.h only
if available.
* configure.ac (INSERT_SYS_TIME_H, INSERT_TIME_H, INSERT_SIGNAL_H):
Detect header files and ac_subst snippets.
--

sys/time.h is required for struct timeval and signal.h for sigset_t.
Without that them the regression test fails on IRIX.  Conditional
inclusion of these files might not bee required, but it should not
harm, either.

configure.ac
src/npth.h.in

index 89f29f7..7e138f1 100644 (file)
@@ -182,13 +182,30 @@ AC_SUBST(BUILD_FILEVERSION)
 # Checks for header files.
 #
 # fixme: For what do we need the sys/socket test?
-AC_CHECK_HEADERS([sys/socket.h sys/select.h unistd.h])
+AC_CHECK_HEADERS([sys/socket.h sys/select.h unistd.h sys/time.h time.h \
+                  signal.h])
 INSERT_SYS_SELECT_H=
 if test x"$ac_cv_header_sys_select_h" = xyes; then
   INSERT_SYS_SELECT_H="include <sys/select.h>"
 fi
 AC_SUBST(INSERT_SYS_SELECT_H)
 
+if test x"$ac_cv_header_sys_time_h" = xyes; then
+  INSERT_SYS_TIME_H="include <sys/time.h>"
+fi
+AC_SUBST(INSERT_SYS_TIME_H)
+
+if test x"$ac_cv_header_time_h" = xyes; then
+  INSERT_TIME_H="include <time.h>"
+fi
+AC_SUBST(INSERT_TIME_H)
+
+if test x"$ac_cv_header_signal_h" = xyes; then
+  INSERT_SIGNAL_H="include <signal.h>"
+fi
+AC_SUBST(INSERT_SIGNAL_H)
+
+
 # Some systems lack socklen_t - provide a replacement.
 gl_TYPE_SOCKLEN_T
 case "${host}" in
index 9ad5fb3..b882ae8 100644 (file)
 
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <time.h>
+#@INSERT_SYS_TIME_H@
+#@INSERT_TIME_H@
 #include <sys/socket.h>
 #@INSERT_SOCKLEN_T@
 #@INSERT_SYS_SELECT_H@
+#@INSERT_SIGNAL_H@
 
 #include <pthread.h>