libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SCO/buffix patch 6 of 10: AC_PROG_NM fixes


From: Ralf Wildenhues
Subject: Re: SCO/buffix patch 6 of 10: AC_PROG_NM fixes
Date: Tue, 1 Nov 2005 06:12:27 +0100
User-agent: Mutt/1.5.9i

Hi Kean,

* Kean Johnston wrote on Mon, Oct 31, 2005 at 02:06:10AM CET:
>
> The test for a suitable nm was too restrictive. First, it would only check
> for nm with $ac_tool_prefix. But only the GNU version of nm installs itself
> that way. This was thwarting finding a non-binutils nm on the path.

Erm, are you using --host when configuring?  If so, why (are you cross
compiling)?  If not, $ac_tool_prefix should be empty.  In any case,
while a search for a nm without the prefix is ok (since that's what
AC_CHECK_TOOL does as well), I'm a bit uneasy about the search order: it
should check for prefixed nm everywhere first, and unprefixed
afterwards.

> Second, added /usr/ccs/bin/elf to the list of paths to search, before
> /usr/ccs/bin. On OpenServer, this makes sure we pick up the ELF version,
> as it is a multi-ABI world, and /usr/ccs/bin/nm is a COFF/ELF schizophrenic
> version that accepts slightly different arguments. This wont affect any
> other systems becuase AFAIK only OSR5 has a /usr/ccs/bin/elf, and any
> other system that may conceivably have it is likely to want the ELF version
> of nm anyway.

I assume this change is ok.  (Searching the net for the string
/usr/ccs/bin/elf hasn't turned up much :)

> Third, dont do the 'sed 1q' stuff, but grep the output returned. The
> 'sed 1q' was causing false negatives if there was only a single line of
> output. By using grep on the entire output, we will still get the correct
> result, even on HP-UX if it first ejects a warning message about unknown
> options.

I'm pretty sure your change breaks the intended workaround for HPUX.
OTOH, I have absolutely no idea about its relevance today; it dates from
1997/11/28, and I don't have any more information about this available
(and no access to HP-UX).

In any case, I believe you got the logic wrong there: /dev/null being
present in the output is taken as a _positive_ sign, ie. that nm
understands -B, iff present in the first line.  What does
  nm -B /dev/null
on SCO output, by the way?  Maybe we can adjust the old scheme to that?

Furthermore, I really don't like that you changed a shell pattern match
to a slow grep; also, please note that grep regexes are different from
shell patterns in that they aren't anchored, so you don't need all those
`.*'.

I'm wondering whether it's easiest to just create an object file first.
Will be most expensive, but most reliable, too..

Cheers,
Ralf

> 2005-10-24  Kean Johnston  <address@hidden>
> 
>       * libtool.m4(AC_PROG_NM): Add /usr/ccs/bin/elf to search path list.
>       Look for tool both with and without ac_tool_prefix. Use grep on output
>       results and dont delete first line of output in case output is
>       only one line long.
> 
> Index: libtool.m4
> ===================================================================
> RCS file: /cvsroot/libtool/libtool/Attic/libtool.m4,v
> retrieving revision 1.314.2.115
> diff -u -3 -p -r1.314.2.115 libtool.m4
> --- libtool.m4        9 Oct 2005 06:26:21 -0000       1.314.2.115
> +++ libtool.m4        30 Oct 2005 21:22:24 -0000
> @@ -2375,33 +2386,37 @@ AC_DEFUN([AC_PROG_NM],
>    lt_cv_path_NM="$NM"
>  else
>    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
> -  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
> +  for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
>      IFS="$lt_save_ifs"
>      test -z "$ac_dir" && ac_dir=.
> -    tmp_nm="$ac_dir/${ac_tool_prefix}nm"
> -    if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
> +    tmp_nm_file="$ac_dir/${ac_tool_prefix}nm"
> +    if test -f "$tmp_nm_file" || test -f "$tmp_nm_file$ac_exeext" ; then
> +      tmp_nm=$tmp_nm_file
> +    else
> +      tmp_nm_file="$ac_dir/nm"
> +      if test -f "$tmp_nm_file" || test -f "$tmp_nm_file$ac_exeext" ; then
> +        tmp_nm=$tmp_nm_file
> +      fi
> +    fi
> +    if test -n "$tmp_nm" ; then
>        # Check to see if the nm accepts a BSD-compat flag.
> -      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
> -      #   nm: unknown option "B" ignored
>        # Tru64's nm complains that /dev/null is an invalid object file
> -      case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
> -      */dev/null* | *'Invalid file or object type'*)
> -     lt_cv_path_NM="$tmp_nm -B"
> +      tmp_nm_out=`$tmp_nm -B /dev/null 2>&1`
> +      echo "$tmp_nm_out" | $EGREP '.*/dev/null.*|.*Invalid file or object 
> type.*' > /dev/null 2>&1
> +      if test $? -eq 0; then
> +        lt_cv_path_NM="$tmp_nm -B"
>       break
> -        ;;
> -      *)
> -     case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
> -     */dev/null*)
> +      else
> +        tmp_nm_out=`$tmp_nm -p /dev/null 2>&1`
> +        echo "$tmp_nm_out" | $EGREP '.*/dev/null.*' > /dev/null 2>&1
> +     if test $? -eq 0; then
>         lt_cv_path_NM="$tmp_nm -p"
>         break
> -       ;;
> -     *)
> +     else
>         lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
>         continue # so that we can try to find one that supports BSD flags
> -       ;;
> -     esac
> -        ;;
> -      esac
> +     fi
> +      fi
>      fi
>    done
>    IFS="$lt_save_ifs"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]