| | | | |
| Offset 0, 0 lines modified | Offset 1, 168 lines modified |
| | 1 | #·lib-ld.m4·serial·12 |
| | 2 | dnl·Copyright·(C)·1996-2003,·2009-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·Subroutines·of·libtool.m4, |
| | 7 | dnl·with·replacements·s/_*LT_PATH/AC_LIB_PROG/·and·s/lt_/acl_/·to·avoid |
| | 8 | dnl·collision·with·libtool.m4. |
| | |
| | 9 | dnl·From·libtool-2.4.·Sets·the·variable·with_gnu_ld·to·yes·or·no. |
| | 10 | AC_DEFUN([AC_LIB_PROG_LD_GNU], |
| | 11 | [AC_CACHE_CHECK([if·the·linker·($LD)·is·GNU·ld],·[acl_cv_prog_gnu_ld], |
| | 12 | [#·I'd·rather·use·--version·here,·but·apparently·some·GNU·lds·only·accept·-v. |
| | 13 | case·`$LD·-v·2>&1·</dev/null`·in |
| | 14 | *GNU*·|·*'with·BFD'*) |
| | 15 | ··acl_cv_prog_gnu_ld=yes |
| | 16 | ··;; |
| | 17 | *) |
| | 18 | ··acl_cv_prog_gnu_ld=no |
| | 19 | ··;; |
| | 20 | esac]) |
| | 21 | with_gnu_ld=$acl_cv_prog_gnu_ld |
| | 22 | ]) |
| | |
| | 23 | dnl·From·libtool-2.4.·Sets·the·variable·LD. |
| | 24 | AC_DEFUN([AC_LIB_PROG_LD], |
| | 25 | [AC_REQUIRE([AC_PROG_CC])dnl |
| | 26 | AC_REQUIRE([AC_CANONICAL_HOST])dnl |
| | |
| | 27 | AC_ARG_WITH([gnu-ld], |
| | 28 | ····[AS_HELP_STRING([[--with-gnu-ld]], |
| | 29 | ········[assume·the·C·compiler·uses·GNU·ld·[default=no]])], |
| | 30 | ····[test·"$withval"·=·no·||·with_gnu_ld=yes], |
| | 31 | ····[with_gnu_ld=no])dnl |
| | |
| | 32 | #·Prepare·PATH_SEPARATOR. |
| | 33 | #·The·user·is·always·right. |
| | 34 | if·test·"${PATH_SEPARATOR+set}"·!=·set;·then |
| | 35 | ··#·Determine·PATH_SEPARATOR·by·trying·to·find·/bin/sh·in·a·PATH·which |
| | 36 | ··#·contains·only·/bin.·Note·that·ksh·looks·also·at·the·FPATH·variable, |
| | 37 | ··#·so·we·have·to·set·that·as·well·for·the·test. |
| | 38 | ··PATH_SEPARATOR=: |
| | 39 | ··(PATH='/bin;/bin';·FPATH=$PATH;·sh·-c·:)·>/dev/null·2>&1·\ |
| | 40 | ····&&·{·(PATH='/bin:/bin';·FPATH=$PATH;·sh·-c·:)·>/dev/null·2>&1·\ |
| | 41 | ···········||·PATH_SEPARATOR=';' |
| | 42 | ·······} |
| | 43 | fi |
| | |
| | 44 | if·test·-n·"$LD";·then |
| | 45 | ··AC_MSG_CHECKING([for·ld]) |
| | 46 | elif·test·"$GCC"·=·yes;·then |
| | 47 | ··AC_MSG_CHECKING([for·ld·used·by·$CC]) |
| | 48 | elif·test·"$with_gnu_ld"·=·yes;·then |
| | 49 | ··AC_MSG_CHECKING([for·GNU·ld]) |
| | 50 | else |
| | 51 | ··AC_MSG_CHECKING([for·non-GNU·ld]) |
| | 52 | fi |
| | 53 | if·test·-n·"$LD";·then |
| | 54 | ··#·Let·the·user·override·the·test·with·a·path. |
| | 55 | ··: |
| | 56 | else |
| | 57 | ··AC_CACHE_VAL([acl_cv_path_LD], |
| | 58 | ··[ |
| | 59 | ····acl_cv_path_LD=·#·Final·result·of·this·test |
| | 60 | ····ac_prog=ld·#·Program·to·search·in·$PATH |
| | 61 | ····if·test·"$GCC"·=·yes;·then |
| | 62 | ······#·Check·if·gcc·-print-prog-name=ld·gives·a·path. |
| | 63 | ······case·$host·in |
| | 64 | ········*-*-mingw*·|·windows*) |
| | 65 | ··········#·gcc·leaves·a·trailing·carriage·return·which·upsets·mingw |
| | 66 | ··········acl_output=`($CC·-print-prog-name=ld)·2>&5·|·tr·-d·'\015'`·;; |
| | 67 | ········*) |
| | 68 | ··········acl_output=`($CC·-print-prog-name=ld)·2>&5`·;; |
| | 69 | ······esac |
| | 70 | ······case·$acl_output·in |
| | 71 | ········#·Accept·absolute·paths. |
| | 72 | ········[[\\/]]*·|·?:[[\\/]]*) |
| | 73 | ··········re_direlt='/[[^/]][[^/]]*/\.\./' |
| | 74 | ··········#·Canonicalize·the·pathname·of·ld |
| | 75 | ··········acl_output=`echo·"$acl_output"·|·sed·'s%\\\\%/%g'` |
| | 76 | ··········while·echo·"$acl_output"·|·grep·"$re_direlt"·>·/dev/null·2>&1;·do |
| | 77 | ············acl_output=`echo·$acl_output·|·sed·"s%$re_direlt%/%"` |
| | 78 | ··········done |
| | 79 | ··········#·Got·the·pathname.·No·search·in·PATH·is·needed. |
| | 80 | ··········acl_cv_path_LD="$acl_output" |
| | 81 | ··········ac_prog= |
| | 82 | ··········;; |
| | 83 | ········"") |
| | 84 | ··········#·If·it·fails,·then·pretend·we·aren't·using·GCC. |
| | 85 | ··········;; |
| | 86 | ········*) |
| | 87 | ··········#·If·it·is·relative,·then·search·for·the·first·ld·in·PATH. |
| | 88 | ··········with_gnu_ld=unknown |
| | 89 | ··········;; |
| | 90 | ······esac |
| | 91 | ····fi |
| | 92 | ····if·test·-n·"$ac_prog";·then |
| | 93 | ······#·Search·for·$ac_prog·in·$PATH. |
| | 94 | ······acl_save_ifs="$IFS";·IFS=$PATH_SEPARATOR |
| | 95 | ······for·ac_dir·in·$PATH;·do |
| | 96 | ········IFS="$acl_save_ifs" |
| | 97 | ········test·-z·"$ac_dir"·&&·ac_dir=. |
| | 98 | ········if·test·-f·"$ac_dir/$ac_prog"·||·test·-f·"$ac_dir/$ac_prog$ac_exeext";·then |
| | 99 | ··········acl_cv_path_LD="$ac_dir/$ac_prog" |
| | 100 | ··········#·Check·to·see·if·the·program·is·GNU·ld.··I'd·rather·use·--version, |
| | 101 | ··········#·but·apparently·some·variants·of·GNU·ld·only·accept·-v. |
| | 102 | ··········#·Break·only·if·it·was·the·GNU/non-GNU·ld·that·we·prefer. |
| | 103 | ··········case·`"$acl_cv_path_LD"·-v·2>&1·</dev/null`·in |
| | 104 | ············*GNU*·|·*'with·BFD'*) |
| | 105 | ··············test·"$with_gnu_ld"·!=·no·&&·break |
| | 106 | ··············;; |
| | 107 | ············*) |
| | 108 | ··············test·"$with_gnu_ld"·!=·yes·&&·break |
| | 109 | ··············;; |
| | 110 | ··········esac |
| | 111 | ········fi |
| | 112 | ······done |
| | 113 | ······IFS="$acl_save_ifs" |
| | 114 | ····fi |
| | 115 | ····case·$host·in |
| | 116 | ······*-*-aix*) |
| | 117 | ········AC_COMPILE_IFELSE( |
| | 118 | ··········[AC_LANG_SOURCE( |
| | 119 | ·············[[#if·defined·__powerpc64__·||·defined·__LP64__ |
| | 120 | ················int·ok; |
| | 121 | ···············#else |
| | 122 | ················error·fail |
| | 123 | ···············#endif |
| | 124 | ·············]])], |
| | 125 | ··········[#·The·compiler·produces·64-bit·code.·Add·option·'-b64'·so·that·the |
| | 126 | ···········#·linker·groks·64-bit·object·files. |
| | 127 | ···········case·"$acl_cv_path_LD·"·in |
| | 128 | ·············*"·-b64·"*)·;; |
| | 129 | ·············*)·acl_cv_path_LD="$acl_cv_path_LD·-b64"·;; |
| | 130 | ···········esac |
| | 131 | ··········],·[]) |
| | 132 | ········;; |
| | 133 | ······sparc64-*-netbsd*) |
| | 134 | ········AC_COMPILE_IFELSE( |
| | 135 | ··········[AC_LANG_SOURCE( |
| | 136 | ·············[[#if·defined·__sparcv9·||·defined·__arch64__ |
| | 137 | ················int·ok; |
| | 138 | ···············#else |
| | 139 | ················error·fail |
| | 140 | ···············#endif |
| | 141 | ·············]])], |
| | 142 | ··········[], |
| | 143 | ··········[#·The·compiler·produces·32-bit·code.·Add·option·'-m·elf32_sparc' |
| | 144 | ···········#·so·that·the·linker·groks·32-bit·object·files. |
| | 145 | ···········case·"$acl_cv_path_LD·"·in |
| | 146 | ·············*"·-m·elf32_sparc·"*)·;; |
| | 147 | ·············*)·acl_cv_path_LD="$acl_cv_path_LD·-m·elf32_sparc"·;; |
| | 148 | ···········esac |
| | 149 | ··········]) |
| | 150 | ········;; |
| | 151 | ····esac |
| | 152 | ··]) |
| | 153 | ··LD="$acl_cv_path_LD" |
| | 154 | fi |
| | 155 | if·test·-n·"$LD";·then |
| | 156 | ··AC_MSG_RESULT([$LD]) |
| | 157 | else |
| | 158 | ··AC_MSG_RESULT([no]) |
| | 159 | ··AC_MSG_ERROR([no·acceptable·ld·found·in·\$PATH]) |
| | 160 | fi |
| | 161 | AC_LIB_PROG_LD_GNU |
| | 162 | ]) |