Browse Source

Fix header includes for FreeBSD compatibility

Fixes #45
tags/1.4
Timo Röhling 9 years ago
parent
commit
9f302b8d6b
3 changed files with 18 additions and 6 deletions
  1. 8
    0
      CMakeLists.txt
  2. 2
    3
      srs2.c
  3. 8
    3
      srs2.h

+ 8
- 0
CMakeLists.txt View File

45
 if(HAVE_TIME_H)
45
 if(HAVE_TIME_H)
46
     add_definitions(-DHAVE_TIME_H)
46
     add_definitions(-DHAVE_TIME_H)
47
 endif()
47
 endif()
48
+check_include_file(alloca.h HAVE_ALLOCA_H)
49
+if(HAVE_ALLOCA_H)
50
+    add_definitions(-DHAVE_ALLOCA_H)
51
+endif()
52
+check_include_file(sys/types.h HAVE_SYS_TYPES_H)
53
+if(HAVE_SYS_TYPES_H)
54
+    add_definitions(-DHAVE_SYS_TYPES_H)
55
+endif()
48
 
56
 
49
 if(NOT DEFINED INIT_FLAVOR)
57
 if(NOT DEFINED INIT_FLAVOR)
50
 	if(IS_DIRECTORY "${SYSD_UNIT_DIR}" AND EXISTS "/usr/lib/systemd/systemd")
58
 	if(IS_DIRECTORY "${SYSD_UNIT_DIR}" AND EXISTS "/usr/lib/systemd/systemd")

+ 2
- 3
srs2.c View File

17
 #undef USE_OPENSSL
17
 #undef USE_OPENSSL
18
 
18
 
19
 #include <stdarg.h>
19
 #include <stdarg.h>
20
-#include <time.h>       /* time */
21
-#include <sys/types.h>  /* tyepdefs */
22
-#include <sys/time.h>   /* timeval / timezone struct */
23
 #include <string.h>		/* memcpy, strcpy, memset */
20
 #include <string.h>		/* memcpy, strcpy, memset */
21
+#ifdef HAVE_ALLOCA_H
24
 #include <alloca.h>
22
 #include <alloca.h>
23
+#endif
25
 
24
 
26
 #ifdef USE_OPENSSL
25
 #ifdef USE_OPENSSL
27
 #include <openssl/hmac.h>
26
 #include <openssl/hmac.h>

+ 8
- 3
srs2.h View File

20
 #include <stdio.h>
20
 #include <stdio.h>
21
 #include <stdlib.h>
21
 #include <stdlib.h>
22
 #include <ctype.h>
22
 #include <ctype.h>
23
-#ifdef __APPLE__
24
-    #include <sys/types.h>
23
+#ifdef HAVE_SYS_TYPES_H
24
+#include <sys/types.h>
25
+#endif
26
+#ifdef HAVE_SYS_TIME_H
27
+#include <sys/time.h>
28
+#endif
29
+#ifdef HAVE_TIME_H
30
+#include <time.h>
25
 #endif
31
 #endif
26
-
27
 
32
 
28
 #ifndef __BEGIN_DECLS
33
 #ifndef __BEGIN_DECLS
29
 #define __BEGIN_DECLS
34
 #define __BEGIN_DECLS

Loading…
Cancel
Save