Re: [PATCH 6/6] use print or printf or cat as $ECHO (really)

2008-11-23 Thread Ralf Wildenhues
* Eric Blake wrote on Sat, Nov 22, 2008 at 03:37:03PM CET:
> According to Eric Blake on 11/22/2008 7:31 AM:
> > Maybe a better suggested test would be one that checks for either print or
> > printf (that way, a Solaris machine will let ksh pass the suggested test).
> >Since the overall test is running with stderr silenced, we don't even
> > have to worry about messages about command not found.  In other words, why
> > not:
> > 
> > test "X`print -r -- $ECHO`" = "X$ECHO" \
> >  || test "X`printf %s $ECHO`" = X$ECHO"
> 
> Scratch that; Solaris /bin/sh passes that test, so we wouldn't favor ksh.
>  It really boils down to finding a shell with either print or a builtin
> printf, so I think we have to play the PATH games, and expend the extra
> fork in looking :(

> At least we can hard-code the fact that ZSH_VERSION or
> BASH_VERSION implies a builtin printf, to skip the forks on those shells.

You mean like this?
Are we certain enough no bash or zsh version has problems with a long
format string?

Thanks,
Ralf

* libltdl/m4/libtool.m4 (_LT_PROG_ECHO_BACKSLASH): Fix test to
not influence further tests registered with _AS_DETECT_SUGGESTED
and do not use a PATH below /tmp, to avoid influence by a third
party.

diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 35d7d5c..300cfd7 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -1114,12 +1114,12 @@ esac
 
 m4_ifdef([_AS_DETECT_SUGGESTED],
 [_AS_DETECT_SUGGESTED([
-  
ECHO='\\\'
-  ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-  ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-  PATH=/tmp/nonexistent; export PATH;
-  FPATH=$PATH; export FPATH;
-  test "X`printf %s $ECHO`" = "X$ECHO"])])
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || {
+
ECHO='\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+( PATH=/empty FPATH=/empty; export PATH FPATH
+  test "X`printf %s $ECHO`" = "X$ECHO" ) }])])
 
 _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
 _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])




Re: [OMPI devel] RFC: Add SunStudio/Libtool helper script for post-configure

2008-11-23 Thread Ralf Wildenhues
[ Libtool list readers: this thread is
   ]

I'm applying this patch to Libtool master, to fix $wl for the Sun Ceres
Fortran compiler.

Cheers,
Ralf

Fix matching of Sun Fortran compiler on Linux.
* libltdl/m4/libtool.m4 (_LT_COMPILER_PIC) [ linux ]: Also
match `Sun Ceres Fortran' compiler; reorder with C compiler
matching.
* THANKS: Update.
Report by Ethan Mallove.

diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 35d7d5c..bb2e6ef 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -3941,17 +3941,17 @@ m4_if([$1], [CXX], [
;;
   *)
case `$CC -V 2>&1 | sed 5q` in
-   *Sun\ C*)
- # Sun C 5.9
+   *Sun\ F* | *Sun*Fortran*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
  ;;
-   *Sun\ F*)
- # Sun Fortran 8.3 passes all unrecognized flags to the linker
+   *Sun\ C*)
+ # Sun C 5.9
  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
  ;;
esac
;;




Re: Revenge of the $ECHO. Kill most uses of Xsed.

2008-11-23 Thread Ralf Wildenhues
I've fixed the issues with the first version of the $Xsed killer patch
now, with the incremental diff as shown below, and pushed the combined
result.

Cheers,
Ralf

diff --git a/libltdl/config/general.m4sh b/libltdl/config/general.m4sh
index ce80241..9fe5873 100644
--- a/libltdl/config/general.m4sh
+++ b/libltdl/config/general.m4sh
@@ -181,6 +181,13 @@ func_verbose ()
 :
 }
 
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+$ECHO "$*"
+}
+
 # func_error arg...
 # Echo program name prefixed message to standard error.
 func_error ()
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 6344729..937f14e 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -4958,7 +4958,7 @@ func_mode_link ()
echo "*** I have the capability to make that library 
automatically link in when"
echo "*** you link to this library.  But I can only do this if 
you have a"
echo "*** shared version of the library, which you do not 
appear to have"
-   $ECHO "*** because the file extensions .$libext of this 
argument makes me believe"
+   echo "*** because the file extensions .$libext of this argument 
makes me believe"
echo "*** that it is just a static archive that I should not 
use here."
  else
echo
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 1b99f02..633d8f8 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -428,7 +428,7 @@ m4_define([_LT_CONFIG_STATUS_DECLARE],
 # embedded single quotes properly.  In configure, this macro expands
 # each variable declared with _LT_DECL (and _LT_TAGDECL) into:
 #
-#='`$ECHO "$" | $$SED "$delay_single_quote_subst"`'
+#='`$ECHO "$" | $SED "$delay_single_quote_subst"`'
 m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
 [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
 [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
@@ -1509,7 +1509,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
   # 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"`$ECHO "$teststring$teststring" 2>/dev/null` \
+  while { test "X"`func_fallback_echo "$teststring$teststring" 
2>/dev/null` \
 = "X$teststring$teststring"; } >/dev/null 2>&1 &&
  test $i != 17 # 1/2 MB should be enough
   do
diff --git a/libtoolize.m4sh b/libtoolize.m4sh
index f1127d4..1427e61 100644
--- a/libtoolize.m4sh
+++ b/libtoolize.m4sh
@@ -168,11 +168,11 @@ all_pkgltdl_files="COPYING.LIB Makefile Makefile.in 
Makefile.inc Makefile.am REA
 
   --dry-run|-n)if $opt_dry_run; then :; else
  opt_dry_run=:
- RM="echo $RM"
- test -n "$LN_S" && LN_S="echo $LN_S"
- CP="echo $CP"
- MKDIR="echo $MKDIR"
- TAR="echo $TAR"
+ RM="func_echo_all $RM"
+ test -n "$LN_S" && LN_S="func_echo_all $LN_S"
+ CP="func_echo_all $CP"
+ MKDIR="func_echo_all $MKDIR"
+ TAR="func_echo_all $TAR"
fi
;;
 
@@ -209,7 +209,7 @@ all_pkgltdl_files="COPYING.LIB Makefile Makefile.in 
Makefile.inc Makefile.am REA
 
   # Separate optargs to long options:
   --*=*)
-   arg=`$ECHO "$opt" | $SED "$my_sed_long_arg"`
+   arg=`$ECHO "$opt" | $SED "$my_sed_long_arg"`
opt=`$ECHO "$opt" | $SED "$my_sed_long_opt"`
set dummy "$opt" "$arg" ${1+"$@"}
shift
@@ -676,7 +676,7 @@ func_included_files ()
 d'
 
 if test -f "$my_searchfile"; then
-  $ECHO "$my_searchfile" 
+  $ECHO "$my_searchfile"
 
   # Only recurse when we don't care if all the variables we use get
   # trashed, since they are in global scope.




No need to prepend $progname with './'.

2008-11-23 Thread Ralf Wildenhues
The new $ECHO allows for this simplification, pushed.

Cheers,
Ralf

No need to prepend $progname with './'.

* libltdl/config/general.m4sh (func_dirname_and_basename): $ECHO
copes with leading hyphens now, so do not mangle $progname any
more.

diff --git a/libltdl/config/general.m4sh b/libltdl/config/general.m4sh
index ce80241..59e6b27 100644
--- a/libltdl/config/general.m4sh
+++ b/libltdl/config/general.m4sh
@@ -101,13 +101,8 @@ func_dirname_and_basename ()
 # Generated shell functions inserted here.
 
 # The name of this program:
-# In the unlikely event $progname began with a '-', it would play havoc with
-# func_echo (imagine progname=-n), so we prepend ./ in that case:
 func_dirname_and_basename "$progpath"
 progname=$func_basename_result
-case $progname in
-  -*) progname=./$progname ;;
-esac
 
 # Make sure we have an absolute path for reexecution:
 case $progpath in




Replace uses of $SED $basename.

2008-11-23 Thread Ralf Wildenhues
Further simplification: no more $SED $basename outside of
func_*basename.  Pushed.

Cheers,
Ralf

Replace uses of $SED $basename.
* libltdl/config/ltmain.m4sh (func_mode_link): Replace instances
of `$ECHO ... | $SED' with calls to func_basename.
* libtoolize.m4sh (func_copy, func_serial)
(func_massage_aclocal_DATA): Likewise, replace with
func_dirname_and_basename.
* tests/defs.m4sh (func_configure_nofail, func_make, func_exec):
Likewise.

diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 937f14e..28ad40d 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -4764,7 +4764,8 @@ func_mode_link ()
  # Collect preopened libtool deplibs, except any this library
  # has declared as weak libs
  for deplib in $dependency_libs; do
-deplib_base=`$ECHO "$deplib" | $SED "$basename"`
+   func_basename "$deplib"
+deplib_base=$func_basename_result
case " $weak_libs " in
*" $deplib_base "*) ;;
*) deplibs="$deplibs $deplib" ;;
@@ -6846,7 +6847,8 @@ EOF
save_libobjs=$libobjs
  fi
  save_output=$output
- output_la=`$ECHO "$output" | $SED "$basename"`
+ func_basename "$output"
+ output_la=$func_basename_result
 
  # Clear the reloadable object creation command queue and
  # initialize k to one.
diff --git a/libtoolize.m4sh b/libtoolize.m4sh
index 1427e61..941ad85 100644
--- a/libtoolize.m4sh
+++ b/libtoolize.m4sh
@@ -269,7 +269,8 @@ func_copy ()
 test -f "$1" || \
   { func_error "\`$1' not copied:  not a regular file"; return 1; }
 
-my_f1=`$ECHO "$1" | $SED "$basename"`
+func_dirname_and_basename "$1"
+my_f1=$func_basename_result
 
 if test -d "$2"; then
 
@@ -279,7 +280,9 @@ func_copy ()
 else
 
   # Supporting this would mean changing the timestamp:
-  test "X$my_f1" = X`$ECHO "$2" | $SED "$basename"` \
+  func_dirname_and_basename "$2"
+  my_tname=$func_basename_result
+  test "X$my_f1" = "X$my_tname" \
 || func_fatal_error "func_copy() cannot change filename on copy"
 
   func_copy_cb "$my_f1" \
@@ -705,10 +708,12 @@ func_serial ()
 # Search FILENAME and all the files it m4_includes for a serial number
 # in the file that AC_DEFUNs MACRO_REGEX.
 my_serial=
+func_dirname_and_basename "$my_filename"
+my_filebase=$func_basename_result
 for my_file in `func_included_files "$my_filename"`; do
   if test -z "$my_macro_regex" ||
  test "$my_filename" = aclocal.m4 ||
- test "$my_macro_regex" = `echo "$my_filename" | $SED "$basename"` ||
+ test "X$my_macro_regex" = "X$my_filebase" ||
  func_grep '^AC_DEFUN(\@<:@'"$my_macro_regex" "$my_file"
   then
 my_serial=`$SED -e "$my_sed_serial" "$my_file"`
@@ -1040,7 +1045,8 @@ func_massage_aclocal_DATA ()
 
 # Massage a value for pkgmacro_files from the value used in Makefile.am.
 for my_filename in @aclocal_DATA@; do
-  my_filename=`$ECHO "$my_filename" | $SED "$basename"`
+  func_dirname_and_basename "$my_filename"
+  my_filename=$func_basename_result
 
   # ignore excluded filenames
   if test -n "$my_glob_exclude"; then
diff --git a/tests/defs.m4sh b/tests/defs.m4sh
index dc23826..27c6f77 100644
--- a/tests/defs.m4sh
+++ b/tests/defs.m4sh
@@ -187,7 +187,8 @@ func_configure_nofail ()
 {
 $opt_debug
 my_args=${1+"$@"}
-my_dir=`pwd | $SED "$basename"`
+func_dirname_and_basename "`pwd`"
+my_dir=$func_basename_result
 my_testdir="$srcdir/tests/$my_dir"
 conf_status=$EXIT_FAILURE
 
@@ -245,7 +246,8 @@ func_make ()
 {
 $opt_debug
 my_args=${1+"$@"}
-my_dir=`pwd | $SED "$basename"`
+func_dirname_and_basename "`pwd`"
+my_dir=$func_basename_result
 
 func_msg "Running \`$MAKE $my_args' in $my_dir"
 
@@ -317,7 +319,8 @@ func_exec ()
 $opt_debug
 my_program="$1"
 my_exp_output="$2"
-my_dir=`pwd | $SED "$basename"`
+func_dirname_and_basename "`pwd`"
+my_dir=$func_basename_result
 
 test -n "$my_exp_output" \
   && my_exp_output="| $EGREP -e "\""$my_exp_output"\"




Avoid newlines in some AT_CHECK commands.

2008-11-23 Thread Ralf Wildenhues
It bothered me while testing these test groups that TESTSUITEFLAGS='-v -x'
doesn't show the trace output for these commands.  Fixed with this
trivial patch by avoiding newlines inside, pushed.

Cheers,
Ralf

Avoid newlines in some AT_CHECK commands.
* tests/standalone.at (linking libltdl without autotools): Wrap
lines with dnl, to avoid turning off tracing of AT_CHECK.
* tests/subproject.at (linking libltdl without autotools):
Likewise.

diff --git a/tests/standalone.at b/tests/standalone.at
index f9ba5ed..39b77c4 100644
--- a/tests/standalone.at
+++ b/tests/standalone.at
@@ -80,9 +80,9 @@ AT_SETUP([linking libltdl without autotools])
 
 _LTDL_PROJECT_FILES([libltdl])
 LT_AT_CHECK_LIBTOOLIZE([--copy --ltdl], [], [ignore])
-LT_AT_MAKE([], [CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS" \
-CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
-   CONFIGURE_OPTIONS="$configure_options"])
+LT_AT_MAKE([], [CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS" ]dnl
+[CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ]dnl
+   [CONFIGURE_OPTIONS="$configure_options"])
 
 LT_AT_EXEC_CHECK([./ltdldemo], 0, [ignore])
 
diff --git a/tests/subproject.at b/tests/subproject.at
index 4b32f44..0e003a3 100644
--- a/tests/subproject.at
+++ b/tests/subproject.at
@@ -110,9 +110,9 @@ AT_SETUP([linking libltdl without autotools])
 
 _LTDL_PROJECT_FILES([sub/ltdl])
 LT_AT_LIBTOOLIZE([--copy --ltdl=sub/ltdl])
-LT_AT_MAKE([], [CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS"  \
- CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" SHELL="$SHELL" MAKE="${MAKE-make}" \
- CONFIGURE_OPTIONS="$configure_options"])
+LT_AT_MAKE([], [CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS" ]dnl
+ [CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" SHELL="$SHELL" MAKE="${MAKE-make}" 
]dnl
+ [CONFIGURE_OPTIONS="$configure_options"])
 
 LT_AT_EXEC_CHECK([./ltdldemo], 0, [ignore])
 




Re: [PATCH 6/6] use print or printf or cat as $ECHO (really)

2008-11-23 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Ralf Wildenhues on 11/23/2008 1:10 AM:
>> At least we can hard-code the fact that ZSH_VERSION or
>> BASH_VERSION implies a builtin printf, to skip the forks on those shells.
> 
> You mean like this?
> Are we certain enough no bash or zsh version has problems with a long
> format string?

I'm not certain they are bug-free on all possible formats (for example,
printf %10s\\n), but for our usage, they do just fine on long strings
where Solaris /bin/printf does not.

> +  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || {
> +
> ECHO='\\\'
> +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
> +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
> +( PATH=/empty FPATH=/empty; export PATH FPATH
> +  test "X`printf %s $ECHO`" = "X$ECHO" ) }])])

Still not enough.  Solaris /bin/sh correctly fails this test.  However,
because we did not check for print, Solaris ksh _also_ fails the test, and
we end up wrongly favoring /bin/sh, even though it lacks a builtin.  On
Solaris, we _want_ to choose ksh over /bin/sh, because builtin print is
faster than the here-doc fallback used in /bin/sh.  I think the last line
has to be:

   ( PATH=/empty FPATH=/empty; export PATH FPATH
 test "X`printf %s $ECHO`" = "X$ECHO" \
   || test "X`print -r -- $ECHO`" = "X$ECHO" ) }])])

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkpaCEACgkQ84KuGfSFAYAiKwCcCiuwIlxSv7qI7fhpLNnGB5R5
gzMAn2zjMeQxPs2liMcCc4xJTbQBlU9a
=7sSU
-END PGP SIGNATURE-




Re: [PATCH 6/6] use print or printf or cat as $ECHO (really)

2008-11-23 Thread Ralf Wildenhues
* Eric Blake wrote on Sun, Nov 23, 2008 at 03:26:41PM CET:
> According to Ralf Wildenhues on 11/23/2008 1:10 AM:
> > Are we certain enough no bash or zsh version has problems with a long
> > format string?
> 
> I'm not certain they are bug-free on all possible formats (for example,
> printf %10s\\n), but for our usage, they do just fine on long strings
> where Solaris /bin/printf does not.

OK, let's leave it at that for now.

> Still not enough.  Solaris /bin/sh correctly fails this test.  However,
> because we did not check for print, Solaris ksh _also_ fails the test, and
> we end up wrongly favoring /bin/sh, even though it lacks a builtin.  On
> Solaris, we _want_ to choose ksh over /bin/sh, because builtin print is
> faster than the here-doc fallback used in /bin/sh.  I think the last line
> has to be:
> 
>( PATH=/empty FPATH=/empty; export PATH FPATH
>  test "X`printf %s $ECHO`" = "X$ECHO" \
>|| test "X`print -r -- $ECHO`" = "X$ECHO" ) }])])

Thanks for testing.  I've pushed this now.

Cheers,
Ralf

2008-11-23  Ralf Wildenhues  <[EMAIL PROTECTED]>
Eric Blake  <[EMAIL PROTECTED]>

Fix $ECHO test to not influence other _AS_DETECT_SUGGESTED code.
* libltdl/m4/libtool.m4 (_LT_PROG_ECHO_BACKSLASH): Fix test to
not influence further tests registered with _AS_DETECT_SUGGESTED
and do not use a PATH below /tmp, to avoid influence by a third
party.

diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 633d8f8..5d1a131 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -1114,12 +1114,13 @@ esac
 
 m4_ifdef([_AS_DETECT_SUGGESTED],
 [_AS_DETECT_SUGGESTED([
-  
ECHO='\\\'
-  ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-  ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-  PATH=/tmp/nonexistent; export PATH;
-  FPATH=$PATH; export FPATH;
-  test "X`printf %s $ECHO`" = "X$ECHO"])])
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+
ECHO='\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+PATH=/empty FPATH=/empty; export PATH FPATH
+test "X`printf %s $ECHO`" = "X$ECHO" \
+  || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
 
 _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
 _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])




No trailing period in Autotest test group names.

2008-11-23 Thread Ralf Wildenhues
Pure cleanup patch, pushed.

Cheers,
Ralf

No trailing period in Autotest test group names.
* tests/link-order.at (Link order test): Drop trailing period
from test name.
* tests/link-order2.at (Link order of deplibs): Likewise.

diff --git a/tests/link-order.at b/tests/link-order.at
index ce52cc9..c12ba0b 100644
--- a/tests/link-order.at
+++ b/tests/link-order.at
@@ -1,6 +1,6 @@
 # link-order.at -- ensure that library linking order matches  -*- Autotest -*-
 #
-#   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+#   Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
 #   Written by Alexandre Oliva & Ralf Wildenhues, 2005
 #
 #   This file is part of GNU Libtool.
@@ -23,7 +23,7 @@
 
 
 
-AT_SETUP([Link order test.])
+AT_SETUP([Link order test])
 AT_KEYWORDS([libtool])
 eval `$LIBTOOL --config | $EGREP 
'^(hardcode_direct|hardcode_direct_absolute|shrext_cmds)='`
 LDFLAGS="$LDFLAGS -no-undefined"
diff --git a/tests/link-order2.at b/tests/link-order2.at
index 91328b1..8e5712f 100644
--- a/tests/link-order2.at
+++ b/tests/link-order2.at
@@ -1,6 +1,6 @@
 # link-order2.at -- test link order of deplibs-*- Autotest -*-
 #
-#   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+#   Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
 #   Written by Ralf Wildenhues, 2006
 #
 #   This file is part of GNU Libtool.
@@ -33,7 +33,7 @@
 # actually loaded in each case, we also use an unrelated symbol
 # from it directly in the main program.  We test for failure by
 # reversing the link order.
-# We test both static and shared: it should work in both cases.  
+# We test both static and shared: it should work in both cases.
 # But for the static case to work, the two symbols in the depdepl
 # need to be in separate object files, otherwise duplicate symbol
 # definitions can happen.
@@ -43,7 +43,7 @@
 # and only with MACOS_DEPLOYMENT_TARGET 10.2 and earlier
 # (in that case $allow_undefined_flag contains -flat_namespace).
 
-AT_SETUP([Link order of deplibs.])
+AT_SETUP([Link order of deplibs])
 AT_KEYWORDS([libtool])
 
 eval `$LIBTOOL --config | $EGREP '^(shlibpath_var|allow_undefined_flag)='`




Re: testsuite.at for version 2.x Was: ... mingw-cross, check-local fail for DESTDIR tests

2008-11-23 Thread Ralf Wildenhues
* Ralf Wildenhues wrote on Wed, Nov 19, 2008 at 07:42:02AM CET:
> 
> >> Test 29 "static linking flags for programs" skipped (static.at:177) -  
> >> problem is with "libtool --mode install" since real executable is in  
> >> .libs subdirectory. No idea how to fix.
> > It is not "--mode install" problem.
> > Still skipped. It is too big test :) .
> 
> The test for the executables that are supposed to fail is too strict for
> wine output and error status.

To fix the loose end wrt. the exec checks, there was some exit status
normalization needed here.  I think this patch should be sufficient,
once the $EXEEXT patch is in (comes next).

Pushed.

Cheers, and thanks,
Ralf

Adjust executable run tests to cwrapper changes.

* tests/testsuite.at (LT_AT_EXEC_CHECK): Accept fifth argument
ARGS-OR-STATUS-ADJUST, for command-line arguments and/or exit
status flattening.  Rewrite to prefer the executable with the
`.exe' prefix over one without.  Test exit status against
expected exit status, not against zero, when determining whether
this may be a cross-compilation-induced result.
(LT_AT_NOINST_EXEC_CHECK): Likewise.
* tests/static.at (static linking flags for programs): Adjust
calls.
Report by Roumen Petrov.

diff --git a/tests/static.at b/tests/static.at
index b5e9946..6c91b1f 100644
--- a/tests/static.at
+++ b/tests/static.at
@@ -194,11 +194,11 @@ func_test_exec_fail ()
 for st
 do
   echo "# m$st"
-  LT_AT_EXEC_CHECK([./m$st || (exit 1)], [1], [], [ignore])
+  LT_AT_EXEC_CHECK([./m$st], [1], [], [ignore], [|| (exit 1)])
   # For some per-deplib flag combinations there may be no installed 
program,
   # because liba2 is not yet installed.
   if test -f "$bindir/m$st"; then
-   LT_AT_EXEC_CHECK([$bindir/m$st || (exit 1)], [1], [], [ignore])
+   LT_AT_EXEC_CHECK([$bindir/m$st], [1], [], [ignore], [|| (exit 1)])
   fi
 done
   fi
diff --git a/tests/testsuite.at b/tests/testsuite.at
index f7e805e..9511c06 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -203,29 +203,45 @@ m4_define([_LT_AT_TRANSLATE_TEXT_OUTPUT],
 esac])
 
 
-# LT_AT_EXEC_CHECK(EXECUTABLE, [STATUS = 0], [STDOUT], [STDERR])
+# LT_AT_EXEC_CHECK(EXECUTABLE, [STATUS = 0], [STDOUT], [STDERR],
+# [ARGS-OR-STATUS-ADJUST])
 # --
+# Run EXECUTABLE ARGS-OR-STATUS-ADJUST.  STATUS, STDOUT, and STDERR are
+# handled as in AT_CHECK, but expout and experr get line endings
+# translated.
+# However, if we are cross-compiling, then SKIP instead of FAIL.
+# ARGS-OR-STATUS-ADJUST can also contain code like `|| (exit 1)'
+# to unify different possible exit status values.
 m4_define([LT_AT_EXEC_CHECK],
 [m4_if([$3], [expout], [_LT_AT_TRANSLATE_TEXT_OUTPUT([$3])])
 m4_if([$4], [experr], [_LT_AT_TRANSLATE_TEXT_OUTPUT([$4])])
-AT_CHECK([$1; lt_status=$?; if test $lt_status -eq 0; then :;
-  elif test "X$host" != "X$build" && \
-   { test -x "$1" || test -x "$1"$EXEEXT; }
-  then (exit 77); else (exit $lt_status); fi],[$2],[$3],[$4])
+lt_exe=$1; if test -f "$1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
+AT_CHECK([if "$lt_exe" $5; then :; else lt_status=$?; ]dnl
+[  m4_ifval([$2], [test $lt_status != $2 && ])]dnl
+[  test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; ]dnl
+[  exit $lt_status; fi],[$2],[$3],[$4])
 ])
 
 
 # LT_AT_NOINST_EXEC_CHECK(EXECUTABLE, [NOINST-MODULES],
-#[STATUS = 0], [STDOUT], [STDERR])
+#[STATUS = 0], [STDOUT], [STDERR],
+#[ARGS-OR-STATUS-ADJUST])
 # -
+# Run EXECUTABLE ARGS-OR-STATUS-ADJUST using `libtool --mode=execute'
+# with `-dlopen' arguments in NOINST_MODULES.  STATUS, STDOUT, and
+# STDERR are handled as in AT_CHECK, but expout and experr get line
+# endings translated.
+# However, if we are cross-compiling, then SKIP instead of FAIL.
+# ARGS-OR-STATUS-ADJUST can also contain code like `|| (exit 1)'
+# to unify different possible exit status values.
 m4_define([LT_AT_NOINST_EXEC_CHECK],
 [m4_if([$4], [expout], [_LT_AT_TRANSLATE_TEXT_OUTPUT([$4])])
 m4_if([$5], [experr], [_LT_AT_TRANSLATE_TEXT_OUTPUT([$5])])
-AT_CHECK([$LIBTOOL --mode=execute $2 $1; lt_status=$?;
-  if test $lt_status -eq 0; then :;
-  elif test "X$host" != "X$build" && \
-   { test -x "$1" || test -x "$1"$EXEEXT; }
-  then (exit 77); else (exit $lt_status); fi],[$3],[$4],[$5])
+lt_exe=$1; if test -f "$1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
+AT_CHECK([if $LIBTOOL --mode=execute $2 "$lt_exe" $6; then :; else 
lt_status=$?; ]dnl
+[  m4_ifval([$2], [test $lt_status != $2 && ])]dnl
+[  test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; ]dnl
+[  exit $lt_status; fi],[$3],[$4],[$5])
 ])
 
 




use $EXEEXT consistently in new testsuite

2008-11-23 Thread Ralf Wildenhues
* Ralf Wildenhues wrote on Sun, Nov 23, 2008 at 10:41:46PM CET:
> 
> To fix the loose end wrt. the exec checks, there was some exit status
> normalization needed here.  I think this patch should be sufficient,
> once the $EXEEXT patch is in (comes next).

Here it is.  I went over tests/*.at and hopefully found all instances
needing $EXEEXT now.  Pushed.  Review appreciated.

Cheers,
Ralf

2008-11-23  Roumen Petrov  <[EMAIL PROTECTED]>
Ralf Wildenhues  <[EMAIL PROTECTED]>

Add $EXEEXT to all linked programs in the new testsuite.
* tests/convenience.at, tests/ctor.at, tests/darwin.at,
tests/deplibs-ident.at, tests/duplicate_conv.at,
tests/duplicate_deps.at, tests/duplicate_members.at,
tests/export.at, tests/fail.at, tests/indirect_deps.at,
tests/inherited_flags.at, tests/link-order.at,
tests/link-order2.at, tests/lt_dladvise.at, tests/lt_dlexit.at,
tests/need_lib_prefix.at, tests/runpath-in-lalib.at,
tests/search-path.at, tests/shlibpath.at, tests/static.at,
tests/stresstest.at, tests/template.at, tests/testsuite.at:
Use $EXEEXT throughout, except in Makefile.am snippets where
automake takes care of it, and in testsuite macros that take
care of the extension.
Reports by Roumen Petrov and Alon Bar-Lev.

diff --git a/tests/convenience.at b/tests/convenience.at
index 7834bff..995c8ff 100644
--- a/tests/convenience.at
+++ b/tests/convenience.at
@@ -56,9 +56,9 @@ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o 
liba123.la a3.lo liba1.la
 conv=
 for i in 1 2 3; do
   conv=$conv$i
-  AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -static -o main_static 
main$i.lo liba$conv.la],
+  AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -static -o 
main_static$EXEEXT main$i.lo liba$conv.la],
   [0],[ignore],[ignore])
-  AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main$i.lo 
liba$conv.la],
+  AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main$i.lo 
liba$conv.la],
   [0],[ignore],[ignore])
   LT_AT_EXEC_CHECK([./main_static])
   LT_AT_EXEC_CHECK([./main])
@@ -96,9 +96,9 @@ AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS 
$LDFLAGS -o liba123.la a
 conv=
 for i in 1 2 3; do
   conv=$conv$i
-  AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -static -o 
main_static main$i.lo liba$conv.la],
+  AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -static -o 
main_static$EXEEXT main$i.lo liba$conv.la],
   [0],[ignore],[ignore])
-  AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o main 
main$i.lo liba$conv.la],
+  AT_CHECK([$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $LDFLAGS -o 
main$EXEEXT main$i.lo liba$conv.la],
   [0],[ignore],[ignore])
   LT_AT_EXEC_CHECK([./main_static])
   LT_AT_EXEC_CHECK([./main])
@@ -156,9 +156,9 @@ AT_CHECK([$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS 
$LDFLAGS -o liba123.la a3.
 conv=
 for i in 1 2 3; do
   conv=$conv$i
-  AT_CHECK([$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -static -o 
main_static main$i.lo liba$conv.la],
+  AT_CHECK([$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -static -o 
main_static$EXEEXT main$i.lo liba$conv.la],
   [0],[ignore],[ignore])
-  AT_CHECK([$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o main 
main$i.lo liba$conv.la],
+  AT_CHECK([$LIBTOOL --tag=F77 --mode=link $F77 $FFLAGS $LDFLAGS -o 
main$EXEEXT main$i.lo liba$conv.la],
   [0],[ignore],[ignore])
   LT_AT_EXEC_CHECK([./main_static])
   LT_AT_EXEC_CHECK([./main])
@@ -216,9 +216,9 @@ AT_CHECK([$LIBTOOL --tag=FC --mode=link $FC $FCFLAGS 
$LDFLAGS -o liba123.la a3.l
 conv=
 for i in 1 2 3; do
   conv=$conv$i
-  AT_CHECK([$LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -static -o 
main_static main$i.lo liba$conv.la],
+  AT_CHECK([$LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -static -o 
main_static$EXEEXT main$i.lo liba$conv.la],
   [0],[ignore],[ignore])
-  AT_CHECK([$LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -o main 
main$i.lo liba$conv.la],
+  AT_CHECK([$LIBTOOL --tag=FC --mode=link $FC $FCFLAGS $LDFLAGS -o main$EXEEXT 
main$i.lo liba$conv.la],
   [0],[ignore],[ignore])
   LT_AT_EXEC_CHECK([./main_static])
   LT_AT_EXEC_CHECK([./main])
@@ -280,9 +280,9 @@ AT_CHECK([$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS 
$LDFLAGS -o liba123.la A
 conv=
 for i in 1 2 3; do
   conv=$conv$i
-  AT_CHECK([$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -static 
--main=foo$i -o main_static foo$i.lo liba$conv.la],
+  AT_CHECK([$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -static 
--main=foo$i -o main_static$EXEEXT foo$i.lo liba$conv.la],
   [0],[ignore],[ignore])
-  AT_CHECK([$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS 
--main=foo$i -o main foo$i.lo liba$conv.la],
+  AT_CHECK([$LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS 
--main=foo$i -o main$EXEEXT foo$i.l

Relax link-order2 test for systems with partial wrong order.

2008-11-23 Thread Ralf Wildenhues
* Ralf Wildenhues wrote on Wed, Nov 19, 2008 at 07:42:02AM CET:
> * Roumen Petrov wrote on Tue, Nov 18, 2008 at 11:12:56PM CET:
> > [SNIP]
> >> Test 25 "Link order of deplibs" skipped (link-order2.at:129) - in my  
> >> todo  for investigation.
> >
> > Still skipped. The executable exit code is 1 instead 2. No idea what is  
> > problem:
> 
> The test is too strict.

Fixed like this.

Cheers,
Ralf

Relax link-order2 test for systems with partial wrong order.
* tests/link-order2.at (Link order of deplibs.): On w32 (and
others, e.g., AIX), the wrongly linked executable picks up only
one instance of the bad function instead of two; relax the test
to accept this; we still require the right link order with the
correctly linked executable.
Reported by Roumen Petrov and others.

diff --git a/tests/link-order2.at b/tests/link-order2.at
index d5e891a..57ff4a0 100644
--- a/tests/link-order2.at
+++ b/tests/link-order2.at
@@ -83,7 +83,7 @@ extern int a (void);
 extern int b (void);
 int main (void)
 {
-  return a () + b ();
+  return !(a () + b () == 0);
 }
 EOF
 
@@ -126,7 +126,7 @@ for type_of_depdepl in libtool non-libtool; do
 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $static -o 
wrong$EXEEXT main.$OBJEXT -la0 libb.la],
 [], [ignore], [ignore])
 if test $shared_fails,$static != yes,; then
-  LT_AT_EXEC_CHECK([./wrong], [2])
+  LT_AT_EXEC_CHECK([./wrong], [1], [], [ignore], [|| (exit 1)])
 fi
 
 $LIBTOOL --mode=install cp liba1.la $libdir/liba1.la
@@ -136,7 +136,7 @@ for type_of_depdepl in libtool non-libtool; do
 $LIBTOOL --mode=clean rm -f liba1.la libb.la
 LT_AT_EXEC_CHECK([$bindir/main])
 if test $shared_fails,$static != yes,; then
-  LT_AT_EXEC_CHECK([$bindir/wrong], [2])
+  LT_AT_EXEC_CHECK([$bindir/wrong], [1], [], [ignore], [|| (exit 1)])
 fi
   done
 done




Fix expout and experr line ending issues.

2008-11-23 Thread Ralf Wildenhues
> * Roumen Petrov wrote on Tue, Nov 18, 2008 at 11:12:56PM CET:
> 
> >> Test 48 "enforced lib prefix" FAILED (need_lib_prefix.at:184) - again  
> >> "--mode install" problem (see test 29).
> > It is not "--mode install" problem. It is related to end of line.

Fixed like this.

Cheers,
Ralf

Fix expout and experr line ending issues.
* tests/testsuite.at (LT_AT_HOST_DATA): Renamed from..
(_LT_AT_TRANSLATE_TEXT_OUTPUT): ..this.
(LT_AT_EXEC_CHECK, LT_AT_NOINST_EXEC_CHECK): Do not use
_LT_AT_TRANSLATE_TEXT_OUTPUT any more.
* tests/configure-iface.at: Use LT_AT_HOST_DATA instead of
AT_DATA for `expout' files.
* tests/lt_dladvise.at (lt_dlopenadvise library loading):
Likewise.
* tests/need_lib_prefix.at (enforced lib prefix): Likewise.
Report by Roumen Petrov.

diff --git a/tests/configure-iface.at b/tests/configure-iface.at
index 38e7824..77e2ebc 100644
--- a/tests/configure-iface.at
+++ b/tests/configure-iface.at
@@ -89,7 +89,7 @@ int f (void) { return 5150; }
 #endif
 ]])
 
-AT_DATA([expout],
+LT_AT_HOST_DATA([expout],
 [[5150
 ]])
 ])# _LT_AT_LTDL_SETUP
diff --git a/tests/lt_dladvise.at b/tests/lt_dladvise.at
index 60385a6..3bf9bee 100644
--- a/tests/lt_dladvise.at
+++ b/tests/lt_dladvise.at
@@ -289,7 +289,7 @@ int k = 3;
 #endif
 ]])
 
-AT_DATA([expout],
+LT_AT_HOST_DATA([expout],
 [[resident: 2
 local: 3
 global: 4
diff --git a/tests/need_lib_prefix.at b/tests/need_lib_prefix.at
index 90f3a60..f6cfcfb 100644
--- a/tests/need_lib_prefix.at
+++ b/tests/need_lib_prefix.at
@@ -131,7 +131,7 @@ int i = 6;
 #endif
 ]])
 
-AT_DATA([expout],
+LT_AT_HOST_DATA([expout],
 [[libfoo1: 2
 libfoo2: 3
 ]])
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 96c172b..f116a1f 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -193,11 +193,12 @@ m4_define([LT_AT_CHECK],
 [echo "LT_ESCAPE([$1])"; AT_CHECK($@)])
 
 
-# _LT_AT_TRANSLATE_TEXT_OUTPUT(FILE)
-# --
+# LT_AT_HOST_DATA(FILE, CONTENTS)
+# ---
 # Ensure correct line ending for expected output of host executables.
-m4_define([_LT_AT_TRANSLATE_TEXT_OUTPUT],
-[case $host_os in mingw*)
+m4_define([LT_AT_HOST_DATA],
+[AT_DATA([$1], [$2])
+case $host_os in mingw*)
   while read -r l; do printf "%s\r\n" "$l"; done < $1 > $1.t
   mv -f $1.t $1 ;;
 esac])
@@ -207,15 +208,12 @@ esac])
 # [ARGS-OR-STATUS-ADJUST])
 # --
 # Run EXECUTABLE ARGS-OR-STATUS-ADJUST.  STATUS, STDOUT, and STDERR are
-# handled as in AT_CHECK, but expout and experr get line endings
-# translated.
+# handled as in AT_CHECK.
 # However, if we are cross-compiling, then SKIP instead of FAIL.
 # ARGS-OR-STATUS-ADJUST can also contain code like `|| (exit 1)'
 # to unify different possible exit status values.
 m4_define([LT_AT_EXEC_CHECK],
-[m4_if([$3], [expout], [_LT_AT_TRANSLATE_TEXT_OUTPUT([$3])])
-m4_if([$4], [experr], [_LT_AT_TRANSLATE_TEXT_OUTPUT([$4])])
-lt_exe=$1; if test -f "$1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
+[lt_exe=$1; if test -f "$1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
 AT_CHECK([if "$lt_exe" $5; then :; else lt_status=$?; ]dnl
 [  m4_ifval([$2], [test $lt_status != $2 && ])]dnl
 [  test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; ]dnl
@@ -229,15 +227,12 @@ AT_CHECK([if "$lt_exe" $5; then :; else lt_status=$?; ]dnl
 # -
 # Run EXECUTABLE ARGS-OR-STATUS-ADJUST using `libtool --mode=execute'
 # with `-dlopen' arguments in NOINST_MODULES.  STATUS, STDOUT, and
-# STDERR are handled as in AT_CHECK, but expout and experr get line
-# endings translated.
+# STDERR are handled as in AT_CHECK.
 # However, if we are cross-compiling, then SKIP instead of FAIL.
 # ARGS-OR-STATUS-ADJUST can also contain code like `|| (exit 1)'
 # to unify different possible exit status values.
 m4_define([LT_AT_NOINST_EXEC_CHECK],
-[m4_if([$4], [expout], [_LT_AT_TRANSLATE_TEXT_OUTPUT([$4])])
-m4_if([$5], [experr], [_LT_AT_TRANSLATE_TEXT_OUTPUT([$5])])
-lt_exe=$1; if test -f "$1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
+[lt_exe=$1; if test -f "$1$EXEEXT"; then lt_exe=$lt_exe$EXEEXT; fi
 AT_CHECK([if $LIBTOOL --mode=execute $2 "$lt_exe" $6; then :; else 
lt_status=$?; ]dnl
 [  m4_ifval([$2], [test $lt_status != $2 && ])]dnl
 [  test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; ]dnl