diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 5482c5d..77df8ff 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -343,7 +343,11 @@ OPTION(DBUS_HAVE_ATOMIC_INT    "Some atomic integer implementation present" ${at
 OPTION(DBUS_USE_ATOMIC_INT_486 "Use atomic integer implementation for 486" ${atomic_int_486})
 
 if(X11_FOUND)
-  OPTION(DBUS_BUILD_X11 "Build X11-dependent code " ON)
+  if (APPLE)
+    OPTION(DBUS_BUILD_X11 "Build X11-dependent code " OFF)
+  else (APPLE)
+    OPTION(DBUS_BUILD_X11 "Build X11-dependent code " ON)
+  endif (APPLE)
 endif(X11_FOUND)
 
 # test binary names
@@ -420,8 +424,8 @@ if (WIN32)
 else (WIN32)
   set (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS unix:tmpdir=)
   set (DBUS_SESSION_BUS_DEFAULT_ADDRESS unix:path=${DBUS_SESSION_SOCKET_DIR})
-  set (sysconfdir "")
-  set (configdir ${sysconfdir}/dbus-1 )
+  set (sysconfdir ${DBUS_INSTALL_DIR}/etc)
+  set (configdir ${sysconfdir} )
   set (DBUS_SYSTEM_CONFIG_FILE  ${configdir}/system.conf)
   set (DBUS_SESSION_CONFIG_FILE ${configdir}/session.conf)
   set (DBUS_USER "root") 
@@ -440,8 +444,10 @@ if (MINGW)
 endif(MINGW)
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
+if (WIN32)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus-env.bat.cmake ${CMAKE_BINARY_DIR}/bin/dbus-env.bat )
 install_files(/bin FILES ${CMAKE_BINARY_DIR}/bin/dbus-env.bat)	
+endif (WIN32)
 
 # compiler definitions 
 add_definitions(-DHAVE_CONFIG_H=1)
diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake
index 1212bf9..9829b9b 100644
--- a/cmake/ConfigureChecks.cmake
+++ b/cmake/ConfigureChecks.cmake
@@ -3,6 +3,11 @@ include(CheckSymbolExists)
 include(CheckStructMember)
 include(CheckTypeSize)
 
+# version macros
+set(DBUS_MAJOR_VERSION 1)
+set(DBUS_MINOR_VERSION 3)
+set(DBUS_MICRO_VERSION 0)
+
 check_include_file(dirent.h     HAVE_DIRENT_H)  # dbus-sysdeps-util.c
 check_include_file(io.h         HAVE_IO_H)      # internal
 check_include_file(grp.h        HAVE_GRP_H)     # dbus-sysdeps-util-win.c
@@ -14,6 +19,7 @@ check_include_file(unistd.h     HAVE_UNISTD_H)  # dbus-sysdeps-util-win.c
 check_include_file(stdio.h      HAVE_STDIO_H)   # dbus-sysdeps.h
 check_include_file(sys/syslimits.h    HAVE_SYS_SYSLIMITS_H)   # dbus-sysdeps-unix.c
 check_include_file(errno.h     HAVE_ERRNO_H)    # dbus-sysdeps.c
+check_include_file(crt_externs.h      HAVE_CRT_EXTERNS_H)
 
 check_symbol_exists(backtrace    "execinfo.h"       HAVE_BACKTRACE)          #  dbus-sysdeps.c, dbus-sysdeps-win.c
 check_symbol_exists(getgrouplist "grp.h"            HAVE_GETGROUPLIST)       #  dbus-sysdeps.c
@@ -26,6 +32,7 @@ check_symbol_exists(unsetenv     "stdlib.h"         HAVE_UNSETENV)           #
 check_symbol_exists(writev       "sys/uio.h"        HAVE_WRITEV)             #  dbus-sysdeps.c, dbus-sysdeps-win.c
 check_symbol_exists(setrlimit    "sys/resource.h"   HAVE_SETRLIMIT)          #  dbus-sysdeps.c, dbus-sysdeps-win.c, test/test-segfault.c
 check_symbol_exists(socklen_t    "sys/socket.h"     HAVE_SOCKLEN_T)          #  dbus-sysdeps-unix.c
+check_symbol_exists(_NSGetEnviron "crt_externs.h"   HAVE_NSGETENVIRON)
 
 check_struct_member(cmsgcred cmcred_pid "sys/types.h sys/socket.h" HAVE_CMSGCRED)   #  dbus-sysdeps.c
 
@@ -127,3 +134,4 @@ else(DBUS_HAVE_VA_COPY)
     SET(DBUS_VA_COPY __va_copy CACHE STRING "va_copy function")
   endif(DBUS_HAVE___VA_COPY)
 endif(DBUS_HAVE_VA_COPY)
+
diff --git a/cmake/bus/CMakeLists.txt b/cmake/bus/CMakeLists.txt
index 5ae4674..091506f 100644
--- a/cmake/bus/CMakeLists.txt
+++ b/cmake/bus/CMakeLists.txt
@@ -45,7 +45,9 @@ set (BUS_SOURCES
 	${BUS_DIR}/bus.c					
 	${BUS_DIR}/bus.h					
 	${BUS_DIR}/config-parser.c				
-	${BUS_DIR}/config-parser.h				
+	${BUS_DIR}/config-parser.h
+        ${BUS_DIR}/config-parser-common.c
+        ${BUS_DIR}/config-parser-common.h
 	${BUS_DIR}/connection.c				
 	${BUS_DIR}/connection.h				
 	${BUS_DIR}/desktop-file.c				
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
index 018fdfd..fc59111 100644
--- a/cmake/config.h.cmake
+++ b/cmake/config.h.cmake
@@ -176,4 +176,13 @@
 #define _dbus_verbose_C_S _dbus_verbose
 #endif 
 
+#cmakedefine HAVE_NSGETENVIRON 1
+#cmakedefine HAVE_CRT_EXTERNS_H 1
+
+#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
+# include <sys/time.h>
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+#endif
+
 #endif  // _DBUS_CONFIG_H
diff --git a/cmake/dbus/dbus-arch-deps.h.cmake b/cmake/dbus/dbus-arch-deps.h.cmake
index 0389da1..07dcafa 100644
--- a/cmake/dbus/dbus-arch-deps.h.cmake
+++ b/cmake/dbus/dbus-arch-deps.h.cmake
@@ -51,6 +51,17 @@ typedef unsigned @DBUS_INT32_TYPE@ dbus_uint32_t;
 typedef @DBUS_INT16_TYPE@ dbus_int16_t;
 typedef unsigned @DBUS_INT16_TYPE@ dbus_uint16_t;
 
+/* This is not really arch-dependent, but it's not worth
+ * creating an additional generated header just for this
+ */
+#define DBUS_MAJOR_VERSION @DBUS_MAJOR_VERSION@
+#define DBUS_MINOR_VERSION @DBUS_MINOR_VERSION@
+#define DBUS_MICRO_VERSION @DBUS_MICRO_VERSION@
+
+#define DBUS_VERSION_STRING "@DBUS_VERSION@"
+
+#define DBUS_VERSION ((@DBUS_MAJOR_VERSION@ << 16) | (@DBUS_MINOR_VERSION@ << 8) | (@DBUS_MICRO_VERSION@))
+
 DBUS_END_DECLS;
 
 #endif /* DBUS_ARCH_DEPS_H */
