I posted a patch for libtool the other day to add a cross
nm check, but in fact it does not seem to solve the problem
in a program I am trying to cross compile (Doh!).

After some more digging, I found a AC_PROG_NM macro in libtool.m4
that searches on the PATH for a nm executable. At first
I was not sure why this did not just use AC_CHECK_TOOL,
but after looking at it further it seems like this
macro can skip multiple versions of nm that it finds
if they do not support the -B flag. So I decided to
try patching this macro so that it will detect a
cross NM. Here are the results I came up with.

./configure --host=i386-mingw32msvc
...
checking for BSD-compatible nm... 
/usr/local/project/install/Xmingwin/bin/i386-mingw32msvc-nm -B
...
checking command to parse 
/usr/local/project/install/Xmingwin/bin/i386-mingw32msvc-nm -B output... ok


This seems right to me, but I would like to hear
any feedback that anyone else has. I am going to
attach the patch for the ML branch to this email.

Mo DeJong
Red Hat Inc
Index: ChangeLog
===================================================================
RCS file: /cvs/libtool/ChangeLog,v
retrieving revision 1.641.2.54
diff -u -r1.641.2.54 ChangeLog
--- ChangeLog   2000/06/18 03:02:52     1.641.2.54
+++ ChangeLog   2000/07/05 05:20:23
@@ -1,3 +1,8 @@
+2000-07-04  Mo DeJong  <[EMAIL PROTECTED]>
+
+       * libtool.m4 (AC_PROG_NM): Fix macro so that it
+       finds a cross NM on the PATH.
+
 2000-06-17  Syd Polk  <[EMAIL PROTECTED]>
 
        * libtool.m4 (AC_LIBTOOL_SETUP): Do not generate a libtool based
Index: libtool.m4
===================================================================
RCS file: /cvs/libtool/libtool.m4,v
retrieving revision 1.71.2.21
diff -u -r1.71.2.21 libtool.m4
--- libtool.m4  2000/06/18 03:02:52     1.71.2.21
+++ libtool.m4  2000/07/05 05:20:24
@@ -632,18 +632,19 @@
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
     test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
+    tmp_nm=$ac_dir/${ac_tool_prefix}nm
+    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; 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
-      if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null 
>/dev/null; then
-       ac_cv_path_NM="$ac_dir/nm -B"
+      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; 
+then
+       ac_cv_path_NM="$tmp_nm -B"
        break
-      elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null 
>/dev/null; then
-       ac_cv_path_NM="$ac_dir/nm -p"
+      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null 
+>/dev/null; then
+       ac_cv_path_NM="$tmp_nm -p"
        break
       else
-       ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
+       ac_cv_path_NM=${ac_cv_path_NM="$tmp_nm"} # keep the first match, but
        continue # so that we can try to find one that supports BSD flags
       fi
     fi

Reply via email to