jpayne@68: # lib-ld.m4 serial 13 jpayne@68: dnl Copyright (C) 1996-2003, 2009-2024 Free Software Foundation, Inc. jpayne@68: dnl This file is free software; the Free Software Foundation jpayne@68: dnl gives unlimited permission to copy and/or distribute it, jpayne@68: dnl with or without modifications, as long as this notice is preserved. jpayne@68: jpayne@68: dnl Subroutines of libtool.m4, jpayne@68: dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid jpayne@68: dnl collision with libtool.m4. jpayne@68: jpayne@68: dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. jpayne@68: AC_DEFUN([AC_LIB_PROG_LD_GNU], jpayne@68: [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], jpayne@68: [# I'd rather use --version here, but apparently some GNU lds only accept -v. jpayne@68: case `$LD -v 2>&1 /dev/null 2>&1 \ jpayne@68: && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ jpayne@68: || PATH_SEPARATOR=';' jpayne@68: } jpayne@68: fi jpayne@68: jpayne@68: if test -n "$LD"; then jpayne@68: AC_MSG_CHECKING([for ld]) jpayne@68: elif test "$GCC" = yes; then jpayne@68: AC_MSG_CHECKING([for ld used by $CC]) jpayne@68: elif test "$with_gnu_ld" = yes; then jpayne@68: AC_MSG_CHECKING([for GNU ld]) jpayne@68: else jpayne@68: AC_MSG_CHECKING([for non-GNU ld]) jpayne@68: fi jpayne@68: if test -n "$LD"; then jpayne@68: # Let the user override the test with a path. jpayne@68: : jpayne@68: else jpayne@68: AC_CACHE_VAL([acl_cv_path_LD], jpayne@68: [ jpayne@68: acl_cv_path_LD= # Final result of this test jpayne@68: ac_prog=ld # Program to search in $PATH jpayne@68: if test "$GCC" = yes; then jpayne@68: # Check if gcc -print-prog-name=ld gives a path. jpayne@68: case $host in jpayne@68: *-*-mingw* | windows*) jpayne@68: # gcc leaves a trailing carriage return which upsets mingw jpayne@68: acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; jpayne@68: *) jpayne@68: acl_output=`($CC -print-prog-name=ld) 2>&5` ;; jpayne@68: esac jpayne@68: case $acl_output in jpayne@68: # Accept absolute paths. jpayne@68: [[\\/]]* | ?:[[\\/]]*) jpayne@68: re_direlt='/[[^/]][[^/]]*/\.\./' jpayne@68: # Canonicalize the pathname of ld jpayne@68: acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` jpayne@68: while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do jpayne@68: acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` jpayne@68: done jpayne@68: # Got the pathname. No search in PATH is needed. jpayne@68: acl_cv_path_LD="$acl_output" jpayne@68: ac_prog= jpayne@68: ;; jpayne@68: "") jpayne@68: # If it fails, then pretend we aren't using GCC. jpayne@68: ;; jpayne@68: *) jpayne@68: # If it is relative, then search for the first ld in PATH. jpayne@68: with_gnu_ld=unknown jpayne@68: ;; jpayne@68: esac jpayne@68: fi jpayne@68: if test -n "$ac_prog"; then jpayne@68: # Search for $ac_prog in $PATH. jpayne@68: acl_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR jpayne@68: for ac_dir in $PATH; do jpayne@68: IFS="$acl_saved_IFS" jpayne@68: test -z "$ac_dir" && ac_dir=. jpayne@68: if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then jpayne@68: acl_cv_path_LD="$ac_dir/$ac_prog" jpayne@68: # Check to see if the program is GNU ld. I'd rather use --version, jpayne@68: # but apparently some variants of GNU ld only accept -v. jpayne@68: # Break only if it was the GNU/non-GNU ld that we prefer. jpayne@68: case `"$acl_cv_path_LD" -v 2>&1