]> git.saurik.com Git - apple/libdispatch.git/blob - configure.ac
libdispatch-913.1.6.tar.gz
[apple/libdispatch.git] / configure.ac
1 #
2 # When this file changes, rerun autogen.sh.
3 #
4
5 AC_PREREQ(2.69)
6 AC_INIT([libdispatch], [1.3], [https://bugs.swift.org], [libdispatch], [https://github.com/apple/swift-corelibs-libdispatch])
7 AC_REVISION([$$])
8 AC_CONFIG_AUX_DIR(config)
9 AC_CONFIG_HEADER([config/config_ac.h])
10 AC_CONFIG_MACRO_DIR([m4])
11 ac_clean_files=a.out.dSYM
12 AM_MAINTAINER_MODE
13
14 AC_CANONICAL_BUILD
15 AC_CANONICAL_HOST
16 AC_CANONICAL_TARGET
17
18 #
19 # Command line argument to specify build variant (default to release).
20 # Impacts default value of CFLAGS et al. so must come before AC_PROG_CC
21 #
22 AC_ARG_WITH([build-variant],
23 [AS_HELP_STRING([--with-build-variant=release|debug|releaseassert|releasedebuginfo], [Specify build variant [default=release]])],
24 [dispatch_build_variant=${withval}],
25 [dispatch_build_variant=release]
26 )
27 AS_CASE([$dispatch_build_variant],
28 [debug], [
29 default_compiler_flags="-g -O0"
30 dispatch_enable_asserts=true
31 dispatch_enable_optimization=false
32 ],
33 [release], [
34 default_compiler_flags="-O2"
35 dispatch_enable_asserts=false
36 dispatch_enable_optimization=true
37 ],
38 [releaseassert], [
39 default_compiler_flags="-O2"
40 dispatch_enable_asserts=true
41 dispatch_enable_optimization=true
42 ],
43 [releasedebuginfo], [
44 default_compiler_flags="-g -O2"
45 dispatch_enable_asserts=false
46 dispatch_enable_optimization=true
47 ],
48 [AC_MSG_ERROR("invalid build-variant $dispatch_build_variant")]
49 )
50 AM_CONDITIONAL(DISPATCH_ENABLE_ASSERTS, $dispatch_enable_asserts)
51 AM_CONDITIONAL(DISPATCH_ENABLE_OPTIMIZATION, $dispatch_enable_optimization)
52
53 : ${CFLAGS=$default_compiler_flags}
54 : ${CXXFLAGS=$default_compiler_flags}
55 : ${OBJCFLAGS=$default_compiler_flags}
56 : ${OBJCXXFLAGS=$default_compiler_flags}
57
58 AC_PROG_CC([clang gcc cc])
59 AC_PROG_CXX([clang++ g++ c++])
60 AC_PROG_OBJC([clang gcc cc])
61 AC_PROG_OBJCXX([clang++ g++ c++])
62
63 #
64 # Android cross-compilation support
65 #
66 AC_ARG_WITH([android-ndk],
67 [AS_HELP_STRING([--with-android-ndk],
68 [Android NDK location])], [
69 android_ndk=${withval}
70 ])
71 AC_ARG_WITH([android-ndk-gcc-version],
72 [AS_HELP_STRING([--with-android-ndk-gcc-version],
73 [Android NDK GCC version [defaults=4.9]])],
74 [android_ndk_gcc_version=${withval}], [android_ndk_gcc_version=4.9])
75 AC_ARG_WITH([android-api-level],
76 [AS_HELP_STRING([--with-android-api-level],
77 [Android API level to link with])], [
78 android_api_level=${withval}
79 ])
80 AC_ARG_ENABLE([android],
81 [AS_HELP_STRING([--enable-android],
82 [Compile for Android])], [
83 android=true
84
85 # Override values until there's real support for multiple Android platforms
86 host=armv7-none-linux-androideabi
87 host_alias=arm-linux-androideabi
88 host_cpu=armv7
89 host_os=linux-androideabi
90 host_vendor=unknown
91 arch=arm
92
93 sysroot=${android_ndk}/platforms/android-${android_api_level}/arch-${arch}
94 toolchain=${android_ndk}/toolchains/${host_alias}-${android_ndk_gcc_version}/prebuilt/linux-${build_cpu}
95
96 CFLAGS="$CFLAGS -target ${host_alias} --sysroot=${sysroot} -B${toolchain}/${host_alias}/bin"
97 CXXFLAGS="$CXXFLAGS -target ${host_alias} --sysroot=${sysroot} -B${toolchain}/${host_alias}/bin"
98 SWIFTC_FLAGS="-target ${host} -sdk ${sysroot} -L${toolchain}/lib/gcc/${host_alias}/${android_ndk_gcc_version}.x"
99 LIBS="$LIBS -L${toolchain}/lib/gcc/${host_alias}/${android_ndk_gcc_version}.x"
100 LDFLAGS="$LDFLAGS -Wc,'-target','${host_alias}','-B${toolchain}/${host_alias}/bin'"
101
102 # FIXME: empty CFLAGS and CXXFLAGS are assumed for this to work.
103 # FIXME: there should be a more elegant way to do this
104 ac_configure_args=`echo $ac_configure_args | sed -e "s/ 'CFLAGS='//" -e "s/ 'CXXFLAGS='//"`
105 # CFLAGS, CXXFLAGS and LIBS needs to be passed to libkqueue and libpwq
106 ac_configure_args="$ac_configure_args --enable-bionic-libc 'CFLAGS=$CFLAGS' 'CXXFLAGS=$CXXFLAGS' 'LIBS=$LIBS'"
107 ], [android=false])
108 AM_CONDITIONAL(ANDROID, $android)
109
110 #
111 # On Mac OS X, some required header files come from other source packages;
112 # allow specifying where those are.
113 #
114 AC_ARG_WITH([apple-libpthread-source],
115 [AS_HELP_STRING([--with-apple-libpthread-source],
116 [Specify path to Apple libpthread source])], [
117 apple_libpthread_source_path=${withval}
118 CPPFLAGS="$CPPFLAGS -isystem $apple_libpthread_source_path"
119 ])
120
121 AC_ARG_WITH([apple-libplatform-source],
122 [AS_HELP_STRING([--with-apple-libplatform-source],
123 [Specify path to Apple libplatform source])], [
124 apple_libplatform_source_include_path=${withval}/include
125 CPPFLAGS="$CPPFLAGS -isystem $apple_libplatform_source_include_path"
126 ])
127
128 AC_ARG_WITH([apple-xnu-source],
129 [AS_HELP_STRING([--with-apple-xnu-source],
130 [Specify path to Apple XNU source])], [
131 apple_xnu_source_libsyscall_path=${withval}/libsyscall
132 apple_xnu_source_libproc_path=${withval}/libsyscall/wrappers/libproc
133 apple_xnu_source_libkern_path=${withval}/libkern
134 apple_xnu_source_bsd_path=${withval}/bsd
135 apple_xnu_source_osfmk_path=${withval}/osfmk
136 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 "
137 ])
138
139 AC_CACHE_CHECK([for System.framework/PrivateHeaders], dispatch_cv_system_privateheaders,
140 [AS_IF([test -d /System/Library/Frameworks/System.framework/PrivateHeaders],
141 [dispatch_cv_system_privateheaders=yes], [dispatch_cv_system_privateheaders=no])]
142 )
143 AS_IF([test "x$dispatch_cv_system_privateheaders" != "xno"],
144 [CPPFLAGS="$CPPFLAGS -isystem /System/Library/Frameworks/System.framework/PrivateHeaders"]
145 )
146
147 #
148 # On Mac OS X, libdispatch_init is automatically invoked during libSystem
149 # process initialization. On other systems, it is tagged as a library
150 # constructor to be run by automatically by the runtime linker.
151 #
152 AC_ARG_ENABLE([libdispatch-init-constructor],
153 [AS_HELP_STRING([--disable-libdispatch-init-constructor],
154 [Disable libdispatch_init as a constructor])],,
155 [AS_IF([test -f /usr/lib/system/libdispatch.dylib],
156 [enable_libdispatch_init_constructor=no])]
157 )
158 AS_IF([test "x$enable_libdispatch_init_constructor" != "xno"],
159 [AC_DEFINE(USE_LIBDISPATCH_INIT_CONSTRUCTOR, 1,
160 [Define to tag libdispatch_init as a constructor])]
161 )
162
163 #
164 # On Mac OS X libdispatch can use the non-portable direct pthread TSD functions
165 #
166 AC_ARG_ENABLE([apple-tsd-optimizations],
167 [AS_HELP_STRING([--enable-apple-tsd-optimizations],
168 [Use non-portable pthread TSD optimizations for Mac OS X.])]
169 )
170 AS_IF([test "x$enable_apple_tsd_optimizations" = "xyes"],
171 [AC_DEFINE(USE_APPLE_TSD_OPTIMIZATIONS, 1,
172 [Define to use non-portable pthread TSD optimizations for Mac OS X)])]
173 )
174
175 #
176 # Enable building Swift overlay support into libdispatch
177 #
178 AC_ARG_WITH([swift-toolchain],
179 [AS_HELP_STRING([--with-swift-toolchain], [Specify path to Swift toolchain])],
180 [swift_toolchain_path=${withval}
181 AC_DEFINE(HAVE_SWIFT, 1, [Define if building for Swift])
182 SWIFTC="$swift_toolchain_path/bin/swiftc"
183 case $target_os in
184 *android*)
185 os_string="android"
186 ;;
187 linux*)
188 os_string="linux"
189 case $target_cpu in
190 armv7l*)
191 target_cpu="armv7"
192 ;;
193 *)
194 esac
195 ;;
196 *)
197 os_string=$target_os
198 ;;
199 esac
200 SWIFT_LIBDIR="$swift_toolchain_path/lib/swift/$os_string/$target_cpu"
201 have_swift=true],
202 [have_swift=false]
203 )
204 AM_CONDITIONAL(HAVE_SWIFT, $have_swift)
205 AC_SUBST([SWIFTC])
206 AC_SUBST([SWIFTC_FLAGS])
207 AC_SUBST([SWIFT_LIBDIR])
208 AC_SUBST([OS_STRING], ["$os_string"])
209
210 #
211 # Enable use of gold linker when building the Swift overlay
212 # to avoid a symbol relocation issue.
213 # Ultimately the request to use gold should be passed in as an arg
214 #
215 AC_CHECK_PROG(use_gold_linker, ld.gold, true, false)
216 AM_CONDITIONAL(USE_GOLD_LINKER, $use_gold_linker)
217
218 #
219 # Enable an extended test suite that includes
220 # tests that are too unreliable to be enabled by
221 # default in the Swift CI environment, but are still
222 # useful for libdispatch developers to be able to run.
223 #
224 AC_ARG_ENABLE([extended-test-suite],
225 [AS_HELP_STRING([--enable-extended-test-suite],
226 [Include additional test cases that may fail intermittently])]
227 )
228 AM_CONDITIONAL(EXTENDED_TEST_SUITE, test "x$enable_extended_test_suite" = "xyes")
229
230 #
231 # Enable __thread based TSD on platforms where it is efficient
232 # Allow override based on command line argument to configure
233 #
234 AC_ARG_ENABLE([thread-local-storage],
235 [AS_HELP_STRING([--enable-thread-local-storage],
236 [Enable usage of thread local storage via __thread])],,
237 [case $target_os in
238 linux*)
239 enable_thread_local_storage=yes
240 ;;
241 *)
242 enable_thread_local_storage=no
243 esac]
244 )
245 AS_IF([test "x$enable_thread_local_storage" = "xyes"],
246 [AC_DEFINE(DISPATCH_USE_THREAD_LOCAL_STORAGE, 1,
247 [Enable usage of thread local storage via __thread])]
248 )
249
250 AC_USE_SYSTEM_EXTENSIONS
251 AM_INIT_AUTOMAKE([foreign no-dependencies subdir-objects])
252 LT_INIT([disable-static])
253
254 AC_PROG_INSTALL
255 AC_PATH_PROGS(MIG, mig)
256 AC_PATH_PROG(DTRACE, dtrace)
257 AS_IF([test "x$DTRACE" != "x"], [use_dtrace=true],[
258 use_dtrace=false
259 CPPFLAGS="$CPPFLAGS -DDISPATCH_USE_DTRACE=0"
260 ])
261 AM_CONDITIONAL(USE_DTRACE, $use_dtrace)
262 AC_PATH_PROG(LEAKS, leaks)
263 AS_IF([test "x$LEAKS" != "x"],
264 [AC_DEFINE(HAVE_LEAKS, 1, [Define if Apple leaks program is present])
265 have_leaks=true],
266 [have_leaks=false]
267 )
268 AM_CONDITIONAL(HAVE_LEAKS, $have_leaks)
269
270 DISPATCH_C_ATOMIC_BUILTINS
271
272 case $dispatch_cv_atomic in
273 yes) ;;
274 -march*) MARCH_FLAGS="$dispatch_cv_atomic"
275 AC_SUBST([MARCH_FLAGS]) ;;
276 *) AC_MSG_ERROR([No gcc builtin atomic operations available]) ;;
277 esac
278
279 #
280 # Find libraries we will need
281 #
282 AC_SEARCH_LIBS(clock_gettime, rt)
283 AC_SEARCH_LIBS(pthread_create, pthread)
284
285 AC_CHECK_FUNCS([strlcpy getprogname], [],
286 [PKG_CHECK_MODULES(BSD_OVERLAY, libbsd-overlay,[
287 AC_DEFINE(HAVE_STRLCPY, 1, [])
288 AC_DEFINE(HAVE_GETPROGNAME, 1, [])
289 ])], [#include <string.h>]
290 )
291
292 #
293 # Checks for header files.
294 #
295 AC_HEADER_STDC
296 AC_CHECK_HEADERS([TargetConditionals.h pthread_np.h malloc/malloc.h libkern/OSCrossEndian.h libkern/OSAtomic.h sys/guarded.h fcntl.h])
297
298 # hack for pthread/private headers
299 AS_IF([test -n "$apple_libpthread_source_path" -a -n "$apple_xnu_source_osfmk_path"], [
300 saveCPPFLAGS="$CPPFLAGS"
301 CPPFLAGS="$CPPFLAGS -I."
302 ln -fsh "$apple_libpthread_source_path"/private/tsd_private.h pthread_machdep.h
303 ln -fsh "$apple_libpthread_source_path"/private pthread
304 ln -fsh "$apple_xnu_source_osfmk_path" System
305 mkdir -p mach && ln -fsh "$apple_xnu_source_osfmk_path"/mach/coalition.h mach
306 ])
307 AC_CHECK_HEADERS([pthread_machdep.h pthread/qos.h])
308
309 # pthread_workqueues.
310 # We can either use libdispatch's internal_workqueue or pthread_workqueue.
311 # If not specifically configured, default to internal_workqueues on
312 # Linux and pthread_workqueue on all other platforms.
313 # On any platform, if pthread_workqueue is not available, fall back
314 # to using internal_workqueue.
315 AC_ARG_ENABLE([internal-libpwq],
316 [AS_HELP_STRING([--enable-internal-libpwq],
317 [Use libdispatch's own implementation of pthread workqueues.])],,
318 [case $target_os in
319 linux*)
320 enable_internal_libpwq=yes
321 ;;
322 *)
323 enable_internal_libpwq=no
324 esac]
325 )
326 AS_IF([test "x$enable_internal_libpwq" = "xyes"],
327 [AC_DEFINE(DISPATCH_USE_INTERNAL_WORKQUEUE, 1, [Use libdispatch's own implementation of pthread workqueues])
328 have_pthread_workqueues=false,
329 dispatch_use_internal_workqueue=true],
330 [AC_CHECK_HEADERS([pthread/workqueue_private.h pthread_workqueue.h],
331 [AC_DEFINE(HAVE_PTHREAD_WORKQUEUES, 1, [Define if pthread work queues are present])
332 have_pthread_workqueues=true,
333 dispatch_use_internal_workqueue=false],
334 [have_pthread_workqueues=false,
335 dispatch_use_internal_workqueue=true]
336 )]
337 )
338 AM_CONDITIONAL(DISPATCH_USE_INTERNAL_WORKQUEUE, $dispatch_use_internal_workqueue)
339 AM_CONDITIONAL(HAVE_PTHREAD_WORKQUEUES, $have_pthread_workqueues)
340
341 AC_CHECK_HEADERS([libproc_internal.h], [], [], [#include <mach/mach.h>])
342 AC_CHECK_FUNCS([pthread_workqueue_setdispatch_np _pthread_workqueue_init])
343 AS_IF([test -n "$apple_libpthread_source_path" -a -n "$apple_xnu_source_osfmk_path"], [
344 rm -f pthread_machdep.h pthread System mach/coalition.h
345 CPPFLAGS="$saveCPPFLAGS"
346 AC_CONFIG_COMMANDS([src/pthread_machdep.h],
347 [ln -fsh "$apple_libpthread_source_path"/private/tsd_private.h src/pthread_machdep.h],
348 [apple_libpthread_source_path="$apple_libpthread_source_path"])
349 AC_CONFIG_COMMANDS([src/pthread],
350 [ln -fsh "$apple_libpthread_source_path"/private src/pthread],
351 [apple_libpthread_source_path="$apple_libpthread_source_path"])
352 AC_CONFIG_COMMANDS([src/System],
353 [ln -fsh "$apple_xnu_source_osfmk_path" src/System],
354 [apple_xnu_source_osfmk_path="$apple_xnu_source_osfmk_path"])
355 AC_CONFIG_COMMANDS([src/mach/coalition.h],
356 [ln -fsh "$apple_xnu_source_osfmk_path"/mach/coalition.h src/mach],
357 [apple_xnu_source_osfmk_path="$apple_xnu_source_osfmk_path"])
358 ])
359 # hack for xnu/bsd/sys/event.h EVFILT_SOCK declaration
360 AS_IF([test -n "$apple_xnu_source_bsd_path"], [
361 CPPFLAGS="$CPPFLAGS -DPRIVATE=1"
362 ])
363
364 #
365 # Check for CoreFoundation, Foundation and objc
366 #
367 AC_CHECK_HEADER([CoreFoundation/CoreFoundation.h],
368 [have_corefoundation=true], [have_corefoundation=false]
369 )
370 AM_CONDITIONAL(HAVE_COREFOUNDATION, $have_corefoundation)
371
372 AC_LANG_PUSH([Objective C])
373 AC_CHECK_HEADER([Foundation/Foundation.h],
374 [have_foundation=true], [have_foundation=false]
375 )
376 AM_CONDITIONAL(HAVE_FOUNDATION, $have_foundation)
377 AC_CHECK_HEADER([objc/NSObject.h], [
378 AC_DEFINE(HAVE_OBJC, 1, [Define if you have the Objective-C runtime])
379 have_objc=true], [have_objc=false]
380 )
381 AM_CONDITIONAL(USE_OBJC, $have_objc)
382 AC_LANG_POP([Objective C])
383
384 #
385 # We use the availability of mach.h to decide whether to compile in all sorts
386 # of Machisms, including using Mach ports as event sources, etc.
387 #
388 AC_CHECK_HEADER([mach/mach.h], [
389 AC_DEFINE(HAVE_MACH, 1, [Define if mach is present])
390 AC_DEFINE(__DARWIN_NON_CANCELABLE, 1, [Define if using Darwin $NOCANCEL])
391 have_mach=true], [have_mach=false]
392 )
393 AM_CONDITIONAL(USE_MIG, $have_mach)
394 AC_CHECK_FUNCS([mach_port_construct])
395
396 #
397 # Find functions and declarations we care about.
398 #
399 AC_CHECK_DECLS([CLOCK_UPTIME, CLOCK_MONOTONIC, CLOCK_REALTIME, CLOCK_UPTIME_FAST], [], [],
400 [[#include <time.h>]])
401 AC_CHECK_DECLS([NOTE_NONE, NOTE_REAP, NOTE_REVOKE, NOTE_SIGNAL, NOTE_LOWAT], [], [],
402 [[#include <sys/event.h>]])
403 AC_CHECK_DECLS([FD_COPY], [], [], [[#include <sys/select.h>]])
404 AC_CHECK_DECLS([SIGEMT], [], [], [[#include <signal.h>]])
405 AC_CHECK_DECLS([VQ_UPDATE, VQ_VERYLOWDISK, VQ_QUOTA, VQ_NEARLOWDISK, VQ_DESIRED_DISK], [], [], [[#include <sys/mount.h>]])
406 AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
407 AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time mach_approximate_time malloc_create_zone sysconf])
408
409 AC_CHECK_DECLS([POSIX_SPAWN_START_SUSPENDED],
410 [have_posix_spawn_start_suspended=true], [have_posix_spawn_start_suspended=false],
411 [[#include <sys/spawn.h>]]
412 )
413 AM_CONDITIONAL(HAVE_POSIX_SPAWN_START_SUSPENDED, $have_posix_spawn_start_suspended)
414
415 AC_CHECK_FUNC([sem_init],
416 [have_sem_init=true], [have_sem_init=false]
417 )
418
419 AC_CHECK_HEADER([linux/futex.h], [
420 AC_DEFINE(HAVE_FUTEX, 1, [Define if linux/futex.h is present])
421 have_futex=true], [have_futex=false]
422 )
423
424 #
425 # We support both Mach semaphores and POSIX semaphores; if the former are
426 # available, prefer them.
427 #
428 AC_MSG_CHECKING([what semaphore type to use]);
429 AS_IF([test "x$have_mach" = "xtrue"],
430 [AC_DEFINE(USE_MACH_SEM, 1, [Define to use Mach semaphores])
431 AC_MSG_RESULT([Mach semaphores])],
432 [test "x$have_sem_init" = "xtrue"],
433 [AC_DEFINE(USE_POSIX_SEM, 1, [Define to use POSIX semaphores])
434 AC_MSG_RESULT([POSIX semaphores])],
435 [AC_MSG_ERROR([no supported semaphore type])]
436 )
437
438 AC_CHECK_HEADERS([sys/cdefs.h], [], [],
439 [#ifdef HAVE_SYS_CDEFS_H
440 #include <sys/cdefs.h>
441 #endif])
442
443 DISPATCH_C_BLOCKS
444
445 AC_CACHE_CHECK([for -fvisibility=hidden], [dispatch_cv_cc_visibility_hidden], [
446 saveCFLAGS="$CFLAGS"
447 CFLAGS="$CFLAGS -fvisibility=hidden"
448 AC_LINK_IFELSE([AC_LANG_PROGRAM([
449 extern __attribute__ ((visibility ("default"))) int foo; int foo;], [foo = 0;])],
450 [dispatch_cv_cc_visibility_hidden="yes"], [dispatch_cv_cc_visibility_hidden="no"])
451 CFLAGS="$saveCFLAGS"
452 ])
453 AS_IF([test "x$dispatch_cv_cc_visibility_hidden" != "xno"], [
454 VISIBILITY_FLAGS="-fvisibility=hidden"
455 ])
456 AC_SUBST([VISIBILITY_FLAGS])
457
458 AC_CACHE_CHECK([for -momit-leaf-frame-pointer], [dispatch_cv_cc_omit_leaf_fp], [
459 saveCFLAGS="$CFLAGS"
460 CFLAGS="$CFLAGS -momit-leaf-frame-pointer"
461 AC_LINK_IFELSE([AC_LANG_PROGRAM([
462 extern int foo(void); int foo(void) {return 1;}], [foo();])],
463 [dispatch_cv_cc_omit_leaf_fp="yes"], [dispatch_cv_cc_omit_leaf_fp="no"])
464 CFLAGS="$saveCFLAGS"
465 ])
466 AS_IF([test "x$dispatch_cv_cc_omit_leaf_fp" != "xno"], [
467 OMIT_LEAF_FP_FLAGS="-momit-leaf-frame-pointer"
468 ])
469 AC_SUBST([OMIT_LEAF_FP_FLAGS])
470
471 AS_IF([test "x$have_mach" = "xtrue"], [
472 AC_CACHE_CHECK([for darwin linker], [dispatch_cv_ld_darwin], [
473 saveLDFLAGS="$LDFLAGS"
474 LDFLAGS="$LDFLAGS -dynamiclib -compatibility_version 1.2.3 -current_version 4.5.6 -dead_strip"
475 AC_LINK_IFELSE([AC_LANG_PROGRAM([
476 extern int foo; int foo;], [foo = 0;])],
477 [dispatch_cv_ld_darwin="yes"], [dispatch_cv_ld_darwin="no"])
478 LDFLAGS="$saveLDFLAGS"
479 ])
480 ])
481 AM_CONDITIONAL(HAVE_DARWIN_LD, [test "x$dispatch_cv_ld_darwin" == "xyes"])
482
483 #
484 # symlink platform-specific module.modulemap files
485 #
486 AS_CASE([$target_os],
487 [darwin*], [ dispatch_module_map_os=darwin ],
488 [ dispatch_module_map_os=generic ]
489 )
490 AC_CONFIG_COMMANDS([modulemaps], [
491 ln -fs $dispatch_module_map_os/module.modulemap $ac_top_srcdir/dispatch/module.modulemap
492 ln -fs $dispatch_module_map_os/module.modulemap $ac_top_srcdir/private/module.modulemap
493 ],
494 [dispatch_module_map_os="$dispatch_module_map_os"]
495 )
496
497 #
498 # Temporary: some versions of clang do not mark __builtin_trap() as
499 # __attribute__((__noreturn__)). Detect and add if required.
500 #
501 AC_COMPILE_IFELSE(
502 [AC_LANG_PROGRAM([void __attribute__((__noreturn__)) temp(void) { __builtin_trap(); }], [])],
503 [AC_DEFINE(HAVE_NORETURN_BUILTIN_TRAP, 1, [Define if __builtin_trap marked noreturn])]
504 )
505
506 #
507 # Add option to avoid building tests
508 #
509 AC_ARG_ENABLE([build-tests],
510 [AS_HELP_STRING([--disable-build-tests], [Disable tests compilation])])
511 AM_CONDITIONAL(BUILD_TESTS, [test "x$enable_build_tests" != "xno"])
512
513 #
514 # Generate Makefiles.
515 #
516 AC_CONFIG_FILES([Makefile dispatch/Makefile man/Makefile os/Makefile private/Makefile src/Makefile tests/Makefile])
517
518 #
519 # Generate testsuite links
520 #
521 AC_CONFIG_LINKS([tests/dispatch:$ac_top_srcdir/private tests/leaks-wrapper:tests/leaks-wrapper.sh])
522
523 AC_OUTPUT