Просмотр исходного кода

s-s-d: Detect system specific headers at configure time

Instead of hardcoding their usage depending on system macros.
Guillem Jover лет назад: 12
Родитель
Сommit
861e165c26
3 измененных файлов с 21 добавлено и 17 удалено
  1. 3 2
      configure.ac
  2. 2 0
      debian/changelog
  3. 16 15
      utils/start-stop-daemon.c

+ 3 - 2
configure.ac

@@ -66,8 +66,9 @@ fi
 
 
 # Checks for header files.
 # Checks for header files.
 AC_HEADER_STDC
 AC_HEADER_STDC
-AC_CHECK_HEADERS([stddef.h error.h locale.h libintl.h kvm.h \
-                  sys/syscall.h linux/fiemap.h])
+AC_CHECK_HEADERS([stddef.h error.h err.h locale.h libintl.h kvm.h \
+                  sys/param.h sys/sysctl.h sys/syscall.h sys/user.h \
+                  sys/proc.h sys/pstat.h linux/fiemap.h])
 
 
 # Checks for typedefs, structures, and compiler characteristics.
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_BIGENDIAN
 AC_C_BIGENDIAN

+ 2 - 0
debian/changelog

@@ -62,6 +62,8 @@ dpkg (1.17.7) UNRELEASED; urgency=low
       on such system anymore. Note that GNU/kFreeBSD is still using Linux
       on such system anymore. Note that GNU/kFreeBSD is still using Linux
       procfs code (which ends up using linprocfs).
       procfs code (which ends up using linprocfs).
     - Fix OpenBSD KVM code to use current kinfo_proc layout.
     - Fix OpenBSD KVM code to use current kinfo_proc layout.
+    - Detect system specific headers at configure time instead of hardcoding
+      their usage depending on system macros.
 
 
   [ Updated dpkg translations ]
   [ Updated dpkg translations ]
   * German (Sven Joachim).
   * German (Sven Joachim).

+ 16 - 15
utils/start-stop-daemon.c

@@ -43,29 +43,24 @@
 #  error Unknown architecture - cannot build start-stop-daemon
 #  error Unknown architecture - cannot build start-stop-daemon
 #endif
 #endif
 
 
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
 #ifdef HAVE_SYS_SYSCALL_H
 #ifdef HAVE_SYS_SYSCALL_H
 #include <sys/syscall.h>
 #include <sys/syscall.h>
 #endif
 #endif
-
-#if defined(OSOpenBSD) || defined(OSFreeBSD) || defined(OSNetBSD)
-#include <sys/param.h>
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#ifdef HAVE_SYS_PROC_H
 #include <sys/proc.h>
 #include <sys/proc.h>
-
-#include <err.h>
 #endif
 #endif
-
-#ifdef HAVE_KVM_H
-#include <sys/sysctl.h>
+#ifdef HAVE_SYS_USER_H
 #include <sys/user.h>
 #include <sys/user.h>
-
-#include <kvm.h>
 #endif
 #endif
-
-#if defined(OShpux)
-#include <sys/param.h>
+#ifdef HAVE_SYS_PSTAT_H
 #include <sys/pstat.h>
 #include <sys/pstat.h>
 #endif
 #endif
-
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/time.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
@@ -91,16 +86,22 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdio.h>
 #include <getopt.h>
 #include <getopt.h>
-
 #ifdef HAVE_ERROR_H
 #ifdef HAVE_ERROR_H
 #include <error.h>
 #include <error.h>
 #endif
 #endif
+#ifdef HAVE_ERR_H
+#include <err.h>
+#endif
 
 
 #if defined(OSHurd)
 #if defined(OSHurd)
 #include <hurd.h>
 #include <hurd.h>
 #include <ps.h>
 #include <ps.h>
 #endif
 #endif
 
 
+#ifdef HAVE_KVM_H
+#include <kvm.h>
+#endif
+
 #ifdef _POSIX_PRIORITY_SCHEDULING
 #ifdef _POSIX_PRIORITY_SCHEDULING
 #include <sched.h>
 #include <sched.h>
 #else
 #else