Re: [PATCH] libtool: LT_PATH_NM: default to ${ac_tool_prefix}nm

Peter Rosin <[email protected]>
Newsgroups gmane.comp.gnu.libtool.patches
Message-ID <[email protected]>
On 2013-04-27 07:58, Mike Frysinger wrote:
> The current code tries to locate a compatible nm tool.  It starts with
> a prefixed nm tool (great!) and includes a plain nm too (that's fine).
> The problem is that the code searches for the prefixed nm before the
> plain nm (normally fine), but doesn't break once it has found a valid
> match.  It does this so that it if it finds an "OK", but "not great",
> tool, it'll keep on searching.

I agree this sounds like the wrong this to do, but isn't it better to
just break all the way out when a "great" nm is found?

(patch untested)

Cheers,
Peter
break-all-the-way-out-of-the-nm-loop.patch (text/x-patch, 1.1 KB)
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 3f50b0c..a8a71da 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -3383,8 +3383,9 @@ else
   if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
     lt_nm_to_check="$lt_nm_to_check nm"
   fi
+  lt_save_ifs=$IFS
   for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
+    IFS=$PATH_SEPARATOR
     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=.
@@ -3397,13 +3398,13 @@ else
 	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"
-	  break
+	  break 2
 	  ;;
 	*)
 	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
 	  */dev/null*)
 	    lt_cv_path_NM="$tmp_nm -p"
-	    break
+	    break 2
 	    ;;
 	  *)
 	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
@@ -3416,6 +3417,7 @@ else
     done
     IFS=$lt_save_ifs
   done
+  IFS=$lt_save_ifs
   : ${lt_cv_path_NM=no}
 fi])
 if test no != "$lt_cv_path_NM"; then
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.