Index: client/CMakeLists.txt
--- client/CMakeLists.txt.orig	2008-12-30 10:52:43 +0100
+++ client/CMakeLists.txt	2009-01-10 11:08:04 +0100
@@ -19,6 +19,7 @@
 set(CLIENT_LINK_LIBRARIES
   ${CLIENT_EXECUTABLE}
   ${CSYNC_LIBRARY}
+  ${CLIENT_LINK_LIBRARIES}
 )
 
 set(client_SRCS
Index: cmake/Modules/DefineCompilerFlags.cmake
--- cmake/Modules/DefineCompilerFlags.cmake.orig	2008-12-30 10:52:43 +0100
+++ cmake/Modules/DefineCompilerFlags.cmake	2009-01-10 11:08:04 +0100
@@ -31,15 +31,9 @@
     )
   endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
 
-  string(REGEX REPLACE "[\r\n]" " " ${_lfs_CFLAGS} "${${_lfs_CFLAGS}}")
+  string(REGEX REPLACE "[\r\n]" " " "${_lfs_CFLAGS}" "${${_lfs_CFLAGS}}")
 
   add_definitions(${_lfs_CFLAGS})
-  add_definitions(-Wall -Wextra -Wmissing-prototypes -Wdeclaration-after-statement -Wunused)
-
-  check_c_compiler_flag("-fstack-protector" WITH_STACK_PROTECTOR)
-  if (WITH_STACK_PROTECTOR)
-    add_definitions(-fstack-protector)
-  endif (WITH_STACK_PROTECTOR)
 
   check_c_compiler_flag("-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
   if (WITH_FORTIFY_SOURCE)
Index: cmake/Modules/FindDlfcn.cmake
--- cmake/Modules/FindDlfcn.cmake.orig	2008-12-30 10:52:43 +0100
+++ cmake/Modules/FindDlfcn.cmake	2009-01-10 11:08:04 +0100
@@ -53,9 +53,9 @@
     )
   endif (DL_FOUND)
 
-  if (DLFCN_INCLUDE_DIRS AND DLFCN_LIBRARIES)
+  if (DLFCN_INCLUDE_DIRS OR DLFCN_LIBRARIES)
      set(DLFCN_FOUND TRUE)
-  endif (DLFCN_INCLUDE_DIRS AND DLFCN_LIBRARIES)
+  endif (DLFCN_INCLUDE_DIRS OR DLFCN_LIBRARIES)
 
   if (DLFCN_FOUND)
     if (NOT Dlfcn_FIND_QUIETLY)
Index: cmake/Modules/FindRT.cmake
--- cmake/Modules/FindRT.cmake.orig	2008-12-30 10:52:43 +0100
+++ cmake/Modules/FindRT.cmake	2009-01-10 11:08:04 +0100
@@ -53,9 +53,9 @@
     )
   endif (RT_FOUND)
 
-  if (RT_INCLUDE_DIRS AND RT_LIBRARIES)
+  if (RT_INCLUDE_DIRS OR RT_LIBRARIES)
      set(RT_FOUND TRUE)
-  endif (RT_INCLUDE_DIRS AND RT_LIBRARIES)
+  endif (RT_INCLUDE_DIRS OR RT_LIBRARIES)
 
   if (RT_FOUND)
     if (NOT RT_FIND_QUIETLY)
Index: src/csync_propagate.c
--- src/csync_propagate.c.orig	2008-12-30 10:52:43 +0100
+++ src/csync_propagate.c	2009-01-10 11:08:39 +0100
@@ -103,10 +103,12 @@
   /* Open the source file */
   ctx->replica = srep;
   flags = O_RDONLY|O_NOFOLLOW;
+#if defined(O_NOATIME)
   /* O_NOATIME can only be set by the owner of the file or the superuser */
   if (st->uid == ctx->pwd.uid || ctx->pwd.euid == 0) {
     flags |= O_NOATIME;
   }
+#endif
   sfp = csync_vio_open(ctx, suri, flags, 0);
   if (sfp == NULL) {
     if (errno == ENOMEM) {
Index: src/std/c_file.c
--- src/std/c_file.c.orig	2008-12-30 10:52:43 +0100
+++ src/std/c_file.c	2009-01-10 11:08:04 +0100
@@ -93,14 +93,22 @@
       /* done */
       break;
     } else if (bread < 0) {
+#if defined(EIO) && !defined(ENODATA)
+      errno = EIO;
+#else
       errno = ENODATA;
+#endif
       rc = -1;
       goto out;
     }
 
     bwritten = write(dstfd, buf, bread);
     if (bwritten < 0) {
+#if defined(EIO) && !defined(ENODATA)
+      errno = EIO;
+#else
       errno = ENODATA;
+#endif
       rc = -1;
       goto out;
     }
