Annotation of embedaddon/confuse/m4/lib-ld.m4, revision 1.1.1.2

1.1.1.2 ! misho       1: # lib-ld.m4 serial 6
        !             2: dnl Copyright (C) 1996-2003, 2009-2013 Free Software Foundation, Inc.
1.1       misho       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,
1.1.1.2 ! misho       8: dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
        !             9: dnl collision with libtool.m4.
1.1       misho      10: 
1.1.1.2 ! misho      11: dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
1.1       misho      12: AC_DEFUN([AC_LIB_PROG_LD_GNU],
1.1.1.2 ! misho      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.
1.1       misho      15: case `$LD -v 2>&1 </dev/null` in
                     16: *GNU* | *'with BFD'*)
1.1.1.2 ! misho      17:   acl_cv_prog_gnu_ld=yes
        !            18:   ;;
1.1       misho      19: *)
1.1.1.2 ! misho      20:   acl_cv_prog_gnu_ld=no
        !            21:   ;;
1.1       misho      22: esac])
                     23: with_gnu_ld=$acl_cv_prog_gnu_ld
                     24: ])
                     25: 
1.1.1.2 ! misho      26: dnl From libtool-2.4. Sets the variable LD.
1.1       misho      27: AC_DEFUN([AC_LIB_PROG_LD],
1.1.1.2 ! misho      28: [AC_REQUIRE([AC_PROG_CC])dnl
1.1       misho      29: AC_REQUIRE([AC_CANONICAL_HOST])dnl
1.1.1.2 ! misho      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: 
1.1       misho      37: # Prepare PATH_SEPARATOR.
                     38: # The user is always right.
                     39: if test "${PATH_SEPARATOR+set}" != set; then
1.1.1.2 ! misho      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:        }
1.1       misho      48: fi
1.1.1.2 ! misho      49: 
1.1       misho      50: ac_prog=ld
                     51: if test "$GCC" = yes; then
                     52:   # Check if gcc -print-prog-name=ld gives a path.
1.1.1.2 ! misho      53:   AC_MSG_CHECKING([for ld used by $CC])
1.1       misho      54:   case $host in
                     55:   *-*-mingw*)
                     56:     # gcc leaves a trailing carriage return which upsets mingw
                     57:     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
                     58:   *)
                     59:     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
                     60:   esac
                     61:   case $ac_prog in
                     62:     # Accept absolute paths.
1.1.1.2 ! misho      63:     [[\\/]]* | ?:[[\\/]]*)
        !            64:       re_direlt='/[[^/]][[^/]]*/\.\./'
        !            65:       # Canonicalize the pathname of ld
        !            66:       ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
        !            67:       while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
        !            68:         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1.1       misho      69:       done
                     70:       test -z "$LD" && LD="$ac_prog"
                     71:       ;;
                     72:   "")
                     73:     # If it fails, then pretend we aren't using GCC.
                     74:     ac_prog=ld
                     75:     ;;
                     76:   *)
                     77:     # If it is relative, then search for the first ld in PATH.
                     78:     with_gnu_ld=unknown
                     79:     ;;
                     80:   esac
                     81: elif test "$with_gnu_ld" = yes; then
                     82:   AC_MSG_CHECKING([for GNU ld])
                     83: else
                     84:   AC_MSG_CHECKING([for non-GNU ld])
                     85: fi
1.1.1.2 ! misho      86: AC_CACHE_VAL([acl_cv_path_LD],
1.1       misho      87: [if test -z "$LD"; then
1.1.1.2 ! misho      88:   acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
1.1       misho      89:   for ac_dir in $PATH; do
1.1.1.2 ! misho      90:     IFS="$acl_save_ifs"
1.1       misho      91:     test -z "$ac_dir" && ac_dir=.
                     92:     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
                     93:       acl_cv_path_LD="$ac_dir/$ac_prog"
                     94:       # Check to see if the program is GNU ld.  I'd rather use --version,
1.1.1.2 ! misho      95:       # but apparently some variants of GNU ld only accept -v.
1.1       misho      96:       # Break only if it was the GNU/non-GNU ld that we prefer.
1.1.1.2 ! misho      97:       case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
1.1       misho      98:       *GNU* | *'with BFD'*)
1.1.1.2 ! misho      99:         test "$with_gnu_ld" != no && break
        !           100:         ;;
1.1       misho     101:       *)
1.1.1.2 ! misho     102:         test "$with_gnu_ld" != yes && break
        !           103:         ;;
1.1       misho     104:       esac
                    105:     fi
                    106:   done
1.1.1.2 ! misho     107:   IFS="$acl_save_ifs"
1.1       misho     108: else
                    109:   acl_cv_path_LD="$LD" # Let the user override the test with a path.
                    110: fi])
                    111: LD="$acl_cv_path_LD"
                    112: if test -n "$LD"; then
1.1.1.2 ! misho     113:   AC_MSG_RESULT([$LD])
1.1       misho     114: else
1.1.1.2 ! misho     115:   AC_MSG_RESULT([no])
1.1       misho     116: fi
                    117: test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
                    118: AC_LIB_PROG_LD_GNU
                    119: ])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>