libtool-patches
[Top][All Lists]
Advanced

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

Re: Find best grep for AIX


From: Albert Chin
Subject: Re: Find best grep for AIX
Date: Thu, 22 Jan 2004 02:00:23 -0600
User-agent: Mutt/1.4i

On Mon, Jan 19, 2004 at 01:39:30PM +0900, Peter O'Gorman wrote:
> Albert Chin wrote:
> >>Patch against CVS head.
> >>
> >>2004-01-11  Albert Chin-A-Young  <address@hidden>
> >>
> >>    * ltmain.in, m4/libtool.m4: New LT_AC_PROG_GREP macro to
> >>    find best "grep" command to match the longest lines.
> >
> >
> > Any comments on this?
> 
> It no longer applies cleanly :(.

The patch below does.

> If it is required for AIX to work properly then there is little
> choice but to check.

It's not required but it helps.

> Maybe you also need to change the check for egrep?

How about we ditch grep in favor of egrep?

> I think that all uses of grep should become $GREP to be consistent.

Done.

BTW, I'd still like to know if adding LT_AC_PROG_GREP to
AC_LIBTOOL_CONFIG is the correct place to put LT_AC_PROG_GREP.

-- 
albert chin (address@hidden)

-- snip snip
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.368
diff -u -3 -p -r1.368 ltmain.in
--- ltmain.in   19 Jan 2004 04:57:26 -0000      1.368
+++ ltmain.in   22 Jan 2004 07:56:07 -0000
@@ -218,7 +218,7 @@ do
        # not specially marked.
        ;;
       *)
-       if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > 
/dev/null; then
+       if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > 
/dev/null; then
          taglist="$taglist $tagname"
          # Evaluate the configuration.
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: 
'$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
@@ -517,7 +517,7 @@ exec_cmd=
       # if we don't check for them as well.
       *)
        for z in $available_tags; do
-         if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; 
then
+         if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; 
then
            # Evaluate the configuration.
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# 
### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
            case "$base_compile " in
@@ -915,7 +915,7 @@ EOF
       # if we don't check for them as well.
       *)
        for z in $available_tags; do
-         if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; 
then
+         if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; 
then
            # Evaluate the configuration.
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# 
### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
            case $base_compile in
@@ -1085,7 +1085,7 @@ EOF
              # A libtool-controlled object.
 
              # Check to see that this really is a libtool object.
-             if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
+             if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
                pic_object=
                non_pic_object=
 
@@ -1589,7 +1589,7 @@ EOF
        # A libtool-controlled object.
 
        # Check to see that this really is a libtool object.
-       if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 
2>&1; then
+       if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
          pic_object=
          non_pic_object=
 
@@ -1921,7 +1921,7 @@ EOF
              case " $predeps $postdeps " in
              *" $deplib "*)
                if (${SED} -e '2q' $lib |
-                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+                    $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
                  library_names=
                  old_library=
                  case $lib in
@@ -2066,7 +2066,7 @@ EOF
        fi
 
        # Check to see that this really is a libtool archive.
-       if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 
2>&1; then :
+       if (${SED} -e '2q' $lib | $GREP "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then :
        else
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
          exit 1
@@ -2431,7 +2431,7 @@ EOF
                  *-*-darwin* )
                    # if the lib is a module then we can not link against it, 
someone
                    # is ignoring the new warnings I added
-                   if /usr/bin/file -L $add 2> /dev/null | grep "bundle" 
>/dev/null ; then
+                   if /usr/bin/file -L $add 2> /dev/null | $GREP "bundle" 
>/dev/null ; then
                      $echo "** Warning, lib $linklib is a module, not a shared 
library"
                      if test -z "$old_library" ; then
                        $echo
@@ -2655,7 +2655,7 @@ EOF
                  fi
                  ;;
                esac
-               if grep "^installed=no" $deplib > /dev/null; then
+               if $GREP "^installed=no" $deplib > /dev/null; then
                  path="$absdir/$objdir"
                else
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
@@ -3398,7 +3398,7 @@ EOF
                  for potent_lib in $potential_libs; do
                      # Follow soft links.
                      if ls -lLd "$potent_lib" 2>/dev/null \
-                        | grep " -> " >/dev/null; then
+                        | $GREP " -> " >/dev/null; then
                        continue
                      fi
                      # The statement above tries to avoid entering an
@@ -3508,7 +3508,7 @@ EOF
            done
          fi
          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
-           | grep . >/dev/null; then
+           | $GREP . >/dev/null; then
            $echo
            if test "X$deplibs_check_method" = "Xnone"; then
              $echo "*** Warning: inter-library dependencies are not supported 
in this platform."
@@ -4356,7 +4356,7 @@ extern \"C\" {
              $run eval "${SED} -n -e '/^: @address@hidden/d' -e 's/^.* 
\(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
            else
              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 
's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
-             $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > 
"$nlist"T'
+             $run eval '$GREP -f "$output_objdir/$output.exp" < "$nlist" > 
"$nlist"T'
              $run eval 'mv "$nlist"T "$nlist"'
            fi
          fi
@@ -4378,7 +4378,7 @@ extern \"C\" {
            fi
 
            # Try sorting and uniquifying the output.
-           if grep -v "^: " < "$nlist" |
+           if $GREP -v "^: " < "$nlist" |
                if sort -k 3 </dev/null >/dev/null 2>&1; then
                  sort -k 3
                else
@@ -4387,7 +4387,7 @@ extern \"C\" {
                uniq > "$nlist"S; then
              :
            else
-             grep -v "^: " < "$nlist" > "$nlist"S
+             $GREP -v "^: " < "$nlist" > "$nlist"S
            fi
 
            if test -f "$nlist"S; then
@@ -5468,7 +5468,7 @@ relink_command=\"$relink_command\""
     # install_prog (especially on Windows NT).
     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
        # Allow the use of GNU shtool's install command.
-       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+       $echo "X$nonopt" | $Xsed | $GREP shtool > /dev/null; then
       # Aesthetically quote it.
       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
       case $arg in
@@ -5620,7 +5620,7 @@ relink_command=\"$relink_command\""
 
       *.la)
        # Check to see that this really is a libtool archive.
-       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then :
+       if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then :
        else
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
          $echo "$help" 1>&2
@@ -5812,7 +5812,7 @@ relink_command=\"$relink_command\""
            wrapper=$file
            ;;
        esac
-       if (${SED} -e '4q' $wrapper | grep "^# Generated by 
.*$PACKAGE")>/dev/null 2>&1; then
+       if (${SED} -e '4q' $wrapper | $GREP "^# Generated by 
.*$PACKAGE")>/dev/null 2>&1; then
          notinst_deplibs=
          relink_command=
 
@@ -6062,7 +6062,7 @@ relink_command=\"$relink_command\""
       case $file in
       *.la)
        # Check to see that this really is a libtool archive.
-       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then :
+       if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then :
        else
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
          $echo "$help" 1>&2
@@ -6133,7 +6133,7 @@ relink_command=\"$relink_command\""
       -*) ;;
       *)
        # Do a test to see if this is really a libtool program.
-       if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
+       if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
          # If there is no directory component, then add one.
          case $file in
          */* | *\\*) . $file ;;
@@ -6243,7 +6243,7 @@ relink_command=\"$relink_command\""
       case $name in
       *.la)
        # Possibly a libtool archive, so verify it.
-       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
+       if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
          . $dir/$name
 
          # Delete the libtool libraries and symlinks.
@@ -6292,7 +6292,7 @@ relink_command=\"$relink_command\""
 
       *.lo)
        # Possibly a libtool object, so verify it.
-       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
+       if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
 
          # Read the .lo file
          . $dir/$name
@@ -6324,7 +6324,7 @@ relink_command=\"$relink_command\""
            ;;
          esac
          # Do a test to see if this is a libtool program.
-         if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
+         if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
            relink_command=
            . $dir/$noexename
 
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.33
diff -u -3 -p -r1.33 libtool.m4
--- m4/libtool.m4       21 Jan 2004 14:38:54 -0000      1.33
+++ m4/libtool.m4       22 Jan 2004 07:56:09 -0000
@@ -475,7 +475,8 @@ _LT_OUTPUT_LIBTOOL_INIT
 # add code to config.status for appending the configuration named by
 # TAGNAME from the matching tagged config vars.
 m4_define([AC_LIBTOOL_CONFIG],
-[_LT_CONFIG_SAVE_COMMANDS([
+[AC_REQUIRE([LT_AC_PROG_GREP])dnl
+_LT_CONFIG_SAVE_COMMANDS([
   m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
   m4_if(_LT_TAG, [C], [
     # See if we are running on zsh, and set the options which allow our
@@ -5857,6 +5858,62 @@ AU_DEFUN([AM_PROG_NM],        [AC_PROG_N
 # This is just to silence aclocal about the macro not being used
 m4_if([AC_DISABLE_FAST_INSTALL])
 
+
+# LT_AC_PROG_GREP
+# --------------
+# Check for a fully-functional grep program, that handles
+# the longest lines possible. Prefer GNU grep if found.
+AC_DEFUN([LT_AC_PROG_GREP],
+[AC_MSG_CHECKING([for a grep that handles long lines])
+AC_CACHE_VAL(lt_cv_path_GREP,
+[# Loop through the user's path and test for grep and ggrep.
+# Then use that list of grep's as ones to test for.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_grep_list="$lt_ac_grep_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+for lt_ac_grep in $lt_ac_grep_list; do
+  test ! -f $lt_ac_grep && break
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU grep and select it if it is found.
+  if "$lt_ac_grep" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_GREP=$lt_ac_grep
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo "GREP" >>conftest.nl
+    $lt_ac_grep 'GREP$' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_GREP=$lt_ac_grep
+    fi
+  done
+done
+GREP=$lt_cv_path_GREP
+])
+AC_MSG_RESULT([$GREP])
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+])# LT_AC_PROG_GREP
 
 # LT_AC_PROG_SED
 # --------------




reply via email to

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