Skip to content

Commit ec10433

Browse files
author
Jordan K. Hubbard
committed
> 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” 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). git-svn-id: https://svn.macosforge.org/repository/libdispatch/trunk@194 5710d607-3af0-45f8-8f96-4508d4f60227
1 parent 9d3c0d0 commit ec10433

File tree

8 files changed

+39
-8
lines changed

8 files changed

+39
-8
lines changed

configure.ac

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ AC_CHECK_HEADER([pthread_workqueue.h],
181181
[AC_DEFINE(HAVE_PTHREAD_WORKQUEUES, 1,Define if pthread work queues are present)]
182182
)
183183

184+
#
185+
# Check if libpthread_workqueue.so exists
186+
#
187+
AC_CHECK_LIB(pthread_workqueue, pthread_workqueue_init_np,
188+
have_lpwq=true, have_lpwq=false)
189+
AM_CONDITIONAL(USE_LIBPTHREAD_WORKQUEUE, $have_lpwq)
190+
184191
#
185192
# Find functions and declarations we care about.
186193
#
@@ -193,7 +200,7 @@ AC_CHECK_DECLS([FD_COPY], [], [], [[#include <sys/select.h>]])
193200
AC_CHECK_DECLS([SIGEMT], [], [], [[#include <signal.h>]])
194201
AC_CHECK_DECLS([VQ_UPDATE, VQ_VERYLOWDISK], [], [], [[#include <sys/mount.h>]])
195202
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
196-
AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf getprogname])
203+
AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf getprogname getexecname])
197204

198205
AC_CHECK_DECLS([POSIX_SPAWN_START_SUSPENDED],
199206
[have_posix_spawn_start_suspended=true],

libdispatch.xcodeproj/project.pbxproj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,14 @@
328328
isa = PBXProject;
329329
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "libdispatch" */;
330330
compatibilityVersion = "Xcode 3.1";
331+
developmentRegion = English;
331332
hasScannedForEncodings = 1;
333+
knownRegions = (
334+
English,
335+
Japanese,
336+
French,
337+
German,
338+
);
332339
mainGroup = 08FB7794FE84155DC02AAC07 /* libdispatch */;
333340
projectDirPath = "";
334341
projectRoot = "";
@@ -403,7 +410,10 @@
403410
GCC_ENABLE_CPP_RTTI = NO;
404411
GCC_ENABLE_OBJC_EXCEPTIONS = NO;
405412
GCC_OPTIMIZATION_LEVEL = s;
406-
GCC_PREPROCESSOR_DEFINITIONS = "__DARWIN_NON_CANCELABLE=1";
413+
GCC_PREPROCESSOR_DEFINITIONS = (
414+
"DISPATCH_NO_LEGACY=1",
415+
"__DARWIN_NON_CANCELABLE=1",
416+
);
407417
GENERATE_MASTER_OBJECT_FILE = NO;
408418
INSTALL_PATH = /usr/local/lib/system;
409419
LINK_WITH_STANDARD_LIBRARIES = NO;

m4/private-extern.m4

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
#
55
AC_DEFUN([DISPATCH_C_PRIVATE_EXTERN], [
66
7+
AC_LANG_WERROR
8+
79
AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
810
dispatch_cv_hidden_visibility_attribute, [
9-
AC_TRY_LINK([],
10-
[extern __attribute__ ((visibility ("hidden"))) int foo;],
11+
AC_TRY_LINK([int foo; extern __attribute__ ((visibility ("hidden"))) int foo;],
12+
[foo = 0;],
1113
[dispatch_cv_hidden_visibility_attribute=yes],
1214
[dispatch_cv_hidden_visibility_attribute=no])])
1315

src/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ endif
3636
libdispatch_la_LIBADD=libshims.la $(KQUEUE_LIBS)
3737
libdispatch_la_DEPENDENCIES=libshims.la
3838

39+
if USE_LIBPTHREAD_WORKQUEUE
40+
libdispatch_la_LIBADD+=-lpthread_workqueue
41+
endif
42+
3943
if USE_MIG
4044
libdispatch_la_SOURCES+= \
4145
protocolUser.c \

src/queue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ _dispatch_root_queues_init(void *context __attribute__((unused)))
12061206
#endif
12071207
#if HAVE_PTHREAD_WORKQUEUES
12081208
} else {
1209-
dispatch_assume(_dispatch_root_queue_contexts[i].dgq_kworkqueue);
1209+
(void)dispatch_assume(_dispatch_root_queue_contexts[i].dgq_kworkqueue);
12101210
}
12111211
#endif
12121212
}

src/shims/getprogname.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@
2323
#define __DISPATCH_SHIMS_GETPROGNAME__
2424

2525
#ifndef HAVE_GETPROGNAME
26-
static inline char *
26+
27+
static inline const char *
2728
getprogname(void)
2829
{
2930
# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
3031
return program_invocation_short_name;
32+
#elif HAVE_GETEXECNAME
33+
return getexecname();
3134
# else
3235
# error getprogname(3) is not available on this platform
3336
# endif
3437
}
38+
3539
#endif /* HAVE_GETPROGNAME */
3640

3741
#endif /* __DISPATCH_SHIMS_GETPROGNAME__ */

src/shims/time.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ _dispatch_get_host_time_init(void *context __attribute__((unused)))
3737
dispatch_assume(QueryPerformanceFrequency(&freq));
3838
_dispatch_host_time_data.frac = (long double)NSEC_PER_SEC / (long double)freq.QuadPart;
3939
_dispatch_host_time_data.ratio_1_to_1 = (freq.QuadPart == 1);
40-
#endif /* TARGET_OS_WIN32 */
40+
#else // TARGET_OS_WIN32
41+
_dispatch_host_time_data.frac = 1.0;
42+
_dispatch_host_time_data.ratio_1_to_1 = 1;
43+
#endif
4144
}
45+
4246
#endif

testing/dispatch_after.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "dispatch_test.h"
3030
#include <Block.h>
3131

32-
void done(void *arg __unused) {
32+
void done(void *arg __attribute__((unused))) {
3333
sleep(1);
3434
test_stop();
3535
}

0 commit comments

Comments
 (0)