1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
|
#
# When this file changes, rerun autogen.sh.
#
AC_PREREQ(2.59)
AC_INIT([libdispatch], [1.0], [libdispatch@macosforge.org], [libdispatch])
AC_REVISION([$$])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_HEADER([config/config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_MAINTAINER_MODE
#
# On Mac OS X, some required header files come from other source packages;
# allow specifying where those are.
#
AC_ARG_WITH([apple-libc-source],
[AS_HELP_STRING([--with-apple-libc-source],
[Specify path to Apple Libc source])],
[apple_libc_source_path=${withval}/pthreads
APPLE_LIBC_SOURCE_PATH=-I$apple_libc_source_path
CPPFLAGS="$CPPFLAGS -I$apple_libc_source_path"],
[APPLE_LIBC_SOURCE_PATH=]
)
AC_SUBST([APPLE_LIBC_SOURCE_PATH])
AC_ARG_WITH([apple-xnu-source],
[AS_HELP_STRING([--with-apple-xnu-source],
[Specify path to Apple XNU source])],
[apple_xnu_source_path=${withval}/libkern
APPLE_XNU_SOURCE_PATH=-I$apple_xnu_source_path
CPPFLAGS="$CPPFLAGS -I$apple_xnu_source_path"],
[APPLE_XNU_SOURCE_PATH=]
)
AC_SUBST([APPLE_XNU_SOURCE_PATH])
AC_CACHE_CHECK([for System.framework/PrivateHeaders], dispatch_cv_system_privateheaders,
[AS_IF([test -d /System/Library/Frameworks/System.framework/PrivateHeaders],
[dispatch_cv_system_privateheaders=yes], [dispatch_cv_system_privateheaders=no])]
)
AS_IF([test "x$dispatch_cv_system_privateheaders" != "xno"],
[CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/System.framework/PrivateHeaders"]
)
#
# Try to build the legacy API only if specifically requested.
#
AC_ARG_ENABLE([legacy-api],
[AS_HELP_STRING([--enable-legacy-api], [Enable legacy (deprecated) API.])]
)
AS_IF([test "x$enable_legacy_api" != "xyes"],
[use_legacy_api=false
AC_DEFINE(DISPATCH_NO_LEGACY, 1,[Define to compile out legacy API])],
[use_legacy_api=true]
)
AM_CONDITIONAL(USE_LEGACY_API, $use_legacy_api)
#
# On Mac OS X Snow Leopard, libpispatch_init is automatically invoked during
# libsyscall process setup. On other systems, it is tagged as a library
# constructor to be run by automatically by the runtime linker.
#
AC_ARG_ENABLE([libdispatch-init-constructor],
[AS_HELP_STRING([--disable-libdispatch-init-constructor],
[Disable libdispatch_init as a constructor])]
)
AS_IF([test "x$enable_libdispatch_init_constructor" != "xno"],
[AC_DEFINE(USE_LIBDISPATCH_INIT_CONSTRUCTOR, 1,
[Define to tag libdispatch_init as a constructor])]
)
#
# Whether or not to include/reference a crashreporter symbol.
#
AC_ARG_ENABLE([apple-crashreporter-info],
[AS_HELP_STRING([--enable-apple-crashreporter-info],
[Use Mac OS X crashreporter info])]
)
AS_IF([test "x$enable_apple_crashreporter_info" = "xyes"],
[AC_DEFINE(USE_APPLE_CRASHREPORTER_INFO, 1,
[Define to use Mac OS X crashreporter info])]
)
#
# libdispatch has micro-optimized and deeply personal knowledge of Mac OS
# implementation details. Only enable this if explicitly requested, as it
# will lead to data corruption if applied on systems violating its
# expectations.
#
AC_ARG_ENABLE([apple-tsd-optimizations],
[AS_HELP_STRING([--enable-apple-tsd-optimizations],
[Use non-portable pthread TSD optimizations for Mac OS X.])]
)
AS_IF([test "x$enable_apple_tsd_optimizations" = "xyes"],
[AC_DEFINE(USE_APPLE_TSD_OPTIMIZATIONS, 1,
[Define to use non-portable pthread TSD optimizations for Mac OS X)])]
)
AC_ARG_ENABLE([apple-semaphore-optimizations],
[AS_HELP_STRING([--enable-apple-semaphore-optimizations],
[Use non-portable semaphore optimizations for Mac OS X.])]
)
AS_IF([test "x$enable_apple_semaphore_optimizations" = "xyes"],
[AC_DEFINE(USE_APPLE_SEMAPHORE_OPTIMIZATIONS, 1,
[Define to use non-portablesemaphore optimizations for Mac OS X])]
)
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PATH_PROGS(MIG, mig)
AC_PATH_PROG(LEAKS, leaks)
AS_IF([test "x$LEAKS" != "x"],
[AC_DEFINE(HAVE_LEAKS, 1, [Define if Apple leaks program is present])]
)
AM_INIT_AUTOMAKE([foreign])
DISPATCH_C_ATOMIC_BUILTINS
case $dispatch_cv_atomic in
yes) ;;
-march*) MARCH_FLAGS="$dispatch_cv_atomic"
AC_SUBST([MARCH_FLAGS]) ;;
*) AC_MSG_ERROR([No gcc builtin atomic operations available]) ;;
esac
#
# Find libraries we will need
#
AC_SEARCH_LIBS(clock_gettime, rt)
AC_SEARCH_LIBS(pthread_create, pthread)
#
# Prefer native kqueue(2); otherwise use libkqueue if present.
#
AC_CHECK_HEADER(sys/event.h, [],
[PKG_CHECK_MODULES(KQUEUE, libkqueue)]
)
#
# Checks for header files.
#
AC_HEADER_STDC
AC_CHECK_HEADERS([TargetConditionals.h pthread_machdep.h pthread_np.h malloc/malloc.h libkern/OSCrossEndian.h libkern/OSAtomic.h sys/sysctl.h])
#
# Core Services is tested in one of the GCD regression tests, so test for its
# presence using its header file.
#
AC_CHECK_HEADER([CoreServices/CoreServices.h],
[have_coreservices=true],
[have_coreservices=false]
)
AM_CONDITIONAL(HAVE_CORESERVICES, $have_coreservices)
#
# We use the availability of mach.h to decide whether to compile in all sorts
# of Machisms, including using Mach ports as event sources, etc.
#
AC_CHECK_HEADER([mach/mach.h],
[AC_DEFINE(HAVE_MACH, 1,Define if mach is present)
have_mach=true],
[have_mach=false]
)
AM_CONDITIONAL(USE_MIG, $have_mach)
AC_DEFINE(HAVE_PTHREAD_WORKQUEUES, 1,Define if pthread work queues are present)
AC_DEFINE([__private_extern__], [__attribute__ ((visibility("hidden")))], "workaround")
#
# Find functions and declarations we care about.
#
AC_CHECK_DECLS([CLOCK_UPTIME, CLOCK_MONOTONIC, CLOCK_REALTIME], [], [],
[[#include <time.h>]])
AC_CHECK_DECLS([EVFILT_LIO, EVFILT_SESSION, NOTE_NONE, NOTE_REAP, NOTE_REVOKE, NOTE_SIGNAL], [], [],
[[#include <sys/types.h>
#include <sys/event.h>]])
AC_CHECK_DECLS([FD_COPY], [], [], [[#include <sys/select.h>]])
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_DECLS([POSIX_SPAWN_START_SUSPENDED],
[have_posix_spawn_start_suspended=true],
[have_posix_spawn_start_suspended=false],
[[#include <sys/spawn.h>]]
)
AM_CONDITIONAL(HAVE_POSIX_SPAWN_START_SUSPENDED, $have_posix_spawn_start_suspended)
AC_CHECK_FUNC([sem_init],
[have_sem_init=true],
[have_sem_init=false]
)
#
# We support both Mach semaphores and POSIX semaphores; if the former are
# available, prefer them.
#
AC_MSG_CHECKING([what semaphore type to use]);
AS_IF([test "x$have_mach" = "xtrue"],
[AC_DEFINE(USE_MACH_SEM, 1,[Define to use Mach semaphores])
AC_MSG_RESULT([Mach semaphores])],
[test "x$have_sem_init" = "xtrue"],
[AC_DEFINE(USE_POSIX_SEM, 1,[Define to use POSIX semaphores])
AC_MSG_RESULT([POSIX semaphores])],
[AC_MSG_ERROR([no supported semaphore type])]
)
AC_CHECK_HEADERS([sys/cdefs.h], [], [],
[#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif])
DISPATCH_C_PRIVATE_EXTERN
DISPATCH_C_BLOCKS
#
# Temporary: some versions of clang do not mark __builtin_trap() as
# __attribute__((__noreturn__)). Detect and add if required.
#
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([void __attribute__((__noreturn__)) temp(void) { __builtin_trap(); }], [])], [
AC_DEFINE(HAVE_NORETURN_BUILTIN_TRAP, 1,[Define if __builtin_trap marked noreturn])
], [])
#
# Generate Makefiles.
#
AC_CONFIG_FILES([Makefile dispatch/Makefile man/Makefile src/Makefile testing/Makefile])
AC_OUTPUT
|