libtool-patches
[Top][All Lists]
Advanced

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

Re: Improving maximum command line length detection (Was: Re: [PATCH] Re


From: Peter O'Gorman
Subject: Re: Improving maximum command line length detection (Was: Re: [PATCH] Removal of obsolete AmigaOS support)
Date: Wed, 08 Oct 2003 23:28:23 +0900
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5b) Gecko/20030902 Thunderbird/0.2

Dalibor Topic wrote:

there were no replys on the ammended method. If anyone objects to me putting in an 8K test string into libtool's libtool.m4 please do it now, before I start learning m4 ;)


Please test this patch, removes the string length test from the loop, and starts with a bigger string. Works for me, but if you can improve it, that'd be great.

Thanks,
Peter
(if you get a previous message with this patch, it is because my mailer crashed while sending, yummy)




Index: ChangeLog
2003-10-08  Peter O'Gorman <address@hidden>

        *m4/libtool.m4: Speed up max_cmd_len check.

from  Scott James Remnant  <address@hidden>
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.4
diff -u -r1.4 libtool.m4
--- m4/libtool.m4 7 Oct 2003 17:03:15 -0000 1.4
+++ m4/libtool.m4 8 Oct 2003 14:04:42 -0000
@@ -677,18 +677,24 @@
     ;;
 
  *)
+    # Make testring a little bigger before we do anything with it.
+    # a 4K string should be a reasonable start.
+    for p in 3 4 5 6 7 8 9 10 11 12 ; do
+      testring=$testring$testring
+    done
     # If test is not a shell built-in, we'll probably end up computing a
     # maximum length that is only half of the actual maximum length, but
     # we can't tell.
-    while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 
2>/dev/null` \
-              = "XX$testring") >/dev/null 2>&1 &&
-           new_result=`expr "X$testring" : ".*" 2>&1` &&
-           lt_cv_sys_max_cmd_len=$new_result &&
-           test $i != 17 # 1/2 MB should be enough
+    while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring$testring" 
2>/dev/null` \
+              = "XX$testring$testring") >/dev/null 2>&1 &&
+           test $i != 6 # 1/2 MB should be enough
     do
       i=`expr $i + 1`
       testring=$testring$testring
     done
+    # Only check the string length outside the loop.
+    new_result=`expr "X$testring" : ".*" 2>&1`
+    lt_cv_sys_max_cmd_len=$new_result
     testring=
     # Add a significant safety factor because C++ compilers can tack on massive
     # amounts of additional arguments before passing them to the linker.

reply via email to

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