From a53fd09bed347444f2c14db34d00de60d657d720 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Tue, 29 Apr 2008 15:11:54 -0400 Subject: [PATCH] New libtoolize --no-warn option and LIBTOOLIZE_OPTIONS parsing. * libltdl/config/general.m4sh (opt_warning): New option. (func_warning): Only display a warning message if $opt_warning is true. * libtoolize.m4sh: Accept options in LIBTOOLIZE_OPTIONS environment variable. (--no-warn): Parse new option. (func_serial_update_check, func_keyword_update): Use func_warning. (func_check_macros): Bail out before style issues nags when $opt_warning is false. * doc/libtool.texi (Invoking Libtoolize): Document it. * tests/libtoolize.at: Test it. * NEWS: Updated. --- ChangeLog | 14 +++++++++++ NEWS | 9 ++++++++ doc/libtool.texi | 31 +++++++++++++++++++++++-- libltdl/config/general.m4sh | 6 ++++- libtoolize.m4sh | 45 ++++++++++++++++++++++++++++++++++-- tests/libtoolize.at | 46 +++++++++++++++++++++++++++++++++++++ 6 files changed, 146 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5685bda42..ca8c2a1f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2008-04-29 Gary V. Vaughan + New libtoolize --no-warn option and LIBTOOLIZE_OPTIONS parsing. + * libltdl/config/general.m4sh (opt_warning): New option. + (func_warning): Only display a warning message if $opt_warning + is true. + * libtoolize.m4sh: Accept options in LIBTOOLIZE_OPTIONS + environment variable. + (--no-warn): Parse new option. + (func_serial_update_check, func_keyword_update): Use func_warning. + (func_check_macros): Bail out before style issues nags when + $opt_warning is false. + * doc/libtool.texi (Invoking Libtoolize): Document it. + * tests/libtoolize.at: Test it. + * NEWS: Updated. + Fix libtoolize test failure with aclocal-1.10.1. * tests/libtoolize.at (verbatim aclocal.m4 w/o AC_CONFIG_MACRO_DIR): Force aclocal to diff --git a/NEWS b/NEWS index d7579e9aa..436e22875 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,15 @@ NEWS - list of user-visible changes between releases of GNU Libtool New in 2.2.4: 2008-??-??: CVS version 2.2.3a, Libtool team: +* New features: + + - New libtoolize option --no-warn, for users that want to continue to + use old libtool style without being nagged. + - Options --debug, --no-warn, --quiet and --verbose can be passed to + libtoolize through the environment variable LIBTOOLIZE_OPTIONS, for + cleaner interaction between the user and libtoolize when called by + autoreconf. + * Bug fixes: - The documentation for lt_dlopenadvise showed the wrong type for diff --git a/doc/libtool.texi b/doc/libtool.texi index 5a2bd551b..31ba0c742 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -2329,6 +2329,12 @@ also specify a subdirectory name here if you are not using Autoconf for example. If @command{libtoolize} can't determine the target directory, @samp{libltdl} is used as the default. +@item --no-warn +Normally, Libtoolize tries to diagnose use of deprecated libtool macros +and other stylistic issues. If you are deliberately using outdated +calling conventions, this option prevents Libtoolize from explaining +how to update your project's Libtool conventions. + @item --nonrecursive If passed in conjunction with @option{--ltdl}, this option will cause the @command{libltdl} installed by @samp{libtoolize} to be set up for @@ -2407,6 +2413,27 @@ Work noisily! Give a blow by blow account of what Print @command{libtoolize} version information and exit. @end table +@cindex LIBTOOLIZE_OPTIONS +Sometimes it can be useful to pass options to @command{libtoolize} even +though it is called by another program, such as @command{autoreconf}. A +limited number of options are parsed from the environment variable +@code{LIBTOOLIZE_OPTIONS}: currently @option{--debug}, @option{--no-warn}, +@option{--quiet} and @option{--verbose}. Multiple options passed in +@code{LIBTOOLIZE_OPTIONS} must be separated with a space, comma or a +colon. + +By default, a warning is issued for unknown options found in +@code{LIBTOOLIZE_OPTIONS} unless the first such option is +@option{--no-warn}. Where @command{libtoolize} has always quit +on receipt of an unknown option at the command line, this and all +previous releases of @command{libtoolize} will continue unabated whatever +the content of @code{LIBTOOLIZE_OPTIONS} (modulo some possible warning +messages). + +@example +trick$ @kbd{LIBTOOLIZE_OPTIONS=--no-warn,--quiet autoreconf --install} +@end example + @findex AC_CONFIG_MACRO_DIR If @command{libtoolize} detects an explicit call to @code{AC_CONFIG_MACRO_DIR} (@pxref{Input, , The Autoconf Manual, @@ -2442,8 +2469,8 @@ autoconf, The Autoconf Manual}) in your @file{configure.ac}, it will put the other support files in the specified directory. Otherwise they too end up in the project root directory. -@command{libtoolize} displays hints for adding libtool support to your -package, as well. +Unless @option{--no-warn} is passed, @command{libtoolize} displays +hints for adding libtool support to your package, as well. @node Autoconf and LTLIBOBJS @subsection Autoconf and @code{LTLIBOBJS} diff --git a/libltdl/config/general.m4sh b/libltdl/config/general.m4sh index 29b3d917e..53ff5ea0f 100644 --- a/libltdl/config/general.m4sh +++ b/libltdl/config/general.m4sh @@ -153,6 +153,7 @@ opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false +opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode @@ -185,7 +186,10 @@ func_error () # Echo program name prefixed warning message to standard error. func_warning () { - $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + + # bash bug again: + : } # func_fatal_error arg... diff --git a/libtoolize.m4sh b/libtoolize.m4sh index ad024ed23..41b7eaeb7 100644 --- a/libtoolize.m4sh +++ b/libtoolize.m4sh @@ -35,6 +35,7 @@ m4_divert_push([SCRIPT])#! /bin/sh # -f, --force replace existing files # -i, --install copy missing auxiliary files # --ltdl[=DIR] install libltdl sources [default: libltdl] +# --no-warn don't display warning messages # --nonrecursive prepare ltdl for non-recursive make # -q, --quiet work silently # --recursive prepare ltdl for recursive make @@ -43,6 +44,15 @@ m4_divert_push([SCRIPT])#! /bin/sh # --version print version information and exit # -h, --help print short or long help message # +# The following space or comma delimited options can be passed to $progname +# via the environment variable LIBTOOLIZE_OPTIONS, unknown environment +# options are ignored: +# +# --debug enable verbose shell tracing +# --no-warn don't display warning messages +# --quiet work silently +# --verbose verbosely report processing +# # You must `cd' to the top directory of your package before you run # `$progname'. # @@ -108,6 +118,28 @@ ltdldir= configure_ac=configure.in +# Parse environment options +{ + my_sed_env_opt='1s/^\([^,:; ]*\).*$/\1/;q' + my_sed_env_rest='1s/^[^,:; ]*[,:; ]*\(.*\)$/\1/;q' + + while test -n "$LIBTOOLIZE_OPTIONS"; do + opt=`echo "$LIBTOOLIZE_OPTIONS" | sed "$my_sed_env_opt"` + LIBTOOLIZE_OPTIONS=`echo "$LIBTOOLIZE_OPTIONS" | sed "$my_sed_env_rest"` + + case $opt in + --debug) opt_debug=: ;; + --no-warn) opt_warning=false ;; + --quiet) opt_quiet=: ;; + --verbose) opt_verbose=: ;; + + --*) func_warning "unrecognized environment option \`$opt'" ;; + *) func_fatal_help "garbled LIBTOOLIZE_OPTIONS near \`$opt'" ;; + esac + done +} + + # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtoolize --version' happen quickly. { @@ -153,6 +185,8 @@ configure_ac=configure.in fi ;; + --no-warn) opt_warning=false ;; + --nonrecursive|--non-recursive) ltdl_mode=nonrecursive ;; @@ -743,7 +777,7 @@ func_serial_update_check () if test -f "$my_destfile"; then test "X$my_src_serial" = "X0" && { - func_error "warning: no serial number on \`$my_srcfile', not copying." + func_warning "no serial number on \`$my_srcfile', not copying." return } @@ -904,7 +938,7 @@ func_keyword_update () if test -f "$my_destfile"; then my_src_serial=`$SED -e "$my_sed_script" "$my_srcfile"` test -z "$my_src_serial" && { - func_error "warning: no serial number in \`$my_srcfile', not copying." + func_warning "no serial number in \`$my_srcfile', not copying." return } @@ -1361,6 +1395,13 @@ func_check_macros () fi fi + ## ---------------------------------------------------------- ## + ## Since we return early here when --no-warn was given: ## + ## DO NOT PUT ANYTHING BUT UPGRADE ADVICE MESSAGES BELOW HERE ## + ## ---------------------------------------------------------- ## + + $opt_warning || return + $seen_libtool || func_echo "Remember to add \`LT_INIT' to $configure_ac." diff --git a/tests/libtoolize.at b/tests/libtoolize.at index d91eef2e3..d500db678 100644 --- a/tests/libtoolize.at +++ b/tests/libtoolize.at @@ -937,3 +937,49 @@ LT_AT_CHECK_LIBTOOLIZE([--copy --install], 0, expout) AT_CLEANUP + +## --------------------------- ## +## Garbled LIBTOOLIZE_OPTIONS. ## +## --------------------------- ## + +AT_SETUP([LIBTOOLIZE_OPTIONS]) + +_LT_CONFIGURE_AC + +LIBTOOLIZE_OPTIONS="narf" +export LIBTOOLIZE_OPTIONS + +AT_DATA(experr, +[[libtoolize: garbled LIBTOOLIZE_OPTIONS near `narf' +libtoolize: Try `libtoolize --help' for more information. +]]) + +LT_AT_CHECK_LIBTOOLIZE([--copy], 1, [ignore], experr) + + +## --------------------------- ## +## Unknown LIBTOOLIZE_OPTIONS. ## +## --------------------------- ## + +LIBTOOLIZE_OPTIONS=--no-such-option +export LIBTOOLIZE_OPTIONS + +AT_DATA(experr, +[[libtoolize: warning: unrecognized environment option `--no-such-option' +]]) + +LT_AT_CHECK_LIBTOOLIZE([--copy], 0, [ignore], experr) + + +## ----------------------------- ## +## --no-warn environment option. ## +## ----------------------------- ## + +LIBTOOLIZE_OPTIONS=--no-warn,--no-such-option +export LIBTOOLIZE_OPTIONS + +AT_DATA(experr, [[]]) + +LT_AT_CHECK_LIBTOOLIZE([--copy], 0, [ignore], experr) + +AT_CLEANUP -- 2.47.2