X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=gnulib-tool;h=7cab3ef1de6dd5b86d63dcdaefa25293a184c514;hb=9df4453b386268b137f71b0e9548f67e03565dd4;hp=de45f37259e674d8dd2edf786959cee72b1dafe2;hpb=38b5036f2f36335e7f88dccb8d537abcec267d43;p=gnulib.git diff --git a/gnulib-tool b/gnulib-tool index de45f3725..7cab3ef1d 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -14,7 +14,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # This program is meant for authors or maintainers which want to import @@ -22,7 +22,7 @@ progname=$0 package=gnulib -cvsdatestamp='$Date: 2005-04-15 09:06:26 $' +cvsdatestamp='$Date: 2005-08-11 10:08:57 $' last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'` version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'` @@ -90,12 +90,15 @@ Options: placed (default \"m4\"), for --import. --aux-dir=DIRECTORY Directory relative --dir where auxiliary build tools are placed (default \".\"), for --import. + --avoid=MODULE Avoid including the given MODULE. Useful if you + have code that provides equivalent functionality. + This option can be repeated. --lgpl Abort if modules aren't available under the LGPL. Also modify license template from GPL to LGPL. --libtool Use libtool rules, for --import. --no-changelog don't update or create ChangeLog files --dry-run For --import, only print what would have been done. - --symlink Make symbolic links instead of copying files. + -s, --symbolic, --symlink Make symbolic links instead of copying files. Report bugs to ." } @@ -168,7 +171,7 @@ func_ln_if_changed () if test -L "$2" -a "$1" = "`readlink "$2"`"; then : else - $dry rm "$2" + $dry rm -f "$2" $dry ln -s "$1" "$2" fi } @@ -181,8 +184,9 @@ func_ln_if_changed () # - sourcebase from --source-base # - m4base from --m4-base # - auxdir from --aux-dir -# - libtool true if --libtool was given, blank otherwise +# - avoidlist list of modules to avoid, from --avoid # - lgpl true if --lgpl was given, blank otherwise +# - libtool true if --libtool was given, blank otherwise # - do_changelog false if --no-changelog was given, : otherwise # - dry_run true if --dry-run was given, blank otherwise { @@ -193,12 +197,12 @@ func_ln_if_changed () sourcebase= m4base= auxdir= - libtool= + avoidlist= lgpl= + libtool= do_changelog=: dry_run= - symlink= - lgpl= + symbolic= supplied_opts="$@" @@ -277,20 +281,30 @@ func_ln_if_changed () --aux-dir=* ) auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'` shift ;; - --libtool ) - libtool=true + --avoid ) + shift + if test $# = 0; then + func_fatal_error "missing argument for --avoid" + fi + avoidlist="$avoidlist $1" + shift ;; + --avoid=* ) + avoidlist="$avoidlist "`echo "X$1" | sed -e 's/^X--avoid=//'` shift ;; --lgpl ) lgpl=true shift ;; + --libtool ) + libtool=true + shift ;; --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c ) do_changelog=false shift ;; --dry-run ) dry_run=true shift ;; - --symlink ) - symlink=true + -s | --symbolic | --symlink ) + symbolic=true shift ;; --help | --hel | --he | --h ) func_usage @@ -429,9 +443,24 @@ func_get_maintainer () sed -n -e "/^Maintainer$sed_extract_prog" < "$gnulib_dir/modules/$1" } +# func_acceptable module +# tests whether a module is acceptable. +# Input: +# - avoidlist list of modules to avoid +func_acceptable () +{ + for avoid in $avoidlist; do + if test "$avoid" = "$1"; then + return 1 + fi + done + return 0 +} + # func_modules_transitive_closure # Input: # - modules list of specified modules +# - avoidlist list of modules to avoid # Output: # - modules list of modules, including dependencies func_modules_transitive_closure () @@ -441,12 +470,19 @@ func_modules_transitive_closure () for module in $modules; do func_verify_module if test -n "$module"; then - # Duplicate dependenies are harmless, but Jim wants a warning. + # Duplicate dependencies are harmless, but Jim wants a warning. duplicated_deps=`func_get_dependencies $module | sort | uniq -d` if test -n "$duplicated_deps"; then echo "warning: module $module has duplicated dependencies: "`echo $duplicated_deps` 1>&2 fi - xmodules="$xmodules $module "`func_get_dependencies $module` + if func_acceptable $module; then + xmodules="$xmodules $module" + for depmodule in `func_get_dependencies $module`; do + if func_acceptable $depmodule; then + xmodules="$xmodules $depmodule" + fi + done + fi fi done xmodules=`for m in $xmodules; do echo $m; done | sort | uniq` @@ -554,10 +590,11 @@ func_emit_lib_Makefile_am () # - libname library name # - sourcebase directory relative to destdir where to place source code # - m4base directory relative to destdir where to place *.m4 macros -# - libtool true if libtool will be used, blank otherwise +# - avoidlist list of modules to avoid, from --avoid # - lgpl true if library's license shall be LGPL, blank otherwise +# - libtool true if libtool will be used, blank otherwise # - dry_run true if actions shall only be printed, blank otherwise -# - symlink true if files should be symlinked, copied otherwise +# - symbolic true if files should be symlinked, copied otherwise # - supplied_opts all options passed to gnulib-tool func_import () { @@ -573,9 +610,12 @@ func_import () if test -n "$lgpl"; then for module in $modules; do license=`func_get_license $module` - if test $license != LGPL; then - func_fatal_error "incompatible license on module \`$module\`: $license" - fi + case $license in + LGPL | 'public domain') ;; + *) + func_fatal_error \ + "incompatible license on module \`$module\`: $license" ;; + esac done fi @@ -596,7 +636,7 @@ func_import () m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;; *) g="$f" ;; esac - if test -z "$symlink"; then + if test -z "$symbolic"; then func_cp_if_changed "$gnulib_dir/$f" "$destdir/$g" else func_ln_if_changed "$gnulib_dir/$f" "$destdir/$g" @@ -680,6 +720,9 @@ func_import () echo "dnl Usage: gl_MODULES(module1 module2 ...)" echo "AC_DEFUN([gl_MODULES], [])" echo + echo "dnl Usage: gl_AVOID(module1 module2 ...)" + echo "AC_DEFUN([gl_AVOID], [])" + echo echo "dnl Usage: gl_SOURCE_BASE(DIR)" echo "AC_DEFUN([gl_SOURCE_BASE], [])" echo @@ -699,8 +742,8 @@ func_import () echo echo "You may need to add #include directives for the following .h files." for module in $modules; do - func_get_include_directive "$module" | sed -e '/^$/d;' -e 's/^/ /' - done + func_get_include_directive "$module" + done | LC_ALL=C sort -u | sed -e '/^$/d;' -e 's/^/ /' echo echo "Don't forget to add \"$sourcebase/Makefile\"" echo "to AC_CONFIG_FILES in \"$configure_ac\" and to mention" @@ -740,7 +783,7 @@ func_create_testdir () *) g="$f" ;; esac ln "$gnulib_dir/$f" "$testdir/$g" 2>/dev/null || - if test -z "$symlink"; then + if test -z "$symbolic"; then cp -p "$gnulib_dir/$f" "$testdir/$g" else ln -s "$gnulib_dir/$f" "$testdir/$g" @@ -912,6 +955,9 @@ case $mode in /gl_MODULES[^_]/ { s,^.*gl_MODULES([[ ]*\([^])]*\).*$,ac_modules="\1",; p; }; + /gl_AVOID[^_]/ { + s,^.*gl_AVOID([[ ]*\([^])]*\).*$,ac_avoidlist="\1",; p; + }; /gl_SOURCE_BASE/ { s,^.*gl_SOURCE_BASE([[ ]*\([^])]*\).*$,ac_sourcebase="\1",; p; }; @@ -968,6 +1014,9 @@ case $mode in modules="$*" fi + # Which modules to avoid? + avoidlist="$avoidlist $ac_avoidlist" + func_import "$modules" ;;