libtool-patches
[Top][All Lists]
Advanced

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

HEAD: lo2o in shell


From: Ralf Wildenhues
Subject: HEAD: lo2o in shell
Date: Sun, 11 Feb 2007 16:01:04 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

This improves script time for compile mode by roughly 3% with bash on
GNU/Linux.  Rewriting lists of objects is best done the way we do it
already with sed, that's why not all instances of $lo2o are killed.

This patch conflicts trivially with the other speedup patches; apply
this one last.

With this, compile mode for C code on GNU/Linux is down to two execs of
an external program (sed, for determining the libtool program name, and
computing the object name from the source name).  For a non-C tag,
another sed and grep for the tag configuration.

Cheers,
Ralf

2007-02-11  Ralf Wildenhues  <address@hidden>

        * libltdl/m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS): New substituted
        function `func_lo2o', saving two fork&exec with XSI shells.
        * libltdl/config/ltmain.m4sh (func_mode_compile)
        (func_mode_install, func_mode_link): Use it for rewrites of
        single files.

Index: libltdl/m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v
retrieving revision 1.90
diff -u -r1.90 libtool.m4
--- libltdl/m4/libtool.m4       5 Feb 2007 19:40:18 -0000       1.90
+++ libltdl/m4/libtool.m4       11 Feb 2007 14:55:04 -0000
@@ -7041,6 +7040,15 @@
   func_stripname_result=${func_stripname_result#"${1}"}
   func_stripname_result=${func_stripname_result%"${2}"}
 }
+
+# func_lo2o object
+func_lo2o ()
+{
+  case ${1} in
+    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+    *)    func_lo2o_result=${1} ;;
+  esac
+}
 _LT_EOF
     ;;
   *) # Bourne compatible functions.
@@ -7080,6 +7088,12 @@
            | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
   esac
 }
+
+# func_lo2o object
+func_lo2o ()
+{
+  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
 _LT_EOF
 esac
 
Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.59
diff -u -r1.59 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  28 Jan 2007 15:13:25 -0000      1.59
+++ libltdl/config/ltmain.m4sh  11 Feb 2007 14:55:06 -0000
@@ -1320,7 +1347,7 @@
     libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
 
     case $libobj in
-    *.lo) obj=`$ECHO "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
     *)
       func_fatal_error "cannot determine name of library object from 
\`$libobj'"
       ;;
@@ -2011,7 +2044,8 @@
        # Deduce the name of the destination old-style object file.
        case $destfile in
        *.lo)
-         staticdest=`$ECHO "X$destfile" | $Xsed -e "$lo2o"`
+         func_lo2o "$destfile"
+         staticdest=$func_lo2o_result
          ;;
        *.$objext)
          staticdest="$destfile"
@@ -2029,7 +2063,8 @@
        # Install the old object if enabled.
        if test "$build_old_libs" = yes; then
          # Deduce the name of the old-style object file.
-         staticobj=`$ECHO "X$file" | $Xsed -e "$lo2o"`
+         func_lo2o "$file"
+         staticobj=$func_lo2o_result
          func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
        fi
        exit $EXIT_SUCCESS
@@ -2472,8 +2509,9 @@
                  func_dirname "$arg" "/" ""
                  xdir="$func_dirname_result"
 
-                 pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e 
"$lo2o"`
-                 non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+                 func_lo2o "$arg"
+                 pic_object=$xdir$objdir/$func_lo2o_result
+                 non_pic_object=$xdir$func_lo2o_result
                  func_append libobjs " $pic_object"
                  func_append non_pic_objects " $non_pic_object"
                else
@@ -2996,8 +3034,9 @@
            func_dirname "$arg" "/" ""
            xdir="$func_dirname_result"
 
-           pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
-           non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+           func_lo2o "$arg"
+           pic_object=$xdir$objdir/$func_lo2o_result
+           non_pic_object=$xdir$func_lo2o_result
            func_append libobjs " $pic_object"
            func_append non_pic_objects " $non_pic_object"
          else
@@ -5443,8 +5482,9 @@
        test -n "$objs$old_deplibs" && \
          func_fatal_error "cannot build library object \`$output' from 
non-libtool objects"
 
-       libobj="$output"
-       obj=`$ECHO "X$output" | $Xsed -e "$lo2o"`
+       libobj=$output
+       func_lo2o "$libobj"
+       obj=$func_lo2o_result
        ;;
       *)
        libobj=




reply via email to

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