22# When this file changes, rerun autogen.sh.
33#
44
5- AC_PREREQ ( 2.59 )
6- AC_INIT ( [ libdispatch] ,
[ 1.2 ] ,
[ [email protected] ] ,
[ libdispatch] ) 5+ AC_PREREQ ( 2.69 )
6+ AC_INIT ( [ libdispatch] ,
[ 1.3 ] ,
[ [email protected] ] ,
[ libdispatch] , [ http://libdispatch.macosforge.org ] ) 77AC_REVISION ( [ $$] )
88AC_CONFIG_AUX_DIR ( config )
99AC_CONFIG_HEADER([ config/config.h] )
@@ -14,32 +14,42 @@ AM_MAINTAINER_MODE
1414AC_PROG_CC ( [ clang gcc cc] )
1515AC_PROG_CXX ( [ clang++ g++ c++] )
1616AC_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
2937AC_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
3644AC_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
4555AC_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
5868AC_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)
6272AS_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
98108AC_PROG_INSTALL
99109AC_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)
100116AC_PATH_PROG ( LEAKS , leaks )
101117AS_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#
130146AC_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
148181AS_IF ( [ test -n "$apple_xnu_source_bsd_path"] , [
@@ -194,15 +227,6 @@ AC_CHECK_HEADER([mach/mach.h], [
194227)
195228AM_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+
299329AC_OUTPUT
0 commit comments