annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/aclocal/lib-ld.m4 @ 68:5028fdace37b

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