aboutsummaryrefslogtreecommitdiff
path: root/libtool.m4
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2007-06-01 11:33:01 +0000
committerPaolo Bonzini <bonzini@gnu.org>2007-06-01 11:33:01 +0000
commitf7c5c4b53e8db3ae7f16862e2b2dd1bcebe735d7 (patch)
tree15a4f8c941537ebae16ef9e8b236d740884d0ba7 /libtool.m4
parent1b10b7bfe2883e7b6b697d5f3a2765bb608bd099 (diff)
downloadfsf-binutils-gdb-f7c5c4b53e8db3ae7f16862e2b2dd1bcebe735d7.zip
fsf-binutils-gdb-f7c5c4b53e8db3ae7f16862e2b2dd1bcebe735d7.tar.gz
fsf-binutils-gdb-f7c5c4b53e8db3ae7f16862e2b2dd1bcebe735d7.tar.bz2
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.
Diffstat (limited to 'libtool.m4')
-rw-r--r--libtool.m452
1 files changed, 29 insertions, 23 deletions
diff --git a/libtool.m4 b/libtool.m4
index 46d5963..df40fe8 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1439,29 +1439,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
])