]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/m4/libtool.m4 (LT_CMD_MAX_LEN): Try using getconf
authorSteve Ellcey <sje@cup.hp.com>
Fri, 1 Jun 2007 06:35:05 +0000 (06:35 +0000)
committerPeter O'Gorman <peter@pogma.com>
Fri, 1 Jun 2007 06:35:05 +0000 (06:35 +0000)
to set lt_cv_sys_max_cmd_len.

ChangeLog
libltdl/m4/libtool.m4

index 12dced812d164dcc16cdf79a714b0c89de8388d7..6e6f9720d88a403754d86d94a618d067f3a19eff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-06-01  Steve Ellcey  <sje@cup.hp.com>
+
+       * libltdl/m4/libtool.m4 (LT_CMD_MAX_LEN): Try using getconf
+       to set lt_cv_sys_max_cmd_len.
+
 2007-05-28  Peter O'Gorman  <peter@pogma.com>
 
        * libltdl/config/ltmain.m4sh (func_mode_link),
index 51fb762a52c106b72e83f464c46e9d7027d9f9ae..c8030ce12945df1eaff9f6ad5d8a9e1f6e100e01 100644 (file)
@@ -1437,29 +1437,35 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     fi
     ;;
   *)
-    # Make teststring a little bigger before we do anything with it.
-    # a 1K string should be a reasonable start.
-    for i in 1 2 3 4 5 6 7 8 ; do
-      teststring=$teststring$teststring
-    done
-    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-    # 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"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-              = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
-           test $i != 17 # 1/2 MB should be enough
-    do
-      i=`expr $i + 1`
-      teststring=$teststring$teststring
-    done
-    # Only check the string length outside the loop.
-    lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
-    teststring=
-    # Add a significant safety factor because C++ compilers can tack on massive
-    # amounts of additional arguments before passing them to the linker.
-    # It appears as though 1/2 is a usable value.
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    lt_cv_sys_max_cmd_len=`getconf ARG_MAX 2> /dev/null`
+    if test -n $lt_cv_sys_max_cmd_len; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # 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"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+                = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+             test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
     ;;
   esac
 ])