all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs-25 dynamic modules support not compiling on FreeBSD 10.x
@ 2015-12-15 14:59 Ashish SHUKLA
  2015-12-16  7:13 ` Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: Ashish SHUKLA @ 2015-12-15 14:59 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]

Hi,

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 @@
     [emacs_cv_pthread_lib=no
      OLD_CPPFLAGS=$CPPFLAGS
      OLD_LIBS=$LIBS
-     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";;
        esac
--8<---------------cut here---------------end--------------->8---

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

HTH
-- 
Ashish SHUKLA

“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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-16 11:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-15 14:59 [PATCH] emacs-25 dynamic modules support not compiling on FreeBSD 10.x Ashish SHUKLA
2015-12-16  7:13 ` Paul Eggert
2015-12-16 11:12   ` Ashish SHUKLA

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.