preliminary cmake support. linking still broken.
authorFelix Morgner <felix.morgner@gmail.com>
Mon, 13 Jan 2014 14:40:40 +0000 (15:40 +0100)
committerFelix Morgner <felix.morgner@gmail.com>
Mon, 13 Jan 2014 14:40:40 +0000 (15:40 +0100)
CMakeLists.txt
src/client.h
src/crypt.h
src/ssl.h

index 3b09b26cf2c40a0a95f7605ed41dc6ecc5c37672..9b2b5baf1cdae3e9c09371517b46d01d907f3ea6 100644 (file)
@@ -7,10 +7,23 @@ add_definitions()
 include(FindPkgConfig)
 include(CheckFunctionExists)
 include(CheckLibraryExists)
+include(CheckSymbolExists)
 
 pkg_check_modules(BASELIBS libconfig)
-check_function_exists(clock_gettime GAVE_CLOCK_GETTIME)
-check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
+
+check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
+
+if(NOT HAVE_CLOCK_GETTIME)
+  check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
+  if(NOT HAVE_CLOCK_GETTIME_RT)
+    check_library_exists(c clock_get_time "mach/time.h" HAVE_CLOCK_GET_TIME)
+    if(NOT HAVE_CLOCK_GET_TIME)
+      message(FATAL_ERROR "Didn't find clock_gettime() or clock_get_time!")
+    endif()
+  else()
+    set(LIBRARIES ${LIBRARIES} rt)
+  endif()
+endif()
 
 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g")
 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
index 95f61725fbb1ddf4f75e8aa2532d39afabba45ea..13ea42705dcb7894fb8cdf2aae2046a9d0183e0c 100644 (file)
@@ -31,7 +31,7 @@
 #ifndef CLIENT_H_45786678
 #define CLIENT_H_45786678
 
-#include <config.h>
+//#include <config.h>
 #include <stdint.h>
 #include <unistd.h>             /* close() */
 #include <sys/types.h>
@@ -65,9 +65,9 @@ typedef struct {
        bool_t shutdown_wait;
        cryptState_t cryptState;
        bool_t readBlockedOnWrite, writeBlockedOnRead;
-       
+
        struct sockaddr_in remote_tcp;
-       struct sockaddr_in remote_udp; 
+       struct sockaddr_in remote_udp;
        uint8_t rxbuf[BUFSIZE], txbuf[BUFSIZE];
        uint32_t rxcount, msgsize, drainleft, txcount, txsize;
        int sessionId;
index e19009396d3802ff0f0121ddda9744e9cfacfa23..7e549b1021fcea44e1f7c00905de4f1279436900 100644 (file)
@@ -32,7 +32,7 @@
 #define CRYPTSTATE_H_34564356
 
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+//#include <config.h>
 #endif
 
 #ifdef USE_POLARSSL
@@ -53,12 +53,12 @@ typedef struct CryptState {
        uint8_t encrypt_iv[AES_BLOCK_SIZE];
        uint8_t decrypt_iv[AES_BLOCK_SIZE];
        uint8_t decrypt_history[0x100];
-       
+
        unsigned int uiGood;
        unsigned int uiLate;
        unsigned int uiLost;
        unsigned int uiResync;
-       
+
        unsigned int uiRemoteGood;
        unsigned int uiRemoteLate;
        unsigned int uiRemoteLost;
@@ -72,7 +72,7 @@ typedef struct CryptState {
 #endif
        etimer_t tLastGood;
        etimer_t tLastRequest;
-       bool_t bInit;   
+       bool_t bInit;
 } cryptState_t;
 
 void CryptState_init(cryptState_t *cs);
index ce9e480ce9f819360624bb45aadd937d5d61c471..1b2d0150ffa5010153a1eeeafff05f9598a18607 100644 (file)
--- a/src/ssl.h
+++ b/src/ssl.h
@@ -33,7 +33,7 @@
 #define SSL_H_987698
 
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+//#include <config.h>
 #endif
 
 #ifdef USE_POLARSSL
@@ -130,7 +130,7 @@ static inline void SSLi_hex2hash(char *in, uint8_t *hash)
        int i, offset = 0;
        char byte[3];
        int scanned;
-       
+
        byte[2] = '\0';
        for (i = 0; i < 20; i++) {
                memcpy(byte, &in[i * 2], 2);