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