* Ralf Wildenhues wrote on Wed, Apr 16, 2008 at 09:53:22PM CEST: > * Bob Friesenhahn wrote on Wed, Apr 16, 2008 at 09:26:49PM CEST: > > With latest CVS HEAD and performing a cross-build to MinGW using FreeBSD > > as the build host, I am seeing an 'illegal option' error message from > > FreeBSD's expr. The only option that FreeBSD's expr supports is -e so I > > must assume that some part of the expression is causing a problem. > > Confirmed. Will fix. > > > expr: > > illegal option -- l > > usage: expr [-e] expression
OK to apply? I was first going to rewrite this to use func_stripname, but then I couldn't find any instance where we actually use $name later. So I figured this can all go. I'd appreciate somebody looking over this, thanks. I also checked other instances of expr for this bug. Cheers, Ralf 2008-04-18 Ralf Wildenhues <[EMAIL PROTECTED]> * libltdl/config/ltmain.m4sh (func_mode_link) <Transforming deplibs into only shared deplibs>: Fix expr portability issues, noted on FreeBSD. While at it, simplify and avoid forking. Report by Bob Friesenhahn. diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 2802254..562bca2 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -5562,9 +5562,8 @@ EOF if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then ldd_output=`ldd conftest` for i in $deplibs; do - name=`expr $i : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then + case $i in + -l*) if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) @@ -5591,17 +5590,18 @@ EOF $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." fi fi - else + ;; + *) newdeplibs="$newdeplibs $i" - fi + ;; + esac done else # Error occurred in the first compile. Let's try to salvage # the situation: Compile a separate program for each library. for i in $deplibs; do - name=`expr $i : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then + case $i in + -l*) $opt_dry_run || $RM conftest if $LTCC $LTCFLAGS -o conftest conftest.c $i; then ldd_output=`ldd conftest` @@ -5639,9 +5639,11 @@ EOF $ECHO "*** library that it depends on before this library will be fully" $ECHO "*** functional. Installing it before continuing would be even better." fi - else + ;; + *) newdeplibs="$newdeplibs $i" - fi + ;; + esac done fi ;; @@ -5649,9 +5651,8 @@ EOF set dummy $deplibs_check_method; shift file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do - name=`expr $a_deplib : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then + case $a_deplib in + -l*) if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) @@ -5708,19 +5709,20 @@ EOF $ECHO "*** using a file magic. Last file checked: $potlib" fi fi - else + ;; + *) # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" - fi + ;; + esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do - name=`expr $a_deplib : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then + case $a_deplib in + -l*) if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) @@ -5759,10 +5761,12 @@ EOF $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi - else + ;; + *) # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" - fi + ;; + esac done # Gone through all deplibs. ;; none | unknown | *)