Hi Martin, * Martin Waitz wrote on Fri, Dec 10, 2004 at 02:50:42PM CET: > > next request: > > could libtool take a look at MAKEFLAGS and automatically use --silent > mode when 's' is included in the make flags?
That sounds like a good idea -- in principle. > At the moment I'm unconditionally using libtool --silent to make > 'make -s' usable. It would be nicer if libtool would handle that > automatically. > > An alternative would be to implement short options (make -s an alias > to --silent and ignore all other short options) and use > 'libtool -$(MAKEFLAGS)', but I don't really like that. Nope. MAKEFLAGS can have more than one possible format (either the options like given on the command line, or just the letters corresponding to those options) according to XSI. GNU Make does the latter and also adds possible long options and other variable settings afterwards, so we want to treat that correctly as well. I'm not sure how to reliably distinguish between both forms without any forking. But here's a try with just a subshell. Because the user has to be able to override this, we now need an option to undo this. And we need to adjust some tests to use this, because they check the output of libtool. Two things I'm unsure about: - whether `-v|--verbose' was or is in use w.r.t libtool. Should I use that rather than --no-silent? - interaction between `-n|--dry-run' and silence. Should --dry-run imply --no-silent? (One could imagine just trying to syntax-check with --dry-run --silent; in some future version of libtool). OK to apply (to HEAD only, this is a new feature)? Are there any packages that rely on the old behavior? Regards, Ralf * config/ltmain.m4sh (func_make_s): New function to detect `make -s'. Use before parsing the command line so that new option `--no-silent' can override it. * NEWS, doc/libtool.texi (Invoking libtool): Mention it. * tests/link.test, tests/link-2.test, tests/objectlist.test, tests/quote.test: Adjust to use --no-silent so `make -s check' does the right thing. Index: NEWS =================================================================== RCS file: /cvsroot/libtool/libtool/NEWS,v retrieving revision 1.175 diff -u -r1.175 NEWS --- NEWS 29 Nov 2004 21:18:26 -0000 1.175 +++ NEWS 10 Dec 2004 16:36:09 -0000 @@ -6,6 +6,7 @@ * Fix libltdl on static platforms. * Support for linux-dietlibc (`diet' as well as `diet-dyn', separately). * Shell optimizations which break use of the stdin file descriptor in libtool. +* libtool now honors `make -s' (MAKEFLAGS). Use --no-silent to override. New in 1.9h: 2004-??-??; CVS version 1.9g, Libtool team: * Libtool versions can now be parallel installed, except that only one Index: config/ltmain.m4sh =================================================================== RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v retrieving revision 1.34 diff -u -r1.34 ltmain.m4sh --- config/ltmain.m4sh 9 Dec 2004 17:59:15 -0000 1.34 +++ config/ltmain.m4sh 10 Dec 2004 16:36:09 -0000 @@ -38,6 +38,7 @@ # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages +# --no-silent print informational messages (default) # --tag=TAG use configuration variables from tag TAG # --version print version information # -h, --help print short or long help message @@ -393,6 +394,24 @@ exit $EXIT_SUCCESS } +func_make_silent () +{ + ( has_s=false + set x $MAKEFLAGS + case $2 in + s* | [^-]*s* ) # single-letter options within the first word (eg. GNU Make) + has_s=: + ;; + esac + case $MAKEFLAGS in + -s | *\ -s | -s\ * | *\ -s\ * ) # hyphenated options (eg. BSD Make) + has_s=: + ;; + esac + $has_s ) && opt_silent=: + : # work around bash bug +} + # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { @@ -427,6 +446,8 @@ ;; esac + func_make_silent # set first to allow cmdline override + # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" @@ -479,6 +500,10 @@ opt_silent=: ;; + --no-silent) preserve_args="$preserve_args $opt" + opt_silent=false + ;; + --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here Index: doc/libtool.texi =================================================================== RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v retrieving revision 1.185 diff -u -r1.185 libtool.texi --- doc/libtool.texi 23 Nov 2004 09:37:06 -0000 1.185 +++ doc/libtool.texi 10 Dec 2004 16:36:09 -0000 @@ -1173,7 +1173,9 @@ @item --quiet @itemx --silent -Do not print out any progress or informational messages. [EMAIL PROTECTED] --no-silent +Do not (or do) print out any progress or informational messages. +The last form can be used to override silence based on @samp{make -s}. @item --version Print libtool version information and exit. Index: tests/link-2.test =================================================================== RCS file: /cvsroot/libtool/libtool/tests/link-2.test,v retrieving revision 1.8 diff -u -r1.8 link-2.test --- tests/link-2.test 23 Sep 2004 14:50:36 -0000 1.8 +++ tests/link-2.test 10 Dec 2004 16:36:09 -0000 @@ -31,7 +31,7 @@ EOF # Try a sample link command. -linkresult=`$LIBTOOL -n --mode=link $CC -o something foo.o hell.lo` +linkresult=`$LIBTOOL -n --no-silent --mode=link $CC -o something foo.o hell.lo` res=$? rm -f hell.lo Index: tests/link.test =================================================================== RCS file: /cvsroot/libtool/libtool/tests/link.test,v retrieving revision 1.9 diff -u -r1.9 link.test --- tests/link.test 11 Oct 2004 15:15:00 -0000 1.9 +++ tests/link.test 10 Dec 2004 16:36:09 -0000 @@ -24,7 +24,7 @@ . ./defs || exit 1 # Try a sample link command. -linkresult=`$LIBTOOL -n --mode=link $CC -o gettext ../lib/libnlsut.a` +linkresult=`$LIBTOOL -n --no-silent --mode=link $CC -o gettext ../lib/libnlsut.a` test $? -eq 0 || exit $EXIT_FAILURE echo "$linkresult" Index: tests/objectlist.test =================================================================== RCS file: /cvsroot/libtool/libtool/tests/objectlist.test,v retrieving revision 1.3 diff -u -r1.3 objectlist.test --- tests/objectlist.test 22 Nov 2004 15:43:44 -0000 1.3 +++ tests/objectlist.test 10 Dec 2004 16:36:09 -0000 @@ -25,7 +25,7 @@ . ./defs || exit 1 # Try a sample link command. -linkresult=`$LIBTOOL -n --mode=link $CC -objectlist nonexistant 2>&1` +linkresult=`$LIBTOOL -n --no-silent --mode=link $CC -objectlist nonexistant 2>&1` test $? -eq 0 && exit $EXIT_FAILURE echo "$linkresult" | ${EGREP} "nonexistant" >/dev/null 2>&1 && { @@ -35,7 +35,7 @@ objlist="object list with spaces" : > "$objlist" -linkresult=`$LIBTOOL -n --mode=link $CC -o a.out -objectlist "$objlist" 2>&1` +linkresult=`$LIBTOOL -n --no-silent --mode=link $CC -o a.out -objectlist "$objlist" 2>&1` rm -f "$objlist" echo "$linkresult" | ${EGREP} "spaces" >/dev/null 2>&1 && { Index: tests/quote.test =================================================================== RCS file: /cvsroot/libtool/libtool/tests/quote.test,v retrieving revision 1.14 diff -u -r1.14 quote.test --- tests/quote.test 11 Oct 2004 15:15:00 -0000 1.14 +++ tests/quote.test 10 Dec 2004 16:36:09 -0000 @@ -28,6 +28,8 @@ func_get_config "ECHO" "../libtool --config" +LIBTOOL="$LIBTOOL --no-silent" + for mode in compile link install; do $ECHO "== $mode mode" _______________________________________________ Libtool mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/libtool