X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=gnulib-tool;h=79a8af5452de0279abc7ff124b9f5e37cc89eaa5;hb=901462b016c595449586550662511ac858661f4d;hp=32a18d0d92d645becb6e8fead4edc33fa66825c0;hpb=4f282711dfa378f35d88e3f2496aa80a2f89e360;p=gnulib.git diff --git a/gnulib-tool b/gnulib-tool index 32a18d0d9..79a8af545 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -22,7 +22,7 @@ progname=$0 package=gnulib -cvsdatestamp='$Date: 2006-05-09 02:38:16 $' +cvsdatestamp='$Date: 2006-07-15 23:07:01 $' last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'` version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'` @@ -101,33 +101,35 @@ Operation modes: --extract-tests-module report the unit test module, if it exists Options: - --dir=DIRECTORY specify the target directory - For --import, this specifies where your - configure.ac can be found. Defaults to current - directory. - --lib=LIBRARY Specify the library name. Defaults to 'libgnu'. - --source-base=DIRECTORY - Directory relative --dir where source code is - placed (default \"lib\"), for --import. - --m4-base=DIRECTORY Directory relative --dir where *.m4 macros are - placed (default \"m4\"), for --import. - --tests-base=DIRECTORY - Directory relative --dir where unit tests are - placed (default \"tests\"), for --import. - --aux-dir=DIRECTORY Directory relative --dir where auxiliary build - tools are placed (default \"build-aux\"). - --with-tests Include unit tests for the included modules. --avoid=MODULE Avoid including the given MODULE. Useful if you have code that provides equivalent functionality. This option can be repeated. + --dry-run For --import, only print what would have been done. --lgpl Abort if modules aren't available under the LGPL. Also modify license template from GPL to LGPL. + --lib=LIBRARY Specify the library name. Defaults to 'libgnu'. --libtool Use libtool rules, for --import. - --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and - 'gl_INIT'. Default is 'gl'. + --macro-prefix=PREFIX Specify the prefix of the macros gl_EARLY and + gl_INIT. Default is "gl". --no-changelog don't update or create ChangeLog files - --dry-run For --import, only print what would have been done. -s, --symbolic, --symlink Make symbolic links instead of copying files. + --with-tests Include unit tests for the included modules. + +Directory options: + --dir=DIRECTORY specify the target directory + For --import, this specifies where your + configure.ac can be found. Defaults to current + directory. + --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build + tools are placed (default \"build-aux\"). + --doc-base=DIRECTORY Directory relative to --dir where doc files are + placed (default \"doc\"), for --import. + --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are + placed (default \"m4\"), for --import. + --source-base=DIRECTORY Directory relative to --dir where source code is + placed (default \"lib\"), for --import. + --tests-base=DIRECTORY Directory relative to --dir where unit tests are + placed (default \"tests\"), for --import. Report bugs to ." } @@ -238,6 +240,7 @@ func_ln_if_changed () # - libname, supplied_libname from --lib # - sourcebase from --source-base # - m4base from --m4-base +# - docbase from --doc-base # - testsbase from --tests-base # - auxdir from --aux-dir # - inctests true if --with-tests was given, blank otherwise @@ -253,6 +256,7 @@ func_ln_if_changed () supplied_libname= sourcebase= m4base= + docbase= testsbase= auxdir= inctests= @@ -334,6 +338,16 @@ func_ln_if_changed () --m4-base=* ) m4base=`echo "X$1" | sed -e 's/^X--m4-base=//'` shift ;; + --doc-base ) + shift + if test $# = 0; then + func_fatal_error "missing argument for --doc-base" + fi + docbase=$1 + shift ;; + --doc-base=* ) + docbase=`echo "X$1" | sed -e 's/^X--doc-base=//'` + shift ;; --tests-base ) shift if test $# = 0; then @@ -421,6 +435,7 @@ func_ln_if_changed () fi if test -n "$supplied_libname" || test -n "$sourcebase" || test -n "$m4base" \ || test -n "$testsbase" || test -n "$auxdir" || test -n "$inctests" \ + || test -n "$docbase" \ || 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 @@ -440,6 +455,9 @@ func_ln_if_changed () case "$m4base" in */ ) m4base=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;; esac + case "$docbase" in + */ ) docbase=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;; + esac case "$testsbase" in */ ) testsbase=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;; esac @@ -520,17 +538,17 @@ func_verify_tests_module () esac } -sed_extract_prog=':[ ]*$/ { +sed_extract_prog=':[ ]*$/ { :a n - s/^Description:[ ]*$// - s/^Files:[ ]*$// - s/^Depends-on:[ ]*$// - s/^configure\.ac:[ ]*$// - s/^Makefile\.am:[ ]*$// - s/^Include:[ ]*$// - s/^License:[ ]*$// - s/^Maintainer:[ ]*$// + s/^Description:[ ]*$// + s/^Files:[ ]*$// + s/^Depends-on:[ ]*$// + s/^configure\.ac:[ ]*$// + s/^Makefile\.am:[ ]*$// + s/^Include:[ ]*$// + s/^License:[ ]*$// + s/^Maintainer:[ ]*$// tb p ba @@ -548,7 +566,7 @@ func_get_filelist () { sed -n -e "/^Files$sed_extract_prog" < "$gnulib_dir/modules/$1" #echo m4/onceonly.m4 - echo m4/onceonly_2_57.m4 + #echo m4/onceonly_2_57.m4 } # func_get_dependencies module @@ -683,7 +701,7 @@ ba func_verify_nontests_module if test -n "$module"; then # Extract the value of "lib_SOURCES += ...". - for file in `func_get_automake_snippet "$module" | sed -e "$sed_remove_backslash_newline" | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do + for file in `func_get_automake_snippet "$module" | sed -e "$sed_remove_backslash_newline" | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do # Ignore .h files since they are not compiled. case "$file" in *.h) ;; @@ -749,6 +767,7 @@ func_emit_lib_Makefile_am () echo "BUILT_SOURCES =" echo "SUFFIXES =" echo "MOSTLYCLEANFILES =" + echo "MOSTLYCLEANDIRS =" echo "CLEANFILES =" echo "DISTCLEANFILES =" echo "MAINTAINERCLEANFILES =" @@ -766,7 +785,7 @@ func_emit_lib_Makefile_am () fi } > amsnippet.tmp # Skip the contents if its entirely empty. - if grep '[^ ]' amsnippet.tmp > /dev/null ; then + if grep '[^ ]' amsnippet.tmp > /dev/null ; then echo "## begin gnulib module $module" echo cat amsnippet.tmp @@ -777,6 +796,14 @@ func_emit_lib_Makefile_am () fi done echo + echo "mostlyclean-local:" + echo " @test -z \"\$(MOSTLYCLEANDIRS)\" || \\" + echo " for dir in \$(MOSTLYCLEANDIRS); do \\" + echo " if test -d \$\$dir; then \\" + echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\" + echo " fi; \\" + echo " done" + echo echo "# Makefile.am ends here" } @@ -818,6 +845,7 @@ func_emit_tests_Makefile_am () echo "BUILT_SOURCES =" echo "SUFFIXES =" echo "MOSTLYCLEANFILES =" + echo "MOSTLYCLEANDIRS =" echo "CLEANFILES =" echo "DISTCLEANFILES =" echo "MAINTAINERCLEANFILES =" @@ -834,7 +862,7 @@ func_emit_tests_Makefile_am () if test -n "$module"; then func_get_automake_snippet "$module" > amsnippet.tmp # Skip the contents if its entirely empty. - if grep '[^ ]' amsnippet.tmp > /dev/null ; then + if grep '[^ ]' amsnippet.tmp > /dev/null ; then echo "## begin gnulib module $module" echo cat amsnippet.tmp @@ -848,6 +876,14 @@ func_emit_tests_Makefile_am () echo "clean-local:" echo " rm -rf SunWS_cache" echo + echo "mostlyclean-local:" + echo " @test -z \"\$(MOSTLYCLEANDIRS)\" || \\" + echo " for dir in \$(MOSTLYCLEANDIRS); do \\" + echo " if test -d \$\$dir; then \\" + echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\" + echo " fi; \\" + echo " done" + echo echo "# Makefile.am ends here" } @@ -857,6 +893,7 @@ func_emit_tests_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 +# - docbase directory relative to destdir where to place doc files # - testsbase directory relative to destdir where to place unit test code # - auxdir directory relative to destdir where to place build aux files # - inctests true if --with-tests was given, blank otherwise @@ -874,6 +911,7 @@ func_import () cached_avoidlist= cached_sourcebase= cached_m4base= + cached_docbase= cached_testsbase= cached_libname= cached_lgpl= @@ -897,6 +935,9 @@ func_import () /gl_M4_BASE(/ { s,^.*gl_M4_BASE([[ ]*\([^])]*\).*$,cached_m4base="\1",p } + /gl_DOC_BASE(/ { + s,^.*gl_DOC_BASE([[ ]*\([^])]*\).*$,cached_docbase="\1",p + } /gl_TESTS_BASE(/ { s,^.*gl_TESTS_BASE([[ ]*\([^])]*\).*$,cached_testsbase="\1",p } @@ -953,6 +994,13 @@ func_import () func_fatal_error "missing --source-base option" fi fi + # The docbase defaults to the cached one. + if test -z "$docbase"; then + docbase="$cached_docbase" + if test -z "$docbase"; then + func_fatal_error "missing --doc-base option" + fi + fi # The testsbase defaults to the cached one. if test -z "$testsbase"; then testsbase="$cached_testsbase" @@ -1042,6 +1090,14 @@ func_import () echo "Create directory $destdir/$m4base" fi fi + if test ! -d "$destdir/$docbase"; then + if $doit; then + echo "Creating directory $destdir/$docbase" + mkdir "$destdir/$docbase" || func_fatal_error "failed" + else + echo "Create directory $destdir/$docbase" + fi + fi if test -n "$inctests"; then if test ! -d "$destdir/$testsbase"; then if $doit; then @@ -1085,6 +1141,7 @@ func_import () for f in $old_files; do case "$f" in build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;; + doc/*) g=`echo "$f" | sed -e "s,^doc/,$cached_docbase/,"` ;; 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/,"` ;; @@ -1095,6 +1152,7 @@ func_import () for f in $new_files; do case "$f" in build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;; + doc/*) g=`echo "$f" | sed -e "s,^doc/,$docbase/,"` ;; 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/,"` ;; @@ -1180,6 +1238,7 @@ func_import () for f in `LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_last_column"`; do case "$f" in build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;; + doc/*) g=`echo "$f" | sed -e "s,^doc/,$docbase/,"` ;; 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/,"` ;; @@ -1192,6 +1251,7 @@ func_import () for f in `LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_last_column"`; do case "$f" in build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;; + doc/*) g=`echo "$f" | sed -e "s,^doc/,$docbase/,"` ;; 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/,"` ;; @@ -1206,6 +1266,7 @@ func_import () actioncmd="$actioncmd --lib=$libname" actioncmd="$actioncmd --source-base=$sourcebase" actioncmd="$actioncmd --m4-base=$m4base" + actioncmd="$actioncmd --doc-base=$docbase" actioncmd="$actioncmd --aux-dir=$auxdir" for module in $avoidlist; do actioncmd="$actioncmd --avoid=$module" @@ -1264,6 +1325,7 @@ func_import () echo "gl_AVOID([$avoidlist])" echo "gl_SOURCE_BASE([$sourcebase])" echo "gl_M4_BASE([$m4base])" + echo "gl_DOC_BASE([$docbase])" echo "gl_TESTS_BASE([$testsbase])" echo "gl_LIB([$libname])" test -z "$lgpl" || echo "gl_LGPL" @@ -1795,7 +1857,7 @@ case $mode in ;; import | update ) - + # Where to import. if test -z "$destdir"; then destdir=. @@ -1844,6 +1906,7 @@ case $mode in # First use of gnulib in the given m4base. test -n "$supplied_libname" || supplied_libname=true test -n "$sourcebase" || sourcebase="lib" + test -n "$docbase" || docbase="doc" test -n "$testsbase" || testsbase="tests" test -n "$macro_prefix" || macro_prefix="gl" fi @@ -1853,7 +1916,7 @@ case $mode in # To get this list of directories, look at Makefile.am. (Not at # configure, because it may be omitted from CVS. Also, don't run # "find $destdir -name gnulib-cache.m4", as it might be too expensive.) - aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[ ]*=' "$destdir"/Makefile.am | sed -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/'` + aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[ ]*=' "$destdir"/Makefile.am | sed -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/'` m4dirs= m4dirs_count=0 m4dir_is_next= @@ -1883,6 +1946,7 @@ case $mode in test -n "$supplied_libname" || supplied_libname=true test -n "$sourcebase" || sourcebase="lib" m4base="m4" + test -n "$docbase" || docbase="doc" test -n "$testsbase" || testsbase="tests" test -n "$macro_prefix" || macro_prefix="gl" func_import "$*"