aboutsummaryrefslogtreecommitdiff
path: root/m4/lib-link.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/lib-link.m4')
-rw-r--r--m4/lib-link.m4311
1 files changed, 222 insertions, 89 deletions
diff --git a/m4/lib-link.m4 b/m4/lib-link.m4
index f95b7ba88..3522d994d 100644
--- a/m4/lib-link.m4
+++ b/m4/lib-link.m4
@@ -1,58 +1,66 @@
1# lib-link.m4 serial 9 (gettext-0.16) 1# lib-link.m4 serial 26 (gettext-0.18.2)
2dnl Copyright (C) 2001-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2014 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7dnl From Bruno Haible. 7dnl From Bruno Haible.
8 8
9AC_PREREQ(2.50) 9AC_PREREQ([2.54])
10 10
11dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and 11dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
12dnl the libraries corresponding to explicit and implicit dependencies. 12dnl the libraries corresponding to explicit and implicit dependencies.
13dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and 13dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
14dnl augments the CPPFLAGS variable. 14dnl augments the CPPFLAGS variable.
15dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
16dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
15AC_DEFUN([AC_LIB_LINKFLAGS], 17AC_DEFUN([AC_LIB_LINKFLAGS],
16[ 18[
17 AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) 19 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
18 AC_REQUIRE([AC_LIB_RPATH]) 20 AC_REQUIRE([AC_LIB_RPATH])
19 define([Name],[translit([$1],[./-], [___])]) 21 pushdef([Name],[m4_translit([$1],[./+-], [____])])
20 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], 22 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
21 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) 23 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
22 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ 24 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
23 AC_LIB_LINKFLAGS_BODY([$1], [$2]) 25 AC_LIB_LINKFLAGS_BODY([$1], [$2])
24 ac_cv_lib[]Name[]_libs="$LIB[]NAME" 26 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
25 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" 27 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
26 ac_cv_lib[]Name[]_cppflags="$INC[]NAME" 28 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
29 ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
27 ]) 30 ])
28 LIB[]NAME="$ac_cv_lib[]Name[]_libs" 31 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
29 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" 32 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
30 INC[]NAME="$ac_cv_lib[]Name[]_cppflags" 33 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
34 LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
31 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) 35 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
32 AC_SUBST([LIB]NAME) 36 AC_SUBST([LIB]NAME)
33 AC_SUBST([LTLIB]NAME) 37 AC_SUBST([LTLIB]NAME)
38 AC_SUBST([LIB]NAME[_PREFIX])
34 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the 39 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
35 dnl results of this search when this library appears as a dependency. 40 dnl results of this search when this library appears as a dependency.
36 HAVE_LIB[]NAME=yes 41 HAVE_LIB[]NAME=yes
37 undefine([Name]) 42 popdef([NAME])
38 undefine([NAME]) 43 popdef([Name])
39]) 44])
40 45
41dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) 46dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
42dnl searches for libname and the libraries corresponding to explicit and 47dnl searches for libname and the libraries corresponding to explicit and
43dnl implicit dependencies, together with the specified include files and 48dnl implicit dependencies, together with the specified include files and
44dnl the ability to compile and link the specified testcode. If found, it 49dnl the ability to compile and link the specified testcode. The missing-message
45dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and 50dnl defaults to 'no' and may contain additional hints for the user.
46dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and 51dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
52dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
47dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs 53dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
48dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. 54dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
55dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
56dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
49AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], 57AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
50[ 58[
51 AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) 59 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
52 AC_REQUIRE([AC_LIB_RPATH]) 60 AC_REQUIRE([AC_LIB_RPATH])
53 define([Name],[translit([$1],[./-], [___])]) 61 pushdef([Name],[m4_translit([$1],[./+-], [____])])
54 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], 62 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
55 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) 63 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
56 64
57 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME 65 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
58 dnl accordingly. 66 dnl accordingly.
@@ -66,13 +74,26 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
66 74
67 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ 75 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
68 ac_save_LIBS="$LIBS" 76 ac_save_LIBS="$LIBS"
69 LIBS="$LIBS $LIB[]NAME" 77 dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
70 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) 78 dnl because these -l options might require -L options that are present in
79 dnl LIBS. -l options benefit only from the -L options listed before it.
80 dnl Otherwise, add it to the front of LIBS, because it may be a static
81 dnl library that depends on another static library that is present in LIBS.
82 dnl Static libraries benefit only from the static libraries listed after
83 dnl it.
84 case " $LIB[]NAME" in
85 *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
86 *) LIBS="$LIB[]NAME $LIBS" ;;
87 esac
88 AC_LINK_IFELSE(
89 [AC_LANG_PROGRAM([[$3]], [[$4]])],
90 [ac_cv_lib[]Name=yes],
91 [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
71 LIBS="$ac_save_LIBS" 92 LIBS="$ac_save_LIBS"
72 ]) 93 ])
73 if test "$ac_cv_lib[]Name" = yes; then 94 if test "$ac_cv_lib[]Name" = yes; then
74 HAVE_LIB[]NAME=yes 95 HAVE_LIB[]NAME=yes
75 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) 96 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
76 AC_MSG_CHECKING([how to link with lib[]$1]) 97 AC_MSG_CHECKING([how to link with lib[]$1])
77 AC_MSG_RESULT([$LIB[]NAME]) 98 AC_MSG_RESULT([$LIB[]NAME])
78 else 99 else
@@ -82,17 +103,25 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
82 CPPFLAGS="$ac_save_CPPFLAGS" 103 CPPFLAGS="$ac_save_CPPFLAGS"
83 LIB[]NAME= 104 LIB[]NAME=
84 LTLIB[]NAME= 105 LTLIB[]NAME=
106 LIB[]NAME[]_PREFIX=
85 fi 107 fi
86 AC_SUBST([HAVE_LIB]NAME) 108 AC_SUBST([HAVE_LIB]NAME)
87 AC_SUBST([LIB]NAME) 109 AC_SUBST([LIB]NAME)
88 AC_SUBST([LTLIB]NAME) 110 AC_SUBST([LTLIB]NAME)
89 undefine([Name]) 111 AC_SUBST([LIB]NAME[_PREFIX])
90 undefine([NAME]) 112 popdef([NAME])
113 popdef([Name])
91]) 114])
92 115
93dnl Determine the platform dependent parameters needed to use rpath: 116dnl Determine the platform dependent parameters needed to use rpath:
94dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, 117dnl acl_libext,
95dnl hardcode_direct, hardcode_minus_L. 118dnl acl_shlibext,
119dnl acl_libname_spec,
120dnl acl_library_names_spec,
121dnl acl_hardcode_libdir_flag_spec,
122dnl acl_hardcode_libdir_separator,
123dnl acl_hardcode_direct,
124dnl acl_hardcode_minus_L.
96AC_DEFUN([AC_LIB_RPATH], 125AC_DEFUN([AC_LIB_RPATH],
97[ 126[
98 dnl Tell automake >= 1.10 to complain if config.rpath is missing. 127 dnl Tell automake >= 1.10 to complain if config.rpath is missing.
@@ -101,7 +130,7 @@ AC_DEFUN([AC_LIB_RPATH],
101 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld 130 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
102 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host 131 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
103 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir 132 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
104 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ 133 AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
105 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ 134 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
106 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh 135 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
107 . ./conftest.sh 136 . ./conftest.sh
@@ -109,35 +138,66 @@ AC_DEFUN([AC_LIB_RPATH],
109 acl_cv_rpath=done 138 acl_cv_rpath=done
110 ]) 139 ])
111 wl="$acl_cv_wl" 140 wl="$acl_cv_wl"
112 libext="$acl_cv_libext" 141 acl_libext="$acl_cv_libext"
113 shlibext="$acl_cv_shlibext" 142 acl_shlibext="$acl_cv_shlibext"
114 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" 143 acl_libname_spec="$acl_cv_libname_spec"
115 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" 144 acl_library_names_spec="$acl_cv_library_names_spec"
116 hardcode_direct="$acl_cv_hardcode_direct" 145 acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
117 hardcode_minus_L="$acl_cv_hardcode_minus_L" 146 acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
147 acl_hardcode_direct="$acl_cv_hardcode_direct"
148 acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
118 dnl Determine whether the user wants rpath handling at all. 149 dnl Determine whether the user wants rpath handling at all.
119 AC_ARG_ENABLE(rpath, 150 AC_ARG_ENABLE([rpath],
120 [ --disable-rpath do not hardcode runtime library paths], 151 [ --disable-rpath do not hardcode runtime library paths],
121 :, enable_rpath=yes) 152 :, enable_rpath=yes)
122]) 153])
123 154
155dnl AC_LIB_FROMPACKAGE(name, package)
156dnl declares that libname comes from the given package. The configure file
157dnl will then not have a --with-libname-prefix option but a
158dnl --with-package-prefix option. Several libraries can come from the same
159dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
160dnl macro call that searches for libname.
161AC_DEFUN([AC_LIB_FROMPACKAGE],
162[
163 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
164 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
165 define([acl_frompackage_]NAME, [$2])
166 popdef([NAME])
167 pushdef([PACK],[$2])
168 pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
169 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
170 define([acl_libsinpackage_]PACKUP,
171 m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
172 popdef([PACKUP])
173 popdef([PACK])
174])
175
124dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and 176dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
125dnl the libraries corresponding to explicit and implicit dependencies. 177dnl the libraries corresponding to explicit and implicit dependencies.
126dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. 178dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
179dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
180dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
127AC_DEFUN([AC_LIB_LINKFLAGS_BODY], 181AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
128[ 182[
129 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) 183 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
130 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], 184 pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
131 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) 185 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
186 pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
187 pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
188 [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
189 pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
190 dnl Autoconf >= 2.61 supports dots in --with options.
191 pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
132 dnl By default, look in $includedir and $libdir. 192 dnl By default, look in $includedir and $libdir.
133 use_additional=yes 193 use_additional=yes
134 AC_LIB_WITH_FINAL_PREFIX([ 194 AC_LIB_WITH_FINAL_PREFIX([
135 eval additional_includedir=\"$includedir\" 195 eval additional_includedir=\"$includedir\"
136 eval additional_libdir=\"$libdir\" 196 eval additional_libdir=\"$libdir\"
137 ]) 197 ])
138 AC_LIB_ARG_WITH([lib$1-prefix], 198 AC_ARG_WITH(P_A_C_K[-prefix],
139[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib 199[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
140 --without-lib$1-prefix don't search for lib$1 in includedir and libdir], 200 --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
141[ 201[
142 if test "X$withval" = "Xno"; then 202 if test "X$withval" = "Xno"; then
143 use_additional=no 203 use_additional=no
@@ -150,6 +210,10 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
150 else 210 else
151 additional_includedir="$withval/include" 211 additional_includedir="$withval/include"
152 additional_libdir="$withval/$acl_libdirstem" 212 additional_libdir="$withval/$acl_libdirstem"
213 if test "$acl_libdirstem2" != "$acl_libdirstem" \
214 && ! test -d "$withval/$acl_libdirstem"; then
215 additional_libdir="$withval/$acl_libdirstem2"
216 fi
153 fi 217 fi
154 fi 218 fi
155]) 219])
@@ -158,6 +222,10 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
158 LIB[]NAME= 222 LIB[]NAME=
159 LTLIB[]NAME= 223 LTLIB[]NAME=
160 INC[]NAME= 224 INC[]NAME=
225 LIB[]NAME[]_PREFIX=
226 dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
227 dnl computed. So it has to be reset here.
228 HAVE_LIB[]NAME=
161 rpathdirs= 229 rpathdirs=
162 ltrpathdirs= 230 ltrpathdirs=
163 names_already_handled= 231 names_already_handled=
@@ -177,7 +245,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
177 names_already_handled="$names_already_handled $name" 245 names_already_handled="$names_already_handled $name"
178 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS 246 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
179 dnl or AC_LIB_HAVE_LINKFLAGS call. 247 dnl or AC_LIB_HAVE_LINKFLAGS call.
180 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` 248 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
181 eval value=\"\$HAVE_LIB$uppername\" 249 eval value=\"\$HAVE_LIB$uppername\"
182 if test -n "$value"; then 250 if test -n "$value"; then
183 if test "$value" = yes; then 251 if test "$value" = yes; then
@@ -197,27 +265,53 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
197 found_la= 265 found_la=
198 found_so= 266 found_so=
199 found_a= 267 found_a=
268 eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
269 if test -n "$acl_shlibext"; then
270 shrext=".$acl_shlibext" # typically: shrext=.so
271 else
272 shrext=
273 fi
200 if test $use_additional = yes; then 274 if test $use_additional = yes; then
201 if test -n "$shlibext" \ 275 dir="$additional_libdir"
202 && { test -f "$additional_libdir/lib$name.$shlibext" \ 276 dnl The same code as in the loop below:
203 || { test "$shlibext" = dll \ 277 dnl First look for a shared library.
204 && test -f "$additional_libdir/lib$name.dll.a"; }; }; then 278 if test -n "$acl_shlibext"; then
205 found_dir="$additional_libdir" 279 if test -f "$dir/$libname$shrext"; then
206 if test -f "$additional_libdir/lib$name.$shlibext"; then 280 found_dir="$dir"
207 found_so="$additional_libdir/lib$name.$shlibext" 281 found_so="$dir/$libname$shrext"
208 else 282 else
209 found_so="$additional_libdir/lib$name.dll.a" 283 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
284 ver=`(cd "$dir" && \
285 for f in "$libname$shrext".*; do echo "$f"; done \
286 | sed -e "s,^$libname$shrext\\\\.,," \
287 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
288 | sed 1q ) 2>/dev/null`
289 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
290 found_dir="$dir"
291 found_so="$dir/$libname$shrext.$ver"
292 fi
293 else
294 eval library_names=\"$acl_library_names_spec\"
295 for f in $library_names; do
296 if test -f "$dir/$f"; then
297 found_dir="$dir"
298 found_so="$dir/$f"
299 break
300 fi
301 done
302 fi
210 fi 303 fi
211 if test -f "$additional_libdir/lib$name.la"; then 304 fi
212 found_la="$additional_libdir/lib$name.la" 305 dnl Then look for a static library.
306 if test "X$found_dir" = "X"; then
307 if test -f "$dir/$libname.$acl_libext"; then
308 found_dir="$dir"
309 found_a="$dir/$libname.$acl_libext"
213 fi 310 fi
214 else 311 fi
215 if test -f "$additional_libdir/lib$name.$libext"; then 312 if test "X$found_dir" != "X"; then
216 found_dir="$additional_libdir" 313 if test -f "$dir/$libname.la"; then
217 found_a="$additional_libdir/lib$name.$libext" 314 found_la="$dir/$libname.la"
218 if test -f "$additional_libdir/lib$name.la"; then
219 found_la="$additional_libdir/lib$name.la"
220 fi
221 fi 315 fi
222 fi 316 fi
223 fi 317 fi
@@ -227,26 +321,44 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
227 case "$x" in 321 case "$x" in
228 -L*) 322 -L*)
229 dir=`echo "X$x" | sed -e 's/^X-L//'` 323 dir=`echo "X$x" | sed -e 's/^X-L//'`
230 if test -n "$shlibext" \ 324 dnl First look for a shared library.
231 && { test -f "$dir/lib$name.$shlibext" \ 325 if test -n "$acl_shlibext"; then
232 || { test "$shlibext" = dll \ 326 if test -f "$dir/$libname$shrext"; then
233 && test -f "$dir/lib$name.dll.a"; }; }; then 327 found_dir="$dir"
234 found_dir="$dir" 328 found_so="$dir/$libname$shrext"
235 if test -f "$dir/lib$name.$shlibext"; then
236 found_so="$dir/lib$name.$shlibext"
237 else 329 else
238 found_so="$dir/lib$name.dll.a" 330 if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
239 fi 331 ver=`(cd "$dir" && \
240 if test -f "$dir/lib$name.la"; then 332 for f in "$libname$shrext".*; do echo "$f"; done \
241 found_la="$dir/lib$name.la" 333 | sed -e "s,^$libname$shrext\\\\.,," \
334 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
335 | sed 1q ) 2>/dev/null`
336 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
337 found_dir="$dir"
338 found_so="$dir/$libname$shrext.$ver"
339 fi
340 else
341 eval library_names=\"$acl_library_names_spec\"
342 for f in $library_names; do
343 if test -f "$dir/$f"; then
344 found_dir="$dir"
345 found_so="$dir/$f"
346 break
347 fi
348 done
349 fi
242 fi 350 fi
243 else 351 fi
244 if test -f "$dir/lib$name.$libext"; then 352 dnl Then look for a static library.
353 if test "X$found_dir" = "X"; then
354 if test -f "$dir/$libname.$acl_libext"; then
245 found_dir="$dir" 355 found_dir="$dir"
246 found_a="$dir/lib$name.$libext" 356 found_a="$dir/$libname.$acl_libext"
247 if test -f "$dir/lib$name.la"; then 357 fi
248 found_la="$dir/lib$name.la" 358 fi
249 fi 359 if test "X$found_dir" != "X"; then
360 if test -f "$dir/$libname.la"; then
361 found_la="$dir/$libname.la"
250 fi 362 fi
251 fi 363 fi
252 ;; 364 ;;
@@ -263,7 +375,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
263 dnl Linking with a shared library. We attempt to hardcode its 375 dnl Linking with a shared library. We attempt to hardcode its
264 dnl directory into the executable's runpath, unless it's the 376 dnl directory into the executable's runpath, unless it's the
265 dnl standard /usr/lib. 377 dnl standard /usr/lib.
266 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then 378 if test "$enable_rpath" = no \
379 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
380 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
267 dnl No hardcoding is needed. 381 dnl No hardcoding is needed.
268 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" 382 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
269 else 383 else
@@ -282,12 +396,12 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
282 ltrpathdirs="$ltrpathdirs $found_dir" 396 ltrpathdirs="$ltrpathdirs $found_dir"
283 fi 397 fi
284 dnl The hardcoding into $LIBNAME is system dependent. 398 dnl The hardcoding into $LIBNAME is system dependent.
285 if test "$hardcode_direct" = yes; then 399 if test "$acl_hardcode_direct" = yes; then
286 dnl Using DIR/libNAME.so during linking hardcodes DIR into the 400 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
287 dnl resulting binary. 401 dnl resulting binary.
288 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" 402 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
289 else 403 else
290 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then 404 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
291 dnl Use an explicit option to hardcode DIR into the resulting 405 dnl Use an explicit option to hardcode DIR into the resulting
292 dnl binary. 406 dnl binary.
293 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" 407 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
@@ -318,13 +432,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
318 if test -z "$haveit"; then 432 if test -z "$haveit"; then
319 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" 433 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
320 fi 434 fi
321 if test "$hardcode_minus_L" != no; then 435 if test "$acl_hardcode_minus_L" != no; then
322 dnl FIXME: Not sure whether we should use 436 dnl FIXME: Not sure whether we should use
323 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" 437 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
324 dnl here. 438 dnl here.
325 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" 439 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
326 else 440 else
327 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH 441 dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
328 dnl here, because this doesn't fit in flags passed to the 442 dnl here, because this doesn't fit in flags passed to the
329 dnl compiler. So give up. No hardcoding. This affects only 443 dnl compiler. So give up. No hardcoding. This affects only
330 dnl very old systems. 444 dnl very old systems.
@@ -351,6 +465,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
351 case "$found_dir" in 465 case "$found_dir" in
352 */$acl_libdirstem | */$acl_libdirstem/) 466 */$acl_libdirstem | */$acl_libdirstem/)
353 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` 467 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
468 if test "$name" = '$1'; then
469 LIB[]NAME[]_PREFIX="$basedir"
470 fi
471 additional_includedir="$basedir/include"
472 ;;
473 */$acl_libdirstem2 | */$acl_libdirstem2/)
474 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
475 if test "$name" = '$1'; then
476 LIB[]NAME[]_PREFIX="$basedir"
477 fi
354 additional_includedir="$basedir/include" 478 additional_includedir="$basedir/include"
355 ;; 479 ;;
356 esac 480 esac
@@ -411,9 +535,11 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
411 dnl 3. if it's already present in $LDFLAGS or the already 535 dnl 3. if it's already present in $LDFLAGS or the already
412 dnl constructed $LIBNAME, 536 dnl constructed $LIBNAME,
413 dnl 4. if it doesn't exist as a directory. 537 dnl 4. if it doesn't exist as a directory.
414 if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then 538 if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
539 && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
415 haveit= 540 haveit=
416 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then 541 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
542 || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
417 if test -n "$GCC"; then 543 if test -n "$GCC"; then
418 case $host_os in 544 case $host_os in
419 linux* | gnu* | k*bsd*-gnu) haveit=yes;; 545 linux* | gnu* | k*bsd*-gnu) haveit=yes;;
@@ -512,18 +638,18 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
512 done 638 done
513 done 639 done
514 if test "X$rpathdirs" != "X"; then 640 if test "X$rpathdirs" != "X"; then
515 if test -n "$hardcode_libdir_separator"; then 641 if test -n "$acl_hardcode_libdir_separator"; then
516 dnl Weird platform: only the last -rpath option counts, the user must 642 dnl Weird platform: only the last -rpath option counts, the user must
517 dnl pass all path elements in one option. We can arrange that for a 643 dnl pass all path elements in one option. We can arrange that for a
518 dnl single library, but not when more than one $LIBNAMEs are used. 644 dnl single library, but not when more than one $LIBNAMEs are used.
519 alldirs= 645 alldirs=
520 for found_dir in $rpathdirs; do 646 for found_dir in $rpathdirs; do
521 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" 647 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
522 done 648 done
523 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. 649 dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
524 acl_save_libdir="$libdir" 650 acl_save_libdir="$libdir"
525 libdir="$alldirs" 651 libdir="$alldirs"
526 eval flag=\"$hardcode_libdir_flag_spec\" 652 eval flag=\"$acl_hardcode_libdir_flag_spec\"
527 libdir="$acl_save_libdir" 653 libdir="$acl_save_libdir"
528 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" 654 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
529 else 655 else
@@ -531,7 +657,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
531 for found_dir in $rpathdirs; do 657 for found_dir in $rpathdirs; do
532 acl_save_libdir="$libdir" 658 acl_save_libdir="$libdir"
533 libdir="$found_dir" 659 libdir="$found_dir"
534 eval flag=\"$hardcode_libdir_flag_spec\" 660 eval flag=\"$acl_hardcode_libdir_flag_spec\"
535 libdir="$acl_save_libdir" 661 libdir="$acl_save_libdir"
536 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" 662 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
537 done 663 done
@@ -544,6 +670,11 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
544 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" 670 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
545 done 671 done
546 fi 672 fi
673 popdef([P_A_C_K])
674 popdef([PACKLIBS])
675 popdef([PACKUP])
676 popdef([PACK])
677 popdef([NAME])
547]) 678])
548 679
549dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, 680dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
@@ -580,7 +711,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
580 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) 711 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
581 $1= 712 $1=
582 if test "$enable_rpath" != no; then 713 if test "$enable_rpath" != no; then
583 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then 714 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
584 dnl Use an explicit option to hardcode directories into the resulting 715 dnl Use an explicit option to hardcode directories into the resulting
585 dnl binary. 716 dnl binary.
586 rpathdirs= 717 rpathdirs=
@@ -589,7 +720,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
589 if test -n "$next"; then 720 if test -n "$next"; then
590 dir="$next" 721 dir="$next"
591 dnl No need to hardcode the standard /usr/lib. 722 dnl No need to hardcode the standard /usr/lib.
592 if test "X$dir" != "X/usr/$acl_libdirstem"; then 723 if test "X$dir" != "X/usr/$acl_libdirstem" \
724 && test "X$dir" != "X/usr/$acl_libdirstem2"; then
593 rpathdirs="$rpathdirs $dir" 725 rpathdirs="$rpathdirs $dir"
594 fi 726 fi
595 next= 727 next=
@@ -598,7 +730,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
598 -L) next=yes ;; 730 -L) next=yes ;;
599 -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` 731 -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
600 dnl No need to hardcode the standard /usr/lib. 732 dnl No need to hardcode the standard /usr/lib.
601 if test "X$dir" != "X/usr/$acl_libdirstem"; then 733 if test "X$dir" != "X/usr/$acl_libdirstem" \
734 && test "X$dir" != "X/usr/$acl_libdirstem2"; then
602 rpathdirs="$rpathdirs $dir" 735 rpathdirs="$rpathdirs $dir"
603 fi 736 fi
604 next= ;; 737 next= ;;
@@ -614,16 +747,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
614 done 747 done
615 else 748 else
616 dnl The linker is used for linking directly. 749 dnl The linker is used for linking directly.
617 if test -n "$hardcode_libdir_separator"; then 750 if test -n "$acl_hardcode_libdir_separator"; then
618 dnl Weird platform: only the last -rpath option counts, the user 751 dnl Weird platform: only the last -rpath option counts, the user
619 dnl must pass all path elements in one option. 752 dnl must pass all path elements in one option.
620 alldirs= 753 alldirs=
621 for dir in $rpathdirs; do 754 for dir in $rpathdirs; do
622 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir" 755 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
623 done 756 done
624 acl_save_libdir="$libdir" 757 acl_save_libdir="$libdir"
625 libdir="$alldirs" 758 libdir="$alldirs"
626 eval flag=\"$hardcode_libdir_flag_spec\" 759 eval flag=\"$acl_hardcode_libdir_flag_spec\"
627 libdir="$acl_save_libdir" 760 libdir="$acl_save_libdir"
628 $1="$flag" 761 $1="$flag"
629 else 762 else
@@ -631,7 +764,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
631 for dir in $rpathdirs; do 764 for dir in $rpathdirs; do
632 acl_save_libdir="$libdir" 765 acl_save_libdir="$libdir"
633 libdir="$dir" 766 libdir="$dir"
634 eval flag=\"$hardcode_libdir_flag_spec\" 767 eval flag=\"$acl_hardcode_libdir_flag_spec\"
635 libdir="$acl_save_libdir" 768 libdir="$acl_save_libdir"
636 $1="${$1}${$1:+ }$flag" 769 $1="${$1}${$1:+ }$flag"
637 done 770 done