[libdispatch-changes] [194] trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Dec 22 17:36:01 PST 2010
Revision: 194
http://trac.macosforge.org/projects/libdispatch/changeset/194
Author: jkh at apple.com
Date: 2010-12-22 17:35:54 -0800 (Wed, 22 Dec 2010)
Log Message:
-----------
> Mark Heily:
>
> I have attached a collection of patches that allows libdispatch to build on
> Linux and Solaris. Many thanks to Joakim Johansson for providing the Solaris
> patches and testing everything.
>
> The commands I used to build on Linux are:
>
> CC="clang" LD="llvm-ld-2.8" CFLAGS="-I/usr/local" \
> LDFLAGS="-L/usr/local" LIBS="-lbsd" ./configure && make
>
> The commands Joakim used to build on Solaris are:
>
> ./configure CFLAGS="-m64 -I/usr/local/include" \
> LDFLAGS="-L/usr/local/lib?\226?\128?\157 gmake
My Solaris and Linux environments are limping at the moment (dev tools all
horked up in both) so I couldn't do the build tests on anything but Darwin,
but the patches pass the eyeball check in any case. Also made a small
change to the xcode project to increase buildability (no legacy APIs).
Modified Paths:
--------------
trunk/configure.ac
trunk/libdispatch.xcodeproj/project.pbxproj
trunk/m4/private-extern.m4
trunk/src/Makefile.am
trunk/src/queue.c
trunk/src/shims/getprogname.h
trunk/src/shims/time.c
trunk/testing/dispatch_after.c
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2010-10-24 08:36:30 UTC (rev 193)
+++ trunk/configure.ac 2010-12-23 01:35:54 UTC (rev 194)
@@ -182,6 +182,13 @@
)
#
+# Check if libpthread_workqueue.so exists
+#
+AC_CHECK_LIB(pthread_workqueue, pthread_workqueue_init_np,
+ have_lpwq=true, have_lpwq=false)
+AM_CONDITIONAL(USE_LIBPTHREAD_WORKQUEUE, $have_lpwq)
+
+#
# Find functions and declarations we care about.
#
AC_CHECK_DECLS([CLOCK_UPTIME, CLOCK_MONOTONIC, CLOCK_REALTIME], [], [],
@@ -193,7 +200,7 @@
AC_CHECK_DECLS([SIGEMT], [], [], [[#include <signal.h>]])
AC_CHECK_DECLS([VQ_UPDATE, VQ_VERYLOWDISK], [], [], [[#include <sys/mount.h>]])
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
-AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf getprogname])
+AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf getprogname getexecname])
AC_CHECK_DECLS([POSIX_SPAWN_START_SUSPENDED],
[have_posix_spawn_start_suspended=true],
Modified: trunk/libdispatch.xcodeproj/project.pbxproj
===================================================================
--- trunk/libdispatch.xcodeproj/project.pbxproj 2010-10-24 08:36:30 UTC (rev 193)
+++ trunk/libdispatch.xcodeproj/project.pbxproj 2010-12-23 01:35:54 UTC (rev 194)
@@ -328,7 +328,14 @@
isa = PBXProject;
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "libdispatch" */;
compatibilityVersion = "Xcode 3.1";
+ developmentRegion = English;
hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
mainGroup = 08FB7794FE84155DC02AAC07 /* libdispatch */;
projectDirPath = "";
projectRoot = "";
@@ -403,7 +410,10 @@
GCC_ENABLE_CPP_RTTI = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = NO;
GCC_OPTIMIZATION_LEVEL = s;
- GCC_PREPROCESSOR_DEFINITIONS = "__DARWIN_NON_CANCELABLE=1";
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DISPATCH_NO_LEGACY=1",
+ "__DARWIN_NON_CANCELABLE=1",
+ );
GENERATE_MASTER_OBJECT_FILE = NO;
INSTALL_PATH = /usr/local/lib/system;
LINK_WITH_STANDARD_LIBRARIES = NO;
Modified: trunk/m4/private-extern.m4
===================================================================
--- trunk/m4/private-extern.m4 2010-10-24 08:36:30 UTC (rev 193)
+++ trunk/m4/private-extern.m4 2010-12-23 01:35:54 UTC (rev 194)
@@ -4,10 +4,12 @@
#
AC_DEFUN([DISPATCH_C_PRIVATE_EXTERN], [
+AC_LANG_WERROR
+
AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
dispatch_cv_hidden_visibility_attribute, [
- AC_TRY_LINK([],
- [extern __attribute__ ((visibility ("hidden"))) int foo;],
+ AC_TRY_LINK([int foo; extern __attribute__ ((visibility ("hidden"))) int foo;],
+ [foo = 0;],
[dispatch_cv_hidden_visibility_attribute=yes],
[dispatch_cv_hidden_visibility_attribute=no])])
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2010-10-24 08:36:30 UTC (rev 193)
+++ trunk/src/Makefile.am 2010-12-23 01:35:54 UTC (rev 194)
@@ -36,6 +36,10 @@
libdispatch_la_LIBADD=libshims.la $(KQUEUE_LIBS)
libdispatch_la_DEPENDENCIES=libshims.la
+if USE_LIBPTHREAD_WORKQUEUE
+libdispatch_la_LIBADD+=-lpthread_workqueue
+endif
+
if USE_MIG
libdispatch_la_SOURCES+= \
protocolUser.c \
Modified: trunk/src/queue.c
===================================================================
--- trunk/src/queue.c 2010-10-24 08:36:30 UTC (rev 193)
+++ trunk/src/queue.c 2010-12-23 01:35:54 UTC (rev 194)
@@ -1206,7 +1206,7 @@
#endif
#if HAVE_PTHREAD_WORKQUEUES
} else {
- dispatch_assume(_dispatch_root_queue_contexts[i].dgq_kworkqueue);
+ (void)dispatch_assume(_dispatch_root_queue_contexts[i].dgq_kworkqueue);
}
#endif
}
Modified: trunk/src/shims/getprogname.h
===================================================================
--- trunk/src/shims/getprogname.h 2010-10-24 08:36:30 UTC (rev 193)
+++ trunk/src/shims/getprogname.h 2010-12-23 01:35:54 UTC (rev 194)
@@ -23,15 +23,19 @@
#define __DISPATCH_SHIMS_GETPROGNAME__
#ifndef HAVE_GETPROGNAME
-static inline char *
+
+static inline const char *
getprogname(void)
{
# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
return program_invocation_short_name;
+#elif HAVE_GETEXECNAME
+ return getexecname();
# else
# error getprogname(3) is not available on this platform
# endif
}
+
#endif /* HAVE_GETPROGNAME */
#endif /* __DISPATCH_SHIMS_GETPROGNAME__ */
Modified: trunk/src/shims/time.c
===================================================================
--- trunk/src/shims/time.c 2010-10-24 08:36:30 UTC (rev 193)
+++ trunk/src/shims/time.c 2010-12-23 01:35:54 UTC (rev 194)
@@ -37,6 +37,10 @@
dispatch_assume(QueryPerformanceFrequency(&freq));
_dispatch_host_time_data.frac = (long double)NSEC_PER_SEC / (long double)freq.QuadPart;
_dispatch_host_time_data.ratio_1_to_1 = (freq.QuadPart == 1);
-#endif /* TARGET_OS_WIN32 */
+#else // TARGET_OS_WIN32
+ _dispatch_host_time_data.frac = 1.0;
+ _dispatch_host_time_data.ratio_1_to_1 = 1;
+#endif
}
+
#endif
Modified: trunk/testing/dispatch_after.c
===================================================================
--- trunk/testing/dispatch_after.c 2010-10-24 08:36:30 UTC (rev 193)
+++ trunk/testing/dispatch_after.c 2010-12-23 01:35:54 UTC (rev 194)
@@ -29,7 +29,7 @@
#include "dispatch_test.h"
#include <Block.h>
-void done(void *arg __unused) {
+void done(void *arg __attribute__((unused))) {
sleep(1);
test_stop();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20101222/a5def8a5/attachment.html>
More information about the libdispatch-changes
mailing list