1: dnl ** Additional Autoconf tests for BIRD configure script
2: dnl ** (c) 1999 Martin Mares <mj@ucw.cz>
3:
4: AC_DEFUN([BIRD_CHECK_THREAD_LOCAL],
5: [
6: AC_CACHE_CHECK(
7: [whether _Thread_local is known],
8: [bird_cv_thread_local],
9: AC_COMPILE_IFELSE([
10: AC_LANG_PROGRAM(
11: [
12: _Thread_local static int x = 42;
13: ],
14: []
15: )
16: ],
17: [bird_cv_thread_local=yes],
18: [bird_cv_thread_local=no]
19: )
20: )
21: ])
22:
23: AC_DEFUN([BIRD_CHECK_PTHREADS],
24: [
25: bird_tmp_cflags="$CFLAGS"
26: CFLAGS="$CFLAGS -pthread"
27:
28: AC_CACHE_CHECK(
29: [whether POSIX threads are available],
30: [bird_cv_lib_pthreads],
31: [
32: AC_LINK_IFELSE(
33: [
34: AC_LANG_PROGRAM(
35: [ #include <pthread.h> ],
36: [
37: pthread_t pt;
38: pthread_create(&pt, NULL, NULL, NULL);
39: pthread_spinlock_t lock;
40: pthread_spin_lock(&lock);
41: ]
42: )
43: ],
44: [bird_cv_lib_pthreads=yes],
45: [bird_cv_lib_pthreads=no]
46: )
47: ]
48: )
49:
50: CFLAGS="$bird_tmp_cflags"
51: ])
52:
53: AC_DEFUN([BIRD_CHECK_MPLS_KERNEL],
54: [
55: AC_CACHE_CHECK(
56: [for Linux MPLS headers],
57: [bird_cv_mpls_kernel],
58: [
59: AC_COMPILE_IFELSE(
60: [
61: AC_LANG_PROGRAM(
62: [
63: #include <linux/lwtunnel.h>
64: #include <linux/netlink.h>
65: #include <linux/rtnetlink.h>
66: #include <sys/socket.h>
67: void t(int arg);
68: ],
69: [
70: t(AF_MPLS);
71: t(RTA_VIA);
72: t(RTA_NEWDST);
73: t(RTA_ENCAP_TYPE);
74: t(RTA_ENCAP);
75: struct rtvia rtvia;
76: t(LWTUNNEL_ENCAP_MPLS);
77: ]
78: )
79: ],
80: [bird_cv_mpls_kernel=yes],
81: [bird_cv_mpls_kernel=no]
82: )
83: ]
84: )
85: ])
86:
87: AC_DEFUN([BIRD_CHECK_ANDROID_GLOB],
88: [
89: AC_CACHE_CHECK(
90: [for glob.h],
91: [bird_cv_lib_glob],
92: AC_LINK_IFELSE([
93: AC_LANG_PROGRAM(
94: [
95: #include <glob.h>
96: #include <stdlib.h>
97: ],
98: [ glob(NULL, 0, NULL, NULL); ]
99: )
100: ],
101: [bird_cv_lib_glob=yes],
102: [
103: bird_tmp_libs="$LIBS"
104: LIBS="$LIBS -landroid-glob"
105: AC_LINK_IFELSE([
106: AC_LANG_PROGRAM(
107: [
108: #include <glob.h>
109: #include <stdlib.h>
110: ],
111: [ glob(NULL, 0, NULL, NULL); ]
112: )
113: ],
114: [bird_cv_lib_glob=-landroid-glob],
115: [bird_cv_lib_glob=no]
116: )
117: LIBS="$bird_tmp_libs"
118: ]
119: )
120: )
121: ])
122:
123: AC_DEFUN([BIRD_CHECK_ANDROID_LOG],
124: [
125: AC_CACHE_CHECK(
126: [for syslog lib flags],
127: [bird_cv_lib_log],
128: AC_LINK_IFELSE([
129: AC_LANG_PROGRAM(
130: [ #include <sys/syslog.h> ],
131: [ syslog(0, ""); ]
132: )
133: ],
134: [bird_cv_lib_log=yes],
135: [
136: bird_tmp_libs="$LIBS"
137: LIBS="$LIBS -llog"
138: AC_LINK_IFELSE([
139: AC_LANG_PROGRAM(
140: [ #include <sys/syslog.h> ],
141: [ syslog(0, ""); ]
142: )
143: ],
144: [bird_cv_lib_log=-llog],
145: [bird_cv_lib_log=no]
146: )
147: LIBS="$bird_tmp_libs"
148: ]
149: )
150: )
151: ])
152:
153: AC_DEFUN([BIRD_CHECK_LTO],
154: [
155: bird_tmp_cflags="$CFLAGS"
156: bird_tmp_ldflags="$LDFLAGS"
157: CFLAGS="-flto"
158: LDFLAGS="-flto=4"
159:
160: AC_CACHE_CHECK(
161: [whether link time optimizer is available],
162: [bird_cv_c_lto],
163: [
164: AC_LINK_IFELSE(
165: [AC_LANG_PROGRAM()],
166: [bird_cv_c_lto=yes],
167: [bird_cv_c_lto=no]
168: )
169: ]
170: )
171:
172: CFLAGS="$bird_tmp_cflags"
173: LDFLAGS="$bird_tmp_ldflags"
174: ])
175:
176:
177: AC_DEFUN([BIRD_CHECK_GCC_OPTION],
178: [
179: bird_tmp_cflags="$CFLAGS"
180: CFLAGS="$3 $2"
181:
182: AC_CACHE_CHECK(
183: [whether CC supports $2],
184: [$1],
185: [
186: AC_COMPILE_IFELSE(
187: [AC_LANG_PROGRAM()],
188: [$1=yes],
189: [$1=no]
190: )
191: ]
192: )
193:
194: CFLAGS="$bird_tmp_cflags"
195: ])
196:
197: AC_DEFUN([BIRD_ADD_GCC_OPTION],
198: [
199: if test "$$1" = yes ; then
200: CFLAGS="$CFLAGS $2"
201: fi
202: ])
203:
204: # BIRD_CHECK_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
205: # copied from autoconf internal _AC_PATH_PROG_FLAVOR_GNU
206: AC_DEFUN([BIRD_CHECK_PROG_FLAVOR_GNU],
207: [
208: # Check for GNU $1
209: case `"$1" --version 2>&1` in
210: *GNU*)
211: $2
212: ;;
213: m4_ifval([$3],
214: [*)
215: $3
216: ;;
217: ]
218: )
219: esac
220: ])
221:
222: AC_DEFUN([BIRD_CHECK_BISON_VERSION],
223: [
224: $1=`bison --version | ( read line; echo ${line##* } )`
225: case "$$1" in
226: 1.* | 2.0* | 2.1* | 2.2* | 2.3*)
227: AC_MSG_ERROR([Provided Bison version $$1 is too old, need at least 2.4])
228: ;;
229: 2.*)
230: bird_bison_synclines=no
231: bird_bison_enhanced_error=no
232: ;;
233: 3.* | 4.* | 5.* | 6.* | 7.* | 8.* | 9.*)
234: bird_bison_synclines=yes
235: bird_bison_enhanced_error=yes
236: ;;
237: *)
238: AC_MSG_ERROR([Couldn't parse Bison version $$1. Call the developers for help.])
239: ;;
240: esac
241: ])
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>