Skip to content

Commit 50e1003

Browse files
committed
Update autotools buildsystem for libdispatch-500.1.5 and testsuite
1 parent a60acd6 commit 50e1003

File tree

9 files changed

+175
-103
lines changed

9 files changed

+175
-103
lines changed

INSTALL

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ An uncustomized install requires:
2020

2121
The following configure options may be of general interest:
2222

23-
--with-apple-libc-source
23+
--with-apple-libpthread-source
2424

25-
Specify the path to Apple's Libc package, so that appropriate headers can
26-
be found and used.
25+
Specify the path to Apple's libpthread package, so that appropriate headers
26+
can be found and used.
27+
28+
--with-apple-libplatform-source
29+
30+
Specify the path to Apple's libplatform package, so that appropriate headers
31+
can be found and used.
2732

2833
--with-apple-libclosure-source
2934

@@ -38,12 +43,12 @@ The following configure options may be of general interest:
3843
--with-blocks-runtime
3944

4045
On systems where -fblocks is supported, specify an additional library path
41-
in which libBlocksRuntime can be found. This is not required on Mac OS X,
46+
in which libBlocksRuntime can be found. This is not required on OS X,
4247
where the Blocks runtime is included in libSystem, but is required on
4348
FreeBSD.
4449

4550
The following options are likely to only be useful when building libdispatch on
46-
Mac OS X as a replacement for /usr/lib/system/libdispatch.dylib:
51+
OS X as a replacement for /usr/lib/system/libdispatch.dylib:
4752

4853
--with-apple-objc4-source
4954

@@ -59,31 +64,33 @@ Mac OS X as a replacement for /usr/lib/system/libdispatch.dylib:
5964

6065
Do not tag libdispatch's init routine as __constructor, in which case it
6166
must be run manually before libdispatch routines can be called. This is the
62-
default when building on Mac OS X. For /usr/lib/system/libdispatch.dylib
67+
default when building on OS X. For /usr/lib/system/libdispatch.dylib
6368
the init routine is called automatically during process start.
6469

6570
--enable-apple-tsd-optimizations
6671

6772
Use a non-portable allocation scheme for pthread per-thread data (TSD) keys
68-
when building libdispatch for /usr/lib/system on Mac OS X. This should not
69-
be used on other OS's, or on Mac OS X when building a stand-alone library.
73+
when building libdispatch for /usr/lib/system on OS X. This should not
74+
be used on other OS's, or on OS X when building a stand-alone library.
7075

7176
Typical configuration commands
7277

7378
The following command lines create the configuration required to build
74-
libdispatch for /usr/lib/system on OS X MountainLion:
79+
libdispatch for /usr/lib/system on OS X El Capitan:
7580

76-
sh autogen.sh
81+
clangpath=$(dirname `xcrun --find clang`)
82+
sudo mkdir -p "$clangpath/../local/lib/clang/enable_objc_gc"
83+
LIBTOOLIZE=glibtoolize sh autogen.sh
7784
cflags='-arch x86_64 -arch i386 -g -Os'
7885
./configure CFLAGS="$cflags" OBJCFLAGS="$cflags" CXXFLAGS="$cflags" \
79-
--prefix=/usr --libdir=/usr/lib/system \
80-
--disable-dependency-tracking --disable-static \
86+
--prefix=/usr --libdir=/usr/lib/system --disable-static \
8187
--enable-apple-tsd-optimizations \
82-
--with-apple-libc-source=/path/to/10.8.0/Libc-825.24 \
83-
--with-apple-libclosure-source=/path/to/10.8.0/libclosure-59 \
84-
--with-apple-xnu-source=/path/to/10.8.0/xnu-2050.7.9 \
85-
--with-apple-objc4-source=/path/to/10.8.0/objc4-532 \
86-
--with-apple-libauto-source=/path/to/10.8.0/libauto-185.1
88+
--with-apple-libpthread-source=/path/to/10.11.0/libpthread-137.1.1 \
89+
--with-apple-libplatform-source=/path/to/10.11.0/libplatform-73.1.1 \
90+
--with-apple-libclosure-source=/path/to/10.11.0/libclosure-65 \
91+
--with-apple-xnu-source=/path/to/10.11.0/xnu-3247.1.106 \
92+
--with-apple-objc4-source=/path/to/10.11.0/objc4-680 \
93+
--with-apple-libauto-source=/path/to/10.11.0/libauto-186
8794
make check
8895

8996
Typical configuration line for FreeBSD 8.x and 9.x to build libdispatch with

Makefile.am

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ SUBDIRS= \
99
man \
1010
os \
1111
private \
12-
src
12+
src \
13+
tests
1314

1415
EXTRA_DIST= \
16+
README.md \
1517
LICENSE \
1618
PATCHES \
1719
autogen.sh \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ libdispatch on Darwin is a combination of logic in the `xnu` kernel alongside th
1818

1919
Our first tasks for this project are:
2020

21-
0. Develop a makefile or other build script for the project on Linux. The current build system is focused on Darwin.
21+
0. Adapt the current autotools build system to work on Linux, or develop a new makefile or other build script for the project on Linux. The current version of the build system has only been tested on Darwin, though previous versions have been made to work on FreeBSD and Linux (see INSTALL).
2222
0. Omit as much of the extra functionality of the library as possible, to get a core version of the project building. Much of the OS X-specific functionality can be elided completely on Linux.
2323
0. Adopt libdispatch in other Core Libraries projects, especially Foundation. This will validate our work and get immediate coverage on basic functionality.
2424
0. Incrementally add functionality back in.

config/config.h

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,20 @@
102102
/* Define to 1 if you have the <pthread_np.h> header file. */
103103
/* #undef HAVE_PTHREAD_NP_H */
104104

105+
/* Define to 1 if you have the <pthread/qos.h> header file. */
106+
#define HAVE_PTHREAD_QOS_H 1
107+
105108
/* Define if pthread work queues are present */
106109
#define HAVE_PTHREAD_WORKQUEUES 1
107110

108-
/* Define to 1 if you have the `pthread_workqueue_setdispatch_np' function. */
109-
#define HAVE_PTHREAD_WORKQUEUE_SETDISPATCH_NP 1
111+
/* Define to 1 if you have the <pthread_workqueue.h> header file. */
112+
#define HAVE_PTHREAD_WORKQUEUE_H 1
110113

111-
/* Define to 1 if you have the `_pthread_workqueue_init' function. */
112-
#define HAVE__PTHREAD_WORKQUEUE_INIT 1
114+
/* Define to 1 if you have the <pthread/workqueue_private.h> header file. */
115+
#define HAVE_PTHREAD_WORKQUEUE_PRIVATE_H 1
113116

114-
/* Define to 1 if you have the <pthread/qos.h> header file. */
115-
#define HAVE_PTHREAD_QOS_H 1
117+
/* Define to 1 if you have the `pthread_workqueue_setdispatch_np' function. */
118+
#define HAVE_PTHREAD_WORKQUEUE_SETDISPATCH_NP 1
116119

117120
/* Define to 1 if you have the <stdint.h> header file. */
118121
#define HAVE_STDINT_H 1
@@ -147,8 +150,10 @@
147150
/* Define to 1 if you have the <unistd.h> header file. */
148151
#define HAVE_UNISTD_H 1
149152

150-
/* Define to the sub-directory in which libtool stores uninstalled libraries.
151-
*/
153+
/* Define to 1 if you have the `_pthread_workqueue_init' function. */
154+
#define HAVE__PTHREAD_WORKQUEUE_INIT 1
155+
156+
/* Define to the sub-directory where libtool stores uninstalled libraries. */
152157
#define LT_OBJDIR ".libs/"
153158

154159
/* Name of package */
@@ -161,13 +166,16 @@
161166
#define PACKAGE_NAME "libdispatch"
162167

163168
/* Define to the full name and version of this package. */
164-
#define PACKAGE_STRING "libdispatch 1.2"
169+
#define PACKAGE_STRING "libdispatch 1.3"
165170

166171
/* Define to the one symbol short name of this package. */
167172
#define PACKAGE_TARNAME "libdispatch"
168173

174+
/* Define to the home page for this package. */
175+
#define PACKAGE_URL "http://libdispatch.macosforge.org"
176+
169177
/* Define to the version of this package. */
170-
#define PACKAGE_VERSION "1.2"
178+
#define PACKAGE_VERSION "1.3"
171179

172180
/* Define to 1 if you have the ANSI C header files. */
173181
#define STDC_HEADERS 1
@@ -184,20 +192,30 @@
184192
/* Define to use POSIX semaphores */
185193
/* #undef USE_POSIX_SEM */
186194

187-
/* Version number of package */
188-
#define VERSION "1.2"
189-
190-
/* Define to 1 if on AIX 3.
191-
System headers sometimes define this.
192-
We just want to avoid a redefinition error message. */
195+
/* Enable extensions on AIX 3, Interix. */
193196
#ifndef _ALL_SOURCE
194-
/* # undef _ALL_SOURCE */
197+
# define _ALL_SOURCE 1
195198
#endif
196-
197199
/* Enable GNU extensions on systems that have them. */
198200
#ifndef _GNU_SOURCE
199201
# define _GNU_SOURCE 1
200202
#endif
203+
/* Enable threading extensions on Solaris. */
204+
#ifndef _POSIX_PTHREAD_SEMANTICS
205+
# define _POSIX_PTHREAD_SEMANTICS 1
206+
#endif
207+
/* Enable extensions on HP NonStop. */
208+
#ifndef _TANDEM_SOURCE
209+
# define _TANDEM_SOURCE 1
210+
#endif
211+
/* Enable general extensions on Solaris. */
212+
#ifndef __EXTENSIONS__
213+
# define __EXTENSIONS__ 1
214+
#endif
215+
216+
217+
/* Version number of package */
218+
#define VERSION "1.3"
201219

202220
/* Define to 1 if on MINIX. */
203221
/* #undef _MINIX */
@@ -211,14 +229,3 @@
211229

212230
/* Define if using Darwin $NOCANCEL */
213231
#define __DARWIN_NON_CANCELABLE 1
214-
215-
/* Enable extensions on Solaris. */
216-
#ifndef __EXTENSIONS__
217-
# define __EXTENSIONS__ 1
218-
#endif
219-
#ifndef _POSIX_PTHREAD_SEMANTICS
220-
# define _POSIX_PTHREAD_SEMANTICS 1
221-
#endif
222-
#ifndef _TANDEM_SOURCE
223-
# define _TANDEM_SOURCE 1
224-
#endif

configure.ac

Lines changed: 57 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# When this file changes, rerun autogen.sh.
33
#
44

5-
AC_PREREQ(2.59)
6-
AC_INIT([libdispatch], [1.2], [libdispatch@macosforge.org], [libdispatch])
5+
AC_PREREQ(2.69)
6+
AC_INIT([libdispatch], [1.3], [libdispatch@macosforge.org], [libdispatch], [http://libdispatch.macosforge.org])
77
AC_REVISION([$$])
88
AC_CONFIG_AUX_DIR(config)
99
AC_CONFIG_HEADER([config/config.h])
@@ -14,32 +14,42 @@ AM_MAINTAINER_MODE
1414
AC_PROG_CC([clang gcc cc])
1515
AC_PROG_CXX([clang++ g++ c++])
1616
AC_PROG_OBJC([clang gcc cc])
17+
AC_PROG_OBJCXX([clang++ g++ c++])
1718

1819
#
1920
# On Mac OS X, some required header files come from other source packages;
2021
# allow specifying where those are.
2122
#
22-
AC_ARG_WITH([apple-libc-source],
23-
[AS_HELP_STRING([--with-apple-libc-source],
24-
[Specify path to Apple Libc source])], [
25-
apple_libc_source_pthreads_path=${withval}/pthreads
26-
CPPFLAGS="$CPPFLAGS -I$apple_libc_source_pthreads_path"
23+
AC_ARG_WITH([apple-libpthread-source],
24+
[AS_HELP_STRING([--with-apple-libpthread-source],
25+
[Specify path to Apple libpthread source])], [
26+
apple_libpthread_source_path=${withval}
27+
CPPFLAGS="$CPPFLAGS -isystem $apple_libpthread_source_path"
28+
])
29+
30+
AC_ARG_WITH([apple-libplatform-source],
31+
[AS_HELP_STRING([--with-apple-libplatform-source],
32+
[Specify path to Apple libplatform source])], [
33+
apple_libplatform_source_include_path=${withval}/include
34+
CPPFLAGS="$CPPFLAGS -isystem $apple_libplatform_source_include_path"
2735
])
2836

2937
AC_ARG_WITH([apple-libclosure-source],
3038
[AS_HELP_STRING([--with-apple-libclosure-source],
3139
[Specify path to Apple libclosure source])], [
3240
apple_libclosure_source_path=${withval}
33-
CPPFLAGS="$CPPFLAGS -I$apple_libclosure_source_path"
41+
CPPFLAGS="$CPPFLAGS -isystem $apple_libclosure_source_path"
3442
])
3543

3644
AC_ARG_WITH([apple-xnu-source],
3745
[AS_HELP_STRING([--with-apple-xnu-source],
3846
[Specify path to Apple XNU source])], [
47+
apple_xnu_source_libsyscall_path=${withval}/libsyscall
48+
apple_xnu_source_libproc_path=${withval}/libsyscall/wrappers/libproc
3949
apple_xnu_source_libkern_path=${withval}/libkern
4050
apple_xnu_source_bsd_path=${withval}/bsd
4151
apple_xnu_source_osfmk_path=${withval}/osfmk
42-
CPPFLAGS="$CPPFLAGS -idirafter $apple_xnu_source_libkern_path -isystem $apple_xnu_source_bsd_path"
52+
CPPFLAGS="$CPPFLAGS -idirafter $apple_xnu_source_libkern_path -isystem $apple_xnu_source_bsd_path -isystem $apple_xnu_source_libsyscall_path -isystem $apple_xnu_source_libproc_path "
4353
])
4454

4555
AC_ARG_WITH([apple-objc4-source],
@@ -52,15 +62,15 @@ AC_ARG_WITH([apple-libauto-source],
5262
[AS_HELP_STRING([--with-apple-libauto-source],
5363
[Specify path to Apple libauto source])], [
5464
apple_libauto_source_path=${withval}
55-
CPPFLAGS="$CPPFLAGS -I$apple_libauto_source_path"
65+
CPPFLAGS="$CPPFLAGS -isystem $apple_libauto_source_path"
5666
])
5767

5868
AC_CACHE_CHECK([for System.framework/PrivateHeaders], dispatch_cv_system_privateheaders,
5969
[AS_IF([test -d /System/Library/Frameworks/System.framework/PrivateHeaders],
6070
[dispatch_cv_system_privateheaders=yes], [dispatch_cv_system_privateheaders=no])]
6171
)
6272
AS_IF([test "x$dispatch_cv_system_privateheaders" != "xno"],
63-
[CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/System.framework/PrivateHeaders"]
73+
[CPPFLAGS="$CPPFLAGS -isystem /System/Library/Frameworks/System.framework/PrivateHeaders"]
6474
)
6575

6676
#
@@ -97,6 +107,12 @@ LT_INIT([disable-static])
97107

98108
AC_PROG_INSTALL
99109
AC_PATH_PROGS(MIG, mig)
110+
AC_PATH_PROG(DTRACE, dtrace)
111+
AS_IF([test "x$DTRACE" != "x"], [use_dtrace=true],[
112+
use_dtrace=false
113+
CPPFLAGS="$CPPFLAGS -DDISPATCH_USE_DTRACE=0"
114+
])
115+
AM_CONDITIONAL(USE_DTRACE, $use_dtrace)
100116
AC_PATH_PROG(LEAKS, leaks)
101117
AS_IF([test "x$LEAKS" != "x"],
102118
[AC_DEFINE(HAVE_LEAKS, 1, [Define if Apple leaks program is present])]
@@ -128,21 +144,38 @@ AC_CHECK_HEADER(sys/event.h, [],
128144
# Checks for header files.
129145
#
130146
AC_HEADER_STDC
131-
AC_CHECK_HEADERS([TargetConditionals.h pthread_np.h malloc/malloc.h libkern/OSCrossEndian.h libkern/OSAtomic.h sys/guarded.h libproc_internal.h])
147+
AC_CHECK_HEADERS([TargetConditionals.h pthread_np.h malloc/malloc.h libkern/OSCrossEndian.h libkern/OSAtomic.h sys/guarded.h fcntl.h])
132148

133-
# hack for pthread_machdep.h's #include <System/machine/cpu_capabilities.h>
134-
AS_IF([test -n "$apple_xnu_source_osfmk_path"], [
149+
# hack for pthread/private headers
150+
AS_IF([test -n "$apple_libpthread_source_path" -a -n "$apple_xnu_source_osfmk_path"], [
135151
saveCPPFLAGS="$CPPFLAGS"
136152
CPPFLAGS="$CPPFLAGS -I."
153+
ln -fsh "$apple_libpthread_source_path"/private/tsd_private.h pthread_machdep.h
154+
ln -fsh "$apple_libpthread_source_path"/private pthread
137155
ln -fsh "$apple_xnu_source_osfmk_path" System
156+
mkdir -p mach && ln -fsh "$apple_xnu_source_osfmk_path"/mach/coalition.h mach
138157
])
139-
AC_CHECK_HEADERS([pthread_machdep.h])
140-
AS_IF([test -n "$apple_xnu_source_osfmk_path"], [
141-
rm -f System
158+
AC_CHECK_HEADERS([pthread_machdep.h pthread/qos.h])
159+
AC_CHECK_HEADERS([pthread/workqueue_private.h pthread_workqueue.h],
160+
[AC_DEFINE(HAVE_PTHREAD_WORKQUEUES, 1, [Define if pthread work queues are present])]
161+
)
162+
AC_CHECK_HEADERS([libproc_internal.h], [], [], [#include <mach/mach.h>])
163+
AC_CHECK_FUNCS([pthread_workqueue_setdispatch_np _pthread_workqueue_init])
164+
AS_IF([test -n "$apple_libpthread_source_path" -a -n "$apple_xnu_source_osfmk_path"], [
165+
rm -f pthread_machdep.h pthread System mach/coalition.h
142166
CPPFLAGS="$saveCPPFLAGS"
167+
AC_CONFIG_COMMANDS([src/pthread_machdep.h],
168+
[ln -fsh "$apple_libpthread_source_path"/private/tsd_private.h src/pthread_machdep.h],
169+
[apple_libpthread_source_path="$apple_libpthread_source_path"])
170+
AC_CONFIG_COMMANDS([src/pthread],
171+
[ln -fsh "$apple_libpthread_source_path"/private src/pthread],
172+
[apple_libpthread_source_path="$apple_libpthread_source_path"])
143173
AC_CONFIG_COMMANDS([src/System],
144174
[ln -fsh "$apple_xnu_source_osfmk_path" src/System],
145175
[apple_xnu_source_osfmk_path="$apple_xnu_source_osfmk_path"])
176+
AC_CONFIG_COMMANDS([src/mach/coalition.h],
177+
[ln -fsh "$apple_xnu_source_osfmk_path"/mach/coalition.h src/mach],
178+
[apple_xnu_source_osfmk_path="$apple_xnu_source_osfmk_path"])
146179
])
147180
# hack for xnu/bsd/sys/event.h EVFILT_SOCK declaration
148181
AS_IF([test -n "$apple_xnu_source_bsd_path"], [
@@ -194,15 +227,6 @@ AC_CHECK_HEADER([mach/mach.h], [
194227
)
195228
AM_CONDITIONAL(USE_MIG, $have_mach)
196229

197-
#
198-
# We use the availability of pthread_workqueue.h to decide whether to compile
199-
# in support for pthread work queues.
200-
#
201-
AC_CHECK_HEADER([pthread_workqueue.h],
202-
[AC_DEFINE(HAVE_PTHREAD_WORKQUEUES, 1, [Define if pthread work queues are present])]
203-
)
204-
AC_CHECK_FUNCS([pthread_workqueue_setdispatch_np])
205-
206230
#
207231
# Find functions and declarations we care about.
208232
#
@@ -295,5 +319,11 @@ AC_COMPILE_IFELSE(
295319
#
296320
# Generate Makefiles.
297321
#
298-
AC_CONFIG_FILES([Makefile dispatch/Makefile man/Makefile os/Makefile private/Makefile src/Makefile])
322+
AC_CONFIG_FILES([Makefile dispatch/Makefile man/Makefile os/Makefile private/Makefile src/Makefile tests/Makefile])
323+
324+
#
325+
# Generate testsuite links
326+
#
327+
AC_CONFIG_LINKS([tests/dispatch:${x:+}private tests/leaks-wrapper:tests/leaks-wrapper.sh])
328+
299329
AC_OUTPUT

dispatch/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ dispatchdir=$(includedir)/dispatch
66

77
dispatch_HEADERS= \
88
base.h \
9+
block.h \
910
data.h \
1011
dispatch.h \
1112
group.h \

0 commit comments

Comments
 (0)