ObjFW  Diff

Differences From Artifact [77b93dd29a]:

To Artifact [1833208dd2]:


522
523
524
525
526
527
528


529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568



























569
570
571
572
573
574
575
		AC_CHECK_FUNCS(dladdr)
		;;
esac

AC_ARG_ENABLE(threads,
	AS_HELP_STRING([--disable-threads], [disable thread support]))
AS_IF([test x"$enable_threads" != x"no"], [


	case "$host_os" in
	mingw*)
		AC_MSG_CHECKING(for threads)
		AC_MSG_RESULT(WinAPI)
		;;
	*)
		ACX_PTHREAD([
			CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS"
			LIBS="$LIBS $PTHREAD_LIBS"
			AC_DEFINE(OF_HAVE_PTHREADS, 1,
				[Whether we have pthreads])

			AC_TRY_COMPILE([
				#include <pthread.h>
			], [
				pthread_mutexattr_t attr;
				pthread_mutexattr_settype(&attr,
				    PTHREAD_MUTEX_RECURSIVE);
			], [
				AC_DEFINE(OF_HAVE_RECURSIVE_PTHREAD_MUTEXES, 1,
					[If pthread mutexes can be recursive])
			])

			AC_CHECK_FUNC(pthread_spin_lock, [
				have_spinlocks="yes"
				AC_DEFINE(OF_HAVE_PTHREAD_SPINLOCKS, 1,
					[Whether we have pthread spinlocks])
			])

			AC_CHECK_FUNC(sched_yield, [
				AC_DEFINE(OF_HAVE_SCHED_YIELD, 1,
					[Whether we have sched_yield()])
			])

			AC_CHECK_HEADERS(pthread_np.h)
			AC_CHECK_FUNCS(pthread_set_name_np pthread_setname_np,
				break)
		], [
			AC_MSG_ERROR(No supported threads found!)
		])



























		;;
	esac

	AC_DEFINE(OF_HAVE_THREADS, 1, [Whether we have threads])
	AC_SUBST(USE_SRCS_THREADS, '${SRCS_THREADS}')

	AC_ARG_ENABLE(compiler-tls,







>
>


<



|
<
<
<
<

|
|
|
<
<
|
<
<
<
|

|
<
|
<
<
|
<
<
<
|
|
<
<
<
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







522
523
524
525
526
527
528
529
530
531
532

533
534
535
536




537
538
539
540


541



542
543
544

545


546



547
548



549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
		AC_CHECK_FUNCS(dladdr)
		;;
esac

AC_ARG_ENABLE(threads,
	AS_HELP_STRING([--disable-threads], [disable thread support]))
AS_IF([test x"$enable_threads" != x"no"], [
	AC_MSG_CHECKING(for threads)

	case "$host_os" in
	mingw*)

		AC_MSG_RESULT(WinAPI)
		;;
	*)
		AC_MSG_RESULT(POSIX)





		AX_CHECK_COMPILER_FLAGS(-pthread, [
			CPPFLAGS="$CPPFLAGS -pthread"
		], [


			CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_THREAD_SAFE"



		])

		LIBS="$LIBS -lpthread"

		AC_TRY_LINK([


			#include <pthread.h>



		], [
			pthread_create(NULL, NULL, NULL, NULL);



		], [], [
			AC_MSG_ERROR(No supported threads found!)
		])

		AC_DEFINE(OF_HAVE_PTHREADS, 1, [Whether we have pthreads])

		AC_TRY_COMPILE([
			#include <pthread.h>
		], [
			pthread_mutexattr_t attr;
			pthread_mutexattr_settype(&attr,
			    PTHREAD_MUTEX_RECURSIVE);
		], [
			AC_DEFINE(OF_HAVE_RECURSIVE_PTHREAD_MUTEXES, 1,
				[If pthread mutexes can be recursive])
		])

		AC_CHECK_FUNC(pthread_spin_lock, [
			have_spinlocks="yes"
			AC_DEFINE(OF_HAVE_PTHREAD_SPINLOCKS, 1,
				[Whether we have pthread spinlocks])
		])

		AC_CHECK_FUNC(sched_yield, [
			AC_DEFINE(OF_HAVE_SCHED_YIELD, 1,
				[Whether we have sched_yield()])
		])

		AC_CHECK_HEADERS(pthread_np.h)
		AC_CHECK_FUNCS(pthread_set_name_np pthread_setname_np, break)
		;;
	esac

	AC_DEFINE(OF_HAVE_THREADS, 1, [Whether we have threads])
	AC_SUBST(USE_SRCS_THREADS, '${SRCS_THREADS}')

	AC_ARG_ENABLE(compiler-tls,