]>
Commit | Line | Data |
---|---|---|
2f9bcf97 MM |
1 | dnl ** Additional Autoconf tests for BIRD configure script |
2 | dnl ** (c) 1999 Martin Mares <mj@ucw.cz> | |
3 | ||
7a855725 | 4 | AC_DEFUN([BIRD_CHECK_PTHREADS], |
1ec52253 OZ |
5 | [ |
6 | bird_tmp_cflags="$CFLAGS" | |
1ec52253 | 7 | CFLAGS="$CFLAGS -pthread" |
b81a73d1 OZ |
8 | |
9 | AC_CACHE_CHECK( | |
10 | [whether POSIX threads are available], | |
11 | [bird_cv_lib_pthreads], | |
12 | [ | |
13 | AC_LINK_IFELSE( | |
14 | [ | |
15 | AC_LANG_PROGRAM( | |
16 | [ #include <pthread.h> ], | |
17 | [ | |
18 | pthread_t pt; | |
19 | pthread_create(&pt, NULL, NULL, NULL); | |
20 | pthread_spinlock_t lock; | |
21 | pthread_spin_lock(&lock); | |
22 | ] | |
23 | ) | |
24 | ], | |
25 | [bird_cv_lib_pthreads=yes], | |
26 | [bird_cv_lib_pthreads=no] | |
27 | ) | |
28 | ] | |
29 | ) | |
1ec52253 OZ |
30 | |
31 | CFLAGS="$bird_tmp_cflags" | |
32 | ]) | |
33 | ||
6b0f5f68 MJM |
34 | AC_DEFUN([BIRD_CHECK_MPLS_KERNEL], |
35 | [ | |
36 | AC_CACHE_CHECK( | |
37 | [for Linux MPLS headers], | |
38 | [bird_cv_mpls_kernel], | |
39 | [ | |
40 | AC_COMPILE_IFELSE( | |
41 | [ | |
42 | AC_LANG_PROGRAM( | |
43 | [ | |
44 | #include <linux/lwtunnel.h> | |
45 | #include <linux/netlink.h> | |
46 | #include <linux/rtnetlink.h> | |
47 | #include <sys/socket.h> | |
48 | void t(int arg); | |
49 | ], | |
50 | [ | |
51 | t(AF_MPLS); | |
52 | t(RTA_VIA); | |
53 | t(RTA_NEWDST); | |
54 | t(RTA_ENCAP_TYPE); | |
55 | t(RTA_ENCAP); | |
56 | struct rtvia rtvia; | |
57 | t(LWTUNNEL_ENCAP_MPLS); | |
58 | ] | |
59 | ) | |
60 | ], | |
61 | [bird_cv_mpls_kernel=yes], | |
62 | [bird_cv_mpls_kernel=no] | |
63 | ) | |
64 | ] | |
65 | ) | |
66 | ]) | |
67 | ||
68 | ||
7a855725 | 69 | AC_DEFUN([BIRD_CHECK_GCC_OPTION], |
efd6d12b OZ |
70 | [ |
71 | bird_tmp_cflags="$CFLAGS" | |
efd6d12b | 72 | CFLAGS="$3 $2" |
b81a73d1 OZ |
73 | |
74 | AC_CACHE_CHECK( | |
75 | [whether CC supports $2], | |
76 | [$1], | |
77 | [ | |
78 | AC_COMPILE_IFELSE( | |
79 | [AC_LANG_PROGRAM()], | |
80 | [$1=yes], | |
81 | [$1=no] | |
82 | ) | |
83 | ] | |
84 | ) | |
efd6d12b OZ |
85 | |
86 | CFLAGS="$bird_tmp_cflags" | |
87 | ]) | |
88 | ||
7a855725 | 89 | AC_DEFUN([BIRD_ADD_GCC_OPTION], |
efd6d12b OZ |
90 | [ |
91 | if test "$$1" = yes ; then | |
92 | CFLAGS="$CFLAGS $2" | |
93 | fi | |
94 | ]) | |
b1c030b0 | 95 | |
8de11deb | 96 | # BIRD_CHECK_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE]) |
b81a73d1 | 97 | # copied from autoconf internal _AC_PATH_PROG_FLAVOR_GNU |
c253ec3a | 98 | AC_DEFUN([BIRD_CHECK_PROG_FLAVOR_GNU], |
b81a73d1 OZ |
99 | [ |
100 | # Check for GNU $1 | |
101 | case `"$1" --version 2>&1` in | |
102 | *GNU*) | |
103 | $2 | |
104 | ;; | |
105 | m4_ifval([$3], | |
106 | [*) | |
107 | $3 | |
108 | ;; | |
109 | ] | |
110 | ) | |
111 | esac | |
c253ec3a | 112 | ]) |