The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/openzfs/config/lib-ld.m4

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

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

Cache object: 0cfbc84b4566d537d02dd915dbcb6e0d


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.