Accept GPLed build tool modules when --lgpl is given.
[gnulib.git] / gnulib-tool
index 971843f..5f20206 100755 (executable)
@@ -22,7 +22,7 @@
 
 progname=$0
 package=gnulib
-cvsdatestamp='$Date: 2005-10-17 15:44:51 $'
+cvsdatestamp='$Date: 2005-12-02 13:37:34 $'
 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
 
@@ -44,6 +44,7 @@ func_usage ()
   echo "\
 Usage: gnulib-tool --list
        gnulib-tool --import [module1 ... moduleN]
+       gnulib-tool --update
        gnulib-tool --create-testdir --dir=directory module1 ... moduleN
        gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
        gnulib-tool --test --dir=directory module1 ... moduleN
@@ -237,6 +238,9 @@ func_ln_if_changed ()
       --import | --impor | --impo | --imp | --im | --i )
         mode=import
         shift ;;
+      --update | --updat | --upda | --upd | --up | --u )
+        mode=update
+        shift ;;
       --create-testdir | --create-testdi | --create-testd | --create-test | --create-tes | --create-te | --create-t )
         mode=create-testdir
         shift ;;
@@ -349,7 +353,7 @@ func_ln_if_changed ()
       --dry-run )
         doit=false
         shift ;;
-      -s | --symbolic | --symlink )
+      -s | --symbolic | --symboli | --symbol | --symbo | --symb | --symlink | --symlin | --symli | --syml | --sym | --sy )
         symbolic=true
         shift ;;
       --help | --hel | --he | --h )
@@ -371,6 +375,26 @@ func_ln_if_changed ()
     esac
   done
 
+  if test "$mode" = update; then
+    if test $# != 0; then
+      echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
+      echo "Try 'gnulib-tool --help' for more information." 1>&2
+      echo "If you really want to modify the gnulib configuration of your project," 1>&2
+      echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
+      exit 1
+    fi
+    if test -n "$libname" || test -n "$sourcebase" || test -n "$m4base" \
+       || test -n "$testsbase" || test -n "$auxdir" || test -n "$inctests" \
+       || test -n "$avoidlist" || test -n "$lgpl" || test -n "$macro_prefix"; then
+      echo "gnulib-tool: invalid options for 'update' mode" 1>&2
+      echo "Try 'gnulib-tool --help' for more information." 1>&2
+      echo "If you really want to modify the gnulib configuration of your project," 1>&2
+      echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
+      exit 1
+    fi
+    do_changelog=false
+  fi
+
   # Remove trailing slashes from the directory names. This is necessary for
   # m4base (to avoid an error in func_import) and optional for the others.
   sed_trimtrailingslashes='s,\([^/]\)//*$,\1,'
@@ -914,7 +938,7 @@ func_import ()
     for module in $modules; do
       license=`func_get_license $module`
       case $license in
-        LGPL | 'public domain' | 'unlimited') ;;
+        LGPL | 'GPLed build tool' | 'public domain' | 'unlimited') ;;
         *) func_fatal_error "incompatible license on module $module: $license" ;;
       esac
     done
@@ -980,6 +1004,7 @@ func_import ()
       build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
       lib/*) g=`echo "$f" | sed -e "s,^lib/,$cached_sourcebase/,"` ;;
       m4/*) g=`echo "$f" | sed -e "s,^m4/,$cached_m4base/,"` ;;
+      tests/*) g=`echo "$f" | sed -e "s,^tests/,$cached_testsbase/,"` ;;
       *) g="$f" ;;
     esac
     echo "$g""$delimiter""$f"
@@ -989,6 +1014,7 @@ func_import ()
       build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
       lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"` ;;
       m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
+      tests/*) g=`echo "$f" | sed -e "s,^tests/,$testsbase/,"` ;;
       *) g="$f" ;;
     esac
     echo "$g""$delimiter""$f"
@@ -1070,6 +1096,7 @@ func_import ()
       build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
       lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"` ;;
       m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
+      tests/*) g=`echo "$f" | sed -e "s,^tests/,$testsbase/,"` ;;
       *) g="$f" ;;
     esac
     func_add_or_update
@@ -1081,6 +1108,7 @@ func_import ()
       build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
       lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"` ;;
       m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
+      tests/*) g=`echo "$f" | sed -e "s,^tests/,$testsbase/,"` ;;
       *) g="$f" ;;
     esac
     func_add_or_update
@@ -1226,6 +1254,11 @@ func_import ()
     echo "# \"Check for header files, types and library functions\"."
     echo "AC_DEFUN([${macro_prefix}_INIT],"
     echo "["
+    if test -z "$libtool"; then
+      echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
+    else
+      echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
+    fi
     for module in $modules; do
       func_verify_module
       if test -n "$module"; then
@@ -1426,6 +1459,11 @@ func_create_testdir ()
        echo "gl_USE_SYSTEM_EXTENSIONS"
        echo
      fi
+     if test -z "$libtool"; then
+       echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
+     else
+       echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
+     fi
      # We don't have explicit ordering constraints between the various
      # autoconf snippets. It's cleanest to put those of the library before
      # those of the tests.
@@ -1485,6 +1523,11 @@ func_create_testdir ()
      echo "gl_USE_SYSTEM_EXTENSIONS"
      echo
    fi
+   if test -z "$libtool"; then
+     echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
+   else
+     echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
+   fi
    for module in $modules; do
      func_verify_nontests_module
      if test -n "$module"; then
@@ -1584,7 +1627,8 @@ case $mode in
     func_all_modules
     ;;
 
-  import )
+  import | update )
+    
     # Where to import.
     if test -z "$destdir"; then
       destdir=.