OLD | NEW |
1 # lib-link.m4 serial 9 (gettext-0.16) | 1 # lib-link.m4 serial 13 (gettext-0.17) |
2 dnl Copyright (C) 2001-2006 Free Software Foundation, Inc. | 2 dnl Copyright (C) 2001-2007 Free Software Foundation, Inc. |
3 dnl This file is free software; the Free Software Foundation | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | 4 dnl gives unlimited permission to copy and/or distribute it, |
5 dnl with or without modifications, as long as this notice is preserved. | 5 dnl with or without modifications, as long as this notice is preserved. |
6 | 6 |
7 dnl From Bruno Haible. | 7 dnl From Bruno Haible. |
8 | 8 |
9 AC_PREREQ(2.50) | 9 AC_PREREQ(2.54) |
10 | 10 |
11 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and | 11 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and |
12 dnl the libraries corresponding to explicit and implicit dependencies. | 12 dnl the libraries corresponding to explicit and implicit dependencies. |
13 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and | 13 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and |
14 dnl augments the CPPFLAGS variable. | 14 dnl augments the CPPFLAGS variable. |
| 15 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname |
| 16 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. |
15 AC_DEFUN([AC_LIB_LINKFLAGS], | 17 AC_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 define([Name],[translit([$1],[./-], [___])]) |
20 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | 22 define([NAME],[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 undefine([Name]) |
38 undefine([NAME]) | 43 undefine([NAME]) |
39 ]) | 44 ]) |
40 | 45 |
41 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) | 46 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) |
42 dnl searches for libname and the libraries corresponding to explicit and | 47 dnl searches for libname and the libraries corresponding to explicit and |
43 dnl implicit dependencies, together with the specified include files and | 48 dnl implicit dependencies, together with the specified include files and |
44 dnl the ability to compile and link the specified testcode. If found, it | 49 dnl the ability to compile and link the specified testcode. If found, it |
45 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and | 50 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and |
46 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and | 51 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and |
47 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs | 52 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs |
48 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. | 53 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. |
| 54 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname |
| 55 dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. |
49 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], | 56 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], |
50 [ | 57 [ |
51 AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | 58 AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
52 AC_REQUIRE([AC_LIB_RPATH]) | 59 AC_REQUIRE([AC_LIB_RPATH]) |
53 define([Name],[translit([$1],[./-], [___])]) | 60 define([Name],[translit([$1],[./-], [___])]) |
54 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | 61 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], |
55 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | 62 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) |
56 | 63 |
57 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME | 64 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME |
58 dnl accordingly. | 65 dnl accordingly. |
(...skipping 16 matching lines...) Expand all Loading... |
75 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) | 82 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) |
76 AC_MSG_CHECKING([how to link with lib[]$1]) | 83 AC_MSG_CHECKING([how to link with lib[]$1]) |
77 AC_MSG_RESULT([$LIB[]NAME]) | 84 AC_MSG_RESULT([$LIB[]NAME]) |
78 else | 85 else |
79 HAVE_LIB[]NAME=no | 86 HAVE_LIB[]NAME=no |
80 dnl If $LIB[]NAME didn't lead to a usable library, we don't need | 87 dnl If $LIB[]NAME didn't lead to a usable library, we don't need |
81 dnl $INC[]NAME either. | 88 dnl $INC[]NAME either. |
82 CPPFLAGS="$ac_save_CPPFLAGS" | 89 CPPFLAGS="$ac_save_CPPFLAGS" |
83 LIB[]NAME= | 90 LIB[]NAME= |
84 LTLIB[]NAME= | 91 LTLIB[]NAME= |
| 92 LIB[]NAME[]_PREFIX= |
85 fi | 93 fi |
86 AC_SUBST([HAVE_LIB]NAME) | 94 AC_SUBST([HAVE_LIB]NAME) |
87 AC_SUBST([LIB]NAME) | 95 AC_SUBST([LIB]NAME) |
88 AC_SUBST([LTLIB]NAME) | 96 AC_SUBST([LTLIB]NAME) |
| 97 AC_SUBST([LIB]NAME[_PREFIX]) |
89 undefine([Name]) | 98 undefine([Name]) |
90 undefine([NAME]) | 99 undefine([NAME]) |
91 ]) | 100 ]) |
92 | 101 |
93 dnl Determine the platform dependent parameters needed to use rpath: | 102 dnl Determine the platform dependent parameters needed to use rpath: |
94 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, | 103 dnl acl_libext, |
95 dnl hardcode_direct, hardcode_minus_L. | 104 dnl acl_shlibext, |
| 105 dnl acl_hardcode_libdir_flag_spec, |
| 106 dnl acl_hardcode_libdir_separator, |
| 107 dnl acl_hardcode_direct, |
| 108 dnl acl_hardcode_minus_L. |
96 AC_DEFUN([AC_LIB_RPATH], | 109 AC_DEFUN([AC_LIB_RPATH], |
97 [ | 110 [ |
98 dnl Tell automake >= 1.10 to complain if config.rpath is missing. | 111 dnl Tell automake >= 1.10 to complain if config.rpath is missing. |
99 m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) | 112 m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) |
100 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS | 113 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS |
101 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld | 114 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld |
102 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host | 115 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host |
103 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir | 116 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, [ | 117 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" \ | 118 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 | 119 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh |
107 . ./conftest.sh | 120 . ./conftest.sh |
108 rm -f ./conftest.sh | 121 rm -f ./conftest.sh |
109 acl_cv_rpath=done | 122 acl_cv_rpath=done |
110 ]) | 123 ]) |
111 wl="$acl_cv_wl" | 124 wl="$acl_cv_wl" |
112 libext="$acl_cv_libext" | 125 acl_libext="$acl_cv_libext" |
113 shlibext="$acl_cv_shlibext" | 126 acl_shlibext="$acl_cv_shlibext" |
114 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" | 127 acl_libname_spec="$acl_cv_libname_spec" |
115 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" | 128 acl_library_names_spec="$acl_cv_library_names_spec" |
116 hardcode_direct="$acl_cv_hardcode_direct" | 129 acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" |
117 hardcode_minus_L="$acl_cv_hardcode_minus_L" | 130 acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" |
| 131 acl_hardcode_direct="$acl_cv_hardcode_direct" |
| 132 acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" |
118 dnl Determine whether the user wants rpath handling at all. | 133 dnl Determine whether the user wants rpath handling at all. |
119 AC_ARG_ENABLE(rpath, | 134 AC_ARG_ENABLE(rpath, |
120 [ --disable-rpath do not hardcode runtime library paths], | 135 [ --disable-rpath do not hardcode runtime library paths], |
121 :, enable_rpath=yes) | 136 :, enable_rpath=yes) |
122 ]) | 137 ]) |
123 | 138 |
124 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and | 139 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and |
125 dnl the libraries corresponding to explicit and implicit dependencies. | 140 dnl the libraries corresponding to explicit and implicit dependencies. |
126 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. | 141 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. |
| 142 dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found |
| 143 dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. |
127 AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | 144 AC_DEFUN([AC_LIB_LINKFLAGS_BODY], |
128 [ | 145 [ |
129 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) | 146 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) |
130 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | 147 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], |
131 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | 148 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) |
| 149 dnl Autoconf >= 2.61 supports dots in --with options. |
| 150 define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61
]),[-1],[translit([$1],[.],[_])],[$1])]) |
132 dnl By default, look in $includedir and $libdir. | 151 dnl By default, look in $includedir and $libdir. |
133 use_additional=yes | 152 use_additional=yes |
134 AC_LIB_WITH_FINAL_PREFIX([ | 153 AC_LIB_WITH_FINAL_PREFIX([ |
135 eval additional_includedir=\"$includedir\" | 154 eval additional_includedir=\"$includedir\" |
136 eval additional_libdir=\"$libdir\" | 155 eval additional_libdir=\"$libdir\" |
137 ]) | 156 ]) |
138 AC_LIB_ARG_WITH([lib$1-prefix], | 157 AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix], |
139 [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib | 158 [ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib |
140 --without-lib$1-prefix don't search for lib$1 in includedir and libdir], | 159 --without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and lib
dir], |
141 [ | 160 [ |
142 if test "X$withval" = "Xno"; then | 161 if test "X$withval" = "Xno"; then |
143 use_additional=no | 162 use_additional=no |
144 else | 163 else |
145 if test "X$withval" = "X"; then | 164 if test "X$withval" = "X"; then |
146 AC_LIB_WITH_FINAL_PREFIX([ | 165 AC_LIB_WITH_FINAL_PREFIX([ |
147 eval additional_includedir=\"$includedir\" | 166 eval additional_includedir=\"$includedir\" |
148 eval additional_libdir=\"$libdir\" | 167 eval additional_libdir=\"$libdir\" |
149 ]) | 168 ]) |
150 else | 169 else |
151 additional_includedir="$withval/include" | 170 additional_includedir="$withval/include" |
152 additional_libdir="$withval/$acl_libdirstem" | 171 additional_libdir="$withval/$acl_libdirstem" |
153 fi | 172 fi |
154 fi | 173 fi |
155 ]) | 174 ]) |
156 dnl Search the library and its dependencies in $additional_libdir and | 175 dnl Search the library and its dependencies in $additional_libdir and |
157 dnl $LDFLAGS. Using breadth-first-seach. | 176 dnl $LDFLAGS. Using breadth-first-seach. |
158 LIB[]NAME= | 177 LIB[]NAME= |
159 LTLIB[]NAME= | 178 LTLIB[]NAME= |
160 INC[]NAME= | 179 INC[]NAME= |
| 180 LIB[]NAME[]_PREFIX= |
161 rpathdirs= | 181 rpathdirs= |
162 ltrpathdirs= | 182 ltrpathdirs= |
163 names_already_handled= | 183 names_already_handled= |
164 names_next_round='$1 $2' | 184 names_next_round='$1 $2' |
165 while test -n "$names_next_round"; do | 185 while test -n "$names_next_round"; do |
166 names_this_round="$names_next_round" | 186 names_this_round="$names_next_round" |
167 names_next_round= | 187 names_next_round= |
168 for name in $names_this_round; do | 188 for name in $names_this_round; do |
169 already_handled= | 189 already_handled= |
170 for n in $names_already_handled; do | 190 for n in $names_already_handled; do |
(...skipping 19 matching lines...) Expand all Loading... |
190 dnl that this library doesn't exist. So just drop it. | 210 dnl that this library doesn't exist. So just drop it. |
191 : | 211 : |
192 fi | 212 fi |
193 else | 213 else |
194 dnl Search the library lib$name in $additional_libdir and $LDFLAGS | 214 dnl Search the library lib$name in $additional_libdir and $LDFLAGS |
195 dnl and the already constructed $LIBNAME/$LTLIBNAME. | 215 dnl and the already constructed $LIBNAME/$LTLIBNAME. |
196 found_dir= | 216 found_dir= |
197 found_la= | 217 found_la= |
198 found_so= | 218 found_so= |
199 found_a= | 219 found_a= |
| 220 eval libname=\"$acl_libname_spec\" # typically: libname=lib$name |
| 221 if test -n "$acl_shlibext"; then |
| 222 shrext=".$acl_shlibext" # typically: shrext=.so |
| 223 else |
| 224 shrext= |
| 225 fi |
200 if test $use_additional = yes; then | 226 if test $use_additional = yes; then |
201 if test -n "$shlibext" \ | 227 dir="$additional_libdir" |
202 && { test -f "$additional_libdir/lib$name.$shlibext" \ | 228 dnl The same code as in the loop below: |
203 || { test "$shlibext" = dll \ | 229 dnl First look for a shared library. |
204 && test -f "$additional_libdir/lib$name.dll.a"; }; }; t
hen | 230 if test -n "$acl_shlibext"; then |
205 found_dir="$additional_libdir" | 231 if test -f "$dir/$libname$shrext"; then |
206 if test -f "$additional_libdir/lib$name.$shlibext"; then | 232 found_dir="$dir" |
207 found_so="$additional_libdir/lib$name.$shlibext" | 233 found_so="$dir/$libname$shrext" |
208 else | 234 else |
209 found_so="$additional_libdir/lib$name.dll.a" | 235 if test "$acl_library_names_spec" = '$libname$shrext$versuffix';
then |
210 fi | 236 ver=`(cd "$dir" && \ |
211 if test -f "$additional_libdir/lib$name.la"; then | 237 for f in "$libname$shrext".*; do echo "$f"; done \ |
212 found_la="$additional_libdir/lib$name.la" | 238 | sed -e "s,^$libname$shrext\\\\.,," \ |
213 fi | 239 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ |
214 else | 240 | sed 1q ) 2>/dev/null` |
215 if test -f "$additional_libdir/lib$name.$libext"; then | 241 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then |
216 found_dir="$additional_libdir" | 242 found_dir="$dir" |
217 found_a="$additional_libdir/lib$name.$libext" | 243 found_so="$dir/$libname$shrext.$ver" |
218 if test -f "$additional_libdir/lib$name.la"; then | 244 fi |
219 found_la="$additional_libdir/lib$name.la" | 245 else |
| 246 eval library_names=\"$acl_library_names_spec\" |
| 247 for f in $library_names; do |
| 248 if test -f "$dir/$f"; then |
| 249 found_dir="$dir" |
| 250 found_so="$dir/$f" |
| 251 break |
| 252 fi |
| 253 done |
220 fi | 254 fi |
221 fi | 255 fi |
222 fi | 256 fi |
| 257 dnl Then look for a static library. |
| 258 if test "X$found_dir" = "X"; then |
| 259 if test -f "$dir/$libname.$acl_libext"; then |
| 260 found_dir="$dir" |
| 261 found_a="$dir/$libname.$acl_libext" |
| 262 fi |
| 263 fi |
| 264 if test "X$found_dir" != "X"; then |
| 265 if test -f "$dir/$libname.la"; then |
| 266 found_la="$dir/$libname.la" |
| 267 fi |
| 268 fi |
223 fi | 269 fi |
224 if test "X$found_dir" = "X"; then | 270 if test "X$found_dir" = "X"; then |
225 for x in $LDFLAGS $LTLIB[]NAME; do | 271 for x in $LDFLAGS $LTLIB[]NAME; do |
226 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | 272 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
227 case "$x" in | 273 case "$x" in |
228 -L*) | 274 -L*) |
229 dir=`echo "X$x" | sed -e 's/^X-L//'` | 275 dir=`echo "X$x" | sed -e 's/^X-L//'` |
230 if test -n "$shlibext" \ | 276 dnl First look for a shared library. |
231 && { test -f "$dir/lib$name.$shlibext" \ | 277 if test -n "$acl_shlibext"; then |
232 || { test "$shlibext" = dll \ | 278 if test -f "$dir/$libname$shrext"; then |
233 && test -f "$dir/lib$name.dll.a"; }; }; then | 279 found_dir="$dir" |
234 found_dir="$dir" | 280 found_so="$dir/$libname$shrext" |
235 if test -f "$dir/lib$name.$shlibext"; then | |
236 found_so="$dir/lib$name.$shlibext" | |
237 else | 281 else |
238 found_so="$dir/lib$name.dll.a" | 282 if test "$acl_library_names_spec" = '$libname$shrext$versu
ffix'; then |
| 283 ver=`(cd "$dir" && \ |
| 284 for f in "$libname$shrext".*; do echo "$f"; done \ |
| 285 | sed -e "s,^$libname$shrext\\\\.,," \ |
| 286 | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5
\ |
| 287 | sed 1q ) 2>/dev/null` |
| 288 if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"
; then |
| 289 found_dir="$dir" |
| 290 found_so="$dir/$libname$shrext.$ver" |
| 291 fi |
| 292 else |
| 293 eval library_names=\"$acl_library_names_spec\" |
| 294 for f in $library_names; do |
| 295 if test -f "$dir/$f"; then |
| 296 found_dir="$dir" |
| 297 found_so="$dir/$f" |
| 298 break |
| 299 fi |
| 300 done |
| 301 fi |
239 fi | 302 fi |
240 if test -f "$dir/lib$name.la"; then | 303 fi |
241 found_la="$dir/lib$name.la" | 304 dnl Then look for a static library. |
| 305 if test "X$found_dir" = "X"; then |
| 306 if test -f "$dir/$libname.$acl_libext"; then |
| 307 found_dir="$dir" |
| 308 found_a="$dir/$libname.$acl_libext" |
242 fi | 309 fi |
243 else | 310 fi |
244 if test -f "$dir/lib$name.$libext"; then | 311 if test "X$found_dir" != "X"; then |
245 found_dir="$dir" | 312 if test -f "$dir/$libname.la"; then |
246 found_a="$dir/lib$name.$libext" | 313 found_la="$dir/$libname.la" |
247 if test -f "$dir/lib$name.la"; then | |
248 found_la="$dir/lib$name.la" | |
249 fi | |
250 fi | 314 fi |
251 fi | 315 fi |
252 ;; | 316 ;; |
253 esac | 317 esac |
254 if test "X$found_dir" != "X"; then | 318 if test "X$found_dir" != "X"; then |
255 break | 319 break |
256 fi | 320 fi |
257 done | 321 done |
258 fi | 322 fi |
259 if test "X$found_dir" != "X"; then | 323 if test "X$found_dir" != "X"; then |
(...skipping 15 matching lines...) Expand all Loading... |
275 for x in $ltrpathdirs; do | 339 for x in $ltrpathdirs; do |
276 if test "X$x" = "X$found_dir"; then | 340 if test "X$x" = "X$found_dir"; then |
277 haveit=yes | 341 haveit=yes |
278 break | 342 break |
279 fi | 343 fi |
280 done | 344 done |
281 if test -z "$haveit"; then | 345 if test -z "$haveit"; then |
282 ltrpathdirs="$ltrpathdirs $found_dir" | 346 ltrpathdirs="$ltrpathdirs $found_dir" |
283 fi | 347 fi |
284 dnl The hardcoding into $LIBNAME is system dependent. | 348 dnl The hardcoding into $LIBNAME is system dependent. |
285 if test "$hardcode_direct" = yes; then | 349 if test "$acl_hardcode_direct" = yes; then |
286 dnl Using DIR/libNAME.so during linking hardcodes DIR into the | 350 dnl Using DIR/libNAME.so during linking hardcodes DIR into the |
287 dnl resulting binary. | 351 dnl resulting binary. |
288 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | 352 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" |
289 else | 353 else |
290 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_min
us_L" = no; then | 354 if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hard
code_minus_L" = no; then |
291 dnl Use an explicit option to hardcode DIR into the resultin
g | 355 dnl Use an explicit option to hardcode DIR into the resultin
g |
292 dnl binary. | 356 dnl binary. |
293 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | 357 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" |
294 dnl Potentially add DIR to rpathdirs. | 358 dnl Potentially add DIR to rpathdirs. |
295 dnl The rpathdirs will be appended to $LIBNAME at the end. | 359 dnl The rpathdirs will be appended to $LIBNAME at the end. |
296 haveit= | 360 haveit= |
297 for x in $rpathdirs; do | 361 for x in $rpathdirs; do |
298 if test "X$x" = "X$found_dir"; then | 362 if test "X$x" = "X$found_dir"; then |
299 haveit=yes | 363 haveit=yes |
300 break | 364 break |
(...skipping 10 matching lines...) Expand all Loading... |
311 for x in $LDFLAGS $LIB[]NAME; do | 375 for x in $LDFLAGS $LIB[]NAME; do |
312 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | 376 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
313 if test "X$x" = "X-L$found_dir"; then | 377 if test "X$x" = "X-L$found_dir"; then |
314 haveit=yes | 378 haveit=yes |
315 break | 379 break |
316 fi | 380 fi |
317 done | 381 done |
318 if test -z "$haveit"; then | 382 if test -z "$haveit"; then |
319 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" | 383 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" |
320 fi | 384 fi |
321 if test "$hardcode_minus_L" != no; then | 385 if test "$acl_hardcode_minus_L" != no; then |
322 dnl FIXME: Not sure whether we should use | 386 dnl FIXME: Not sure whether we should use |
323 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" | 387 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" |
324 dnl here. | 388 dnl here. |
325 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | 389 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" |
326 else | 390 else |
327 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH | 391 dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PAT
H |
328 dnl here, because this doesn't fit in flags passed to the | 392 dnl here, because this doesn't fit in flags passed to the |
329 dnl compiler. So give up. No hardcoding. This affects only | 393 dnl compiler. So give up. No hardcoding. This affects only |
330 dnl very old systems. | 394 dnl very old systems. |
331 dnl FIXME: Not sure whether we should use | 395 dnl FIXME: Not sure whether we should use |
332 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" | 396 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" |
333 dnl here. | 397 dnl here. |
334 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" | 398 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" |
335 fi | 399 fi |
336 fi | 400 fi |
337 fi | 401 fi |
338 fi | 402 fi |
339 else | 403 else |
340 if test "X$found_a" != "X"; then | 404 if test "X$found_a" != "X"; then |
341 dnl Linking with a static library. | 405 dnl Linking with a static library. |
342 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" | 406 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" |
343 else | 407 else |
344 dnl We shouldn't come here, but anyway it's good to have a | 408 dnl We shouldn't come here, but anyway it's good to have a |
345 dnl fallback. | 409 dnl fallback. |
346 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" | 410 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" |
347 fi | 411 fi |
348 fi | 412 fi |
349 dnl Assume the include files are nearby. | 413 dnl Assume the include files are nearby. |
350 additional_includedir= | 414 additional_includedir= |
351 case "$found_dir" in | 415 case "$found_dir" in |
352 */$acl_libdirstem | */$acl_libdirstem/) | 416 */$acl_libdirstem | */$acl_libdirstem/) |
353 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdir
stem/"'*$,,'` | 417 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdir
stem/"'*$,,'` |
| 418 LIB[]NAME[]_PREFIX="$basedir" |
354 additional_includedir="$basedir/include" | 419 additional_includedir="$basedir/include" |
355 ;; | 420 ;; |
356 esac | 421 esac |
357 if test "X$additional_includedir" != "X"; then | 422 if test "X$additional_includedir" != "X"; then |
358 dnl Potentially add $additional_includedir to $INCNAME. | 423 dnl Potentially add $additional_includedir to $INCNAME. |
359 dnl But don't add it | 424 dnl But don't add it |
360 dnl 1. if it's the standard /usr/include, | 425 dnl 1. if it's the standard /usr/include, |
361 dnl 2. if it's /usr/local/include and we are using GCC on Linux, | 426 dnl 2. if it's /usr/local/include and we are using GCC on Linux, |
362 dnl 3. if it's already present in $CPPFLAGS or the already | 427 dnl 3. if it's already present in $CPPFLAGS or the already |
363 dnl constructed $INCNAME, | 428 dnl constructed $INCNAME, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 dnl directories known to the linker should also be known to the | 570 dnl directories known to the linker should also be known to the |
506 dnl runtime loader, otherwise the system is severely misconfigured.) | 571 dnl runtime loader, otherwise the system is severely misconfigured.) |
507 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" | 572 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" |
508 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" | 573 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" |
509 fi | 574 fi |
510 fi | 575 fi |
511 fi | 576 fi |
512 done | 577 done |
513 done | 578 done |
514 if test "X$rpathdirs" != "X"; then | 579 if test "X$rpathdirs" != "X"; then |
515 if test -n "$hardcode_libdir_separator"; then | 580 if test -n "$acl_hardcode_libdir_separator"; then |
516 dnl Weird platform: only the last -rpath option counts, the user must | 581 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 | 582 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. | 583 dnl single library, but not when more than one $LIBNAMEs are used. |
519 alldirs= | 584 alldirs= |
520 for found_dir in $rpathdirs; do | 585 for found_dir in $rpathdirs; do |
521 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" | 586 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" |
522 done | 587 done |
523 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. | 588 dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. |
524 acl_save_libdir="$libdir" | 589 acl_save_libdir="$libdir" |
525 libdir="$alldirs" | 590 libdir="$alldirs" |
526 eval flag=\"$hardcode_libdir_flag_spec\" | 591 eval flag=\"$acl_hardcode_libdir_flag_spec\" |
527 libdir="$acl_save_libdir" | 592 libdir="$acl_save_libdir" |
528 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" | 593 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" |
529 else | 594 else |
530 dnl The -rpath options are cumulative. | 595 dnl The -rpath options are cumulative. |
531 for found_dir in $rpathdirs; do | 596 for found_dir in $rpathdirs; do |
532 acl_save_libdir="$libdir" | 597 acl_save_libdir="$libdir" |
533 libdir="$found_dir" | 598 libdir="$found_dir" |
534 eval flag=\"$hardcode_libdir_flag_spec\" | 599 eval flag=\"$acl_hardcode_libdir_flag_spec\" |
535 libdir="$acl_save_libdir" | 600 libdir="$acl_save_libdir" |
536 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" | 601 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" |
537 done | 602 done |
538 fi | 603 fi |
539 fi | 604 fi |
540 if test "X$ltrpathdirs" != "X"; then | 605 if test "X$ltrpathdirs" != "X"; then |
541 dnl When using libtool, the option that works for both libraries and | 606 dnl When using libtool, the option that works for both libraries and |
542 dnl executables is -R. The -R options are cumulative. | 607 dnl executables is -R. The -R options are cumulative. |
543 for found_dir in $ltrpathdirs; do | 608 for found_dir in $ltrpathdirs; do |
544 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" | 609 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" |
(...skipping 28 matching lines...) Expand all Loading... |
573 dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) | 638 dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) |
574 dnl sets LDADDVAR to linker options needed together with LIBSVALUE. | 639 dnl sets LDADDVAR to linker options needed together with LIBSVALUE. |
575 dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, | 640 dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, |
576 dnl otherwise linking without libtool is assumed. | 641 dnl otherwise linking without libtool is assumed. |
577 AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], | 642 AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], |
578 [ | 643 [ |
579 AC_REQUIRE([AC_LIB_RPATH]) | 644 AC_REQUIRE([AC_LIB_RPATH]) |
580 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) | 645 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) |
581 $1= | 646 $1= |
582 if test "$enable_rpath" != no; then | 647 if test "$enable_rpath" != no; then |
583 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; th
en | 648 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 | 649 dnl Use an explicit option to hardcode directories into the resulting |
585 dnl binary. | 650 dnl binary. |
586 rpathdirs= | 651 rpathdirs= |
587 next= | 652 next= |
588 for opt in $2; do | 653 for opt in $2; do |
589 if test -n "$next"; then | 654 if test -n "$next"; then |
590 dir="$next" | 655 dir="$next" |
591 dnl No need to hardcode the standard /usr/lib. | 656 dnl No need to hardcode the standard /usr/lib. |
592 if test "X$dir" != "X/usr/$acl_libdirstem"; then | 657 if test "X$dir" != "X/usr/$acl_libdirstem"; then |
593 rpathdirs="$rpathdirs $dir" | 658 rpathdirs="$rpathdirs $dir" |
(...skipping 13 matching lines...) Expand all Loading... |
607 fi | 672 fi |
608 done | 673 done |
609 if test "X$rpathdirs" != "X"; then | 674 if test "X$rpathdirs" != "X"; then |
610 if test -n ""$3""; then | 675 if test -n ""$3""; then |
611 dnl libtool is used for linking. Use -R options. | 676 dnl libtool is used for linking. Use -R options. |
612 for dir in $rpathdirs; do | 677 for dir in $rpathdirs; do |
613 $1="${$1}${$1:+ }-R$dir" | 678 $1="${$1}${$1:+ }-R$dir" |
614 done | 679 done |
615 else | 680 else |
616 dnl The linker is used for linking directly. | 681 dnl The linker is used for linking directly. |
617 if test -n "$hardcode_libdir_separator"; then | 682 if test -n "$acl_hardcode_libdir_separator"; then |
618 dnl Weird platform: only the last -rpath option counts, the user | 683 dnl Weird platform: only the last -rpath option counts, the user |
619 dnl must pass all path elements in one option. | 684 dnl must pass all path elements in one option. |
620 alldirs= | 685 alldirs= |
621 for dir in $rpathdirs; do | 686 for dir in $rpathdirs; do |
622 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir" | 687 alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" |
623 done | 688 done |
624 acl_save_libdir="$libdir" | 689 acl_save_libdir="$libdir" |
625 libdir="$alldirs" | 690 libdir="$alldirs" |
626 eval flag=\"$hardcode_libdir_flag_spec\" | 691 eval flag=\"$acl_hardcode_libdir_flag_spec\" |
627 libdir="$acl_save_libdir" | 692 libdir="$acl_save_libdir" |
628 $1="$flag" | 693 $1="$flag" |
629 else | 694 else |
630 dnl The -rpath options are cumulative. | 695 dnl The -rpath options are cumulative. |
631 for dir in $rpathdirs; do | 696 for dir in $rpathdirs; do |
632 acl_save_libdir="$libdir" | 697 acl_save_libdir="$libdir" |
633 libdir="$dir" | 698 libdir="$dir" |
634 eval flag=\"$hardcode_libdir_flag_spec\" | 699 eval flag=\"$acl_hardcode_libdir_flag_spec\" |
635 libdir="$acl_save_libdir" | 700 libdir="$acl_save_libdir" |
636 $1="${$1}${$1:+ }$flag" | 701 $1="${$1}${$1:+ }$flag" |
637 done | 702 done |
638 fi | 703 fi |
639 fi | 704 fi |
640 fi | 705 fi |
641 fi | 706 fi |
642 fi | 707 fi |
643 AC_SUBST([$1]) | 708 AC_SUBST([$1]) |
644 ]) | 709 ]) |
OLD | NEW |