1 | AC_DEFUN([AX_LIB_ARBDB], |
---|
2 | [ |
---|
3 | AH_TEMPLATE([HAVE_ARB], [Defined to 1 if ARB libraries are present]) |
---|
4 | # Check for dynamic libraries |
---|
5 | |
---|
6 | AC_ARG_WITH([arbhome], |
---|
7 | AC_HELP_STRING( |
---|
8 | [--with-arbhome=<PATH>], |
---|
9 | [point to ARBHOME] |
---|
10 | ), |
---|
11 | [ |
---|
12 | if test x"$withval" = x"no"; then |
---|
13 | WANT_ARB="no" |
---|
14 | elif test x"$withval" = "yes"; then |
---|
15 | WANT_ARB="yes" |
---|
16 | ax_arb_path="" |
---|
17 | else |
---|
18 | WANT_ARB="yes" |
---|
19 | ax_arb_path="$withval" |
---|
20 | fi |
---|
21 | ], |
---|
22 | [WANT_ARB="yes"] |
---|
23 | ) |
---|
24 | |
---|
25 | ARB_CPPFLAGS="" |
---|
26 | ARB_LDFLAGS="" |
---|
27 | ARB_LIBS="" |
---|
28 | success="no" |
---|
29 | if test x"$WANT_ARB" = x"yes"; then |
---|
30 | if test x"$GLIB_LIBS" = x""; then |
---|
31 | PKG_CHECK_MODULES([GLIB], [glib-2.0 > 2.2]) |
---|
32 | fi |
---|
33 | if test x"$ax_arb_path" == x""; then |
---|
34 | AC_MSG_CHECKING([for location of ARB headers]) |
---|
35 | for ax_arb_path_tmp in $ax_arb_path $ARBHOME /usr/lib/arb; do |
---|
36 | if test -f "$ax_arb_path_tmp/INCLUDE/arbdb.h" \ |
---|
37 | && test -r "$ax_arb_path_tmp/INCLUDE/arbdb.h"; then |
---|
38 | ax_arb_path="$ax_arb_path_tmp" |
---|
39 | break |
---|
40 | fi |
---|
41 | done |
---|
42 | if test -n "$ax_arb_path"; then |
---|
43 | AC_MSG_RESULT([$ax_arb_path]) |
---|
44 | success="yes" |
---|
45 | else |
---|
46 | AC_MSG_RESULT([not found]) |
---|
47 | success="no" |
---|
48 | fi |
---|
49 | fi |
---|
50 | if test x"$ax_arb_path" != x""; then |
---|
51 | saved_CPPFLAGS="$CPPFLAGS" |
---|
52 | CPPFLAGS="$CPPFLAGS -I$ax_arb_path/INCLUDE $GLIB_CFLAGS" |
---|
53 | AC_CHECK_HEADER([arbdb.h], [ |
---|
54 | ax_arb_cppflags="-I$ax_arb_path/INCLUDE $GLIB_CFLAGS" |
---|
55 | success="yes" |
---|
56 | ],[ |
---|
57 | success="no" |
---|
58 | ]) |
---|
59 | CPPFLAGS="$saved_CPPFLAGS" |
---|
60 | fi |
---|
61 | fi |
---|
62 | |
---|
63 | if test x"$success" = x"yes"; then |
---|
64 | AC_MSG_CHECKING([for libARBDB location]) |
---|
65 | |
---|
66 | ax_arb_lib_path= |
---|
67 | for thelibext in so dylib; do |
---|
68 | for ax_arb_lib_path_tmp in $ax_arb_path/lib /usr/lib/arb/lib; do |
---|
69 | if test -f "$ax_arb_lib_path_tmp/libARBDB.$thelibext" \ |
---|
70 | && test -r "$ax_arb_lib_path_tmp/libARBDB.$thelibext"; then |
---|
71 | ax_arb_lib_path="$ax_arb_lib_path_tmp" |
---|
72 | break |
---|
73 | fi |
---|
74 | if test -f "$ax_arb_lib_path_tmp/libARBDB.$thelibext" \ |
---|
75 | && test -r "$ax_arb_lib_path_tmp/libARBDB.$thelibext"; then |
---|
76 | ax_arb_lib_path="$ax_arb_lib_path_tmp" |
---|
77 | break |
---|
78 | fi |
---|
79 | done |
---|
80 | done |
---|
81 | if test -n "$ax_arb_lib_path"; then |
---|
82 | AC_MSG_RESULT([$ax_arb_lib_path]) |
---|
83 | success="yes" |
---|
84 | else |
---|
85 | AC_MSG_RESULT([not found]) |
---|
86 | success="no" |
---|
87 | fi |
---|
88 | fi |
---|
89 | |
---|
90 | if test x"$success" = x"yes"; then |
---|
91 | AC_MSG_CHECKING([for GB_open in -lARBDB]) |
---|
92 | saved_CPPFLAGS="$CPPFLAGS" |
---|
93 | saved_LIBS="$LIBS" |
---|
94 | saved_LDFLAGS="$LDFLAGS" |
---|
95 | |
---|
96 | ax_arb_ldflags="-L$ax_arb_lib_path -Wl,-rpath -Wl,$ax_arb_lib_path" |
---|
97 | ax_arb_libs="-lARBDB -lCORE $GLIB_LIBS" |
---|
98 | |
---|
99 | CPPFLAGS="$CPPFLAGS $ax_arb_cppflags" |
---|
100 | LIBS="$LIBS $ax_arb_libs" |
---|
101 | LDFLAGS="$LDFLAGS $ax_arb_ldflags" |
---|
102 | |
---|
103 | AC_LANG_PUSH(C++) |
---|
104 | AC_LINK_IFELSE([ |
---|
105 | AC_LANG_PROGRAM([[ |
---|
106 | #include <arbdb.h> |
---|
107 | ]], [[ |
---|
108 | GB_open("",""); |
---|
109 | ]]) |
---|
110 | ],[ |
---|
111 | AC_MSG_RESULT([yes]) |
---|
112 | success="yes" |
---|
113 | ],[ |
---|
114 | AC_MSG_RESULT([not found]) |
---|
115 | success="no" |
---|
116 | ]) |
---|
117 | AC_LANG_POP(C++) |
---|
118 | |
---|
119 | LIBS="$saved_LIBS" |
---|
120 | CPPFLAGS="$saved_CPPFLAGS" |
---|
121 | LDFLAGS="$saved_LDFLAGS" |
---|
122 | fi |
---|
123 | |
---|
124 | if test x"$success" == x"yes"; then |
---|
125 | ARB_CPPFLAGS="$ax_arb_cppflags" |
---|
126 | ARB_LDFLAGS="$ax_arb_ldflags" |
---|
127 | ARB_LIBS="$ax_arb_libs" |
---|
128 | ARBHOME="$ax_arb_path" |
---|
129 | AC_SUBST(ARB_CPPFLAGS) |
---|
130 | AC_SUBST(ARB_LDFLAGS) |
---|
131 | AC_SUBST(ARB_LIBS) |
---|
132 | AC_SUBST(ARBHOME) |
---|
133 | AC_DEFINE(HAVE_ARB) |
---|
134 | fi |
---|
135 | ]) |
---|
136 | |
---|
137 | |
---|
138 | ### Check for a function in ARB |
---|
139 | # Since ARB exports as C++, the full synopsis is needed. |
---|
140 | # => Provide HAVE_xxx name in first argument and function in second argument |
---|
141 | AC_DEFUN([AX_ARB_CHECK_FUNC], |
---|
142 | [ |
---|
143 | AC_REQUIRE([AX_LIB_ARBDB]) |
---|
144 | AH_TEMPLATE([HAVE_$1]) |
---|
145 | |
---|
146 | AC_MSG_CHECKING([for $1 in libARBDB]) |
---|
147 | |
---|
148 | saved_CPPFLAGS="$CPPFLAGS" |
---|
149 | saved_LIBS="$LIBS" |
---|
150 | saved_LDFLAGS="$LDFLAGS" |
---|
151 | |
---|
152 | CPPFLAGS="$CPPFLAGS $ARB_CPPFLAGS" |
---|
153 | LIBS="$LIBS $ARB_LIBS" |
---|
154 | LDFLAGS="$LDFLAGS $ARB_LDFLAGS" |
---|
155 | |
---|
156 | AC_LANG_PUSH(C++) |
---|
157 | AC_LINK_IFELSE([ |
---|
158 | AC_LANG_PROGRAM([[ |
---|
159 | #include <arbdbt.h> |
---|
160 | ]], [[ |
---|
161 | $2; |
---|
162 | ]]) |
---|
163 | ],[ |
---|
164 | AC_MSG_RESULT([yes]) |
---|
165 | AC_DEFINE(HAVE_$1) |
---|
166 | ],[ |
---|
167 | AC_MSG_RESULT([no]) |
---|
168 | ]) |
---|
169 | AC_LANG_POP(C++) |
---|
170 | |
---|
171 | LIBS="$saved_LIBS" |
---|
172 | CPPFLAGS="$saved_CPPFLAGS" |
---|
173 | LDFLAGS="$saved_LDFLAGS" |
---|
174 | ]) |
---|
175 | |
---|
176 | ### Check for static PT server interface lib |
---|
177 | AC_DEFUN([AX_LIB_ARB_PROBE], |
---|
178 | [ |
---|
179 | AC_REQUIRE([AX_LIB_ARBDB]) |
---|
180 | AH_TEMPLATE([HAVE_ARB_PROBE], [], [Defined to 1 if ARB PROBE_COM is present]) |
---|
181 | |
---|
182 | AC_MSG_CHECKING([for ARB PROBE_COM]) |
---|
183 | if test -f "$ARBHOME/PROBE_COM/client.a" \ |
---|
184 | && test -r "$ARBHOME"; then |
---|
185 | AC_MSG_RESULT([found]) |
---|
186 | success="yes" |
---|
187 | else |
---|
188 | AC_MSG_RESULT([not found]) |
---|
189 | success="no" |
---|
190 | fi |
---|
191 | |
---|
192 | if test x"$success" = x"yes"; then |
---|
193 | AC_MSG_CHECKING([for aisc_open in ARB PROBE_COM]) |
---|
194 | AC_LANG_PUSH(C++) |
---|
195 | |
---|
196 | AC_LANG_CONFTEST([AC_LANG_PROGRAM([[ |
---|
197 | #include "PT_com.h" |
---|
198 | #include "client.h" |
---|
199 | ]],[[ |
---|
200 | T_PT_MAIN main; |
---|
201 | GB_ERROR err; |
---|
202 | aisc_open("", main, AISC_MAGIC_NUMBER, &err); |
---|
203 | ]])]) |
---|
204 | |
---|
205 | saved_CPPFLAGS="$CPPFLAGS" |
---|
206 | saved_LDFLAGS="$LDFLAGS" |
---|
207 | saved_LIBS="$LIBS" |
---|
208 | |
---|
209 | CPPFLAGS="$CPPFLAGS $ARB_CPPFLAGS" |
---|
210 | LDFLAGS="$LDFLAGS $ARB_LDFLAGS" |
---|
211 | |
---|
212 | ax_arb_probe_libs="" |
---|
213 | for common in '' "$ARBHOME/PROBE_COM/common.a"; do |
---|
214 | ax_arb_probe_libs_tmp="$ARBHOME/PROBE_COM/client.a $common $ARB_LIBS" |
---|
215 | LIBS="$saved_LIBS $ax_arb_probe_libs_tmp" |
---|
216 | AC_LINK_IFELSE([], [ |
---|
217 | ax_arb_probe_libs="$ax_arb_probe_libs_tmp" |
---|
218 | break |
---|
219 | ]) |
---|
220 | done |
---|
221 | |
---|
222 | LIBS="$saved_LIBS" |
---|
223 | CPPFLAGS="$saved_CPPFLAGS" |
---|
224 | LDFLAGS="$saved_LDFLAGS" |
---|
225 | |
---|
226 | AC_LANG_POP(C++) |
---|
227 | |
---|
228 | success="yes" |
---|
229 | if test -z "$ax_arb_probe_libs"; then |
---|
230 | AC_MSG_RESULT([no]) |
---|
231 | success="no" |
---|
232 | elif test -n "$common"; then |
---|
233 | AC_MSG_RESULT([yes]) |
---|
234 | else |
---|
235 | AC_MSG_RESULT([yes (common.a not needed)]) |
---|
236 | fi |
---|
237 | fi |
---|
238 | if test x"$success" = x"yes"; then |
---|
239 | ARB_PROBE_LIBS="$ax_arb_probe_libs" |
---|
240 | AC_SUBST(ARB_PROBE_LIBS) |
---|
241 | AC_DEFINE(HAVE_ARB_PROBE) |
---|
242 | fi |
---|
243 | ]) |
---|
244 | |
---|
245 | # Check for static HELIX interface lib |
---|
246 | AC_DEFUN([AX_LIB_ARB_HELIX], |
---|
247 | [ |
---|
248 | AC_REQUIRE([AX_LIB_ARBDB]) |
---|
249 | |
---|
250 | AH_TEMPLATE([HAVE_ARB_HELIX], [Defined to 1 if ARB SL HELIX is present]) |
---|
251 | AC_MSG_CHECKING([for ARB HELIX static lib]) |
---|
252 | |
---|
253 | saved_CPPFLAGS="$CPPFLAGS" |
---|
254 | saved_LDFLAGS="$LDFLAGS" |
---|
255 | saved_LIBS="$LIBS" |
---|
256 | |
---|
257 | CPPFLAGS="$CPPFLAGS $ARB_CPPFLAGS" |
---|
258 | LDFLAGS="$LDFLAGS $ARB_LDFLAGS" |
---|
259 | LIBS="$LIBS $ARBHOME/SL/HELIX/HELIX.a $ARB_LIBS" |
---|
260 | |
---|
261 | AC_LANG_PUSH(C++) |
---|
262 | AC_LINK_IFELSE([ |
---|
263 | AC_LANG_PROGRAM([[ |
---|
264 | #include "BI_helix.hxx" |
---|
265 | ]],[[ |
---|
266 | BI_helix h; |
---|
267 | h.init((GBDATA*)0,(const char*)0); |
---|
268 | ]]) |
---|
269 | ],[ |
---|
270 | AC_MSG_RESULT([yes]) |
---|
271 | ARB_HELIX_LIBS="$ARBHOME/SL/HELIX/HELIX.a $ARB_LIBS" |
---|
272 | AC_SUBST(ARB_HELIX_LIBS) |
---|
273 | AC_DEFINE(HAVE_ARB_HELIX) |
---|
274 | ],[ |
---|
275 | AC_MSG_RESULT([no]) |
---|
276 | ]) |
---|
277 | AC_LANG_POP(C++) |
---|
278 | |
---|
279 | LIBS="$saved_LIBS" |
---|
280 | CPPFLAGS="$saved_CPPFLAGS" |
---|
281 | LDFLAGS="$saved_LDFLAGS" |
---|
282 | ]) |
---|
283 | |
---|
284 | AC_DEFUN([AX_ARB_STATUS_RETURN_TYPE], |
---|
285 | [ |
---|
286 | AH_TEMPLATE([ARB_STATUS_RETURN_TYPE], [void or bool depending on version...]) |
---|
287 | AH_TEMPLATE([ARB_STATUS_RETURN_VALUE], ['' or true depending on RETURN_TYPE]) |
---|
288 | AC_REQUIRE([AX_LIB_ARBDB]) |
---|
289 | |
---|
290 | saved_CPPFLAGS="$CPPFLAGS" |
---|
291 | saved_LDFLAGS="$LDFLAGS" |
---|
292 | saved_LIBS="$LIBS" |
---|
293 | CPPFLAGS="$CPPFLAGS $ARB_CPPFLAGS" |
---|
294 | LDFLAGS="$LDFLAGS $ARB_LDFLAGS" |
---|
295 | LIBS="$LIBS $ARBHOME/SL/HELIX/HELIX.a $ARB_LIBS" |
---|
296 | AC_LANG_PUSH(C++) |
---|
297 | |
---|
298 | AC_CHECK_HEADER([arb_handlers.h]) |
---|
299 | AC_MSG_CHECKING([ARB status return type]) |
---|
300 | |
---|
301 | ARB_STATUS_RETURN_TYPE=error |
---|
302 | for sig in bool void; do |
---|
303 | AC_LINK_IFELSE([ |
---|
304 | AC_LANG_PROGRAM([[ |
---|
305 | #include <arb_handlers.h> |
---|
306 | ]], [[ |
---|
307 | arb_status_implementation status; |
---|
308 | $sig (*x)(const char*) = status.set_title; |
---|
309 | ]]) |
---|
310 | ],[ |
---|
311 | ARB_STATUS_RETURN_TYPE=$sig |
---|
312 | break |
---|
313 | ]) |
---|
314 | done |
---|
315 | AC_MSG_RESULT([$ARB_STATUS_RETURN_TYPE]) |
---|
316 | if test x"$ARB_STATUS_RETURN_TYPE" == x"error"; then |
---|
317 | ARB_STATUS_RETURN_TYPE= |
---|
318 | fi |
---|
319 | AC_DEFINE_UNQUOTED(ARB_STATUS_RETURN_TYPE, [$ARB_STATUS_RETURN_TYPE]) |
---|
320 | AC_SUBST(ARB_STATUS_RETURN_TYPE) |
---|
321 | |
---|
322 | if test x"$ARB_STATUS_RETURN_TYPE" == x"bool"; then |
---|
323 | ARB_STATUS_RETURN_VALUE=true |
---|
324 | else |
---|
325 | ARB_STAUTS_RETURN_VALUE= |
---|
326 | fi |
---|
327 | AC_DEFINE_UNQUOTED(ARB_STATUS_RETURN_VALUE, [$ARB_STATUS_RETURN_VALUE]) |
---|
328 | AC_SUBST(ARB_STATUS_RETURN_VALUE) |
---|
329 | |
---|
330 | AC_LANG_POP(C++) |
---|
331 | LIBS="$saved_LIBS" |
---|
332 | CPPFLAGS="$saved_CPPFLAGS" |
---|
333 | LDFLAGS="$saved_LDFLAGS" |
---|
334 | ]) |
---|
335 | |
---|
336 | |
---|