]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
New libtoolize --no-warn option and LIBTOOLIZE_OPTIONS parsing.
authorGary V. Vaughan <gary@gnu.org>
Tue, 29 Apr 2008 19:11:54 +0000 (15:11 -0400)
committerGary V. Vaughan <gary@gnu.org>
Wed, 30 Apr 2008 00:35:21 +0000 (20:35 -0400)
* 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
NEWS
doc/libtool.texi
libltdl/config/general.m4sh
libtoolize.m4sh
tests/libtoolize.at

index 5685bda42f975c348175428f7e1a72f1682771ec..ca8c2a1f5277edb1dc53d3865d8a4a01647e243a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2008-04-29  Gary V. Vaughan  <gary@gnu.org>
 
+       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 d7579e9aab8261c981f54443cb597558eece485b..436e22875f3fa1e22566e087abe5d4157004bb49 100644 (file)
--- 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
index 5a2bd551b8cca96d42eef7bc6831a31886275e07..31ba0c742958f94a688828b45fba924a20a3dd7c 100644 (file)
@@ -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}
index 29b3d917e1125d0adf9ec75c5ab44e7da7478edf..53ff5ea0fe075acca23136a63d2185205bd9fd08 100644 (file)
@@ -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...
index ad024ed2389f976f1fd92009e12eaf6ad7384421..41b7eaeb7d63927b5bcf0eb0df5e0ca448220886 100644 (file)
@@ -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."
 
index d91eef2e3f4692ab2d158bc8dfe11eb0253c810c..d500db678ab2fbd70eb2f2273321f45f8a2703aa 100644 (file)
@@ -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