bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib-tool: tweaks


From: Bruno Haible
Subject: gnulib-tool: tweaks
Date: Fri, 1 Sep 2006 13:55:38 +0200
User-agent: KMail/1.9.1

Hi Paul,

Such code in gnulib-tool

   case $nl$modules$nl in
     *"${nl}config-h$nl"*)

is not very robust: it exploits that $modules uses a newline as separator.
But quite often a space is used separator. (I got trapped when using
similar constructs in gettext.m4.) I'm changing this code to:

   for module in $modules; do
     if test $module = config-h; then

which is not only more robust but IMO also more readable. Speed doesn't
matter here.

Last week's lesson, when I used ${makefile_name-Makefile.am} where
${makefile_name:-Makefile.am} would have been correct (but less portable),
also teaches me to not use too "tricky" constructs.


2006-08-31  Bruno Haible  <address@hidden>

        * gnulib-tool (nl): Remove variable.
        (sed_transform_lib_file): Use more robust test for config-h module.
        (func_import): Fix typo in 2006-08-25 patch.

*** gnulib-20060831/gnulib-tool 2006-08-31 23:03:42.000000000 +0200
--- gnulib-20060831-modified/gnulib-tool        2006-09-01 00:56:10.000000000 
+0200
***************
*** 59,67 ****
    SORT=sort
  fi
  
- nl='
- '
- 
  # func_usage
  # outputs to stdout the --help usage message.
  func_usage ()
--- 59,64 ----
***************
*** 1418,1424 ****
        license=`func_get_license $module`
        case $license in
          LGPL | 'GPLed build tool') ;;
!       'public domain' | 'unlimited' | 'unmodifiable license text') ;;
          *) func_fatal_error "incompatible license on module $module: 
$license" ;;
        esac
      done
--- 1415,1421 ----
        license=`func_get_license $module`
        case $license in
          LGPL | 'GPLed build tool') ;;
!         'public domain' | 'unlimited' | 'unmodifiable license text') ;;
          *) func_fatal_error "incompatible license on module $module: 
$license" ;;
        esac
      done
***************
*** 1426,1438 ****
  
    # Determine script to apply to imported library files.
    sed_transform_lib_file=
!   case $nl$modules$nl in
!     *"${nl}config-h$nl"*)
        # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
        sed_transform_lib_file=$sed_transform_lib_file'
!       s/^#ifdef[       ]*HAVE_CONFIG_H[        ]*$/#if 1/
!       ' ;;
!   esac
    if test -n "$lgpl"; then
      # Update license.
      sed_transform_lib_file=$sed_transform_lib_file'
--- 1423,1437 ----
  
    # Determine script to apply to imported library files.
    sed_transform_lib_file=
!   for module in $modules; do
!     if test $module = config-h; then
        # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
        sed_transform_lib_file=$sed_transform_lib_file'
!         s/^#ifdef[     ]*HAVE_CONFIG_H[        ]*$/#if 1/
!       '
!       break
!     fi
!   done
    if test -n "$lgpl"; then
      # Update license.
      sed_transform_lib_file=$sed_transform_lib_file'
***************
*** 1564,1570 ****
      func_dest_tmpfilename "$g"
      func_lookup_file "$f"
      cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
!     if test -n "sed_transform_lib_file"; then
        case "$f" in
          lib/*)
            sed -e "$sed_transform_lib_file" \
--- 1563,1569 ----
      func_dest_tmpfilename "$g"
      func_lookup_file "$f"
      cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
!     if test -n "$sed_transform_lib_file"; then
        case "$f" in
          lib/*)
            sed -e "$sed_transform_lib_file" \




reply via email to

[Prev in Thread] Current Thread [Next in Thread]