libtool-patches
[Top][All Lists]
Advanced

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

Re: compile mode, XSI shell: do not fork for $xform


From: Ralf Wildenhues
Subject: Re: compile mode, XSI shell: do not fork for $xform
Date: Thu, 10 Apr 2008 23:01:57 +0200
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

> * Peter O'Gorman wrote on Thu, Apr 10, 2008 at 02:13:02AM CEST:
> > > $ echo ada.ada.ada | sed -e "s/\.[^.]*/.lo/"
> > > ada.lo.ada

> > A $ helps:

> > It's ok with this changed.

Applied like this.

Cheers,
Ralf

2008-04-10  Ralf Wildenhues  <address@hidden>

        * libltdl/m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS) <func_xform>:
        New function.
        * libltdl/config/ltmain.m4sh (func_mode_compile): Use it to
        avoid two forks with XSI shells.
        * tests/suffix.test: Also test a file with multiple dots.

Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.103
diff -u -r1.103 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  10 Apr 2008 17:43:39 -0000      1.103
+++ libltdl/config/ltmain.m4sh  10 Apr 2008 21:00:39 -0000
@@ -769,27 +769,16 @@
 
     # Recognize several different file suffixes.
     # If the user specifies -o file.o, it is replaced with file.lo
-    xform='[cCFSifmso]'
     case $libobj in
-    *.ada) xform=ada ;;
-    *.adb) xform=adb ;;
-    *.ads) xform=ads ;;
-    *.asm) xform=asm ;;
-    *.c++) xform=c++ ;;
-    *.cc) xform=cc ;;
-    *.ii) xform=ii ;;
-    *.class) xform=class ;;
-    *.cpp) xform=cpp ;;
-    *.cxx) xform=cxx ;;
-    *.[fF][09]?) xform='[fF][09].' ;;
-    *.for) xform=for ;;
-    *.java) xform=java ;;
-    *.obj) xform=obj ;;
-    *.sx) xform=sx ;;
+    *.[cCFSifmso] | \
+    *.ada | *.adb | *.ads | *.asm | \
+    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
+      func_xform "$libobj"
+      libobj=$func_xform_result
+      ;;
     esac
 
-    libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
-
     case $libobj in
     *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
     *)
Index: libltdl/m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v
retrieving revision 1.146
diff -u -r1.146 libtool.m4
--- libltdl/m4/libtool.m4       1 Apr 2008 18:23:19 -0000       1.146
+++ libltdl/m4/libtool.m4       10 Apr 2008 21:00:41 -0000
@@ -7098,6 +7098,7 @@
 [case $xsi_shell in
   yes)
     cat << \_LT_EOF >> "$cfgfile"
+
 # func_dirname file append nondir_replacement
 # Compute the dirname of FILE.  If nonempty, add APPEND to the result,
 # otherwise set result to NONDIR_REPLACEMENT.
@@ -7165,10 +7166,18 @@
     *)    func_lo2o_result=${1} ;;
   esac
 }
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=${1%.*}.lo
+}
+
 _LT_EOF
     ;;
   *) # Bourne compatible functions.
     cat << \_LT_EOF >> "$cfgfile"
+
 # func_dirname file append nondir_replacement
 # Compute the dirname of FILE.  If nonempty, add APPEND to the result,
 # otherwise set result to NONDIR_REPLACEMENT.
@@ -7245,6 +7254,12 @@
 {
   func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
 }
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
+}
 _LT_EOF
 esac
 
@@ -7269,6 +7284,7 @@
 {
   eval "$[1]=\$$[1]\$[2]"
 }
+
 _LT_EOF
     ;;
   esac
Index: tests/suffix.test
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/suffix.test,v
retrieving revision 1.15
diff -u -r1.15 suffix.test
--- tests/suffix.test   9 Oct 2007 19:32:45 -0000       1.15
+++ tests/suffix.test   10 Apr 2008 21:00:41 -0000
@@ -1,7 +1,7 @@
 #! /bin/sh
 # suffix.test - check that libtool knows how to transform source suffices.
 #
-#   Copyright (C) 2003, 2004, 2007  Free Software Foundation, Inc.
+#   Copyright (C) 2003, 2004, 2007, 2008  Free Software Foundation, Inc.
 #   Written by Gary V. Vaughan, 2003
 #
 #   This file is part of GNU Libtool.
@@ -24,8 +24,8 @@
 ####
 
 # Extensions taken from the ones that Automake recognizes, plus Objective C,
-# and GNU Ada.
-extensions="C F S ada adb ads asm c c++ cc cpp cxx f f90 F90 f95 F95 f03 F03 
for m s sx"
+# and GNU Ada.  Also test that multiple dots are handled correctly.
+extensions="C F S ada adb ads asm c c++ cc cpp cxx f f90 F90 f95 F95 f03 F03 
for m s sx ada.ada"
 bad_names="foo."
 
 . tests/defs || exit 1




reply via email to

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