annotate m4/lib-link.m4 @ 9787:932a22d80734

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