summaryrefslogtreecommitdiff
path: root/include/AddScgBits.cmake
blob: 6aaff73e76224d6984fdec293aeba4867a800fa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

IF(NOT GUARD_SCGCONFIG)
   SET(GUARD_SCGCONFIG 1)


LIST(APPEND EXTRA_LIBS "usal")

INCLUDE(CheckIncludeFiles)
CHECK_INCLUDE_FILES("stdio.h;camlib.h" HAVE_CAMLIB_H)

IF(HAVE_CAMLIB_H)

   # quick an dirty, should better become a variable used by libusal only,
   # analogous to SCG_SELF_LIBS
   ADD_DEFINITIONS(-DHAVE_CAMLIB_H)

   LIST(APPEND EXTRA_LIBS "cam")
   LIST(APPEND SCG_SELF_LIBS "cam")

ENDIF(HAVE_CAMLIB_H)

FIND_LIBRARY(HAVE_LIBVOLMGT "volmgt")
IF(HAVE_LIBVOLMGT)
   LIST(APPEND EXTRA_LIBS "volmgt")
   LIST(APPEND SCG_SELF_LIBS "volmgt")
ENDIF(HAVE_LIBVOLMGT)

   INCLUDE(CheckCSourceCompiles)

   SET(TESTSRC "
#include <sys/types.h>
#include <sys/socket.h>

int main(int argc, char **argv) {
   return socket(AF_INET, SOCK_STREAM, 0);
}
")

SET(CMAKE_REQUIRED_LIBRARIES )
   CHECK_C_SOURCE_COMPILES("${TESTSRC}" LIBC_SOCKET)

IF(NOT LIBC_SOCKET)
   LIST(APPEND EXTRA_LIBS -lsocket)
   #MESSAGE("Using libsocket for socket functions")
ENDIF(NOT LIBC_SOCKET)


   SET(TESTSRC "
#include <sched.h>
struct sched_param scp;
         int main(int argc, char **argv) {
         return sched_setscheduler(0, SCHED_RR, &scp);
         }
")


SET(CMAKE_REQUIRED_LIBRARIES )
   CHECK_C_SOURCE_COMPILES("${TESTSRC}" LIBC_SCHED)

IF(NOT LIBC_SCHED)
   LIST(APPEND EXTRA_LIBS -lrt)
   #MESSAGE("Using librt for realtime functions")
ENDIF(NOT LIBC_SCHED)

ENDIF(NOT GUARD_SCGCONFIG)