X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=gnulib-tool;h=493dfa310ec30e51af9b84d1ef9d1a6f96bdd031;hb=b187ff0528e2a081392a834e684d1d0c161708a7;hp=ef2bd46b718497367f6a6f064b6f7cee1b20424e;hpb=dbb3c91f97905f9ef30ca8ea52d5cf2a862e7762;p=gnulib.git diff --git a/gnulib-tool b/gnulib-tool index ef2bd46b7..493dfa310 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -40,6 +40,9 @@ AUTOMAKEPATH= # You can set GETTEXTPATH to empty if autopoint 0.15 is already in your PATH. GETTEXTPATH= +# You can set LIBTOOLPATH to empty if libtoolize 2.x is already in your PATH. +LIBTOOLPATH= + # If you didn't set AUTOCONFPATH and AUTOMAKEPATH, you can also set the # variables AUTOCONF, AUTOHEADER, ACLOCAL, AUTOMAKE, AUTORECONF individually. if test -z "${AUTOCONF}" || test -n "${AUTOCONFPATH}"; then @@ -63,6 +66,11 @@ if test -z "${AUTOPOINT}" || test -n "${GETTEXTPATH}"; then AUTOPOINT="${GETTEXTPATH}autopoint" fi +# If you didn't set LIBTOOLPATH, you can also set the variable LIBTOOLIZE. +if test -z "${LIBTOOLIZE}" || test -n "${LIBTOOLPATH}"; then + LIBTOOLIZE="${LIBTOOLPATH}libtoolize" +fi + # You can set MAKE. if test -z "${MAKE}"; then MAKE=make @@ -181,6 +189,20 @@ General options: --verbose Increase verbosity. May be repeated. --quiet Decrease verbosity. May be repeated. +Options for --import, --update: + --dry-run Only print what would have been done. + +Options for --import, --create-[mega]testdir, --[mega]test: + --with-tests Include unit tests for the included modules. + --with-obsolete Include obsolete modules when they occur among the + dependencies. By default, dependencies to obsolete + modules are ignored. + --avoid=MODULE Avoid including the given MODULE. Useful if you + have code that provides equivalent functionality. + This option can be repeated. + --libtool Use libtool rules. + --no-libtool Don't use libtool rules. + Options for --import: --lib=LIBRARY Specify the library name. Defaults to 'libgnu'. --source-base=DIRECTORY @@ -197,13 +219,6 @@ Options for --import: placed (default \"tests\"). --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build tools are placed (default \"build-aux\"). - --with-tests Include unit tests for the included modules. - --with-obsolete Include obsolete modules when they occur among the - dependencies. By default, dependencies to obsolete - modules are ignored. - --avoid=MODULE Avoid including the given MODULE. Useful if you - have code that provides equivalent functionality. - This option can be repeated. --lgpl[=2|=3] Abort if modules aren't available under the LGPL. Also modify license template from GPL to LGPL. The version number of the LGPL can be specified; @@ -211,8 +226,6 @@ Options for --import: --makefile-name=NAME Name of makefile in automake syntax in the source-base and tests-base directories (default \"Makefile.am\"). - --libtool Use libtool rules. - --no-libtool Don't use libtool rules. --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and 'gl_INIT'. Default is 'gl'. --po-domain=NAME Specify the prefix of the i18n domain. Usually use @@ -222,11 +235,12 @@ Options for --import: (.gitignore and/or .cvsignore). --no-changelog Don't update or create ChangeLog files. -Options for --import and --update: - --dry-run For --import, only print what would have been done. +Options for --import, --update, --create-[mega]testdir, --[mega]test: -s, --symbolic, --symlink Make symbolic links instead of copying files. --local-symlink Make symbolic links instead of copying files, only for files from the local override directory. + +Options for --import, --update: -S, --more-symlinks Make symbolic links instead of copying files, and don't replace copyright notices. @@ -661,39 +675,20 @@ func_ln_if_changed () fi } -# func_reset_sigpipe -# Resets SIGPIPE to its default behaviour. SIGPIPE is signalled when a process -# writes into a pipe with no readers, i.e. a pipe where all readers have -# already closed their file descriptor that read from it or exited entirely. -# The default behaviour is to terminate the current process without an error -# message. -# When "trap '' SIGPIPE" is in effect, the behaviour (at least with bash) is to -# terminate the current process with an error message. -# This function should be called at the beginning of a command that only -# produces output to stdout (i.e. no side effects!), when the command that -# will read from this pipe might prematurely exit or close its standard input -# descriptor. -if test -n "$BASH_VERSION"; then - # The problem has only been reported with bash. Probably it occurs only with - # bash-3.2. For the reasons, see - # . - # Note that Solaris sh does not understand "trap - SIGPIPE". - func_reset_sigpipe () - { - trap - SIGPIPE - } -else - func_reset_sigpipe () - { - : - } -fi - -# Ensure an 'echo' command that does not interpret backslashes. -# Test cases: +# Ensure an 'echo' command that +# 1. does not interpret backslashes and +# 2. does not print an error message "broken pipe" when writing into a pipe +# with no writers. +# +# Test cases for problem 1: # echo '\n' | wc -l prints 1 when OK, 2 when KO # echo '\t' | grep t > /dev/null has return code 0 when OK, 1 when KO -# This problem is a weird heritage from SVR4. BSD got it right (except that +# Test cases for problem 2: +# echo hi | true frequently prints +# "bash: echo: write error: Broken pipe" +# to standard error in bash 3.2. +# +# Problem 1 is a weird heritage from SVR4. BSD got it right (except that # BSD echo interprets '-n' as an option, which is also not desirable). # Nowadays the problem occurs in 4 situations: # - in bash, when the shell option xpg_echo is set (bash >= 2.04) @@ -716,6 +711,12 @@ fi # - otherwise: respawn using /bin/sh and rely on the workarounds. # When respawning, we pass --no-reexec as first argument, so as to avoid # turning this script into a fork bomb in unlucky situations. +# +# Problem 2 is specific to bash 3.2 and affects the 'echo' built-in, but not +# the 'printf' built-in. See +# +# +# The workaround is: define echo to a function that uses the printf built-in. have_echo= if echo '\t' | grep t > /dev/null; then have_echo=yes # Lucky! @@ -740,7 +741,10 @@ fi # For bash >= 2.0: define echo to a function that uses the printf built-in. # For bash < 2.0: define echo to a function that uses cat of a here document. # (There is no win in using 'printf' over 'cat' if it is not a shell built-in.) -if test -z "$have_echo" \ +# Also handle problem 2, specific to bash 3.2, here. +if { test -z "$have_echo" \ + || case "$BASH_VERSION" in 3.2*) true;; *) false;; esac; \ + } \ && test -n "$BASH_VERSION"; then \ if type printf 2>/dev/null | grep / > /dev/null; then # 'printf' is not a shell built-in. @@ -2029,8 +2033,7 @@ func_get_automake_snippet () func_filter_filelist lib_files "$nl" "$all_files" 'lib/' '' 'lib/' '' # Remove $already_mentioned_files from $lib_files. echo "$lib_files" | LC_ALL=C sort -u > "$tmp"/lib-files - extra_files=`func_reset_sigpipe; \ - for f in $already_mentioned_files; do echo $f; done \ + extra_files=`for f in $already_mentioned_files; do echo $f; done \ | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files` if test -n "$extra_files"; then echo "EXTRA_DIST +=" $extra_files @@ -2266,7 +2269,7 @@ func_modules_transitive_closure () handledmodules=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u` # Remove $handledmodules from $inmodules. for m in $inmodules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/queued-modules - inmodules=`func_reset_sigpipe; echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules` + inmodules=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules` done modules=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u` rm -f "$tmp"/queued-modules @@ -2554,6 +2557,7 @@ func_emit_lib_Makefile_am () if test -n "$module"; then { func_get_automake_snippet "$module" | + LC_ALL=C \ sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \ -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \ -e "$sed_eliminate_LDFLAGS" \ @@ -2813,6 +2817,7 @@ func_emit_tests_Makefile_am () if test -n "$module"; then { func_get_automake_snippet "$module" | + LC_ALL=C \ sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \ -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \ -e "$sed_eliminate_LDFLAGS" \ @@ -3354,8 +3359,7 @@ func_import () fi # Determine tests-related module list. echo "$final_modules" | LC_ALL=C sort -u > "$tmp"/final-modules - testsrelated_modules=`func_reset_sigpipe - for module in $main_modules; do + testsrelated_modules=`for module in $main_modules; do if test \`func_get_applicability $module\` = main; then echo $module fi @@ -4082,6 +4086,7 @@ s,//*$,/,' for module in $final_modules; do func_verify_module if test -n "$module"; then + echo "# Code from module $module:" func_get_autoconf_early_snippet "$module" fi done \ @@ -4116,6 +4121,7 @@ s,//*$,/,' for module in $main_modules; do func_verify_module if test -n "$module"; then + echo " # Code from module $module:" func_get_autoconf_snippet "$module" \ | sed -e '/^$/d;' -e 's/^/ /' \ -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \ @@ -4128,6 +4134,7 @@ s,//*$,/,' fi fi done + echo " # End of code from modules" func_emit_initmacro_end $macro_prefix echo " gltests_libdeps=" echo " gltests_ltlibdeps=" @@ -4256,8 +4263,7 @@ s,//*$,/,' if test -f "$destdir/$dir$ignore"; then if test -n "$dir_added" || test -n "$dir_removed"; then sed -e "s|^$anchor||" < "$destdir/$dir$ignore" | LC_ALL=C sort > "$tmp"/ignore - (func_reset_sigpipe - echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u \ + (echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u \ | LC_ALL=C join -v 1 - "$tmp"/ignore > "$tmp"/ignore-added echo "$dir_removed" | sed -e '/^$/d' | LC_ALL=C sort -u \ | LC_ALL=C join -v 1 - "$tmp"/ignore > "$tmp"/ignore-removed @@ -4413,6 +4419,15 @@ s,//*$,/,' # - local_gnulib_dir from --local-dir # - modcache true or false, from --cache-modules/--no-cache-modules # - auxdir directory relative to destdir where to place build aux files +# - inctests true if tests should be included, blank otherwise +# - incobsolete true if obsolete modules among dependencies should be +# included, blank otherwise +# - avoidlist list of modules to avoid +# - libtool true if --libtool was given, false if --no-libtool was +# given, blank otherwise +# - symbolic true if files should be symlinked, copied otherwise +# - lsymbolic true if files from local_gnulib_dir should be symlinked, +# copied otherwise func_create_testdir () { testdir="$1" @@ -4421,8 +4436,9 @@ func_create_testdir () # All modules together. # Except config-h, which breaks all modules which use HAVE_CONFIG_H. # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME. + # Except lib-ignore, which leads to link errors when Sun C++ is used. FIXME. modules=`func_all_modules` - modules=`for m in $modules; do case $m in config-h | ftruncate | mountlist) ;; *) echo $m;; esac; done` + modules=`for m in $modules; do case $m in config-h | ftruncate | mountlist | lib-ignore) ;; *) echo $m;; esac; done` fi modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u` @@ -4638,6 +4654,8 @@ func_create_testdir () done \ | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/' if test "$libtool" = true; then + echo "LT_INIT([win32-dll])" + echo "LT_LANG([C++])" echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])" echo "gl_cond_libtool=true" else @@ -4761,6 +4779,8 @@ func_create_testdir () done \ | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/' if test "$libtool" = true; then + echo "LT_INIT([win32-dll])" + echo "LT_LANG([C++])" echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])" echo "gl_cond_libtool=true" else @@ -4839,6 +4859,9 @@ func_create_testdir () fi done fi + if test "$libtool" = true; then + func_execute_command ${LIBTOOLIZE} --copy || func_exit 1 + fi func_execute_command ${ACLOCAL} -I $m4base || func_exit 1 if ! test -d build-aux; then func_execute_command mkdir build-aux || func_exit 1 @@ -5022,19 +5045,20 @@ s/\([.*$]\)/[\1]/g' do if test -f "$gnulib_dir/$filename" \ || { test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$filename"; }; then - filenameregex='^'`echo "$filename" | sed -e "$sed_literal_to_basic_regex"`'$' + filename_anywhere_regex=`echo "$filename" | sed -e "$sed_literal_to_basic_regex"` + filename_line_regex='^'"$filename_anywhere_regex"'$' module_candidates=` { - (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filenameregex" /dev/null | sed -e 's,^modules/,,') + (cd "$gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_line_regex" /dev/null | sed -e 's,^modules/,,') if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then - (cd "$local_gnulib_dir" && find modules -type f -print | sed -e 's,^modules/,,' -e 's,\.diff$,,') + (cd "$local_gnulib_dir" && find modules -type f -print | xargs -n 100 grep -l "$filename_anywhere_regex" /dev/null | sed -e 's,^modules/,,' -e 's,\.diff$,,') fi } \ | func_sanitize_modulelist \ | LC_ALL=C sort -u ` for module in $module_candidates; do - if func_get_filelist $module | grep "$filenameregex" > /dev/null; then + if func_get_filelist $module | grep "$filename_line_regex" > /dev/null; then echo $module fi done