Pārlūkot izejas kodu

Fix header includes for FreeBSD compatibility

Fixes #45
tags/1.4
Timo Röhling 9 gadus atpakaļ
vecāks
revīzija
9f302b8d6b
3 mainītis faili ar 18 papildinājumiem un 6 dzēšanām
  1. 8
    0
      CMakeLists.txt
  2. 2
    3
      srs2.c
  3. 8
    3
      srs2.h

+ 8
- 0
CMakeLists.txt Parādīt failu

@@ -45,6 +45,14 @@ check_include_file(time.h HAVE_TIME_H)
45 45
 if(HAVE_TIME_H)
46 46
     add_definitions(-DHAVE_TIME_H)
47 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 57
 if(NOT DEFINED INIT_FLAVOR)
50 58
 	if(IS_DIRECTORY "${SYSD_UNIT_DIR}" AND EXISTS "/usr/lib/systemd/systemd")

+ 2
- 3
srs2.c Parādīt failu

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

+ 8
- 3
srs2.h Parādīt failu

@@ -20,10 +20,15 @@
20 20
 #include <stdio.h>
21 21
 #include <stdlib.h>
22 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 31
 #endif
26
-
27 32
 
28 33
 #ifndef __BEGIN_DECLS
29 34
 #define __BEGIN_DECLS

Notiek ielāde…
Atcelt
Saglabāt