Add a --enable-pthread option to activate experimental threading code

* NEWS, README, doc/org/compile.org: Mention the option and
its effect on compilation requirements.
* configure.ac: Add the --enable-pthread option, and ENABLE_PTHREAD
macro.
* doc/org/g++wrap.in, spot/Makefile.am, spot/libspot.pc.in: Compile
with -pthread conditionally.
* spot/graph/graph.hh, spot/twa/twagraph.cc: Adjust the code to not
use thread-local variables, and let the pthread code be optional.
* .gitlab-ci.yml: Activate --enable-pthread in two configurations.
This commit is contained in:
Alexandre Duret-Lutz 2022-06-16 23:43:50 +02:00
parent 721d5695ec
commit 23908f3d2f
10 changed files with 79 additions and 32 deletions

View file

@ -53,6 +53,15 @@ AC_ARG_ENABLE([c++20],
[Compile in C++20 mode.])],
[enable_20=$enableval], [enable_20=no])
AC_ARG_ENABLE([pthread],
[AS_HELP_STRING([--enable-pthread],
[Allow libspot to use POSIX threads.])],
[enable_pthread=$enableval], [enable_pthread=no])
if test "$enable_pthread" = yes; then
AC_DEFINE([ENABLE_PTHREAD], [1], [Whether Spot is compiled with -pthread.])
AC_SUBST([LIBSPOT_PTHREAD], [-pthread])
fi
AC_ARG_ENABLE([doxygen],
[AS_HELP_STRING([--enable-doxygen],
[enable generation of Doxygen documentation (requires Doxygen)])],
@ -150,7 +159,7 @@ AX_CHECK_BUDDY
AC_CHECK_FUNCS([times kill alarm sigaction sched_getcpu])
oLIBS=$LIBS
LIBS="$LIBS -lpthread"
LIBS="$LIBS -pthread"
AC_CHECK_FUNCS([pthread_setaffinity_np])
LIBS=$oLIBS