Parent Directory | Revision Log
Initial import
1 | harbaum | 1 | dnl aclocal.m4 generated automatically by aclocal 1.4-p6 |
2 | |||
3 | dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. | ||
4 | dnl This file is free software; the Free Software Foundation | ||
5 | dnl gives unlimited permission to copy and/or distribute it, | ||
6 | dnl with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | dnl This program is distributed in the hope that it will be useful, | ||
9 | dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without | ||
10 | dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
11 | dnl PARTICULAR PURPOSE. | ||
12 | |||
13 | # lib-prefix.m4 serial 5 (gettext-0.15) | ||
14 | dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. | ||
15 | dnl This file is free software; the Free Software Foundation | ||
16 | dnl gives unlimited permission to copy and/or distribute it, | ||
17 | dnl with or without modifications, as long as this notice is preserved. | ||
18 | |||
19 | dnl From Bruno Haible. | ||
20 | |||
21 | dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and | ||
22 | dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't | ||
23 | dnl require excessive bracketing. | ||
24 | ifdef([AC_HELP_STRING], | ||
25 | [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], | ||
26 | [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) | ||
27 | |||
28 | dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed | ||
29 | dnl to access previously installed libraries. The basic assumption is that | ||
30 | dnl a user will want packages to use other packages he previously installed | ||
31 | dnl with the same --prefix option. | ||
32 | dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate | ||
33 | dnl libraries, but is otherwise very convenient. | ||
34 | AC_DEFUN([AC_LIB_PREFIX], | ||
35 | [ | ||
36 | AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) | ||
37 | AC_REQUIRE([AC_PROG_CC]) | ||
38 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
39 | AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) | ||
40 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | ||
41 | dnl By default, look in $includedir and $libdir. | ||
42 | use_additional=yes | ||
43 | AC_LIB_WITH_FINAL_PREFIX([ | ||
44 | eval additional_includedir=\"$includedir\" | ||
45 | eval additional_libdir=\"$libdir\" | ||
46 | ]) | ||
47 | AC_LIB_ARG_WITH([lib-prefix], | ||
48 | [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib | ||
49 | --without-lib-prefix don't search for libraries in includedir and libdir], | ||
50 | [ | ||
51 | if test "X$withval" = "Xno"; then | ||
52 | use_additional=no | ||
53 | else | ||
54 | if test "X$withval" = "X"; then | ||
55 | AC_LIB_WITH_FINAL_PREFIX([ | ||
56 | eval additional_includedir=\"$includedir\" | ||
57 | eval additional_libdir=\"$libdir\" | ||
58 | ]) | ||
59 | else | ||
60 | additional_includedir="$withval/include" | ||
61 | additional_libdir="$withval/$acl_libdirstem" | ||
62 | fi | ||
63 | fi | ||
64 | ]) | ||
65 | if test $use_additional = yes; then | ||
66 | dnl Potentially add $additional_includedir to $CPPFLAGS. | ||
67 | dnl But don't add it | ||
68 | dnl 1. if it's the standard /usr/include, | ||
69 | dnl 2. if it's already present in $CPPFLAGS, | ||
70 | dnl 3. if it's /usr/local/include and we are using GCC on Linux, | ||
71 | dnl 4. if it doesn't exist as a directory. | ||
72 | if test "X$additional_includedir" != "X/usr/include"; then | ||
73 | haveit= | ||
74 | for x in $CPPFLAGS; do | ||
75 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | ||
76 | if test "X$x" = "X-I$additional_includedir"; then | ||
77 | haveit=yes | ||
78 | break | ||
79 | fi | ||
80 | done | ||
81 | if test -z "$haveit"; then | ||
82 | if test "X$additional_includedir" = "X/usr/local/include"; then | ||
83 | if test -n "$GCC"; then | ||
84 | case $host_os in | ||
85 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; | ||
86 | esac | ||
87 | fi | ||
88 | fi | ||
89 | if test -z "$haveit"; then | ||
90 | if test -d "$additional_includedir"; then | ||
91 | dnl Really add $additional_includedir to $CPPFLAGS. | ||
92 | CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" | ||
93 | fi | ||
94 | fi | ||
95 | fi | ||
96 | fi | ||
97 | dnl Potentially add $additional_libdir to $LDFLAGS. | ||
98 | dnl But don't add it | ||
99 | dnl 1. if it's the standard /usr/lib, | ||
100 | dnl 2. if it's already present in $LDFLAGS, | ||
101 | dnl 3. if it's /usr/local/lib and we are using GCC on Linux, | ||
102 | dnl 4. if it doesn't exist as a directory. | ||
103 | if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then | ||
104 | haveit= | ||
105 | for x in $LDFLAGS; do | ||
106 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | ||
107 | if test "X$x" = "X-L$additional_libdir"; then | ||
108 | haveit=yes | ||
109 | break | ||
110 | fi | ||
111 | done | ||
112 | if test -z "$haveit"; then | ||
113 | if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then | ||
114 | if test -n "$GCC"; then | ||
115 | case $host_os in | ||
116 | linux*) haveit=yes;; | ||
117 | esac | ||
118 | fi | ||
119 | fi | ||
120 | if test -z "$haveit"; then | ||
121 | if test -d "$additional_libdir"; then | ||
122 | dnl Really add $additional_libdir to $LDFLAGS. | ||
123 | LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" | ||
124 | fi | ||
125 | fi | ||
126 | fi | ||
127 | fi | ||
128 | fi | ||
129 | ]) | ||
130 | |||
131 | dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, | ||
132 | dnl acl_final_exec_prefix, containing the values to which $prefix and | ||
133 | dnl $exec_prefix will expand at the end of the configure script. | ||
134 | AC_DEFUN([AC_LIB_PREPARE_PREFIX], | ||
135 | [ | ||
136 | dnl Unfortunately, prefix and exec_prefix get only finally determined | ||
137 | dnl at the end of configure. | ||
138 | if test "X$prefix" = "XNONE"; then | ||
139 | acl_final_prefix="$ac_default_prefix" | ||
140 | else | ||
141 | acl_final_prefix="$prefix" | ||
142 | fi | ||
143 | if test "X$exec_prefix" = "XNONE"; then | ||
144 | acl_final_exec_prefix='${prefix}' | ||
145 | else | ||
146 | acl_final_exec_prefix="$exec_prefix" | ||
147 | fi | ||
148 | acl_save_prefix="$prefix" | ||
149 | prefix="$acl_final_prefix" | ||
150 | eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" | ||
151 | prefix="$acl_save_prefix" | ||
152 | ]) | ||
153 | |||
154 | dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the | ||
155 | dnl variables prefix and exec_prefix bound to the values they will have | ||
156 | dnl at the end of the configure script. | ||
157 | AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], | ||
158 | [ | ||
159 | acl_save_prefix="$prefix" | ||
160 | prefix="$acl_final_prefix" | ||
161 | acl_save_exec_prefix="$exec_prefix" | ||
162 | exec_prefix="$acl_final_exec_prefix" | ||
163 | $1 | ||
164 | exec_prefix="$acl_save_exec_prefix" | ||
165 | prefix="$acl_save_prefix" | ||
166 | ]) | ||
167 | |||
168 | dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing | ||
169 | dnl the basename of the libdir, either "lib" or "lib64". | ||
170 | AC_DEFUN([AC_LIB_PREPARE_MULTILIB], | ||
171 | [ | ||
172 | dnl There is no formal standard regarding lib and lib64. The current | ||
173 | dnl practice is that on a system supporting 32-bit and 64-bit instruction | ||
174 | dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit | ||
175 | dnl libraries go under $prefix/lib. We determine the compiler's default | ||
176 | dnl mode by looking at the compiler's library search path. If at least | ||
177 | dnl of its elements ends in /lib64 or points to a directory whose absolute | ||
178 | dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the | ||
179 | dnl default, namely "lib". | ||
180 | acl_libdirstem=lib | ||
181 | searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` | ||
182 | if test -n "$searchpath"; then | ||
183 | acl_save_IFS="${IFS= }"; IFS=":" | ||
184 | for searchdir in $searchpath; do | ||
185 | if test -d "$searchdir"; then | ||
186 | case "$searchdir" in | ||
187 | */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; | ||
188 | *) searchdir=`cd "$searchdir" && pwd` | ||
189 | case "$searchdir" in | ||
190 | */lib64 ) acl_libdirstem=lib64 ;; | ||
191 | esac ;; | ||
192 | esac | ||
193 | fi | ||
194 | done | ||
195 | IFS="$acl_save_IFS" | ||
196 | fi | ||
197 | ]) | ||
198 | |||
199 | # lib-link.m4 serial 13 (gettext-0.17) | ||
200 | dnl Copyright (C) 2001-2007 Free Software Foundation, Inc. | ||
201 | dnl This file is free software; the Free Software Foundation | ||
202 | dnl gives unlimited permission to copy and/or distribute it, | ||
203 | dnl with or without modifications, as long as this notice is preserved. | ||
204 | |||
205 | dnl From Bruno Haible. | ||
206 | |||
207 | AC_PREREQ(2.54) | ||
208 | |||
209 | dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and | ||
210 | dnl the libraries corresponding to explicit and implicit dependencies. | ||
211 | dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and | ||
212 | dnl augments the CPPFLAGS variable. | ||
213 | dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname | ||
214 | dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. | ||
215 | AC_DEFUN([AC_LIB_LINKFLAGS], | ||
216 | [ | ||
217 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | ||
218 | AC_REQUIRE([AC_LIB_RPATH]) | ||
219 | define([Name],[translit([$1],[./-], [___])]) | ||
220 | define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | ||
221 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | ||
222 | AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ | ||
223 | AC_LIB_LINKFLAGS_BODY([$1], [$2]) | ||
224 | ac_cv_lib[]Name[]_libs="$LIB[]NAME" | ||
225 | ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" | ||
226 | ac_cv_lib[]Name[]_cppflags="$INC[]NAME" | ||
227 | ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" | ||
228 | ]) | ||
229 | LIB[]NAME="$ac_cv_lib[]Name[]_libs" | ||
230 | LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" | ||
231 | INC[]NAME="$ac_cv_lib[]Name[]_cppflags" | ||
232 | LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" | ||
233 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) | ||
234 | AC_SUBST([LIB]NAME) | ||
235 | AC_SUBST([LTLIB]NAME) | ||
236 | AC_SUBST([LIB]NAME[_PREFIX]) | ||
237 | dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the | ||
238 | dnl results of this search when this library appears as a dependency. | ||
239 | HAVE_LIB[]NAME=yes | ||
240 | undefine([Name]) | ||
241 | undefine([NAME]) | ||
242 | ]) | ||
243 | |||
244 | dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) | ||
245 | dnl searches for libname and the libraries corresponding to explicit and | ||
246 | dnl implicit dependencies, together with the specified include files and | ||
247 | dnl the ability to compile and link the specified testcode. If found, it | ||
248 | dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and | ||
249 | dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and | ||
250 | dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs | ||
251 | dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. | ||
252 | dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname | ||
253 | dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. | ||
254 | AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], | ||
255 | [ | ||
256 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | ||
257 | AC_REQUIRE([AC_LIB_RPATH]) | ||
258 | define([Name],[translit([$1],[./-], [___])]) | ||
259 | define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | ||
260 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | ||
261 | |||
262 | dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME | ||
263 | dnl accordingly. | ||
264 | AC_LIB_LINKFLAGS_BODY([$1], [$2]) | ||
265 | |||
266 | dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, | ||
267 | dnl because if the user has installed lib[]Name and not disabled its use | ||
268 | dnl via --without-lib[]Name-prefix, he wants to use it. | ||
269 | ac_save_CPPFLAGS="$CPPFLAGS" | ||
270 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) | ||
271 | |||
272 | AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ | ||
273 | ac_save_LIBS="$LIBS" | ||
274 | LIBS="$LIBS $LIB[]NAME" | ||
275 | AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) | ||
276 | LIBS="$ac_save_LIBS" | ||
277 | ]) | ||
278 | if test "$ac_cv_lib[]Name" = yes; then | ||
279 | HAVE_LIB[]NAME=yes | ||
280 | AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) | ||
281 | AC_MSG_CHECKING([how to link with lib[]$1]) | ||
282 | AC_MSG_RESULT([$LIB[]NAME]) | ||
283 | else | ||
284 | HAVE_LIB[]NAME=no | ||
285 | dnl If $LIB[]NAME didn't lead to a usable library, we don't need | ||
286 | dnl $INC[]NAME either. | ||
287 | CPPFLAGS="$ac_save_CPPFLAGS" | ||
288 | LIB[]NAME= | ||
289 | LTLIB[]NAME= | ||
290 | LIB[]NAME[]_PREFIX= | ||
291 | fi | ||
292 | AC_SUBST([HAVE_LIB]NAME) | ||
293 | AC_SUBST([LIB]NAME) | ||
294 | AC_SUBST([LTLIB]NAME) | ||
295 | AC_SUBST([LIB]NAME[_PREFIX]) | ||
296 | undefine([Name]) | ||
297 | undefine([NAME]) | ||
298 | ]) | ||
299 | |||
300 | dnl Determine the platform dependent parameters needed to use rpath: | ||
301 | dnl acl_libext, | ||
302 | dnl acl_shlibext, | ||
303 | dnl acl_hardcode_libdir_flag_spec, | ||
304 | dnl acl_hardcode_libdir_separator, | ||
305 | dnl acl_hardcode_direct, | ||
306 | dnl acl_hardcode_minus_L. | ||
307 | AC_DEFUN([AC_LIB_RPATH], | ||
308 | [ | ||
309 | dnl Tell automake >= 1.10 to complain if config.rpath is missing. | ||
310 | m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) | ||
311 | AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS | ||
312 | AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld | ||
313 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host | ||
314 | AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir | ||
315 | AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ | ||
316 | CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ | ||
317 | ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh | ||
318 | . ./conftest.sh | ||
319 | rm -f ./conftest.sh | ||
320 | acl_cv_rpath=done | ||
321 | ]) | ||
322 | wl="$acl_cv_wl" | ||
323 | acl_libext="$acl_cv_libext" | ||
324 | acl_shlibext="$acl_cv_shlibext" | ||
325 | acl_libname_spec="$acl_cv_libname_spec" | ||
326 | acl_library_names_spec="$acl_cv_library_names_spec" | ||
327 | acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" | ||
328 | acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" | ||
329 | acl_hardcode_direct="$acl_cv_hardcode_direct" | ||
330 | acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" | ||
331 | dnl Determine whether the user wants rpath handling at all. | ||
332 | AC_ARG_ENABLE(rpath, | ||
333 | [ --disable-rpath do not hardcode runtime library paths], | ||
334 | :, enable_rpath=yes) | ||
335 | ]) | ||
336 | |||
337 | dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and | ||
338 | dnl the libraries corresponding to explicit and implicit dependencies. | ||
339 | dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. | ||
340 | dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found | ||
341 | dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. | ||
342 | AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | ||
343 | [ | ||
344 | AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) | ||
345 | define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | ||
346 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | ||
347 | dnl Autoconf >= 2.61 supports dots in --with options. | ||
348 | define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])]) | ||
349 | dnl By default, look in $includedir and $libdir. | ||
350 | use_additional=yes | ||
351 | AC_LIB_WITH_FINAL_PREFIX([ | ||
352 | eval additional_includedir=\"$includedir\" | ||
353 | eval additional_libdir=\"$libdir\" | ||
354 | ]) | ||
355 | AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix], | ||
356 | [ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib | ||
357 | --without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and libdir], | ||
358 | [ | ||
359 | if test "X$withval" = "Xno"; then | ||
360 | use_additional=no | ||
361 | else | ||
362 | if test "X$withval" = "X"; then | ||
363 | AC_LIB_WITH_FINAL_PREFIX([ | ||
364 | eval additional_includedir=\"$includedir\" | ||
365 | eval additional_libdir=\"$libdir\" | ||
366 | ]) | ||
367 | else | ||
368 | additional_includedir="$withval/include" | ||
369 | additional_libdir="$withval/$acl_libdirstem" | ||
370 | fi | ||
371 | fi | ||
372 | ]) | ||
373 | dnl Search the library and its dependencies in $additional_libdir and | ||
374 | dnl $LDFLAGS. Using breadth-first-seach. | ||
375 | LIB[]NAME= | ||
376 | LTLIB[]NAME= | ||
377 | INC[]NAME= | ||
378 | LIB[]NAME[]_PREFIX= | ||
379 | rpathdirs= | ||
380 | ltrpathdirs= | ||
381 | names_already_handled= | ||
382 | names_next_round='$1 $2' | ||
383 | while test -n "$names_next_round"; do | ||
384 | names_this_round="$names_next_round" | ||
385 | names_next_round= | ||
386 | for name in $names_this_round; do | ||
387 | already_handled= | ||
388 | for n in $names_already_handled; do | ||
389 | if test "$n" = "$name"; then | ||
390 | already_handled=yes | ||
391 | break | ||
392 | fi | ||
393 | done | ||
394 | if test -z "$already_handled"; then | ||
395 | names_already_handled="$names_already_handled $name" | ||
396 | dnl See if it was already located by an earlier AC_LIB_LINKFLAGS | ||
397 | dnl or AC_LIB_HAVE_LINKFLAGS call. | ||
398 | uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` | ||
399 | eval value=\"\$HAVE_LIB$uppername\" | ||
400 | if test -n "$value"; then | ||
401 | if test "$value" = yes; then | ||
402 | eval value=\"\$LIB$uppername\" | ||
403 | test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" | ||
404 | eval value=\"\$LTLIB$uppername\" | ||
405 | test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" | ||
406 | else | ||
407 | dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined | ||
408 | dnl that this library doesn't exist. So just drop it. | ||
409 | : | ||
410 | fi | ||
411 | else | ||
412 | dnl Search the library lib$name in $additional_libdir and $LDFLAGS | ||
413 | dnl and the already constructed $LIBNAME/$LTLIBNAME. | ||
414 | found_dir= | ||
415 | found_la= | ||
416 | found_so= | ||
417 | found_a= | ||
418 | eval libname=\"$acl_libname_spec\" # typically: libname=lib$name | ||
419 | if test -n "$acl_shlibext"; then | ||
420 | shrext=".$acl_shlibext" # typically: shrext=.so | ||
421 | else | ||
422 | shrext= | ||
423 | fi | ||
424 | if test $use_additional = yes; then | ||
425 | dir="$additional_libdir" | ||
426 | dnl The same code as in the loop below: | ||
427 | dnl First look for a shared library. | ||
428 | if test -n "$acl_shlibext"; then | ||
429 | if test -f "$dir/$libname$shrext"; then | ||
430 | found_dir="$dir" | ||
431 | found_so="$dir/$libname$shrext" | ||
432 | else | ||
433 | if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then | ||
434 | ver=`(cd "$dir" && \ | ||
435 | for f in "$libname$shrext".*; do echo "$f"; done \ | ||
436 | | sed -e "s,^$libname$shrext\\\\.,," \ | ||
437 | | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | ||
438 | | sed 1q ) 2>/dev/null` | ||
439 | if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then | ||
440 | found_dir="$dir" | ||
441 | found_so="$dir/$libname$shrext.$ver" | ||
442 | fi | ||
443 | else | ||
444 | eval library_names=\"$acl_library_names_spec\" | ||
445 | for f in $library_names; do | ||
446 | if test -f "$dir/$f"; then | ||
447 | found_dir="$dir" | ||
448 | found_so="$dir/$f" | ||
449 | break | ||
450 | fi | ||
451 | done | ||
452 | fi | ||
453 | fi | ||
454 | fi | ||
455 | dnl Then look for a static library. | ||
456 | if test "X$found_dir" = "X"; then | ||
457 | if test -f "$dir/$libname.$acl_libext"; then | ||
458 | found_dir="$dir" | ||
459 | found_a="$dir/$libname.$acl_libext" | ||
460 | fi | ||
461 | fi | ||
462 | if test "X$found_dir" != "X"; then | ||
463 | if test -f "$dir/$libname.la"; then | ||
464 | found_la="$dir/$libname.la" | ||
465 | fi | ||
466 | fi | ||
467 | fi | ||
468 | if test "X$found_dir" = "X"; then | ||
469 | for x in $LDFLAGS $LTLIB[]NAME; do | ||
470 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | ||
471 | case "$x" in | ||
472 | -L*) | ||
473 | dir=`echo "X$x" | sed -e 's/^X-L//'` | ||
474 | dnl First look for a shared library. | ||
475 | if test -n "$acl_shlibext"; then | ||
476 | if test -f "$dir/$libname$shrext"; then | ||
477 | found_dir="$dir" | ||
478 | found_so="$dir/$libname$shrext" | ||
479 | else | ||
480 | if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then | ||
481 | ver=`(cd "$dir" && \ | ||
482 | for f in "$libname$shrext".*; do echo "$f"; done \ | ||
483 | | sed -e "s,^$libname$shrext\\\\.,," \ | ||
484 | | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | ||
485 | | sed 1q ) 2>/dev/null` | ||
486 | if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then | ||
487 | found_dir="$dir" | ||
488 | found_so="$dir/$libname$shrext.$ver" | ||
489 | fi | ||
490 | else | ||
491 | eval library_names=\"$acl_library_names_spec\" | ||
492 | for f in $library_names; do | ||
493 | if test -f "$dir/$f"; then | ||
494 | found_dir="$dir" | ||
495 | found_so="$dir/$f" | ||
496 | break | ||
497 | fi | ||
498 | done | ||
499 | fi | ||
500 | fi | ||
501 | fi | ||
502 | dnl Then look for a static library. | ||
503 | if test "X$found_dir" = "X"; then | ||
504 | if test -f "$dir/$libname.$acl_libext"; then | ||
505 | found_dir="$dir" | ||
506 | found_a="$dir/$libname.$acl_libext" | ||
507 | fi | ||
508 | fi | ||
509 | if test "X$found_dir" != "X"; then | ||
510 | if test -f "$dir/$libname.la"; then | ||
511 | found_la="$dir/$libname.la" | ||
512 | fi | ||
513 | fi | ||
514 | ;; | ||
515 | esac | ||
516 | if test "X$found_dir" != "X"; then | ||
517 | break | ||
518 | fi | ||
519 | done | ||
520 | fi | ||
521 | if test "X$found_dir" != "X"; then | ||
522 | dnl Found the library. | ||
523 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" | ||
524 | if test "X$found_so" != "X"; then | ||
525 | dnl Linking with a shared library. We attempt to hardcode its | ||
526 | dnl directory into the executable's runpath, unless it's the | ||
527 | dnl standard /usr/lib. | ||
528 | if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then | ||
529 | dnl No hardcoding is needed. | ||
530 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | ||
531 | else | ||
532 | dnl Use an explicit option to hardcode DIR into the resulting | ||
533 | dnl binary. | ||
534 | dnl Potentially add DIR to ltrpathdirs. | ||
535 | dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. | ||
536 | haveit= | ||
537 | for x in $ltrpathdirs; do | ||
538 | if test "X$x" = "X$found_dir"; then | ||
539 | haveit=yes | ||
540 | break | ||
541 | fi | ||
542 | done | ||
543 | if test -z "$haveit"; then | ||
544 | ltrpathdirs="$ltrpathdirs $found_dir" | ||
545 | fi | ||
546 | dnl The hardcoding into $LIBNAME is system dependent. | ||
547 | if test "$acl_hardcode_direct" = yes; then | ||
548 | dnl Using DIR/libNAME.so during linking hardcodes DIR into the | ||
549 | dnl resulting binary. | ||
550 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | ||
551 | else | ||
552 | if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then | ||
553 | dnl Use an explicit option to hardcode DIR into the resulting | ||
554 | dnl binary. | ||
555 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | ||
556 | dnl Potentially add DIR to rpathdirs. | ||
557 | dnl The rpathdirs will be appended to $LIBNAME at the end. | ||
558 | haveit= | ||
559 | for x in $rpathdirs; do | ||
560 | if test "X$x" = "X$found_dir"; then | ||
561 | haveit=yes | ||
562 | break | ||
563 | fi | ||
564 | done | ||
565 | if test -z "$haveit"; then | ||
566 | rpathdirs="$rpathdirs $found_dir" | ||
567 | fi | ||
568 | else | ||
569 | dnl Rely on "-L$found_dir". | ||
570 | dnl But don't add it if it's already contained in the LDFLAGS | ||
571 | dnl or the already constructed $LIBNAME | ||
572 | haveit= | ||
573 | for x in $LDFLAGS $LIB[]NAME; do | ||
574 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | ||
575 | if test "X$x" = "X-L$found_dir"; then | ||
576 | haveit=yes | ||
577 | break | ||
578 | fi | ||
579 | done | ||
580 | if test -z "$haveit"; then | ||
581 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" | ||
582 | fi | ||
583 | if test "$acl_hardcode_minus_L" != no; then | ||
584 | dnl FIXME: Not sure whether we should use | ||
585 | dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" | ||
586 | dnl here. | ||
587 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | ||
588 | else | ||
589 | dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH | ||
590 | dnl here, because this doesn't fit in flags passed to the | ||
591 | dnl compiler. So give up. No hardcoding. This affects only | ||
592 | dnl very old systems. | ||
593 | dnl FIXME: Not sure whether we should use | ||
594 | dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" | ||
595 | dnl here. | ||
596 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" | ||
597 | fi | ||
598 | fi | ||
599 | fi | ||
600 | fi | ||
601 | else | ||
602 | if test "X$found_a" != "X"; then | ||
603 | dnl Linking with a static library. | ||
604 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" | ||
605 | else | ||
606 | dnl We shouldn't come here, but anyway it's good to have a | ||
607 | dnl fallback. | ||
608 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" | ||
609 | fi | ||
610 | fi | ||
611 | dnl Assume the include files are nearby. | ||
612 | additional_includedir= | ||
613 | case "$found_dir" in | ||
614 | */$acl_libdirstem | */$acl_libdirstem/) | ||
615 | basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` | ||
616 | LIB[]NAME[]_PREFIX="$basedir" | ||
617 | additional_includedir="$basedir/include" | ||
618 | ;; | ||
619 | esac | ||
620 | if test "X$additional_includedir" != "X"; then | ||
621 | dnl Potentially add $additional_includedir to $INCNAME. | ||
622 | dnl But don't add it | ||
623 | dnl 1. if it's the standard /usr/include, | ||
624 | dnl 2. if it's /usr/local/include and we are using GCC on Linux, | ||
625 | dnl 3. if it's already present in $CPPFLAGS or the already | ||
626 | dnl constructed $INCNAME, | ||
627 | dnl 4. if it doesn't exist as a directory. | ||
628 | if test "X$additional_includedir" != "X/usr/include"; then | ||
629 | haveit= | ||
630 | if test "X$additional_includedir" = "X/usr/local/include"; then | ||
631 | if test -n "$GCC"; then | ||
632 | case $host_os in | ||
633 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; | ||
634 | esac | ||
635 | fi | ||
636 | fi | ||
637 | if test -z "$haveit"; then | ||
638 | for x in $CPPFLAGS $INC[]NAME; do | ||
639 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | ||
640 | if test "X$x" = "X-I$additional_includedir"; then | ||
641 | haveit=yes | ||
642 | break | ||
643 | fi | ||
644 | done | ||
645 | if test -z "$haveit"; then | ||
646 | if test -d "$additional_includedir"; then | ||
647 | dnl Really add $additional_includedir to $INCNAME. | ||
648 | INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" | ||
649 | fi | ||
650 | fi | ||
651 | fi | ||
652 | fi | ||
653 | fi | ||
654 | dnl Look for dependencies. | ||
655 | if test -n "$found_la"; then | ||
656 | dnl Read the .la file. It defines the variables | ||
657 | dnl dlname, library_names, old_library, dependency_libs, current, | ||
658 | dnl age, revision, installed, dlopen, dlpreopen, libdir. | ||
659 | save_libdir="$libdir" | ||
660 | case "$found_la" in | ||
661 | */* | *\\*) . "$found_la" ;; | ||
662 | *) . "./$found_la" ;; | ||
663 | esac | ||
664 | libdir="$save_libdir" | ||
665 | dnl We use only dependency_libs. | ||
666 | for dep in $dependency_libs; do | ||
667 | case "$dep" in | ||
668 | -L*) | ||
669 | additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` | ||
670 | dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. | ||
671 | dnl But don't add it | ||
672 | dnl 1. if it's the standard /usr/lib, | ||
673 | dnl 2. if it's /usr/local/lib and we are using GCC on Linux, | ||
674 | dnl 3. if it's already present in $LDFLAGS or the already | ||
675 | dnl constructed $LIBNAME, | ||
676 | dnl 4. if it doesn't exist as a directory. | ||
677 | if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then | ||
678 | haveit= | ||
679 | if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then | ||
680 | if test -n "$GCC"; then | ||
681 | case $host_os in | ||
682 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; | ||
683 | esac | ||
684 | fi | ||
685 | fi | ||
686 | if test -z "$haveit"; then | ||
687 | haveit= | ||
688 | for x in $LDFLAGS $LIB[]NAME; do | ||
689 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | ||
690 | if test "X$x" = "X-L$additional_libdir"; then | ||
691 | haveit=yes | ||
692 | break | ||
693 | fi | ||
694 | done | ||
695 | if test -z "$haveit"; then | ||
696 | if test -d "$additional_libdir"; then | ||
697 | dnl Really add $additional_libdir to $LIBNAME. | ||
698 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" | ||
699 | fi | ||
700 | fi | ||
701 | haveit= | ||
702 | for x in $LDFLAGS $LTLIB[]NAME; do | ||
703 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | ||
704 | if test "X$x" = "X-L$additional_libdir"; then | ||
705 | haveit=yes | ||
706 | break | ||
707 | fi | ||
708 | done | ||
709 | if test -z "$haveit"; then | ||
710 | if test -d "$additional_libdir"; then | ||
711 | dnl Really add $additional_libdir to $LTLIBNAME. | ||
712 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" | ||
713 | fi | ||
714 | fi | ||
715 | fi | ||
716 | fi | ||
717 | ;; | ||
718 | -R*) | ||
719 | dir=`echo "X$dep" | sed -e 's/^X-R//'` | ||
720 | if test "$enable_rpath" != no; then | ||
721 | dnl Potentially add DIR to rpathdirs. | ||
722 | dnl The rpathdirs will be appended to $LIBNAME at the end. | ||
723 | haveit= | ||
724 | for x in $rpathdirs; do | ||
725 | if test "X$x" = "X$dir"; then | ||
726 | haveit=yes | ||
727 | break | ||
728 | fi | ||
729 | done | ||
730 | if test -z "$haveit"; then | ||
731 | rpathdirs="$rpathdirs $dir" | ||
732 | fi | ||
733 | dnl Potentially add DIR to ltrpathdirs. | ||
734 | dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. | ||
735 | haveit= | ||
736 | for x in $ltrpathdirs; do | ||
737 | if test "X$x" = "X$dir"; then | ||
738 | haveit=yes | ||
739 | break | ||
740 | fi | ||
741 | done | ||
742 | if test -z "$haveit"; then | ||
743 | ltrpathdirs="$ltrpathdirs $dir" | ||
744 | fi | ||
745 | fi | ||
746 | ;; | ||
747 | -l*) | ||
748 | dnl Handle this in the next round. | ||
749 | names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` | ||
750 | ;; | ||
751 | *.la) | ||
752 | dnl Handle this in the next round. Throw away the .la's | ||
753 | dnl directory; it is already contained in a preceding -L | ||
754 | dnl option. | ||
755 | names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` | ||
756 | ;; | ||
757 | *) | ||
758 | dnl Most likely an immediate library name. | ||
759 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" | ||
760 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" | ||
761 | ;; | ||
762 | esac | ||
763 | done | ||
764 | fi | ||
765 | else | ||
766 | dnl Didn't find the library; assume it is in the system directories | ||
767 | dnl known to the linker and runtime loader. (All the system | ||
768 | dnl directories known to the linker should also be known to the | ||
769 | dnl runtime loader, otherwise the system is severely misconfigured.) | ||
770 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" | ||
771 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" | ||
772 | fi | ||
773 | fi | ||
774 | fi | ||
775 | done | ||
776 | done | ||
777 | if test "X$rpathdirs" != "X"; then | ||
778 | if test -n "$acl_hardcode_libdir_separator"; then | ||
779 | dnl Weird platform: only the last -rpath option counts, the user must | ||
780 | dnl pass all path elements in one option. We can arrange that for a | ||
781 | dnl single library, but not when more than one $LIBNAMEs are used. | ||
782 | alldirs= | ||
783 | for found_dir in $rpathdirs; do | ||
784 | alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" | ||
785 | done | ||
786 | dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. | ||
787 | acl_save_libdir="$libdir" | ||
788 | libdir="$alldirs" | ||
789 | eval flag=\"$acl_hardcode_libdir_flag_spec\" | ||
790 | libdir="$acl_save_libdir" | ||
791 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" | ||
792 | else | ||
793 | dnl The -rpath options are cumulative. | ||
794 | for found_dir in $rpathdirs; do | ||
795 | acl_save_libdir="$libdir" | ||
796 | libdir="$found_dir" | ||
797 | eval flag=\"$acl_hardcode_libdir_flag_spec\" | ||
798 | libdir="$acl_save_libdir" | ||
799 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" | ||
800 | done | ||
801 | fi | ||
802 | fi | ||
803 | if test "X$ltrpathdirs" != "X"; then | ||
804 | dnl When using libtool, the option that works for both libraries and | ||
805 | dnl executables is -R. The -R options are cumulative. | ||
806 | for found_dir in $ltrpathdirs; do | ||
807 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" | ||
808 | done | ||
809 | fi | ||
810 | ]) | ||
811 | |||
812 | dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, | ||
813 | dnl unless already present in VAR. | ||
814 | dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes | ||
815 | dnl contains two or three consecutive elements that belong together. | ||
816 | AC_DEFUN([AC_LIB_APPENDTOVAR], | ||
817 | [ | ||
818 | for element in [$2]; do | ||
819 | haveit= | ||
820 | for x in $[$1]; do | ||
821 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | ||
822 | if test "X$x" = "X$element"; then | ||
823 | haveit=yes | ||
824 | break | ||
825 | fi | ||
826 | done | ||
827 | if test -z "$haveit"; then | ||
828 | [$1]="${[$1]}${[$1]:+ }$element" | ||
829 | fi | ||
830 | done | ||
831 | ]) | ||
832 | |||
833 | dnl For those cases where a variable contains several -L and -l options | ||
834 | dnl referring to unknown libraries and directories, this macro determines the | ||
835 | dnl necessary additional linker options for the runtime path. | ||
836 | dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) | ||
837 | dnl sets LDADDVAR to linker options needed together with LIBSVALUE. | ||
838 | dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, | ||
839 | dnl otherwise linking without libtool is assumed. | ||
840 | AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], | ||
841 | [ | ||
842 | AC_REQUIRE([AC_LIB_RPATH]) | ||
843 | AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) | ||
844 | $1= | ||
845 | if test "$enable_rpath" != no; then | ||
846 | if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then | ||
847 | dnl Use an explicit option to hardcode directories into the resulting | ||
848 | dnl binary. | ||
849 | rpathdirs= | ||
850 | next= | ||
851 | for opt in $2; do | ||
852 | if test -n "$next"; then | ||
853 | dir="$next" | ||
854 | dnl No need to hardcode the standard /usr/lib. | ||
855 | if test "X$dir" != "X/usr/$acl_libdirstem"; then | ||
856 | rpathdirs="$rpathdirs $dir" | ||
857 | fi | ||
858 | next= | ||
859 | else | ||
860 | case $opt in | ||
861 | -L) next=yes ;; | ||
862 | -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` | ||
863 | dnl No need to hardcode the standard /usr/lib. | ||
864 | if test "X$dir" != "X/usr/$acl_libdirstem"; then | ||
865 | rpathdirs="$rpathdirs $dir" | ||
866 | fi | ||
867 | next= ;; | ||
868 | *) next= ;; | ||
869 | esac | ||
870 | fi | ||
871 | done | ||
872 | if test "X$rpathdirs" != "X"; then | ||
873 | if test -n ""$3""; then | ||
874 | dnl libtool is used for linking. Use -R options. | ||
875 | for dir in $rpathdirs; do | ||
876 | $1="${$1}${$1:+ }-R$dir" | ||
877 | done | ||
878 | else | ||
879 | dnl The linker is used for linking directly. | ||
880 | if test -n "$acl_hardcode_libdir_separator"; then | ||
881 | dnl Weird platform: only the last -rpath option counts, the user | ||
882 | dnl must pass all path elements in one option. | ||
883 | alldirs= | ||
884 | for dir in $rpathdirs; do | ||
885 | alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" | ||
886 | done | ||
887 | acl_save_libdir="$libdir" | ||
888 | libdir="$alldirs" | ||
889 | eval flag=\"$acl_hardcode_libdir_flag_spec\" | ||
890 | libdir="$acl_save_libdir" | ||
891 | $1="$flag" | ||
892 | else | ||
893 | dnl The -rpath options are cumulative. | ||
894 | for dir in $rpathdirs; do | ||
895 | acl_save_libdir="$libdir" | ||
896 | libdir="$dir" | ||
897 | eval flag=\"$acl_hardcode_libdir_flag_spec\" | ||
898 | libdir="$acl_save_libdir" | ||
899 | $1="${$1}${$1:+ }$flag" | ||
900 | done | ||
901 | fi | ||
902 | fi | ||
903 | fi | ||
904 | fi | ||
905 | fi | ||
906 | AC_SUBST([$1]) | ||
907 | ]) | ||
908 | |||
909 | # lib-ld.m4 serial 3 (gettext-0.13) | ||
910 | dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. | ||
911 | dnl This file is free software; the Free Software Foundation | ||
912 | dnl gives unlimited permission to copy and/or distribute it, | ||
913 | dnl with or without modifications, as long as this notice is preserved. | ||
914 | |||
915 | dnl Subroutines of libtool.m4, | ||
916 | dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision | ||
917 | dnl with libtool.m4. | ||
918 | |||
919 | dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. | ||
920 | AC_DEFUN([AC_LIB_PROG_LD_GNU], | ||
921 | [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, | ||
922 | [# I'd rather use --version here, but apparently some GNU ld's only accept -v. | ||
923 | case `$LD -v 2>&1 </dev/null` in | ||
924 | *GNU* | *'with BFD'*) | ||
925 | acl_cv_prog_gnu_ld=yes ;; | ||
926 | *) | ||
927 | acl_cv_prog_gnu_ld=no ;; | ||
928 | esac]) | ||
929 | with_gnu_ld=$acl_cv_prog_gnu_ld | ||
930 | ]) | ||
931 | |||
932 | dnl From libtool-1.4. Sets the variable LD. | ||
933 | AC_DEFUN([AC_LIB_PROG_LD], | ||
934 | [AC_ARG_WITH(gnu-ld, | ||
935 | [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], | ||
936 | test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) | ||
937 | AC_REQUIRE([AC_PROG_CC])dnl | ||
938 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | ||
939 | # Prepare PATH_SEPARATOR. | ||
940 | # The user is always right. | ||
941 | if test "${PATH_SEPARATOR+set}" != set; then | ||
942 | echo "#! /bin/sh" >conf$$.sh | ||
943 | echo "exit 0" >>conf$$.sh | ||
944 | chmod +x conf$$.sh | ||
945 | if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then | ||
946 | PATH_SEPARATOR=';' | ||
947 | else | ||
948 | PATH_SEPARATOR=: | ||
949 | fi | ||
950 | rm -f conf$$.sh | ||
951 | fi | ||
952 | ac_prog=ld | ||
953 | if test "$GCC" = yes; then | ||
954 | # Check if gcc -print-prog-name=ld gives a path. | ||
955 | AC_MSG_CHECKING([for ld used by GCC]) | ||
956 | case $host in | ||
957 | *-*-mingw*) | ||
958 | # gcc leaves a trailing carriage return which upsets mingw | ||
959 | ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; | ||
960 | *) | ||
961 | ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; | ||
962 | esac | ||
963 | case $ac_prog in | ||
964 | # Accept absolute paths. | ||
965 | [[\\/]* | [A-Za-z]:[\\/]*)] | ||
966 | [re_direlt='/[^/][^/]*/\.\./'] | ||
967 | # Canonicalize the path of ld | ||
968 | ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` | ||
969 | while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do | ||
970 | ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` | ||
971 | done | ||
972 | test -z "$LD" && LD="$ac_prog" | ||
973 | ;; | ||
974 | "") | ||
975 | # If it fails, then pretend we aren't using GCC. | ||
976 | ac_prog=ld | ||
977 | ;; | ||
978 | *) | ||
979 | # If it is relative, then search for the first ld in PATH. | ||
980 | with_gnu_ld=unknown | ||
981 | ;; | ||
982 | esac | ||
983 | elif test "$with_gnu_ld" = yes; then | ||
984 | AC_MSG_CHECKING([for GNU ld]) | ||
985 | else | ||
986 | AC_MSG_CHECKING([for non-GNU ld]) | ||
987 | fi | ||
988 | AC_CACHE_VAL(acl_cv_path_LD, | ||
989 | [if test -z "$LD"; then | ||
990 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" | ||
991 | for ac_dir in $PATH; do | ||
992 | test -z "$ac_dir" && ac_dir=. | ||
993 | if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then | ||
994 | acl_cv_path_LD="$ac_dir/$ac_prog" | ||
995 | # Check to see if the program is GNU ld. I'd rather use --version, | ||
996 | # but apparently some GNU ld's only accept -v. | ||
997 | # Break only if it was the GNU/non-GNU ld that we prefer. | ||
998 | case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in | ||
999 | *GNU* | *'with BFD'*) | ||
1000 | test "$with_gnu_ld" != no && break ;; | ||
1001 | *) | ||
1002 | test "$with_gnu_ld" != yes && break ;; | ||
1003 | esac | ||
1004 | fi | ||
1005 | done | ||
1006 | IFS="$ac_save_ifs" | ||
1007 | else | ||
1008 | acl_cv_path_LD="$LD" # Let the user override the test with a path. | ||
1009 | fi]) | ||
1010 | LD="$acl_cv_path_LD" | ||
1011 | if test -n "$LD"; then | ||
1012 | AC_MSG_RESULT($LD) | ||
1013 | else | ||
1014 | AC_MSG_RESULT(no) | ||
1015 | fi | ||
1016 | test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) | ||
1017 | AC_LIB_PROG_LD_GNU | ||
1018 | ]) | ||
1019 | |||
1020 | # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- | ||
1021 | # | ||
1022 | # Copyright © 2004 Scott James Remnant <scott@netsplit.com>. | ||
1023 | # | ||
1024 | # This program is free software; you can redistribute it and/or modify | ||
1025 | # it under the terms of the GNU General Public License as published by | ||
1026 | # the Free Software Foundation; either version 2 of the License, or | ||
1027 | # (at your option) any later version. | ||
1028 | # | ||
1029 | # This program is distributed in the hope that it will be useful, but | ||
1030 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1031 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
1032 | # General Public License for more details. | ||
1033 | # | ||
1034 | # You should have received a copy of the GNU General Public License | ||
1035 | # along with this program; if not, write to the Free Software | ||
1036 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
1037 | # | ||
1038 | # As a special exception to the GNU General Public License, if you | ||
1039 | # distribute this file as part of a program that contains a | ||
1040 | # configuration script generated by Autoconf, you may include it under | ||
1041 | # the same distribution terms that you use for the rest of that program. | ||
1042 | |||
1043 | # PKG_PROG_PKG_CONFIG([MIN-VERSION]) | ||
1044 | # ---------------------------------- | ||
1045 | AC_DEFUN([PKG_PROG_PKG_CONFIG], | ||
1046 | [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) | ||
1047 | m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) | ||
1048 | AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl | ||
1049 | if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then | ||
1050 | AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) | ||
1051 | fi | ||
1052 | if test -n "$PKG_CONFIG"; then | ||
1053 | _pkg_min_version=m4_default([$1], [0.9.0]) | ||
1054 | AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) | ||
1055 | if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then | ||
1056 | AC_MSG_RESULT([yes]) | ||
1057 | else | ||
1058 | AC_MSG_RESULT([no]) | ||
1059 | PKG_CONFIG="" | ||
1060 | fi | ||
1061 | |||
1062 | fi[]dnl | ||
1063 | ])# PKG_PROG_PKG_CONFIG | ||
1064 | |||
1065 | # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) | ||
1066 | # | ||
1067 | # Check to see whether a particular set of modules exists. Similar | ||
1068 | # to PKG_CHECK_MODULES(), but does not set variables or print errors. | ||
1069 | # | ||
1070 | # | ||
1071 | # Similar to PKG_CHECK_MODULES, make sure that the first instance of | ||
1072 | # this or PKG_CHECK_MODULES is called, or make sure to call | ||
1073 | # PKG_CHECK_EXISTS manually | ||
1074 | # -------------------------------------------------------------- | ||
1075 | AC_DEFUN([PKG_CHECK_EXISTS], | ||
1076 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | ||
1077 | if test -n "$PKG_CONFIG" && \ | ||
1078 | AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then | ||
1079 | m4_ifval([$2], [$2], [:]) | ||
1080 | m4_ifvaln([$3], [else | ||
1081 | $3])dnl | ||
1082 | fi]) | ||
1083 | |||
1084 | |||
1085 | # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) | ||
1086 | # --------------------------------------------- | ||
1087 | m4_define([_PKG_CONFIG], | ||
1088 | [if test -n "$PKG_CONFIG"; then | ||
1089 | if test -n "$$1"; then | ||
1090 | pkg_cv_[]$1="$$1" | ||
1091 | else | ||
1092 | PKG_CHECK_EXISTS([$3], | ||
1093 | [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], | ||
1094 | [pkg_failed=yes]) | ||
1095 | fi | ||
1096 | else | ||
1097 | pkg_failed=untried | ||
1098 | fi[]dnl | ||
1099 | ])# _PKG_CONFIG | ||
1100 | |||
1101 | # _PKG_SHORT_ERRORS_SUPPORTED | ||
1102 | # ----------------------------- | ||
1103 | AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], | ||
1104 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) | ||
1105 | if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then | ||
1106 | _pkg_short_errors_supported=yes | ||
1107 | else | ||
1108 | _pkg_short_errors_supported=no | ||
1109 | fi[]dnl | ||
1110 | ])# _PKG_SHORT_ERRORS_SUPPORTED | ||
1111 | |||
1112 | |||
1113 | # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], | ||
1114 | # [ACTION-IF-NOT-FOUND]) | ||
1115 | # | ||
1116 | # | ||
1117 | # Note that if there is a possibility the first call to | ||
1118 | # PKG_CHECK_MODULES might not happen, you should be sure to include an | ||
1119 | # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac | ||
1120 | # | ||
1121 | # | ||
1122 | # -------------------------------------------------------------- | ||
1123 | AC_DEFUN([PKG_CHECK_MODULES], | ||
1124 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | ||
1125 | AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl | ||
1126 | AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl | ||
1127 | |||
1128 | pkg_failed=no | ||
1129 | AC_MSG_CHECKING([for $1]) | ||
1130 | |||
1131 | _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) | ||
1132 | _PKG_CONFIG([$1][_LIBS], [libs], [$2]) | ||
1133 | |||
1134 | m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS | ||
1135 | and $1[]_LIBS to avoid the need to call pkg-config. | ||
1136 | See the pkg-config man page for more details.]) | ||
1137 | |||
1138 | if test $pkg_failed = yes; then | ||
1139 | _PKG_SHORT_ERRORS_SUPPORTED | ||
1140 | if test $_pkg_short_errors_supported = yes; then | ||
1141 | $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` | ||
1142 | else | ||
1143 | $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` | ||
1144 | fi | ||
1145 | # Put the nasty error message in config.log where it belongs | ||
1146 | echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD | ||
1147 | |||
1148 | ifelse([$4], , [AC_MSG_ERROR(dnl | ||
1149 | [Package requirements ($2) were not met: | ||
1150 | |||
1151 | $$1_PKG_ERRORS | ||
1152 | |||
1153 | Consider adjusting the PKG_CONFIG_PATH environment variable if you | ||
1154 | installed software in a non-standard prefix. | ||
1155 | |||
1156 | _PKG_TEXT | ||
1157 | ])], | ||
1158 | [AC_MSG_RESULT([no]) | ||
1159 | $4]) | ||
1160 | elif test $pkg_failed = untried; then | ||
1161 | ifelse([$4], , [AC_MSG_FAILURE(dnl | ||
1162 | [The pkg-config script could not be found or is too old. Make sure it | ||
1163 | is in your PATH or set the PKG_CONFIG environment variable to the full | ||
1164 | path to pkg-config. | ||
1165 | |||
1166 | _PKG_TEXT | ||
1167 | |||
1168 | To get pkg-config, see <http://pkg-config.freedesktop.org/>.])], | ||
1169 | [$4]) | ||
1170 | else | ||
1171 | $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS | ||
1172 | $1[]_LIBS=$pkg_cv_[]$1[]_LIBS | ||
1173 | AC_MSG_RESULT([yes]) | ||
1174 | ifelse([$3], , :, [$3]) | ||
1175 | fi[]dnl | ||
1176 | ])# PKG_CHECK_MODULES | ||
1177 |