]> git.ipfire.org Git - thirdparty/bird.git/blob - aclocal.m4
Filter: Some people can't pronounce "postfixify" correctly. Let's try "linearize...
[thirdparty/bird.git] / aclocal.m4
1 dnl ** Additional Autoconf tests for BIRD configure script
2 dnl ** (c) 1999 Martin Mares <mj@ucw.cz>
3
4 AC_DEFUN([BIRD_CHECK_PTHREADS],
5 [
6 bird_tmp_cflags="$CFLAGS"
7 CFLAGS="$CFLAGS -pthread"
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 )
30
31 CFLAGS="$bird_tmp_cflags"
32 ])
33
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 AC_DEFUN([BIRD_CHECK_ANDROID_GLOB],
69 [
70 AC_CACHE_CHECK(
71 [for glob.h],
72 [bird_cv_lib_glob],
73 AC_LINK_IFELSE([
74 AC_LANG_PROGRAM(
75 [
76 #include <glob.h>
77 #include <stdlib.h>
78 ],
79 [ glob(NULL, 0, NULL, NULL); ]
80 )
81 ],
82 [bird_cv_lib_glob=yes],
83 [
84 bird_tmp_libs="$LIBS"
85 LIBS="$LIBS -landroid-glob"
86 AC_LINK_IFELSE([
87 AC_LANG_PROGRAM(
88 [
89 #include <glob.h>
90 #include <stdlib.h>
91 ],
92 [ glob(NULL, 0, NULL, NULL); ]
93 )
94 ],
95 [bird_cv_lib_glob=-landroid-glob],
96 [bird_cv_lib_glob=no]
97 )
98 LIBS="$bird_tmp_libs"
99 ]
100 )
101 )
102 ])
103
104 AC_DEFUN([BIRD_CHECK_ANDROID_LOG],
105 [
106 AC_CACHE_CHECK(
107 [for syslog lib flags],
108 [bird_cv_lib_log],
109 AC_LINK_IFELSE([
110 AC_LANG_PROGRAM(
111 [ #include <sys/syslog.h> ],
112 [ syslog(0, ""); ]
113 )
114 ],
115 [bird_cv_lib_log=yes],
116 [
117 bird_tmp_libs="$LIBS"
118 LIBS="$LIBS -llog"
119 AC_LINK_IFELSE([
120 AC_LANG_PROGRAM(
121 [ #include <sys/syslog.h> ],
122 [ syslog(0, ""); ]
123 )
124 ],
125 [bird_cv_lib_log=-llog],
126 [bird_cv_lib_log=no]
127 )
128 LIBS="$bird_tmp_libs"
129 ]
130 )
131 )
132 ])
133
134 AC_DEFUN([BIRD_CHECK_LTO],
135 [
136 bird_tmp_cflags="$CFLAGS"
137 bird_tmp_ldflags="$CFLAGS"
138 CFLAGS="-flto"
139 LDFLAGS="-flto"
140
141 AC_CACHE_CHECK(
142 [whether link time optimizer is available],
143 [bird_cv_c_lto],
144 [
145 AC_LINK_IFELSE(
146 [AC_LANG_PROGRAM()],
147 [bird_cv_c_lto=yes],
148 [bird_cv_c_lto=no]
149 )
150 ]
151 )
152
153 CFLAGS="$bird_tmp_cflags"
154 LDFLAGS="$bird_tmp_ldflags"
155 ])
156
157
158 AC_DEFUN([BIRD_CHECK_GCC_OPTION],
159 [
160 bird_tmp_cflags="$CFLAGS"
161 CFLAGS="$3 $2"
162
163 AC_CACHE_CHECK(
164 [whether CC supports $2],
165 [$1],
166 [
167 AC_COMPILE_IFELSE(
168 [AC_LANG_PROGRAM()],
169 [$1=yes],
170 [$1=no]
171 )
172 ]
173 )
174
175 CFLAGS="$bird_tmp_cflags"
176 ])
177
178 AC_DEFUN([BIRD_ADD_GCC_OPTION],
179 [
180 if test "$$1" = yes ; then
181 CFLAGS="$CFLAGS $2"
182 fi
183 ])
184
185 # BIRD_CHECK_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
186 # copied from autoconf internal _AC_PATH_PROG_FLAVOR_GNU
187 AC_DEFUN([BIRD_CHECK_PROG_FLAVOR_GNU],
188 [
189 # Check for GNU $1
190 case `"$1" --version 2>&1` in
191 *GNU*)
192 $2
193 ;;
194 m4_ifval([$3],
195 [*)
196 $3
197 ;;
198 ]
199 )
200 esac
201 ])
202
203 AC_DEFUN([BIRD_CHECK_BISON_VERSION],
204 [
205 $1=`bison --version | ( read line; echo ${line##* } )`
206 case "$$1" in
207 1.* | 2.0* | 2.1* | 2.2* | 2.3*)
208 AC_MSG_ERROR([Provided Bison version $$1 is too old, need at least 2.4])
209 ;;
210 2.*)
211 bird_bison_synclines=no
212 bird_bison_enhanced_error=no
213 ;;
214 3.* | 4.* | 5.* | 6.* | 7.* | 8.* | 9.*)
215 bird_bison_synclines=yes
216 bird_bison_enhanced_error=yes
217 ;;
218 *)
219 AC_MSG_ERROR([Couldn't parse Bison version $$1. Call the developers for help.])
220 ;;
221 esac
222 ])