diff options
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 00000000..c9aa0f60 --- /dev/null +++ b/acinclude.m4 | |||
@@ -0,0 +1,60 @@ | |||
1 | # See: http://gcc.gnu.org/ml/gcc/2000-05/msg01141.html | ||
2 | AC_DEFUN([CHECK_PTHREAD], | ||
3 | [ | ||
4 | AC_CHECK_LIB(pthread,pthread_create, | ||
5 | [ | ||
6 | PTHREAD_CPPFLAGS= | ||
7 | PTHREAD_LDFLAGS= | ||
8 | PTHREAD_LIBS=-lpthread | ||
9 | ],[ | ||
10 | AC_MSG_CHECKING(if compiler supports -pthread) | ||
11 | save_CPPFLAGS="$CPPFLAGS" | ||
12 | CPPFLAGS="$CPPFLAGS -pthread" | ||
13 | AC_TRY_LINK( | ||
14 | [ | ||
15 | #include <pthread.h> | ||
16 | ],[ | ||
17 | pthread_create(0,0,0,0); | ||
18 | ],[ | ||
19 | AC_MSG_RESULT(yes) | ||
20 | PTHREAD_CPPFLAGS=-pthread | ||
21 | PTHREAD_LDFLAGS=-pthread | ||
22 | PTHREAD_LIBS= | ||
23 | ],[ | ||
24 | AC_MSG_RESULT(no) | ||
25 | AC_MSG_CHECKING(if compiler supports -pthreads) | ||
26 | save_CPPFLAGS="$CPPFLAGS" | ||
27 | CPPFLAGS="$save_CPPFLAGS -pthreads" | ||
28 | AC_TRY_LINK( | ||
29 | [ | ||
30 | #include <pthread.h> | ||
31 | ],[ | ||
32 | pthread_create(0,0,0,0); | ||
33 | ],[ | ||
34 | AC_MSG_RESULT(yes) | ||
35 | PTHREAD_CPPFLAGS=-pthreads | ||
36 | PTHREAD_LDFLAGS=-pthreads | ||
37 | PTHREAD_LIBS= | ||
38 | ],[ | ||
39 | AC_MSG_RESULT(no) | ||
40 | AC_MSG_CHECKING(if compiler supports -threads) | ||
41 | save_CPPFLAGS="$CPPFLAGS" | ||
42 | CPPFLAGS="$save_CPPFLAGS -threads" | ||
43 | AC_TRY_LINK( | ||
44 | [ | ||
45 | #include <pthread.h> | ||
46 | ],[ | ||
47 | pthread_create(0,0,0,0); | ||
48 | ],[ | ||
49 | AC_MSG_RESULT(yes) | ||
50 | PTHREAD_CPPFLAGS=-threads | ||
51 | PTHREAD_LDFLAGS=-threads | ||
52 | PTHREAD_LIBS= | ||
53 | ],[ | ||
54 | AC_MSG_ERROR([Your system is not supporting pthreads!]) | ||
55 | ]) | ||
56 | ]) | ||
57 | ]) | ||
58 | CPPFLAGS="$save_CPPFLAGS" | ||
59 | ]) | ||
60 | ]) | ||