SET(LIBS ${LIBS} ${Threads_LIBRARIES})
ENDIF(enable_threads)
+OPTION(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON)
+
OPTION(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON)
OPTION(enable_parallel_mark "Parallelize marking and free list construction" ON)
MESSAGE("Only on NetBSD 2.0 or later.")
ADD_DEFINITIONS("-D_PTHREADS")
ENDIF()
+ IF( HOST MATCHES .*-.*-aix.*|.*-.*-cygwin.*|.*-.*-.*freebsd.*|.*-.*-haiku.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-kfreebsd.*-gnu|.*-.*-.*linux.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*)
+ IF(enable_handle_fork)
+ ADD_DEFINITIONS("-DHANDLE_FORK")
+ ENDIF(enable_handle_fork)
+ ENDIF()
IF ( HOST MATCHES .*-.*-cygwin.*)
SET(SRC ${SRC} win32_threads.c)
ENDIF()
IF ( HOST MATCHES .*-.*-darwin.*)
+ IF(enable_handle_fork)
+ # The incremental mode conflicts with fork handling.
+ IF(enable_parallel_mark)
+ ADD_DEFINITIONS("-DHANDLE_FORK")
+ ENDIF(enable_parallel_mark)
+ ENDIF(enable_handle_fork)
SET(SRC ${SRC} darwin_stop_world.c)
#TODO
#darwin_threads=true
fi
AC_ARG_ENABLE(handle-fork,
- [AC_HELP_STRING([--enable-handle-fork],
- [Attempt to ensure a usable collector after fork() in multi-threaded
- programs.])])
-
+ [AC_HELP_STRING([--enable-handle-fork[=yes|no|auto|manual]],
+ [Attempt to ensure a usable collector after fork()
+ in multi-threaded programs (default: auto;
+ manual: GC_atfork_prepare/parent/child should be
+ called by the client)])])
if test "${enable_handle_fork}" = yes; then
AC_DEFINE(HANDLE_FORK, 1,
[Define to install pthread_atfork() handlers by default.])
elif test "${enable_handle_fork}" = no; then
AC_DEFINE(NO_HANDLE_FORK, 1,
[Prohibit installation of pthread_atfork() handlers.])
+elif test "${enable_handle_fork}" != manual -a x$THREADS = xposix; then
+ # If the option is omitted, pthread_atfork handlers are installed
+ # by default for the targets where pthread_atfork is known to work.
+ case "$host" in
+ *-*-darwin*)
+ # The incremental mode (which is off if parallel marking) conflicts
+ # with fork handling on Darwin.
+ if test "${enable_parallel_mark}" != no; then
+ AC_DEFINE(HANDLE_FORK)
+ fi
+ ;;
+ *-*-aix* | *-*-cygwin* | *-*-*freebsd* | *-*-haiku* | \
+ *-*-hpux11* | *-*-irix* | *-*-kfreebsd*-gnu | \
+ *-*-*linux* | *-*-netbsd* | *-*-openbsd* | *-*-osf* | *-*-solaris*)
+ AC_DEFINE(HANDLE_FORK)
+ ;;
+ esac
fi
dnl This is something of a hack. When cross-compiling we turn off