Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 819 lines (800 sloc) 32.163 kb
f5eef21 add gettext-lib.m4, as not always already installed
ripley authored
1 ## concatentation of files in gettext-0.14.5/autoconf-lib-link/m4
2 # lib-ld.m4 serial 3 (gettext-0.13)
3 dnl Copyright (C) 1996-2003 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 Subroutines of libtool.m4,
9 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
10 dnl with libtool.m4.
11
12 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
13 AC_DEFUN([AC_LIB_PROG_LD_GNU],
14 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
15 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
16 case `$LD -v 2>&1 </dev/null` in
17 *GNU* | *'with BFD'*)
18 acl_cv_prog_gnu_ld=yes ;;
19 *)
20 acl_cv_prog_gnu_ld=no ;;
21 esac])
22 with_gnu_ld=$acl_cv_prog_gnu_ld
23 ])
24
25 dnl From libtool-1.4. Sets the variable LD.
26 AC_DEFUN([AC_LIB_PROG_LD],
27 [AC_ARG_WITH(gnu-ld,
253bc51 remove/make invisible some options from libtool/gettext that we do not u...
ripley authored
28 [AS_HELP_STRING([--with-gnu-ld],
42c22f1 remove near-duplicate message
ripley authored
29 [assume the C compiler uses GNU ld @<:@default=no@:>@])],
f5eef21 add gettext-lib.m4, as not always already installed
ripley authored
30 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
31 AC_REQUIRE([AC_PROG_CC])dnl
32 AC_REQUIRE([AC_CANONICAL_HOST])dnl
33 # Prepare PATH_SEPARATOR.
34 # The user is always right.
35 if test "${PATH_SEPARATOR+set}" != set; then
36 echo "#! /bin/sh" >conf$$.sh
37 echo "exit 0" >>conf$$.sh
38 chmod +x conf$$.sh
39 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
40 PATH_SEPARATOR=';'
41 else
42 PATH_SEPARATOR=:
43 fi
44 rm -f conf$$.sh
45 fi
46 ac_prog=ld
47 if test "$GCC" = yes; then
48 # Check if gcc -print-prog-name=ld gives a path.
49 AC_MSG_CHECKING([for ld used by GCC])
50 case $host in
51 *-*-mingw*)
52 # gcc leaves a trailing carriage return which upsets mingw
53 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
54 *)
55 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
56 esac
57 case $ac_prog in
58 # Accept absolute paths.
59 [[\\/]* | [A-Za-z]:[\\/]*)]
60 [re_direlt='/[^/][^/]*/\.\./']
61 # Canonicalize the path of ld
62 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
63 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
64 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
65 done
66 test -z "$LD" && LD="$ac_prog"
67 ;;
68 "")
69 # If it fails, then pretend we aren't using GCC.
70 ac_prog=ld
71 ;;
72 *)
73 # If it is relative, then search for the first ld in PATH.
74 with_gnu_ld=unknown
75 ;;
76 esac
77 elif test "$with_gnu_ld" = yes; then
78 AC_MSG_CHECKING([for GNU ld])
79 else
80 AC_MSG_CHECKING([for non-GNU ld])
81 fi
82 AC_CACHE_VAL(acl_cv_path_LD,
83 [if test -z "$LD"; then
84 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
85 for ac_dir in $PATH; do
86 test -z "$ac_dir" && ac_dir=.
87 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
88 acl_cv_path_LD="$ac_dir/$ac_prog"
89 # Check to see if the program is GNU ld. I'd rather use --version,
90 # but apparently some GNU ld's only accept -v.
91 # Break only if it was the GNU/non-GNU ld that we prefer.
92 case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
93 *GNU* | *'with BFD'*)
94 test "$with_gnu_ld" != no && break ;;
95 *)
96 test "$with_gnu_ld" != yes && break ;;
97 esac
98 fi
99 done
100 IFS="$ac_save_ifs"
101 else
102 acl_cv_path_LD="$LD" # Let the user override the test with a path.
103 fi])
104 LD="$acl_cv_path_LD"
105 if test -n "$LD"; then
106 AC_MSG_RESULT($LD)
107 else
108 AC_MSG_RESULT(no)
109 fi
110 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
111 AC_LIB_PROG_LD_GNU
112 ])
113 # lib-link.m4 serial 6 (gettext-0.14.3)
114 dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
115 dnl This file is free software; the Free Software Foundation
116 dnl gives unlimited permission to copy and/or distribute it,
117 dnl with or without modifications, as long as this notice is preserved.
118
119 dnl From Bruno Haible.
120
121 AC_PREREQ(2.50)
122
123 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
124 dnl the libraries corresponding to explicit and implicit dependencies.
125 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
126 dnl augments the CPPFLAGS variable.
127 AC_DEFUN([AC_LIB_LINKFLAGS],
128 [
129 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
253bc51 remove/make invisible some options from libtool/gettext that we do not u...
ripley authored
130 dnl AC_REQUIRE([AC_LIB_RPATH])
f5eef21 add gettext-lib.m4, as not always already installed
ripley authored
131 define([Name],[translit([$1],[./-], [___])])
132 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
133 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
134 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
135 AC_LIB_LINKFLAGS_BODY([$1], [$2])
136 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
137 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
138 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
139 ])
140 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
141 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
142 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
143 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
144 AC_SUBST([LIB]NAME)
145 AC_SUBST([LTLIB]NAME)
146 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
147 dnl results of this search when this library appears as a dependency.
148 HAVE_LIB[]NAME=yes
149 undefine([Name])
150 undefine([NAME])
151 ])
152
153 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
154 dnl searches for libname and the libraries corresponding to explicit and
155 dnl implicit dependencies, together with the specified include files and
156 dnl the ability to compile and link the specified testcode. If found, it
157 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
158 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
159 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
160 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
161 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
162 [
163 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
253bc51 remove/make invisible some options from libtool/gettext that we do not u...
ripley authored
164 dnl AC_REQUIRE([AC_LIB_RPATH])
f5eef21 add gettext-lib.m4, as not always already installed
ripley authored
165 define([Name],[translit([$1],[./-], [___])])
166 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
167 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
168
169 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
170 dnl accordingly.
171 AC_LIB_LINKFLAGS_BODY([$1], [$2])
172
173 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
174 dnl because if the user has installed lib[]Name and not disabled its use
175 dnl via --without-lib[]Name-prefix, he wants to use it.
176 ac_save_CPPFLAGS="$CPPFLAGS"
177 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
178
179 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
180 ac_save_LIBS="$LIBS"
181 LIBS="$LIBS $LIB[]NAME"
182 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
183 LIBS="$ac_save_LIBS"
184 ])
185 if test "$ac_cv_lib[]Name" = yes; then
186 HAVE_LIB[]NAME=yes
187 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
188 AC_MSG_CHECKING([how to link with lib[]$1])
189 AC_MSG_RESULT([$LIB[]NAME])
190 else
191 HAVE_LIB[]NAME=no
192 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
193 dnl $INC[]NAME either.
194 CPPFLAGS="$ac_save_CPPFLAGS"
195 LIB[]NAME=
196 LTLIB[]NAME=
197 fi
198 AC_SUBST([HAVE_LIB]NAME)
199 AC_SUBST([LIB]NAME)
200 AC_SUBST([LTLIB]NAME)
201 undefine([Name])
202 undefine([NAME])
203 ])
204
205 dnl Determine the platform dependent parameters needed to use rpath:
206 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
207 dnl hardcode_direct, hardcode_minus_L.
208 AC_DEFUN([AC_LIB_RPATH],
209 [
210 dnl Tell automake >= 1.10 to complain if config.rpath is missing.
211 m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
212 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
253bc51 remove/make invisible some options from libtool/gettext that we do not u...
ripley authored
213 dnl AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
f5eef21 add gettext-lib.m4, as not always already installed
ripley authored
214 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
215 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
216 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
217 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
218 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
219 . ./conftest.sh
220 rm -f ./conftest.sh
221 acl_cv_rpath=done
222 ])
223 wl="$acl_cv_wl"
224 libext="$acl_cv_libext"
225 shlibext="$acl_cv_shlibext"
226 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
227 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
228 hardcode_direct="$acl_cv_hardcode_direct"
229 hardcode_minus_L="$acl_cv_hardcode_minus_L"
230 dnl Determine whether the user wants rpath handling at all.
253bc51 remove/make invisible some options from libtool/gettext that we do not u...
ripley authored
231 dnl AC_ARG_ENABLE(rpath,
232 dnl [ --disable-rpath do not hardcode runtime library paths],
233 dnl :, enable_rpath=yes)
f5eef21 add gettext-lib.m4, as not always already installed
ripley authored
234 ])
235
236 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
237 dnl the libraries corresponding to explicit and implicit dependencies.
238 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
239 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
240 [
241 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
242 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
243 dnl By default, look in $includedir and $libdir.
244 use_additional=yes
245 AC_LIB_WITH_FINAL_PREFIX([
246 eval additional_includedir=\"$includedir\"
247 eval additional_libdir=\"$libdir\"
248 ])
249 AC_LIB_ARG_WITH([lib$1-prefix],
250 [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
251 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
252 [
253 if test "X$withval" = "Xno"; then
254 use_additional=no
255 else
256 if test "X$withval" = "X"; then
257 AC_LIB_WITH_FINAL_PREFIX([
258 eval additional_includedir=\"$includedir\"
259 eval additional_libdir=\"$libdir\"
260 ])
261 else
262 additional_includedir="$withval/include"
263 additional_libdir="$withval/lib"
264 fi
265 fi
266 ])
267 dnl Search the library and its dependencies in $additional_libdir and
268 dnl $LDFLAGS. Using breadth-first-seach.
269 LIB[]NAME=
270 LTLIB[]NAME=
271 INC[]NAME=
272 rpathdirs=
273 ltrpathdirs=
274 names_already_handled=
275 names_next_round='$1 $2'
276 while test -n "$names_next_round"; do
277 names_this_round="$names_next_round"
278 names_next_round=
279 for name in $names_this_round; do
280 already_handled=
281 for n in $names_already_handled; do
282 if test "$n" = "$name"; then
283 already_handled=yes
284 break
285 fi
286 done
287 if test -z "$already_handled"; then
288 names_already_handled="$names_already_handled $name"
289 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
290 dnl or AC_LIB_HAVE_LINKFLAGS call.
291 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
292 eval value=\"\$HAVE_LIB$uppername\"
293 if test -n "$value"; then
294 if test "$value" = yes; then
295 eval value=\"\$LIB$uppername\"
296 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
297 eval value=\"\$LTLIB$uppername\"
298 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
299 else
300 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
301 dnl that this library doesn't exist. So just drop it.
302 :
303 fi
304 else
305 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
306 dnl and the already constructed $LIBNAME/$LTLIBNAME.
307 found_dir=
308 found_la=
309 found_so=
310 found_a=
311 if test $use_additional = yes; then
312 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
313 found_dir="$additional_libdir"
314 found_so="$additional_libdir/lib$name.$shlibext"
315 if test -f "$additional_libdir/lib$name.la"; then
316 found_la="$additional_libdir/lib$name.la"
317 fi
318 else
319 if test -f "$additional_libdir/lib$name.$libext"; then
320 found_dir="$additional_libdir"
321 found_a="$additional_libdir/lib$name.$libext"
322 if test -f "$additional_libdir/lib$name.la"; then
323 found_la="$additional_libdir/lib$name.la"
324 fi
325 fi
326 fi
327 fi
328 if test "X$found_dir" = "X"; then
329 for x in $LDFLAGS $LTLIB[]NAME; do
330 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
331 case "$x" in
332 -L*)
333 dir=`echo "X$x" | sed -e 's/^X-L//'`
334 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
335 found_dir="$dir"
336 found_so="$dir/lib$name.$shlibext"
337 if test -f "$dir/lib$name.la"; then
338 found_la="$dir/lib$name.la"
339 fi
340 else
341 if test -f "$dir/lib$name.$libext"; then
342 found_dir="$dir"
343 found_a="$dir/lib$name.$libext"
344 if test -f "$dir/lib$name.la"; then
345 found_la="$dir/lib$name.la"
346 fi
347 fi
348 fi
349 ;;
350 esac
351 if test "X$found_dir" != "X"; then
352 break
353 fi
354 done
355 fi
356 if test "X$found_dir" != "X"; then
357 dnl Found the library.
358 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
359 if test "X$found_so" != "X"; then
360 dnl Linking with a shared library. We attempt to hardcode its
361 dnl directory into the executable's runpath, unless it's the
362 dnl standard /usr/lib.
363 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
364 dnl No hardcoding is needed.
365 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
366 else
367 dnl Use an explicit option to hardcode DIR into the resulting
368 dnl binary.
369 dnl Potentially add DIR to ltrpathdirs.
370 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
371 haveit=
372 for x in $ltrpathdirs; do
373 if test "X$x" = "X$found_dir"; then
374 haveit=yes
375 break
376 fi
377 done
378 if test -z "$haveit"; then
379 ltrpathdirs="$ltrpathdirs $found_dir"
380 fi
381 dnl The hardcoding into $LIBNAME is system dependent.
382 if test "$hardcode_direct" = yes; then
383 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
384 dnl resulting binary.
385 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
386 else
387 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
388 dnl Use an explicit option to hardcode DIR into the resulting
389 dnl binary.
390 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
391 dnl Potentially add DIR to rpathdirs.
392 dnl The rpathdirs will be appended to $LIBNAME at the end.
393 haveit=
394 for x in $rpathdirs; do
395 if test "X$x" = "X$found_dir"; then
396 haveit=yes
397 break
398 fi
399 done
400 if test -z "$haveit"; then
401 rpathdirs="$rpathdirs $found_dir"
402 fi
403 else
404 dnl Rely on "-L$found_dir".
405 dnl But don't add it if it's already contained in the LDFLAGS
406 dnl or the already constructed $LIBNAME
407 haveit=
408 for x in $LDFLAGS $LIB[]NAME; do
409 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
410 if test "X$x" = "X-L$found_dir"; then
411 haveit=yes
412 break
413 fi
414 done
415 if test -z "$haveit"; then
416 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
417 fi
418 if test "$hardcode_minus_L" != no; then
419 dnl FIXME: Not sure whether we should use
420 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
421 dnl here.
422 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
423 else
424 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
425 dnl here, because this doesn't fit in flags passed to the
426 dnl compiler. So give up. No hardcoding. This affects only
427 dnl very old systems.
428 dnl FIXME: Not sure whether we should use
429 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
430 dnl here.
431 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
432 fi
433 fi
434 fi
435 fi
436 else
437 if test "X$found_a" != "X"; then
438 dnl Linking with a static library.
439 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
440 else
441 dnl We shouldn't come here, but anyway it's good to have a
442 dnl fallback.
443 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
444 fi
445 fi
446 dnl Assume the include files are nearby.
447 additional_includedir=
448 case "$found_dir" in
449 */lib | */lib/)
450 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
451 additional_includedir="$basedir/include"
452 ;;
453 esac
454 if test "X$additional_includedir" != "X"; then
455 dnl Potentially add $additional_includedir to $INCNAME.
456 dnl But don't add it
457 dnl 1. if it's the standard /usr/include,
458 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
459 dnl 3. if it's already present in $CPPFLAGS or the already
460 dnl constructed $INCNAME,
461 dnl 4. if it doesn't exist as a directory.
462 if test "X$additional_includedir" != "X/usr/include"; then
463 haveit=
464 if test "X$additional_includedir" = "X/usr/local/include"; then
465 if test -n "$GCC"; then
466 case $host_os in
467 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
468 esac
469 fi
470 fi
471 if test -z "$haveit"; then
472 for x in $CPPFLAGS $INC[]NAME; do
473 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
474 if test "X$x" = "X-I$additional_includedir"; then
475 haveit=yes
476 break
477 fi
478 done
479 if test -z "$haveit"; then
480 if test -d "$additional_includedir"; then
481 dnl Really add $additional_includedir to $INCNAME.
482 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
483 fi
484 fi
485 fi
486 fi
487 fi
488 dnl Look for dependencies.
489 if test -n "$found_la"; then
490 dnl Read the .la file. It defines the variables
491 dnl dlname, library_names, old_library, dependency_libs, current,
492 dnl age, revision, installed, dlopen, dlpreopen, libdir.
493 save_libdir="$libdir"
494 case "$found_la" in
495 */* | *\\*) . "$found_la" ;;
496 *) . "./$found_la" ;;
497 esac
498 libdir="$save_libdir"
499 dnl We use only dependency_libs.
500 for dep in $dependency_libs; do
501 case "$dep" in
502 -L*)
503 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
504 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
505 dnl But don't add it
506 dnl 1. if it's the standard /usr/lib,
507 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
508 dnl 3. if it's already present in $LDFLAGS or the already
509 dnl constructed $LIBNAME,
510 dnl 4. if it doesn't exist as a directory.
511 if test "X$additional_libdir" != "X/usr/lib"; then
512 haveit=
513 if test "X$additional_libdir" = "X/usr/local/lib"; then
514 if test -n "$GCC"; then
515 case $host_os in
516 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
517 esac
518 fi
519 fi
520 if test -z "$haveit"; then
521 haveit=
522 for x in $LDFLAGS $LIB[]NAME; do
523 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
524 if test "X$x" = "X-L$additional_libdir"; then
525 haveit=yes
526 break
527 fi
528 done
529 if test -z "$haveit"; then
530 if test -d "$additional_libdir"; then
531 dnl Really add $additional_libdir to $LIBNAME.
532 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
533 fi
534 fi
535 haveit=
536 for x in $LDFLAGS $LTLIB[]NAME; do
537 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
538 if test "X$x" = "X-L$additional_libdir"; then
539 haveit=yes
540 break
541 fi
542 done
543 if test -z "$haveit"; then
544 if test -d "$additional_libdir"; then
545 dnl Really add $additional_libdir to $LTLIBNAME.
546 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
547 fi
548 fi
549 fi
550 fi
551 ;;
552 -R*)
553 dir=`echo "X$dep" | sed -e 's/^X-R//'`
554 if test "$enable_rpath" != no; then
555 dnl Potentially add DIR to rpathdirs.
556 dnl The rpathdirs will be appended to $LIBNAME at the end.
557 haveit=
558 for x in $rpathdirs; do
559 if test "X$x" = "X$dir"; then
560 haveit=yes
561 break
562 fi
563 done
564 if test -z "$haveit"; then
565 rpathdirs="$rpathdirs $dir"
566 fi
567 dnl Potentially add DIR to ltrpathdirs.
568 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
569 haveit=
570 for x in $ltrpathdirs; do
571 if test "X$x" = "X$dir"; then
572 haveit=yes
573 break
574 fi
575 done
576 if test -z "$haveit"; then
577 ltrpathdirs="$ltrpathdirs $dir"
578 fi
579 fi
580 ;;
581 -l*)
582 dnl Handle this in the next round.
583 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
584 ;;
585 *.la)
586 dnl Handle this in the next round. Throw away the .la's
587 dnl directory; it is already contained in a preceding -L
588 dnl option.
589 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
590 ;;
591 *)
592 dnl Most likely an immediate library name.
593 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
594 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
595 ;;
596 esac
597 done
598 fi
599 else
600 dnl Didn't find the library; assume it is in the system directories
601 dnl known to the linker and runtime loader. (All the system
602 dnl directories known to the linker should also be known to the
603 dnl runtime loader, otherwise the system is severely misconfigured.)
604 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
605 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
606 fi
607 fi
608 fi
609 done
610 done
611 if test "X$rpathdirs" != "X"; then
612 if test -n "$hardcode_libdir_separator"; then
613 dnl Weird platform: only the last -rpath option counts, the user must
614 dnl pass all path elements in one option. We can arrange that for a
615 dnl single library, but not when more than one $LIBNAMEs are used.
616 alldirs=
617 for found_dir in $rpathdirs; do
618 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
619 done
620 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
621 acl_save_libdir="$libdir"
622 libdir="$alldirs"
623 eval flag=\"$hardcode_libdir_flag_spec\"
624 libdir="$acl_save_libdir"
625 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
626 else
627 dnl The -rpath options are cumulative.
628 for found_dir in $rpathdirs; do
629 acl_save_libdir="$libdir"
630 libdir="$found_dir"
631 eval flag=\"$hardcode_libdir_flag_spec\"
632 libdir="$acl_save_libdir"
633 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
634 done
635 fi
636 fi
637 if test "X$ltrpathdirs" != "X"; then
638 dnl When using libtool, the option that works for both libraries and
639 dnl executables is -R. The -R options are cumulative.
640 for found_dir in $ltrpathdirs; do
641 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
642 done
643 fi
644 ])
645
646 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
647 dnl unless already present in VAR.
648 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
649 dnl contains two or three consecutive elements that belong together.
650 AC_DEFUN([AC_LIB_APPENDTOVAR],
651 [
652 for element in [$2]; do
653 haveit=
654 for x in $[$1]; do
655 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
656 if test "X$x" = "X$element"; then
657 haveit=yes
658 break
659 fi
660 done
661 if test -z "$haveit"; then
662 [$1]="${[$1]}${[$1]:+ }$element"
663 fi
664 done
665 ])
666 # lib-prefix.m4 serial 4 (gettext-0.14.2)
667 dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
668 dnl This file is free software; the Free Software Foundation
669 dnl gives unlimited permission to copy and/or distribute it,
670 dnl with or without modifications, as long as this notice is preserved.
671
672 dnl From Bruno Haible.
673
674 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
675 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
676 dnl require excessive bracketing.
677 ifdef([AC_HELP_STRING],
678 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
679 [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
680
681 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
682 dnl to access previously installed libraries. The basic assumption is that
683 dnl a user will want packages to use other packages he previously installed
684 dnl with the same --prefix option.
685 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
686 dnl libraries, but is otherwise very convenient.
687 AC_DEFUN([AC_LIB_PREFIX],
688 [
689 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
690 AC_REQUIRE([AC_PROG_CC])
691 AC_REQUIRE([AC_CANONICAL_HOST])
692 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
693 dnl By default, look in $includedir and $libdir.
694 use_additional=yes
695 AC_LIB_WITH_FINAL_PREFIX([
696 eval additional_includedir=\"$includedir\"
697 eval additional_libdir=\"$libdir\"
698 ])
699 AC_LIB_ARG_WITH([lib-prefix],
700 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
701 --without-lib-prefix don't search for libraries in includedir and libdir],
702 [
703 if test "X$withval" = "Xno"; then
704 use_additional=no
705 else
706 if test "X$withval" = "X"; then
707 AC_LIB_WITH_FINAL_PREFIX([
708 eval additional_includedir=\"$includedir\"
709 eval additional_libdir=\"$libdir\"
710 ])
711 else
712 additional_includedir="$withval/include"
713 additional_libdir="$withval/lib"
714 fi
715 fi
716 ])
717 if test $use_additional = yes; then
718 dnl Potentially add $additional_includedir to $CPPFLAGS.
719 dnl But don't add it
720 dnl 1. if it's the standard /usr/include,
721 dnl 2. if it's already present in $CPPFLAGS,
722 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
723 dnl 4. if it doesn't exist as a directory.
724 if test "X$additional_includedir" != "X/usr/include"; then
725 haveit=
726 for x in $CPPFLAGS; do
727 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
728 if test "X$x" = "X-I$additional_includedir"; then
729 haveit=yes
730 break
731 fi
732 done
733 if test -z "$haveit"; then
734 if test "X$additional_includedir" = "X/usr/local/include"; then
735 if test -n "$GCC"; then
736 case $host_os in
737 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
738 esac
739 fi
740 fi
741 if test -z "$haveit"; then
742 if test -d "$additional_includedir"; then
743 dnl Really add $additional_includedir to $CPPFLAGS.
744 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
745 fi
746 fi
747 fi
748 fi
749 dnl Potentially add $additional_libdir to $LDFLAGS.
750 dnl But don't add it
751 dnl 1. if it's the standard /usr/lib,
752 dnl 2. if it's already present in $LDFLAGS,
753 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
754 dnl 4. if it doesn't exist as a directory.
755 if test "X$additional_libdir" != "X/usr/lib"; then
756 haveit=
757 for x in $LDFLAGS; do
758 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
759 if test "X$x" = "X-L$additional_libdir"; then
760 haveit=yes
761 break
762 fi
763 done
764 if test -z "$haveit"; then
765 if test "X$additional_libdir" = "X/usr/local/lib"; then
766 if test -n "$GCC"; then
767 case $host_os in
768 linux*) haveit=yes;;
769 esac
770 fi
771 fi
772 if test -z "$haveit"; then
773 if test -d "$additional_libdir"; then
774 dnl Really add $additional_libdir to $LDFLAGS.
775 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
776 fi
777 fi
778 fi
779 fi
780 fi
781 ])
782
783 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
784 dnl acl_final_exec_prefix, containing the values to which $prefix and
785 dnl $exec_prefix will expand at the end of the configure script.
786 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
787 [
788 dnl Unfortunately, prefix and exec_prefix get only finally determined
789 dnl at the end of configure.
790 if test "X$prefix" = "XNONE"; then
791 acl_final_prefix="$ac_default_prefix"
792 else
793 acl_final_prefix="$prefix"
794 fi
795 if test "X$exec_prefix" = "XNONE"; then
796 acl_final_exec_prefix='${prefix}'
797 else
798 acl_final_exec_prefix="$exec_prefix"
799 fi
800 acl_save_prefix="$prefix"
801 prefix="$acl_final_prefix"
802 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
803 prefix="$acl_save_prefix"
804 ])
805
806 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
807 dnl variables prefix and exec_prefix bound to the values they will have
808 dnl at the end of the configure script.
809 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
810 [
811 acl_save_prefix="$prefix"
812 prefix="$acl_final_prefix"
813 acl_save_exec_prefix="$exec_prefix"
814 exec_prefix="$acl_final_exec_prefix"
815 $1
816 exec_prefix="$acl_save_exec_prefix"
817 prefix="$acl_save_prefix"
818 ])
Something went wrong with that request. Please try again.