Kaynağa Gözat

Check for headers which may or may not be available

tags/1.2
Timo Röhling 10 yıl önce
ebeveyn
işleme
a534a528f7
2 değiştirilmiş dosya ile 29 ekleme ve 4 silme
  1. 18
    0
      CMakeLists.txt
  2. 11
    4
      postsrsd.c

+ 18
- 0
CMakeLists.txt Dosyayı Görüntüle

@@ -1,5 +1,6 @@
1 1
 cmake_minimum_required(VERSION 2.4)
2 2
 project(postsrsd C)
3
+include(CheckIncludeFile)
3 4
 
4 5
 option(GENERATE_SRS_SECRET "Generate a random SRS secret if none exists during install" ON)
5 6
 option(USE_APPARMOR "Enable AppArmor profile" OFF)
@@ -15,6 +16,23 @@ find_program(BASE64 base64 DOC "path to base64 executable")
15 16
 find_program(INSSERV insserv DOC "path to insserv executable")
16 17
 find_program(CHKCONFIG chkconfig DOC "path to chkconfig executable")
17 18
 
19
+check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
20
+if(HAVE_SYS_WAIT_H)
21
+    add_definitions(-DHAVE_SYS_WAIT_H)
22
+endif()
23
+check_include_file(wait.h HAVE_WAIT_H)
24
+if(HAVE_WAIT_H)
25
+    add_definitions(-DHAVE_WAIT_H)
26
+endif()
27
+check_include_file(sys/time.h HAVE_SYS_TIME_H)
28
+if(HAVE_SYS_TIME_H)
29
+    add_definitions(-DHAVE_SYS_TIME_H)
30
+endif()
31
+check_include_file(time.h HAVE_TIME_H)
32
+if(HAVE_TIME_H)
33
+    add_definitions(-DHAVE_TIME_H)
34
+endif()
35
+
18 36
 if(NOT DEFINED INIT_FLAVOR)
19 37
     if(IS_DIRECTORY "${SYSCONF_DIR}/init" AND EXISTS "/lib/init/upstart-job")
20 38
         message(STATUS "Detected init flavor: upstart")

+ 11
- 4
postsrsd.c Dosyayı Görüntüle

@@ -28,10 +28,17 @@
28 28
 #include <pwd.h>
29 29
 #include <string.h>
30 30
 #include <poll.h>
31
-#ifdef __APPLE__
32
-    #include <sys/wait.h>
33
-#else
34
-    #include <wait.h>
31
+#ifdef HAVE_SYS_TIME_H
32
+#include <sys/time.h>
33
+#endif
34
+#ifdef HAVE_TIME_H
35
+#include <time.h>
36
+#endif
37
+#ifdef HAVE_SYS_WAIT_H
38
+#include <sys/wait.h>
39
+#endif
40
+#ifdef HAVE_WAIT_H
41
+#include <wait.h>
35 42
 #endif
36 43
 #include <syslog.h>
37 44
 

Loading…
İptal
Kaydet