OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support])
OPTION_DEFAULT_ON([zlib],[don't compile with zlib decompression support])
+OPTION_DEFAULT_ON([threads],[don't compile with elisp threading support])
AC_ARG_WITH([file-notification],[AS_HELP_STRING([--with-file-notification=LIB],
[use a file notification library (LIB one of: yes, gfile, inotify, w32, no)])],
AC_CHECK_LIB(pthreads, cma_open)
+AC_MSG_CHECKING([for thread support])
+threads_enabled=no
+if test "$with_threads" = yes; then
+ if test "$HAVE_PTHREAD" = yes; then
+ AC_DEFINE(THREADS_ENABLED, 1,
+ [Define to 1 if you want elisp thread support.])
+ threads_enabled=yes
+ fi
+fi
+AC_MSG_RESULT([$threads_enabled])
+
## Note: when using cpp in s/aix4.2.h, this definition depended on
## HAVE_LIBPTHREADS. That was not defined earlier in configure when
## the system file was sourced. Hence the value of LIBS_SYSTEM
echo " Does Emacs directly use zlib? ${HAVE_ZLIB}"
echo " Does Emacs use toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}"
+echo " Does Emacs have threading support in elisp? ${threads_enabled}"
echo
if test -n "${EMACSDATA}"; then
/* System thread definitions
- Copyright (C) 2012 Free Software Foundation, Inc.
+ Copyright (C) 2012, 2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <setjmp.h>
#include "lisp.h"
-#ifdef HAVE_PTHREAD
+#ifndef THREADS_ENABLED
+
+void
+sys_mutex_init (sys_mutex_t *m)
+{
+ *m = 0;
+}
+
+void
+sys_mutex_lock (sys_mutex_t *m)
+{
+}
+
+void
+sys_mutex_unlock (sys_mutex_t *m)
+{
+}
+
+void
+sys_mutex_destroy (sys_mutex_t *m)
+{
+}
+
+void
+sys_cond_init (sys_cond_t *c)
+{
+ *c = 0;
+}
+
+void
+sys_cond_wait (sys_cond_t *c, sys_mutex_t *m)
+{
+}
+
+void
+sys_cond_signal (sys_cond_t *c)
+{
+}
+
+void
+sys_cond_broadcast (sys_cond_t *c)
+{
+}
+
+void
+sys_cond_destroy (sys_cond_t *c)
+{
+}
+
+sys_thread_t
+sys_thread_self (void)
+{
+ return 0;
+}
+
+int
+sys_thread_equal (sys_thread_t x, sys_thread_t y)
+{
+ return x == y;
+}
+
+int
+sys_thread_create (sys_thread_t *t, const char *name,
+ thread_creation_function *func, void *datum)
+{
+ return 0;
+}
+
+void
+sys_thread_yield (void)
+{
+}
+
+#elif defined (HAVE_PTHREAD)
#include <sched.h>
/* System thread definitions
- Copyright (C) 2012 Free Software Foundation, Inc.
+ Copyright (C) 2012, 2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#ifndef SYSTHREAD_H
#define SYSTHREAD_H
+#ifdef THREADS_ENABLED
+
#ifdef HAVE_PTHREAD
#include <pthread.h>
/* A system thread. */
typedef pthread_t sys_thread_t;
-#else
+#else /* HAVE_PTHREAD */
#error port me
-#endif
+#endif /* HAVE_PTHREAD */
+
+#else /* THREADS_ENABLED */
+
+/* For the no-threads case we can simply use dummy definitions. */
+typedef int sys_mutex_t;
+typedef int sys_cond_t;
+typedef int sys_thread_t;
+
+#endif /* THREADS_ENABLED */
typedef void *(thread_creation_function) (void *);
void
syms_of_threads (void)
{
- defsubr (&Sthread_yield);
- defsubr (&Smake_thread);
- defsubr (&Scurrent_thread);
- defsubr (&Sthread_name);
- defsubr (&Sthread_signal);
- defsubr (&Sthread_alive_p);
- defsubr (&Sthread_join);
- defsubr (&Sthread_blocker);
- defsubr (&Sall_threads);
- defsubr (&Smake_mutex);
- defsubr (&Smutex_lock);
- defsubr (&Smutex_unlock);
- defsubr (&Smutex_name);
- defsubr (&Smake_condition_variable);
- defsubr (&Scondition_wait);
- defsubr (&Scondition_notify);
- defsubr (&Scondition_mutex);
- defsubr (&Scondition_name);
+#ifndef THREADS_ENABLED
+ if (0)
+#endif
+ {
+ defsubr (&Sthread_yield);
+ defsubr (&Smake_thread);
+ defsubr (&Scurrent_thread);
+ defsubr (&Sthread_name);
+ defsubr (&Sthread_signal);
+ defsubr (&Sthread_alive_p);
+ defsubr (&Sthread_join);
+ defsubr (&Sthread_blocker);
+ defsubr (&Sall_threads);
+ defsubr (&Smake_mutex);
+ defsubr (&Smutex_lock);
+ defsubr (&Smutex_unlock);
+ defsubr (&Smutex_name);
+ defsubr (&Smake_condition_variable);
+ defsubr (&Scondition_wait);
+ defsubr (&Scondition_notify);
+ defsubr (&Scondition_mutex);
+ defsubr (&Scondition_name);
+ }
Qthreadp = intern_c_string ("threadp");
staticpro (&Qthreadp);