Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: bison/src/bison/2.4.1/bison-2.4.1-src/m4/lib-link.m4

Issue 10807020: Add native Windows binary for bison. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # lib-link.m4 serial 16 (gettext-0.18)
2 dnl Copyright (C) 2001-2008 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 dnl From Bruno Haible.
8
9 AC_PREREQ(2.54)
10
11 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
12 dnl the libraries corresponding to explicit and implicit dependencies.
13 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
14 dnl augments the CPPFLAGS variable.
15 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
16 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
17 AC_DEFUN([AC_LIB_LINKFLAGS],
18 [
19 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
20 AC_REQUIRE([AC_LIB_RPATH])
21 pushdef([Name],[translit([$1],[./-], [___])])
22 pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
23 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
24 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
25 AC_LIB_LINKFLAGS_BODY([$1], [$2])
26 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
27 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
28 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
29 ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
30 ])
31 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
32 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
33 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
34 LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
36 AC_SUBST([LIB]NAME)
37 AC_SUBST([LTLIB]NAME)
38 AC_SUBST([LIB]NAME[_PREFIX])
39 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
40 dnl results of this search when this library appears as a dependency.
41 HAVE_LIB[]NAME=yes
42 popdef([NAME])
43 popdef([Name])
44 ])
45
46 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
47 dnl searches for libname and the libraries corresponding to explicit and
48 dnl implicit dependencies, together with the specified include files and
49 dnl the ability to compile and link the specified testcode. If found, it
50 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
51 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
52 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
53 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
54 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
55 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
56 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
57 [
58 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
59 AC_REQUIRE([AC_LIB_RPATH])
60 pushdef([Name],[translit([$1],[./-], [___])])
61 pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
62 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
63
64 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
65 dnl accordingly.
66 AC_LIB_LINKFLAGS_BODY([$1], [$2])
67
68 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
69 dnl because if the user has installed lib[]Name and not disabled its use
70 dnl via --without-lib[]Name-prefix, he wants to use it.
71 ac_save_CPPFLAGS="$CPPFLAGS"
72 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
73
74 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
75 ac_save_LIBS="$LIBS"
76 LIBS="$LIBS $LIB[]NAME"
77 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
78 LIBS="$ac_save_LIBS"
79 ])
80 if test "$ac_cv_lib[]Name" = yes; then
81 HAVE_LIB[]NAME=yes
82 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
83 AC_MSG_CHECKING([how to link with lib[]$1])
84 AC_MSG_RESULT([$LIB[]NAME])
85 else
86 HAVE_LIB[]NAME=no
87 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
88 dnl $INC[]NAME either.
89 CPPFLAGS="$ac_save_CPPFLAGS"
90 LIB[]NAME=
91 LTLIB[]NAME=
92 LIB[]NAME[]_PREFIX=
93 fi
94 AC_SUBST([HAVE_LIB]NAME)
95 AC_SUBST([LIB]NAME)
96 AC_SUBST([LTLIB]NAME)
97 AC_SUBST([LIB]NAME[_PREFIX])
98 popdef([NAME])
99 popdef([Name])
100 ])
101
102 dnl Determine the platform dependent parameters needed to use rpath:
103 dnl acl_libext,
104 dnl acl_shlibext,
105 dnl acl_hardcode_libdir_flag_spec,
106 dnl acl_hardcode_libdir_separator,
107 dnl acl_hardcode_direct,
108 dnl acl_hardcode_minus_L.
109 AC_DEFUN([AC_LIB_RPATH],
110 [
111 dnl Tell automake >= 1.10 to complain if config.rpath is missing.
112 m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
113 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
114 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
115 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
116 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
117 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
118 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
119 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
120 . ./conftest.sh
121 rm -f ./conftest.sh
122 acl_cv_rpath=done
123 ])
124 wl="$acl_cv_wl"
125 acl_libext="$acl_cv_libext"
126 acl_shlibext="$acl_cv_shlibext"
127 acl_libname_spec="$acl_cv_libname_spec"
128 acl_library_names_spec="$acl_cv_library_names_spec"
129 acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
130 acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
131 acl_hardcode_direct="$acl_cv_hardcode_direct"
132 acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
133 dnl Determine whether the user wants rpath handling at all.
134 AC_ARG_ENABLE(rpath,
135 [ --disable-rpath do not hardcode runtime library paths],
136 :, enable_rpath=yes)
137 ])
138
139 dnl AC_LIB_FROMPACKAGE(name, package)
140 dnl declares that libname comes from the given package. The configure file
141 dnl will then not have a --with-libname-prefix option but a
142 dnl --with-package-prefix option. Several libraries can come from the same
143 dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
144 dnl macro call that searches for libname.
145 AC_DEFUN([AC_LIB_FROMPACKAGE],
146 [
147 pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
148 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
149 define([acl_frompackage_]NAME, [$2])
150 popdef([NAME])
151 pushdef([PACK],[$2])
152 pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
153 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
154 define([acl_libsinpackage_]PACKUP,
155 m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$ 1])
156 popdef([PACKUP])
157 popdef([PACK])
158 ])
159
160 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
161 dnl the libraries corresponding to explicit and implicit dependencies.
162 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
163 dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
164 dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
165 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
166 [
167 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
168 pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
169 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
170 pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$ 1])])
171 pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
172 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
173 pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKU P, lib[$1])])
174 dnl Autoconf >= 2.61 supports dots in --with options.
175 pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.6 1]),[-1],[translit(PACK,[.],[_])],PACK)])
176 dnl By default, look in $includedir and $libdir.
177 use_additional=yes
178 AC_LIB_WITH_FINAL_PREFIX([
179 eval additional_includedir=\"$includedir\"
180 eval additional_libdir=\"$libdir\"
181 ])
182 AC_ARG_WITH(P_A_C_K[-prefix],
183 [[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DI R/lib
184 --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
185 [
186 if test "X$withval" = "Xno"; then
187 use_additional=no
188 else
189 if test "X$withval" = "X"; then
190 AC_LIB_WITH_FINAL_PREFIX([
191 eval additional_includedir=\"$includedir\"
192 eval additional_libdir=\"$libdir\"
193 ])
194 else
195 additional_includedir="$withval/include"
196 additional_libdir="$withval/$acl_libdirstem"
197 if test "$acl_libdirstem2" != "$acl_libdirstem" \
198 && ! test -d "$withval/$acl_libdirstem"; then
199 additional_libdir="$withval/$acl_libdirstem2"
200 fi
201 fi
202 fi
203 ])
204 dnl Search the library and its dependencies in $additional_libdir and
205 dnl $LDFLAGS. Using breadth-first-seach.
206 LIB[]NAME=
207 LTLIB[]NAME=
208 INC[]NAME=
209 LIB[]NAME[]_PREFIX=
210 rpathdirs=
211 ltrpathdirs=
212 names_already_handled=
213 names_next_round='$1 $2'
214 while test -n "$names_next_round"; do
215 names_this_round="$names_next_round"
216 names_next_round=
217 for name in $names_this_round; do
218 already_handled=
219 for n in $names_already_handled; do
220 if test "$n" = "$name"; then
221 already_handled=yes
222 break
223 fi
224 done
225 if test -z "$already_handled"; then
226 names_already_handled="$names_already_handled $name"
227 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
228 dnl or AC_LIB_HAVE_LINKFLAGS call.
229 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEF GHIJKLMNOPQRSTUVWXYZ___|'`
230 eval value=\"\$HAVE_LIB$uppername\"
231 if test -n "$value"; then
232 if test "$value" = yes; then
233 eval value=\"\$LIB$uppername\"
234 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
235 eval value=\"\$LTLIB$uppername\"
236 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$val ue"
237 else
238 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
239 dnl that this library doesn't exist. So just drop it.
240 :
241 fi
242 else
243 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
244 dnl and the already constructed $LIBNAME/$LTLIBNAME.
245 found_dir=
246 found_la=
247 found_so=
248 found_a=
249 eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
250 if test -n "$acl_shlibext"; then
251 shrext=".$acl_shlibext" # typically: shrext=.so
252 else
253 shrext=
254 fi
255 if test $use_additional = yes; then
256 dir="$additional_libdir"
257 dnl The same code as in the loop below:
258 dnl First look for a shared library.
259 if test -n "$acl_shlibext"; then
260 if test -f "$dir/$libname$shrext"; then
261 found_dir="$dir"
262 found_so="$dir/$libname$shrext"
263 else
264 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
265 ver=`(cd "$dir" && \
266 for f in "$libname$shrext".*; do echo "$f"; done \
267 | sed -e "s,^$libname$shrext\\\\.,," \
268 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
269 | sed 1q ) 2>/dev/null`
270 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
271 found_dir="$dir"
272 found_so="$dir/$libname$shrext.$ver"
273 fi
274 else
275 eval library_names=\"$acl_library_names_spec\"
276 for f in $library_names; do
277 if test -f "$dir/$f"; then
278 found_dir="$dir"
279 found_so="$dir/$f"
280 break
281 fi
282 done
283 fi
284 fi
285 fi
286 dnl Then look for a static library.
287 if test "X$found_dir" = "X"; then
288 if test -f "$dir/$libname.$acl_libext"; then
289 found_dir="$dir"
290 found_a="$dir/$libname.$acl_libext"
291 fi
292 fi
293 if test "X$found_dir" != "X"; then
294 if test -f "$dir/$libname.la"; then
295 found_la="$dir/$libname.la"
296 fi
297 fi
298 fi
299 if test "X$found_dir" = "X"; then
300 for x in $LDFLAGS $LTLIB[]NAME; do
301 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
302 case "$x" in
303 -L*)
304 dir=`echo "X$x" | sed -e 's/^X-L//'`
305 dnl First look for a shared library.
306 if test -n "$acl_shlibext"; then
307 if test -f "$dir/$libname$shrext"; then
308 found_dir="$dir"
309 found_so="$dir/$libname$shrext"
310 else
311 if test "$acl_library_names_spec" = '$libname$shrext$versu ffix'; then
312 ver=`(cd "$dir" && \
313 for f in "$libname$shrext".*; do echo "$f"; done \
314 | sed -e "s,^$libname$shrext\\\\.,," \
315 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
316 | sed 1q ) 2>/dev/null`
317 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" ; then
318 found_dir="$dir"
319 found_so="$dir/$libname$shrext.$ver"
320 fi
321 else
322 eval library_names=\"$acl_library_names_spec\"
323 for f in $library_names; do
324 if test -f "$dir/$f"; then
325 found_dir="$dir"
326 found_so="$dir/$f"
327 break
328 fi
329 done
330 fi
331 fi
332 fi
333 dnl Then look for a static library.
334 if test "X$found_dir" = "X"; then
335 if test -f "$dir/$libname.$acl_libext"; then
336 found_dir="$dir"
337 found_a="$dir/$libname.$acl_libext"
338 fi
339 fi
340 if test "X$found_dir" != "X"; then
341 if test -f "$dir/$libname.la"; then
342 found_la="$dir/$libname.la"
343 fi
344 fi
345 ;;
346 esac
347 if test "X$found_dir" != "X"; then
348 break
349 fi
350 done
351 fi
352 if test "X$found_dir" != "X"; then
353 dnl Found the library.
354 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
355 if test "X$found_so" != "X"; then
356 dnl Linking with a shared library. We attempt to hardcode its
357 dnl directory into the executable's runpath, unless it's the
358 dnl standard /usr/lib.
359 if test "$enable_rpath" = no \
360 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
361 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
362 dnl No hardcoding is needed.
363 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
364 else
365 dnl Use an explicit option to hardcode DIR into the resulting
366 dnl binary.
367 dnl Potentially add DIR to ltrpathdirs.
368 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
369 haveit=
370 for x in $ltrpathdirs; do
371 if test "X$x" = "X$found_dir"; then
372 haveit=yes
373 break
374 fi
375 done
376 if test -z "$haveit"; then
377 ltrpathdirs="$ltrpathdirs $found_dir"
378 fi
379 dnl The hardcoding into $LIBNAME is system dependent.
380 if test "$acl_hardcode_direct" = yes; then
381 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
382 dnl resulting binary.
383 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
384 else
385 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hard code_minus_L" = no; then
386 dnl Use an explicit option to hardcode DIR into the resultin g
387 dnl binary.
388 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
389 dnl Potentially add DIR to rpathdirs.
390 dnl The rpathdirs will be appended to $LIBNAME at the end.
391 haveit=
392 for x in $rpathdirs; do
393 if test "X$x" = "X$found_dir"; then
394 haveit=yes
395 break
396 fi
397 done
398 if test -z "$haveit"; then
399 rpathdirs="$rpathdirs $found_dir"
400 fi
401 else
402 dnl Rely on "-L$found_dir".
403 dnl But don't add it if it's already contained in the LDFLAG S
404 dnl or the already constructed $LIBNAME
405 haveit=
406 for x in $LDFLAGS $LIB[]NAME; do
407 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
408 if test "X$x" = "X-L$found_dir"; then
409 haveit=yes
410 break
411 fi
412 done
413 if test -z "$haveit"; then
414 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
415 fi
416 if test "$acl_hardcode_minus_L" != no; then
417 dnl FIXME: Not sure whether we should use
418 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
419 dnl here.
420 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
421 else
422 dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PAT H
423 dnl here, because this doesn't fit in flags passed to the
424 dnl compiler. So give up. No hardcoding. This affects only
425 dnl very old systems.
426 dnl FIXME: Not sure whether we should use
427 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
428 dnl here.
429 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
430 fi
431 fi
432 fi
433 fi
434 else
435 if test "X$found_a" != "X"; then
436 dnl Linking with a static library.
437 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
438 else
439 dnl We shouldn't come here, but anyway it's good to have a
440 dnl fallback.
441 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
442 fi
443 fi
444 dnl Assume the include files are nearby.
445 additional_includedir=
446 case "$found_dir" in
447 */$acl_libdirstem | */$acl_libdirstem/)
448 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdir stem/"'*$,,'`
449 LIB[]NAME[]_PREFIX="$basedir"
450 additional_includedir="$basedir/include"
451 ;;
452 */$acl_libdirstem2 | */$acl_libdirstem2/)
453 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdir stem2/"'*$,,'`
454 LIB[]NAME[]_PREFIX="$basedir"
455 additional_includedir="$basedir/include"
456 ;;
457 esac
458 if test "X$additional_includedir" != "X"; then
459 dnl Potentially add $additional_includedir to $INCNAME.
460 dnl But don't add it
461 dnl 1. if it's the standard /usr/include,
462 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
463 dnl 3. if it's already present in $CPPFLAGS or the already
464 dnl constructed $INCNAME,
465 dnl 4. if it doesn't exist as a directory.
466 if test "X$additional_includedir" != "X/usr/include"; then
467 haveit=
468 if test "X$additional_includedir" = "X/usr/local/include"; then
469 if test -n "$GCC"; then
470 case $host_os in
471 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
472 esac
473 fi
474 fi
475 if test -z "$haveit"; then
476 for x in $CPPFLAGS $INC[]NAME; do
477 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
478 if test "X$x" = "X-I$additional_includedir"; then
479 haveit=yes
480 break
481 fi
482 done
483 if test -z "$haveit"; then
484 if test -d "$additional_includedir"; then
485 dnl Really add $additional_includedir to $INCNAME.
486 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includ edir"
487 fi
488 fi
489 fi
490 fi
491 fi
492 dnl Look for dependencies.
493 if test -n "$found_la"; then
494 dnl Read the .la file. It defines the variables
495 dnl dlname, library_names, old_library, dependency_libs, current,
496 dnl age, revision, installed, dlopen, dlpreopen, libdir.
497 save_libdir="$libdir"
498 case "$found_la" in
499 */* | *\\*) . "$found_la" ;;
500 *) . "./$found_la" ;;
501 esac
502 libdir="$save_libdir"
503 dnl We use only dependency_libs.
504 for dep in $dependency_libs; do
505 case "$dep" in
506 -L*)
507 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
508 dnl Potentially add $additional_libdir to $LIBNAME and $LTLI BNAME.
509 dnl But don't add it
510 dnl 1. if it's the standard /usr/lib,
511 dnl 2. if it's /usr/local/lib and we are using GCC on Linu x,
512 dnl 3. if it's already present in $LDFLAGS or the already
513 dnl constructed $LIBNAME,
514 dnl 4. if it doesn't exist as a directory.
515 if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
516 && test "X$additional_libdir" != "X/usr/$acl_libdirstem2" ; then
517 haveit=
518 if test "X$additional_libdir" = "X/usr/local/$acl_libdirst em" \
519 || test "X$additional_libdir" = "X/usr/local/$acl_libdi rstem2"; then
520 if test -n "$GCC"; then
521 case $host_os in
522 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
523 esac
524 fi
525 fi
526 if test -z "$haveit"; then
527 haveit=
528 for x in $LDFLAGS $LIB[]NAME; do
529 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
530 if test "X$x" = "X-L$additional_libdir"; then
531 haveit=yes
532 break
533 fi
534 done
535 if test -z "$haveit"; then
536 if test -d "$additional_libdir"; then
537 dnl Really add $additional_libdir to $LIBNAME.
538 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_ libdir"
539 fi
540 fi
541 haveit=
542 for x in $LDFLAGS $LTLIB[]NAME; do
543 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
544 if test "X$x" = "X-L$additional_libdir"; then
545 haveit=yes
546 break
547 fi
548 done
549 if test -z "$haveit"; then
550 if test -d "$additional_libdir"; then
551 dnl Really add $additional_libdir to $LTLIBNAME.
552 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$addit ional_libdir"
553 fi
554 fi
555 fi
556 fi
557 ;;
558 -R*)
559 dir=`echo "X$dep" | sed -e 's/^X-R//'`
560 if test "$enable_rpath" != no; then
561 dnl Potentially add DIR to rpathdirs.
562 dnl The rpathdirs will be appended to $LIBNAME at the end.
563 haveit=
564 for x in $rpathdirs; do
565 if test "X$x" = "X$dir"; then
566 haveit=yes
567 break
568 fi
569 done
570 if test -z "$haveit"; then
571 rpathdirs="$rpathdirs $dir"
572 fi
573 dnl Potentially add DIR to ltrpathdirs.
574 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
575 haveit=
576 for x in $ltrpathdirs; do
577 if test "X$x" = "X$dir"; then
578 haveit=yes
579 break
580 fi
581 done
582 if test -z "$haveit"; then
583 ltrpathdirs="$ltrpathdirs $dir"
584 fi
585 fi
586 ;;
587 -l*)
588 dnl Handle this in the next round.
589 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
590 ;;
591 *.la)
592 dnl Handle this in the next round. Throw away the .la's
593 dnl directory; it is already contained in a preceding -L
594 dnl option.
595 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
596 ;;
597 *)
598 dnl Most likely an immediate library name.
599 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
600 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
601 ;;
602 esac
603 done
604 fi
605 else
606 dnl Didn't find the library; assume it is in the system directories
607 dnl known to the linker and runtime loader. (All the system
608 dnl directories known to the linker should also be known to the
609 dnl runtime loader, otherwise the system is severely misconfigured.)
610 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
611 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
612 fi
613 fi
614 fi
615 done
616 done
617 if test "X$rpathdirs" != "X"; then
618 if test -n "$acl_hardcode_libdir_separator"; then
619 dnl Weird platform: only the last -rpath option counts, the user must
620 dnl pass all path elements in one option. We can arrange that for a
621 dnl single library, but not when more than one $LIBNAMEs are used.
622 alldirs=
623 for found_dir in $rpathdirs; do
624 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
625 done
626 dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
627 acl_save_libdir="$libdir"
628 libdir="$alldirs"
629 eval flag=\"$acl_hardcode_libdir_flag_spec\"
630 libdir="$acl_save_libdir"
631 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
632 else
633 dnl The -rpath options are cumulative.
634 for found_dir in $rpathdirs; do
635 acl_save_libdir="$libdir"
636 libdir="$found_dir"
637 eval flag=\"$acl_hardcode_libdir_flag_spec\"
638 libdir="$acl_save_libdir"
639 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
640 done
641 fi
642 fi
643 if test "X$ltrpathdirs" != "X"; then
644 dnl When using libtool, the option that works for both libraries and
645 dnl executables is -R. The -R options are cumulative.
646 for found_dir in $ltrpathdirs; do
647 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
648 done
649 fi
650 popdef([P_A_C_K])
651 popdef([PACKLIBS])
652 popdef([PACKUP])
653 popdef([PACK])
654 popdef([NAME])
655 ])
656
657 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
658 dnl unless already present in VAR.
659 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
660 dnl contains two or three consecutive elements that belong together.
661 AC_DEFUN([AC_LIB_APPENDTOVAR],
662 [
663 for element in [$2]; do
664 haveit=
665 for x in $[$1]; do
666 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
667 if test "X$x" = "X$element"; then
668 haveit=yes
669 break
670 fi
671 done
672 if test -z "$haveit"; then
673 [$1]="${[$1]}${[$1]:+ }$element"
674 fi
675 done
676 ])
677
678 dnl For those cases where a variable contains several -L and -l options
679 dnl referring to unknown libraries and directories, this macro determines the
680 dnl necessary additional linker options for the runtime path.
681 dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
682 dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
683 dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
684 dnl otherwise linking without libtool is assumed.
685 AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
686 [
687 AC_REQUIRE([AC_LIB_RPATH])
688 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
689 $1=
690 if test "$enable_rpath" != no; then
691 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
692 dnl Use an explicit option to hardcode directories into the resulting
693 dnl binary.
694 rpathdirs=
695 next=
696 for opt in $2; do
697 if test -n "$next"; then
698 dir="$next"
699 dnl No need to hardcode the standard /usr/lib.
700 if test "X$dir" != "X/usr/$acl_libdirstem" \
701 && test "X$dir" != "X/usr/$acl_libdirstem2"; then
702 rpathdirs="$rpathdirs $dir"
703 fi
704 next=
705 else
706 case $opt in
707 -L) next=yes ;;
708 -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
709 dnl No need to hardcode the standard /usr/lib.
710 if test "X$dir" != "X/usr/$acl_libdirstem" \
711 && test "X$dir" != "X/usr/$acl_libdirstem2"; then
712 rpathdirs="$rpathdirs $dir"
713 fi
714 next= ;;
715 *) next= ;;
716 esac
717 fi
718 done
719 if test "X$rpathdirs" != "X"; then
720 if test -n ""$3""; then
721 dnl libtool is used for linking. Use -R options.
722 for dir in $rpathdirs; do
723 $1="${$1}${$1:+ }-R$dir"
724 done
725 else
726 dnl The linker is used for linking directly.
727 if test -n "$acl_hardcode_libdir_separator"; then
728 dnl Weird platform: only the last -rpath option counts, the user
729 dnl must pass all path elements in one option.
730 alldirs=
731 for dir in $rpathdirs; do
732 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
733 done
734 acl_save_libdir="$libdir"
735 libdir="$alldirs"
736 eval flag=\"$acl_hardcode_libdir_flag_spec\"
737 libdir="$acl_save_libdir"
738 $1="$flag"
739 else
740 dnl The -rpath options are cumulative.
741 for dir in $rpathdirs; do
742 acl_save_libdir="$libdir"
743 libdir="$dir"
744 eval flag=\"$acl_hardcode_libdir_flag_spec\"
745 libdir="$acl_save_libdir"
746 $1="${$1}${$1:+ }$flag"
747 done
748 fi
749 fi
750 fi
751 fi
752 fi
753 AC_SUBST([$1])
754 ])
OLDNEW
« no previous file with comments | « bison/src/bison/2.4.1/bison-2.4.1-src/m4/lib-ld.m4 ('k') | bison/src/bison/2.4.1/bison-2.4.1-src/m4/lib-prefix.m4 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698