File: pthread.m4

package info (click to toggle)
doodle 0.7.0-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,680 kB
  • ctags: 685
  • sloc: sh: 10,839; ansic: 7,793; java: 152; makefile: 142; sed: 16
file content (60 lines) | stat: -rw-r--r-- 1,288 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# See: http://gcc.gnu.org/ml/gcc/2000-05/msg01141.html
AC_DEFUN([CHECK_PTHREAD],
[
	AC_CHECK_LIB(pthread,pthread_create,
	[
		PTHREAD_CPPFLAGS=
		PTHREAD_LDFLAGS=
		PTHREAD_LIBS=-lpthread
	],[
		AC_MSG_CHECKING(if compiler supports -pthread)
		save_CPPFLAGS="$CPPFLAGS"
		CPPFLAGS="$CPPFLAGS -pthread"
		AC_TRY_LINK(
		[
			#include <pthread.h>
		],[
			pthread_create(0,0,0,0);
		],[
			AC_MSG_RESULT(yes)
			PTHREAD_CPPFLAGS=-pthread
			PTHREAD_LDFLAGS=-pthread
			PTHREAD_LIBS=
		],[
			AC_MSG_RESULT(no)
			AC_MSG_CHECKING(if compiler supports -pthreads)
			save_CPPFLAGS="$CPPFLAGS"
			CPPFLAGS="$save_CPPFLAGS -pthreads"
			AC_TRY_LINK(
			[
				#include <pthread.h>
			],[
				pthread_create(0,0,0,0);
			],[
				AC_MSG_RESULT(yes)
				PTHREAD_CPPFLAGS=-pthreads
				PTHREAD_LDFLAGS=-pthreads
				PTHREAD_LIBS=
			],[
				AC_MSG_RESULT(no)
				AC_MSG_CHECKING(if compiler supports -threads)
				save_CPPFLAGS="$CPPFLAGS"
				CPPFLAGS="$save_CPPFLAGS -threads"
				AC_TRY_LINK(
				[
					#include <pthread.h>
				],[
					pthread_create(0,0,0,0);
				],[
					AC_MSG_RESULT(yes)
					PTHREAD_CPPFLAGS=-threads
					PTHREAD_LDFLAGS=-threads
					PTHREAD_LIBS=
				],[
					AC_MSG_ERROR([Your system is not supporting pthreads!])
				])
			])
		])
		CPPFLAGS="$save_CPPFLAGS"
	])
])