diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2014-02-26 17:55:08 +0000 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2014-02-26 17:55:08 +0000 |
commit | 070cbae02dd3bd0e968a6c300369184074b4b340 (patch) | |
tree | 117b4ef895cd151facc45d112d641eedb8227224 /acinclude.m4 | |
parent | 10885877079c17e5108037df03f7c22ef8e68b89 (diff) | |
download | libmicrohttpd-070cbae02dd3bd0e968a6c300369184074b4b340.tar.gz libmicrohttpd-070cbae02dd3bd0e968a6c300369184074b4b340.zip |
Check for pthread support with autoconf archive macro
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 9c94dfc3..8b137891 100644 --- a/acinclude.m4 +++ b/acinclude.m4 | |||
@@ -1,75 +1 @@ | |||
1 | # See: http://gcc.gnu.org/ml/gcc/2000-05/msg01141.html | ||
2 | AC_DEFUN([CHECK_PTHREAD], | ||
3 | [ | ||
4 | # first try without -pthread | ||
5 | AC_TRY_LINK( | ||
6 | [ | ||
7 | #include <pthread.h> | ||
8 | ],[ | ||
9 | pthread_create(0,0,0,0); | ||
10 | ],[ | ||
11 | AC_MSG_RESULT(yes) | ||
12 | PTHREAD_CPPFLAGS= | ||
13 | PTHREAD_LDFLAGS= | ||
14 | PTHREAD_LIBS= | ||
15 | ],[ | ||
16 | |||
17 | # now with -pthread | ||
18 | AC_CHECK_LIB(pthread,pthread_create, | ||
19 | [ | ||
20 | PTHREAD_CPPFLAGS= | ||
21 | PTHREAD_LDFLAGS= | ||
22 | PTHREAD_LIBS=-lpthread | ||
23 | ],[ | ||
24 | AC_MSG_CHECKING(if compiler supports -pthread) | ||
25 | save_CPPFLAGS="$CPPFLAGS" | ||
26 | CPPFLAGS="$CPPFLAGS -pthread" | ||
27 | AC_TRY_LINK( | ||
28 | [ | ||
29 | #include <pthread.h> | ||
30 | ],[ | ||
31 | pthread_create(0,0,0,0); | ||
32 | ],[ | ||
33 | AC_MSG_RESULT(yes) | ||
34 | PTHREAD_CPPFLAGS=-pthread | ||
35 | PTHREAD_LDFLAGS=-pthread | ||
36 | PTHREAD_LIBS= | ||
37 | ],[ | ||
38 | AC_MSG_RESULT(no) | ||
39 | AC_MSG_CHECKING(if compiler supports -pthreads) | ||
40 | save_CPPFLAGS="$CPPFLAGS" | ||
41 | CPPFLAGS="$save_CPPFLAGS -pthreads" | ||
42 | AC_TRY_LINK( | ||
43 | [ | ||
44 | #include <pthread.h> | ||
45 | ],[ | ||
46 | pthread_create(0,0,0,0); | ||
47 | ],[ | ||
48 | AC_MSG_RESULT(yes) | ||
49 | PTHREAD_CPPFLAGS=-pthreads | ||
50 | PTHREAD_LDFLAGS=-pthreads | ||
51 | PTHREAD_LIBS= | ||
52 | ],[ | ||
53 | AC_MSG_RESULT(no) | ||
54 | AC_MSG_CHECKING(if compiler supports -threads) | ||
55 | save_CPPFLAGS="$CPPFLAGS" | ||
56 | CPPFLAGS="$save_CPPFLAGS -threads" | ||
57 | AC_TRY_LINK( | ||
58 | [ | ||
59 | #include <pthread.h> | ||
60 | ],[ | ||
61 | pthread_create(0,0,0,0); | ||
62 | ],[ | ||
63 | AC_MSG_RESULT(yes) | ||
64 | PTHREAD_CPPFLAGS=-threads | ||
65 | PTHREAD_LDFLAGS=-threads | ||
66 | PTHREAD_LIBS= | ||
67 | ],[ | ||
68 | AC_MSG_ERROR([Your system is not supporting pthreads!]) | ||
69 | ]) | ||
70 | ]) | ||
71 | ]) | ||
72 | CPPFLAGS="$save_CPPFLAGS" | ||
73 | ]) | ||
74 | ]) | ||
75 | ]) | ||