Browse Source

Check for headers which may or may not be available

tags/1.2
Timo Röhling 10 years ago
parent
commit
a534a528f7
2 changed files with 29 additions and 4 deletions
  1. 18
    0
      CMakeLists.txt
  2. 11
    4
      postsrsd.c

+ 18
- 0
CMakeLists.txt View File

1
 cmake_minimum_required(VERSION 2.4)
1
 cmake_minimum_required(VERSION 2.4)
2
 project(postsrsd C)
2
 project(postsrsd C)
3
+include(CheckIncludeFile)
3
 
4
 
4
 option(GENERATE_SRS_SECRET "Generate a random SRS secret if none exists during install" ON)
5
 option(GENERATE_SRS_SECRET "Generate a random SRS secret if none exists during install" ON)
5
 option(USE_APPARMOR "Enable AppArmor profile" OFF)
6
 option(USE_APPARMOR "Enable AppArmor profile" OFF)
15
 find_program(INSSERV insserv DOC "path to insserv executable")
16
 find_program(INSSERV insserv DOC "path to insserv executable")
16
 find_program(CHKCONFIG chkconfig DOC "path to chkconfig executable")
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
 if(NOT DEFINED INIT_FLAVOR)
36
 if(NOT DEFINED INIT_FLAVOR)
19
     if(IS_DIRECTORY "${SYSCONF_DIR}/init" AND EXISTS "/lib/init/upstart-job")
37
     if(IS_DIRECTORY "${SYSCONF_DIR}/init" AND EXISTS "/lib/init/upstart-job")
20
         message(STATUS "Detected init flavor: upstart")
38
         message(STATUS "Detected init flavor: upstart")

+ 11
- 4
postsrsd.c View File

28
 #include <pwd.h>
28
 #include <pwd.h>
29
 #include <string.h>
29
 #include <string.h>
30
 #include <poll.h>
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
 #endif
42
 #endif
36
 #include <syslog.h>
43
 #include <syslog.h>
37
 
44
 

Loading…
Cancel
Save