annotate include/freeDiameter/CMakeLists.txt @ 313:6fd1e6f56af5

Completed initial debianization
author Sebastien Decugis <sdecugis@nict.go.jp>
date Wed, 19 May 2010 11:08:05 +0900
parents 61f78fdbacc2
children aa8f41bca657
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
bafb831ba688 Fix names to proper case for freeDiameter
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 0
diff changeset
1 #CMake configuration for freeDiameter include directory
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
2
1
bafb831ba688 Fix names to proper case for freeDiameter
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 0
diff changeset
3 Project("freeDiameter include directory" C)
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
4
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
5 ########################
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
6 # Configurable parameters
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
7
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
8 # Disable SCTP support completly ?
23
db6c40b8b307 Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 17
diff changeset
9 OPTION(DISABLE_SCTP "Disable SCTP support?" OFF)
db6c40b8b307 Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 17
diff changeset
10 IF (NOT DISABLE_SCTP)
db6c40b8b307 Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 17
diff changeset
11 OPTION(DEBUG_SCTP "Verbose SCTP (for debug)?" OFF)
24
bd83ce9328ed Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 23
diff changeset
12 OPTION(SCTP_USE_MAPPED_ADDRESSES "Use v6-mapped v4 addresses in SCTP (workaround some SCTP limitations)?" OFF)
23
db6c40b8b307 Added some code in cnxctx.c mainly
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 17
diff changeset
13 ENDIF (NOT DISABLE_SCTP)
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
14
17
ab3c58d88be3 Added proper gcrypt initializer
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
15 # Find TODO items in the code easily ?
13
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
16 OPTION(ERRORS_ON_TODO "(development) Generate compilation errors on TODO items ?" OFF)
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
17
304
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 236
diff changeset
18 MARK_AS_ADVANCED(DISABLE_SCTP DEBUG_SCTP SCTP_USE_MAPPED_ADDRESSES ERRORS_ON_TODO)
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
19
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
20 ########################
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
21 # System checks
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
22
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
23 INCLUDE (CheckLibraryExists)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
24 INCLUDE (CheckFunctionExists)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
25 INCLUDE (CheckIncludeFiles)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
26 INCLUDE (CheckSymbolExists)
51
08d8cbeff30b Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
27 INCLUDE (CheckCSourceCompiles)
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
28 INCLUDE (TestBigEndian)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
29
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
30 # We use dlopen and dlclose
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
31 SET(FD_LIBS ${FD_LIBS} ${CMAKE_DL_LIBS})
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
32
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
33 # We need the threads library (pthread)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
34 INCLUDE(FindThreads)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
35 SET(FD_LIBS ${FD_LIBS} ${CMAKE_THREAD_LIBS_INIT})
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
36
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
37 # We need the clock_gettime function ( -lrt, -lposix4 )
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
38 CHECK_FUNCTION_EXISTS (clock_gettime HAVE_CLOCK_GETTIME)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
39 IF (HAVE_CLOCK_GETTIME)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
40 SET(CLOCK_GETTIME_LIBS "")
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
41 ELSE (HAVE_CLOCK_GETTIME)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
42 CHECK_LIBRARY_EXISTS (rt clock_gettime "" HAVE_LIBRT)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
43 IF (HAVE_LIBRT)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
44 SET(CLOCK_GETTIME_LIBS "-lrt")
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
45 ELSE (HAVE_LIBRT)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
46 CHECK_LIBRARY_EXISTS (posix4 clock_gettime "" HAVE_LIBPOSIX4)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
47 IF (HAVE_LIBPOSIX4)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
48 SET(CLOCK_GETTIME_LIBS "-lposix4")
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
49 ENDIF (HAVE_LIBPOSIX4)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
50 ENDIF (HAVE_LIBRT)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
51 ENDIF (HAVE_CLOCK_GETTIME)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
52 SET(FD_LIBS ${FD_LIBS} ${CLOCK_GETTIME_LIBS})
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
53
51
08d8cbeff30b Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
54 # We need the sctp_connectx function among others
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
55 # We need the IPPROTO_SCTP symbol from sys/socket.h, netinet/in.h or netinet/sctp.h
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
56 IF(NOT DISABLE_SCTP)
51
08d8cbeff30b Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
57 CHECK_FUNCTION_EXISTS(sctp_connectx HAVE_NATIVE_SCTP)
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
58 IF(NOT HAVE_NATIVE_SCTP)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
59 FIND_PACKAGE(SCTP REQUIRED)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
60 INCLUDE_DIRECTORIES(${SCTP_INCLUDE_DIRS})
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
61 SET(FD_LIBS ${FD_LIBS} ${SCTP_LIBRARIES})
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
62 ENDIF(NOT HAVE_NATIVE_SCTP)
51
08d8cbeff30b Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
63 # Now check the number of args of this function, since it changed between Ubuntu 9.04 and 9.10
08d8cbeff30b Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
64 SET(CHECK_SCTP_CONNECTX_4_ARGS_SOURCE_CODE "
168
6db078b955e3 Completed rt_default extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 51
diff changeset
65 #include <unistd.h>
6db078b955e3 Completed rt_default extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 51
diff changeset
66 #include <netinet/sctp.h>
51
08d8cbeff30b Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
67 int main() {
08d8cbeff30b Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
68 return sctp_connectx(0, NULL, 0, NULL);
08d8cbeff30b Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
69 }
08d8cbeff30b Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
70 ")
08d8cbeff30b Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
71 SET(CMAKE_REQUIRED_LIBRARIES ${SCTP_LIBRARIES})
08d8cbeff30b Fix for number of args to sctp_connectx
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
72 CHECK_C_SOURCE_COMPILES("${CHECK_SCTP_CONNECTX_4_ARGS_SOURCE_CODE}" SCTP_CONNECTX_4_ARGS)
305
61f78fdbacc2 Cleanup vars names
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
73 ELSE (NOT DISABLE_SCTP)
61f78fdbacc2 Cleanup vars names
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
74 MESSAGE(STATUS "Disabled SCTP support.")
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
75 ENDIF(NOT DISABLE_SCTP)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
76
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
77 # Check byte ordering
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
78 TEST_BIG_ENDIAN(HOST_BIG_ENDIAN)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
79
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
80 # We need the getopt_long function
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
81 CHECK_FUNCTION_EXISTS (getopt_long HAVE_LONG_OPTIONS)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
82 IF (NOT HAVE_LONG_OPTIONS)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
83 MESSAGE(SEND_ERROR "The getopt_long function is not found, please add needed library in build system")
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
84 ENDIF (NOT HAVE_LONG_OPTIONS)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
85
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
86 # Check if ntohll is provided on the system
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
87 CHECK_SYMBOL_EXISTS(ntohll "" HAVE_NTOHLL)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
88
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
89 # malloc.h ?
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
90 CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H)
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
91
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
92 ##########################
313
6fd1e6f56af5 Completed initial debianization
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 305
diff changeset
93 # Create the absolute path for searching extensions
6fd1e6f56af5 Completed initial debianization
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 305
diff changeset
94 SET(DEFAULT_EXTENSIONS_PATH ${CMAKE_INSTALL_PREFIX}/${INSTALL_EXTENSIONS_SUFFIX})
305
61f78fdbacc2 Cleanup vars names
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
95
61f78fdbacc2 Cleanup vars names
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
96 ##########################
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
97
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
98 # Generate the host.h file
1
bafb831ba688 Fix names to proper case for freeDiameter
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 0
diff changeset
99 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeDiameter-host.h.in ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h)
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
100
304
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 236
diff changeset
101 # Save some variables for the other directories
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
102 SET(FD_LIBS ${FD_LIBS} PARENT_SCOPE)
304
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 236
diff changeset
103
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 236
diff changeset
104 ####
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 236
diff changeset
105 ## INSTALL section ##
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 236
diff changeset
106
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 236
diff changeset
107 # The headers from this directory are required to develop new extensions for freeDiameter.
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 236
diff changeset
108 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h libfreeDiameter.h freeDiameter.h extension.h
313
6fd1e6f56af5 Completed initial debianization
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 305
diff changeset
109 DESTINATION ${INSTALL_HEADERS_SUFFIX}
304
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 236
diff changeset
110 COMPONENT freeDiameter-dev)
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 236
diff changeset
111
"Welcome to our mercurial repository"