[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] emacs-25 dynamic modules support not compiling on FreeBSD 10.x

From: Ashish SHUKLA
Subject: [PATCH] emacs-25 dynamic modules support not compiling on FreeBSD 10.x
Date: Tue, 15 Dec 2015 20:29:39 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (amd64-portbld-freebsd10.2)


Due to C11 threads.h check in configure, we get HAVE_THREADS_H defined in
config.h, which results in thrd_current getting invoked in `module_init' as
shown below:

--8<---------------cut here---------------start------------->8---
1123 void
1124 module_init (void)
1125 {
1126   /* It is not guaranteed that dynamic initializers run in the main thread,
1127      therefore detect the main thread here.  */
1128 #ifdef HAVE_THREADS_H
1129   main_thread = thrd_current ();
1130 #elif defined HAVE_PTHREAD
1131   main_thread = pthread_self ();
1132 #elif defined WINDOWSNT
1133   /* The 'main' function already recorded the main thread's thread ID,
1134      so we need just to use it . */
1135   main_thread = dwMainThreadId;
1136 #endif
1137 }
--8<---------------cut here---------------end--------------->8---

thrd_current(3)[1] on FreeBSD 10.x requires -lstdthreads to be included in
libraries, or you'll get linker error about missing `thrd_current'.

Attached diff (w.r.t. 0ad27a5a) fixes this on FreeBSD 10.x, but needs to be
rewritten to be portable.

--8<---------------cut here---------------start------------->8---
--- configure.ac.orig
+++ configure.ac
@@ -2204,7 +2204,7 @@
-     for emacs_pthread_lib in 'none needed' -lpthread; do
+     for emacs_pthread_lib in 'none needed' '-lpthread -lstdthreads'; do
        case $emacs_pthread_lib in
         -*) LIBS="$OLD_LIBS $emacs_pthread_lib";;
--8<---------------cut here---------------end--------------->8---

[1]  https://www.freebsd.org/cgi/man.cgi?query=thrd_current


“If we live, we live; if we die, we die; if we suffer, we suffer; if we are
terrified, we are terrified. No problem.” (Alan Watts)

Sent from my Emacs

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]