[libdispatch-changes] [208] branches/Lion

source_changes at macosforge.org source_changes at macosforge.org
Tue Aug 23 19:51:11 PDT 2011


Revision: 208
          http://trac.macosforge.org/projects/libdispatch/changeset/208
Author:   dsteffen at apple.com
Date:     2011-08-23 19:51:10 -0700 (Tue, 23 Aug 2011)
Log Message:
-----------
Darwin auto* buildsystem & portability fixes

Modified Paths:
--------------
    branches/Lion/INSTALL
    branches/Lion/configure.ac
    branches/Lion/man/Makefile.am
    branches/Lion/src/Makefile.am
    branches/Lion/src/queue.c
    branches/Lion/src/shims/tsd.h

Modified: branches/Lion/INSTALL
===================================================================
--- branches/Lion/INSTALL	2011-08-19 06:18:36 UTC (rev 207)
+++ branches/Lion/INSTALL	2011-08-24 02:51:10 UTC (rev 208)
@@ -22,8 +22,8 @@
 
 --with-apple-libc-source
 
-	Specify the path to Apple's Libc package, so that appropriate headers
-	can be found and used.
+	Specify the path to Apple's Libc package, so that appropriate headers can
+	be found and used.
 
 --with-apple-libclosure-source
 
@@ -32,32 +32,31 @@
 
 --with-apple-xnu-source
 
-	Specify the path to Apple's XNU package, so that appropriate headers
-	can be found and used.
+	Specify the path to Apple's XNU package, so that appropriate headers can be
+	found and used.
 
 --with-blocks-runtime
 
-	On systems where -fblocks is supported, specify an additional library
-	path in which libBlocksRuntime can be found.  This is not required on
-	Mac OS X, where the Blocks runtime is included in libSystem, but is
-	required on FreeBSD.
+	On systems where -fblocks is supported, specify an additional library path
+	in which libBlocksRuntime can be found.  This is not required on Mac OS X,
+	where the Blocks runtime is included in libSystem, but is required on
+	FreeBSD.
 
-The following options are likely to only be useful when building libdispatch
-on Mac OS X as a replacement for /usr/lib/system/libdispatch.dylib:
+The following options are likely to only be useful when building libdispatch on
+Mac OS X as a replacement for /usr/lib/system/libdispatch.dylib:
 
 --disable-libdispatch-init-constructor
 
-	Do not tag libdispatch's init routine as __constructor, in which case
-	it must be run manually before libdispatch routines can be called.
-	For the libdispatch library in /usr/lib/system, the init routine is called
-	automatically during process start.
+	Do not tag libdispatch's init routine as __constructor, in which case it
+	must be run manually before libdispatch routines can be called. This is the
+	default when building on Mac OS X. For /usr/lib/system/libdispatch.dylib
+	the init routine is called automatically during process start.
 
 --enable-apple-tsd-optimizations
 
-	Use a non-portable allocation scheme for pthread per-thread data (TSD)
-	keys when building libdispatch for /usr/lib/system on Mac OS X.  This
-	should not be used on other OS's, or on Mac OS X when building a
-	stand-alone library.
+	Use a non-portable allocation scheme for pthread per-thread data (TSD) keys
+	when building libdispatch for /usr/lib/system on Mac OS X.  This should not
+	be used on other OS's, or on Mac OS X when building a stand-alone library.
 
   Typical configuration commands
 
@@ -65,17 +64,18 @@
 libdispatch for /usr/lib/system on Mac OS X Lion:
 
 	sh autogen.sh
-	./configure CFLAGS='-arch x86_64 -arch i386' \
+	./configure CFLAGS='-arch x86_64 -arch i386 -g -Os' \
 		--prefix=/usr --libdir=/usr/lib/system \
 		--disable-dependency-tracking --disable-static \
-		--disable-libdispatch-init-constructor \
 		--enable-apple-tsd-optimizations \
 		--with-apple-libc-source=/path/to/10.7.0/Libc-763.11 \
 		--with-apple-libclosure-source=/path/to/10.7.0/libclosure-53 \
 		--with-apple-xnu-source=/path/to/10.7.0/xnu-1699.22.73
+	make check
 
 Typical configuration line for FreeBSD 8.x and 9.x to build libdispatch with
 clang and blocks support:
 
 	sh autogen.sh
 	./configure CC=clang --with-blocks-runtime=/usr/local/lib
+	make check

Modified: branches/Lion/configure.ac
===================================================================
--- branches/Lion/configure.ac	2011-08-19 06:18:36 UTC (rev 207)
+++ branches/Lion/configure.ac	2011-08-24 02:51:10 UTC (rev 208)
@@ -8,45 +8,38 @@
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_HEADER([config/config.h])
 AC_CONFIG_MACRO_DIR([m4])
+ac_clean_files=a.out.dSYM
 AM_MAINTAINER_MODE
 
+AC_PROG_CC([clang gcc cc])
+AC_PROG_CXX([clang++ g++ c++])
+AC_PROG_OBJC([clang gcc cc])
+
 #
 # On Mac OS X, some required header files come from other source packages;
 # allow specifying where those are.
 #
 AC_ARG_WITH([apple-libc-source],
   [AS_HELP_STRING([--with-apple-libc-source],
-    [Specify path to Apple Libc source])],
-  [apple_libc_source_path=${withval}/pthreads
-    APPLE_LIBC_SOURCE_PATH=-I$apple_libc_source_path
-    CPPFLAGS="$CPPFLAGS -I$apple_libc_source_path"],
-  [APPLE_LIBC_SOURCE_PATH=]
-)
-AC_SUBST([APPLE_LIBC_SOURCE_PATH])
+    [Specify path to Apple Libc source])], [
+  apple_libc_source_pthreads_path=${withval}/pthreads
+  CPPFLAGS="$CPPFLAGS -I$apple_libc_source_pthreads_path"
+])
 
 AC_ARG_WITH([apple-libclosure-source],
   [AS_HELP_STRING([--with-apple-libclosure-source],
-    [Specify path to Apple libclosure source])],
-  [apple_libclosure_source_path=${withval}
-    APPLE_LIBCLOSURE_SOURCE_PATH=-I$apple_libclosure_source_path
-    CPPFLAGS="$CPPFLAGS -I$apple_libclosure_source_path"],
-  [APPLE_LIBCLOSURE_SOURCE_PATH=]
-)
-AC_SUBST([APPLE_LIBCLOSURE_SOURCE_PATH])
+    [Specify path to Apple libclosure source])], [
+  apple_libclosure_source_path=${withval}
+  CPPFLAGS="$CPPFLAGS -I$apple_libclosure_source_path"
+])
 
 AC_ARG_WITH([apple-xnu-source],
   [AS_HELP_STRING([--with-apple-xnu-source],
-    [Specify path to Apple XNU source])],
-  [apple_xnu_source_path=${withval}/libkern
-    APPLE_XNU_SOURCE_PATH=-I$apple_xnu_source_path
-    CPPFLAGS="$CPPFLAGS -I$apple_xnu_source_path"
-    apple_xnu_source_system_path=${withval}/osfmk
-    APPLE_XNU_SOURCE_SYSTEM_PATH=$apple_xnu_source_system_path],
-  [APPLE_XNU_SOURCE_PATH=]
-)
-AC_SUBST([APPLE_XNU_SOURCE_PATH])
-AC_SUBST([APPLE_XNU_SOURCE_SYSTEM_PATH])
-AM_CONDITIONAL(USE_XNU_SOURCE, [test -n "$apple_xnu_source_system_path"])
+    [Specify path to Apple XNU source])], [
+  apple_xnu_source_libkern_path=${withval}/libkern
+  apple_xnu_source_osfmk_path=${withval}/osfmk
+  CPPFLAGS="$CPPFLAGS -I$apple_xnu_source_libkern_path"
+])
 
 AC_CACHE_CHECK([for System.framework/PrivateHeaders], dispatch_cv_system_privateheaders,
   [AS_IF([test -d /System/Library/Frameworks/System.framework/PrivateHeaders],
@@ -57,15 +50,16 @@
 )
 
 #
-# On Mac OS X, libpispatch_init is automatically invoked during libSystem
+# On Mac OS X, libdispatch_init is automatically invoked during libSystem
 # process initialization.  On other systems, it is tagged as a library
 # constructor to be run by automatically by the runtime linker.
 #
 AC_ARG_ENABLE([libdispatch-init-constructor],
   [AS_HELP_STRING([--disable-libdispatch-init-constructor],
-    [Disable libdispatch_init as a constructor])]
+    [Disable libdispatch_init as a constructor])],,
+  [AS_IF([test -f /usr/lib/system/libdispatch.dylib],
+    [enable_libdispatch_init_constructor=no])]
 )
-
 AS_IF([test "x$enable_libdispatch_init_constructor" != "xno"],
   [AC_DEFINE(USE_LIBDISPATCH_INIT_CONSTRUCTOR, 1,
     [Define to tag libdispatch_init as a constructor])]
@@ -78,15 +72,12 @@
   [AS_HELP_STRING([--enable-apple-tsd-optimizations],
     [Use non-portable pthread TSD optimizations for Mac OS X.])]
 )
-
 AS_IF([test "x$enable_apple_tsd_optimizations" = "xyes"],
   [AC_DEFINE(USE_APPLE_TSD_OPTIMIZATIONS, 1,
     [Define to use non-portable pthread TSD optimizations for Mac OS X)])]
 )
 
 AC_USE_SYSTEM_EXTENSIONS
-AC_PROG_CC
-AC_PROG_CXX
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
 AC_PATH_PROGS(MIG, mig)
@@ -127,26 +118,33 @@
 AC_CHECK_HEADERS([TargetConditionals.h pthread_np.h malloc/malloc.h libkern/OSCrossEndian.h libkern/OSAtomic.h])
 
 # hack for pthread_machdep.h's #include <System/machine/cpu_capabilities.h>
-AS_IF([test -n "$apple_xnu_source_system_path"], [
+AS_IF([test -n "$apple_xnu_source_osfmk_path"], [
   saveCPPFLAGS="$CPPFLAGS"
   CPPFLAGS="$CPPFLAGS -I."
-  ln -fsh "$apple_xnu_source_system_path" System
+  ln -fsh "$apple_xnu_source_osfmk_path" System
 ])
 AC_CHECK_HEADERS([pthread_machdep.h])
-AS_IF([test -n "$apple_xnu_source_system_path"], [
+AS_IF([test -n "$apple_xnu_source_osfmk_path"], [
   rm -f System
   CPPFLAGS="$saveCPPFLAGS"
+  AC_CONFIG_COMMANDS([src/System],
+    [ln -fsh "$apple_xnu_source_osfmk_path" src/System],
+    [apple_xnu_source_osfmk_path="$apple_xnu_source_osfmk_path"])
 ])
 
 #
-# Core Services is tested in one of the GCD regression tests, so test for its
-# presence using its header file.
+# Parts of the testsuite use CoreFoundation and Foundation
 #
-AC_CHECK_HEADER([CoreServices/CoreServices.h],
-  [have_coreservices=true],
-  [have_coreservices=false]
+AC_CHECK_HEADER([CoreFoundation/CoreFoundation.h],
+  [have_corefoundation=true], [have_corefoundation=false]
 )
-AM_CONDITIONAL(HAVE_CORESERVICES, $have_coreservices)
+AM_CONDITIONAL(HAVE_COREFOUNDATION, $have_corefoundation)
+AC_LANG_PUSH([Objective C])
+AC_CHECK_HEADER([Foundation/Foundation.h],
+  [have_foundation=true], [have_foundation=false]
+)
+AM_CONDITIONAL(HAVE_FOUNDATION, $have_foundation)
+AC_LANG_POP([Objective C])
 
 #
 # We use the availability of mach.h to decide whether to compile in all sorts
@@ -155,8 +153,7 @@
 AC_CHECK_HEADER([mach/mach.h], [
     AC_DEFINE(HAVE_MACH, 1, [Define if mach is present])
     AC_DEFINE(__DARWIN_NON_CANCELABLE, 1, [Define if using Darwin $NOCANCEL])
-    have_mach=true],
-  [have_mach=false]
+    have_mach=true], [have_mach=false]
 )
 AM_CONDITIONAL(USE_MIG, $have_mach)
 
@@ -182,15 +179,13 @@
 AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf getprogname])
 
 AC_CHECK_DECLS([POSIX_SPAWN_START_SUSPENDED],
-  [have_posix_spawn_start_suspended=true],
-  [have_posix_spawn_start_suspended=false],
+  [have_posix_spawn_start_suspended=true], [have_posix_spawn_start_suspended=false],
   [[#include <sys/spawn.h>]]
 )
 AM_CONDITIONAL(HAVE_POSIX_SPAWN_START_SUSPENDED, $have_posix_spawn_start_suspended)
 
 AC_CHECK_FUNC([sem_init],
-  [have_sem_init=true],
-  [have_sem_init=false]
+  [have_sem_init=true], [have_sem_init=false]
 )
 
 #
@@ -236,7 +231,7 @@
   CFLAGS="$saveCFLAGS"
 ])
 AS_IF([test "x$dispatch_cv_cc_omit_leaf_fp" != "xno"], [
-    OMIT_LEAF_FP_FLAGS="-momit-leaf-frame-pointer"
+  OMIT_LEAF_FP_FLAGS="-momit-leaf-frame-pointer"
 ])
 AC_SUBST([OMIT_LEAF_FP_FLAGS])
 
@@ -254,10 +249,10 @@
 # Temporary: some versions of clang do not mark __builtin_trap() as
 # __attribute__((__noreturn__)).  Detect and add if required.
 #
-AC_COMPILE_IFELSE([
-  AC_LANG_PROGRAM([void __attribute__((__noreturn__)) temp(void) { __builtin_trap(); }], [])], [
-    AC_DEFINE(HAVE_NORETURN_BUILTIN_TRAP, 1, [Define if __builtin_trap marked noreturn])
-  ], [])
+AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM([void __attribute__((__noreturn__)) temp(void) { __builtin_trap(); }], [])],
+  [AC_DEFINE(HAVE_NORETURN_BUILTIN_TRAP, 1, [Define if __builtin_trap marked noreturn])]
+)
 
 #
 # Generate Makefiles.

Modified: branches/Lion/man/Makefile.am
===================================================================
--- branches/Lion/man/Makefile.am	2011-08-19 06:18:36 UTC (rev 207)
+++ branches/Lion/man/Makefile.am	2011-08-24 02:51:10 UTC (rev 208)
@@ -30,7 +30,7 @@
 LN=ln
 
 install-data-hook:
-	cd $(DESTDIR)$(mandir)/man3 &&					\
+	cd $(DESTDIR)$(mandir)/man3 &&	\
 		$(LN) -f dispatch_after.3 dispatch_after_f.3 &&	\
 		$(LN) -f dispatch_apply.3 dispatch_apply_f.3 &&	\
 		$(LN) -f dispatch_async.3 dispatch_sync.3 &&	\
@@ -87,3 +87,62 @@
 		$(LN) -f dispatch_io_create.3 dispatch_io_close.3 &&	\
 		$(LN) -f dispatch_io_read.3 dispatch_io_write.3 &&	\
 		$(LN) -f dispatch_read.3 dispatch_write.3
+
+uninstall-hook:
+	cd $(DESTDIR)$(mandir)/man3 &&	\
+		rm -f dispatch_after_f.3	\
+			dispatch_apply_f.3	\
+			dispatch_sync.3	\
+			dispatch_async_f.3	\
+			dispatch_sync_f.3	\
+			dispatch_group_enter.3	\
+			dispatch_group_leave.3	\
+			dispatch_group_wait.3	\
+			dispatch_group_notify.3	\
+			dispatch_group_notify_f.3	\
+			dispatch_group_async.3	\
+			dispatch_group_async_f.3	\
+			dispatch_retain.3	\
+			dispatch_release.3	\
+			dispatch_suspend.3	\
+			dispatch_resume.3	\
+			dispatch_get_context.3	\
+			dispatch_set_context.3	\
+			dispatch_set_finalizer_f.3	\
+			dispatch_once_f.3	\
+			dispatch_queue_get_label.3	\
+			dispatch_get_current_queue.3	\
+			dispatch_get_global_queue.3	\
+			dispatch_get_main_queue.3	\
+			dispatch_main.3	\
+			dispatch_set_target_queue.3	\
+			dispatch_semaphore_signal.3	\
+			dispatch_semaphore_wait.3	\
+			dispatch_source_set_event_handler.3	\
+			dispatch_source_set_event_handler_f.3	\
+			dispatch_source_set_cancel_handler.3	\
+			dispatch_source_set_cancel_handler_f.3	\
+			dispatch_source_cancel.3	\
+			dispatch_source_testcancel.3	\
+			dispatch_source_get_handle.3	\
+			dispatch_source_get_mask.3	\
+			dispatch_source_get_data.3	\
+			dispatch_source_merge_data.3	\
+			dispatch_source_set_timer.3	\
+			dispatch_walltime.3	\
+			dispatch_data_create_concat.3	\
+			dispatch_data_create_subrange.3	\
+			dispatch_data_create_map.3	\
+			dispatch_data_apply.3	\
+			dispatch_data_copy_subrange.3	\
+			dispatch_data_copy_region.3	\
+			dispatch_data_get_size.3	\
+			dispatch_data_copy_subrange.3	\
+			dispatch_data_empty.3	\
+			dispatch_io_create_with_path.3	\
+			dispatch_io_set_high_water.3	\
+			dispatch_io_set_low_water.3	\
+			dispatch_io_set_interval.3	\
+			dispatch_io_close.3	\
+			dispatch_io_write.3	\
+			dispatch_write.3

Modified: branches/Lion/src/Makefile.am
===================================================================
--- branches/Lion/src/Makefile.am	2011-08-19 06:18:36 UTC (rev 207)
+++ branches/Lion/src/Makefile.am	2011-08-24 02:51:10 UTC (rev 208)
@@ -35,8 +35,7 @@
 	shims/time.h			\
 	shims/tsd.h
 
-INCLUDES=-I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/private \
-	@APPLE_LIBC_SOURCE_PATH@ @APPLE_LIBCLOSURE_SOURCE_PATH@ @APPLE_XNU_SOURCE_PATH@
+INCLUDES=-I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/private
 
 libdispatch_la_CFLAGS=-Wall $(VISIBILITY_FLAGS) $(OMIT_LEAF_FP_FLAGS)
 libdispatch_la_CFLAGS+=$(MARCH_FLAGS) $(CBLOCKS_FLAGS) $(KQUEUE_CFLAGS)
@@ -48,6 +47,7 @@
 endif
 
 CLEANFILES=
+DISTCLEANFILES=System
 
 if USE_MIG
 BUILT_SOURCES=				\
@@ -63,11 +63,3 @@
 	$(MIG) -user $*User.c -header $*.h \
 	    -server $*Server.c -sheader $*Server.h $<
 endif
-
-if USE_XNU_SOURCE
-# hack for pthread_machdep.h's #include <System/machine/cpu_capabilities.h>
-$(libdispatch_la_OBJECTS): $(abs_srcdir)/System
-$(abs_srcdir)/System:
-	$(LN_S) -fh "@APPLE_XNU_SOURCE_SYSTEM_PATH@" System
-CLEANFILES+=System
-endif

Modified: branches/Lion/src/queue.c
===================================================================
--- branches/Lion/src/queue.c	2011-08-19 06:18:36 UTC (rev 207)
+++ branches/Lion/src/queue.c	2011-08-24 02:51:10 UTC (rev 208)
@@ -443,6 +443,17 @@
 
 }
 
+#if !DISPATCH_USE_DIRECT_TSD
+pthread_key_t dispatch_queue_key;
+pthread_key_t dispatch_sema4_key;
+pthread_key_t dispatch_cache_key;
+pthread_key_t dispatch_io_key;
+pthread_key_t dispatch_apply_key;
+#if DISPATCH_PERF_MON
+pthread_key_t dispatch_bcounter_key;
+#endif
+#endif // !DISPATCH_USE_DIRECT_TSD
+
 #define countof(x) (sizeof(x) / sizeof(x[0]))
 
 DISPATCH_EXPORT DISPATCH_NOTHROW

Modified: branches/Lion/src/shims/tsd.h
===================================================================
--- branches/Lion/src/shims/tsd.h	2011-08-19 06:18:36 UTC (rev 207)
+++ branches/Lion/src/shims/tsd.h	2011-08-24 02:51:10 UTC (rev 208)
@@ -54,12 +54,12 @@
 	dispatch_assert_zero(pthread_key_init_np((int)*k, d));
 }
 #else
-pthread_key_t dispatch_queue_key;
-pthread_key_t dispatch_sema4_key;
-pthread_key_t dispatch_cache_key;
-pthread_key_t dispatch_io_key;
-pthread_key_t dispatch_apply_key;
-pthread_key_t dispatch_bcounter_key;
+extern pthread_key_t dispatch_queue_key;
+extern pthread_key_t dispatch_sema4_key;
+extern pthread_key_t dispatch_cache_key;
+extern pthread_key_t dispatch_io_key;
+extern pthread_key_t dispatch_apply_key;
+extern pthread_key_t dispatch_bcounter_key;
 
 DISPATCH_TSD_INLINE
 static inline void
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20110823/14a9fb92/attachment-0001.html>


More information about the libdispatch-changes mailing list