3 # Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # This program is meant for authors or maintainers which want to import
21 # modules from gnulib into their packages.
25 cvsdatestamp='$Date: 2005-08-31 20:55:19 $'
26 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
27 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
29 # You can set AUTOCONFPATH to empty if autoconf 2.57 is already in your PATH.
33 # AUTOCONFBINDIR=/packages/gnu-inst-autoconf/2.57/bin
34 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
38 AUTORECONF="${AUTOCONFPATH}autoreconf"
41 # outputs to stdout the --help usage message.
45 Usage: gnulib-tool --list
46 gnulib-tool --import [module1 ... moduleN]
47 gnulib-tool --create-testdir --dir=directory module1 ... moduleN
48 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
49 gnulib-tool --test --dir=directory module1 ... moduleN
50 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
51 gnulib-tool --extract-description module
52 gnulib-tool --extract-filelist module
53 gnulib-tool --extract-dependencies module
54 gnulib-tool --extract-autoconf-snippet module
55 gnulib-tool --extract-automake-snippet module
56 gnulib-tool --extract-include-directive module
57 gnulib-tool --extract-license module
58 gnulib-tool --extract-maintainer module
59 gnulib-tool --extract-tests-module module
62 --list print the available module names
63 --import import the given modules into the current package
64 --create-testdir create a scratch package with the given modules
65 --create-megatestdir create a mega scratch package with the given modules
66 one by one and all together
67 --test test the combination of the given modules
68 (recommended to use CC=\"gcc -Wall\" here)
69 --megatest test the given modules one by one and all together
70 (recommended to use CC=\"gcc -Wall\" here)
71 --extract-description extract the description
72 --extract-filelist extract the list of files
73 --extract-dependencies extract the dependencies
74 --extract-autoconf-snippet extract the snippet for configure.ac
75 --extract-automake-snippet extract the snippet for lib/Makefile.am
76 --extract-include-directive extract the #include directive
77 --extract-license report the license terms of the source files
79 --extract-maintainer report the maintainer(s) inside gnulib
80 --extract-tests-module report the unit test module, if it exists
83 --dir=DIRECTORY specify the target directory
84 For --import, this specifies where your
85 configure.ac can be found. Defaults to current
87 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
88 --source-base=DIRECTORY
89 Directory relative --dir where source code is
90 placed (default \"lib\"), for --import.
91 --m4-base=DIRECTORY Directory relative --dir where *.m4 macros are
92 placed (default \"m4\"), for --import.
93 --tests-base=DIRECTORY
94 Directory relative --dir where unit tests are
95 placed (default \"tests\"), for --import.
96 --aux-dir=DIRECTORY Directory relative --dir where auxiliary build
97 tools are placed (default \"build-aux\").
98 --with-tests Include unit tests for the included modules.
99 --avoid=MODULE Avoid including the given MODULE. Useful if you
100 have code that provides equivalent functionality.
101 This option can be repeated.
102 --lgpl Abort if modules aren't available under the LGPL.
103 Also modify license template from GPL to LGPL.
104 --libtool Use libtool rules, for --import.
105 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
106 'gl_INIT'. Default is 'gl'.
107 --no-changelog don't update or create ChangeLog files
108 --dry-run For --import, only print what would have been done.
109 -s, --symbolic, --symlink Make symbolic links instead of copying files.
111 Report bugs to <bug-gnulib@gnu.org>."
115 # outputs to stdout the --version message.
118 echo "$progname (GNU $package) $version"
119 echo "Copyright (C) 2002-2005 Free Software Foundation, Inc.
120 This is free software; see the source for copying conditions. There is NO
121 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
122 echo "Written by" "Bruno Haible" "and" "Simon Josefsson"
125 # func_fatal_error message
126 # outputs to stderr a fatal error message, and terminates the program.
129 echo "gnulib-tool: *** $1" 1>&2
130 echo "gnulib-tool: *** Stop." 1>&2
134 # func_cp_if_changed SRC DEST
135 # Like cp, but avoids munging timestamps if the file hasn't changed.
136 # Uses also the variables
137 # - dry_run true if actions shall only be printed, blank otherwise
138 func_cp_if_changed ()
140 if test $# -ne 2; then
141 echo "usage: func_cp_if_changed SRC DEST" >&2
143 test -n "$dry_run" && dry=echo
144 if cmp "$1" "$2" >/dev/null 2>&1; then
151 # func_mv_if_changed SRC DEST
152 # Like mv, but avoids munging timestamps if the file hasn't changed.
153 # Removes SRC if it is not renamed.
154 # Uses also the variables
155 # - dry_run true if actions shall only be printed, blank otherwise
156 func_mv_if_changed ()
158 if test $# -ne 2; then
159 echo "usage: func_mv_if_changed SRC DEST" >&2
161 test -n "$dry_run" && dry=echo
162 if cmp "$1" "$2" >/dev/null 2>&1; then
169 # func_ln_if_changed SRC DEST
170 # Like ln -s, but avoids munging timestamps if the link is correct.
171 # Uses also the variables
172 # - dry_run true if actions shall only be printed, blank otherwise
173 func_ln_if_changed ()
175 if test $# -ne 2; then
176 echo "usage: func_ln_if_changed SRC DEST" >&2
178 test -n "$dry_run" && dry=echo
179 if test -L "$2" -a "$1" = "`readlink "$2"`"; then
187 # Command-line option processing.
188 # Removes the OPTIONS from the arguments. Sets the variables:
189 # - mode list or import or create-testdir or create-megatestdir
190 # - destdir from --dir
191 # - libname, supplied_libname from --lib
192 # - sourcebase from --source-base
193 # - m4base from --m4-base
194 # - testsbase from --tests-base
195 # - auxdir from --aux-dir
196 # - inctests true if --with-tests was given, blank otherwise
197 # - avoidlist list of modules to avoid, from --avoid
198 # - lgpl true if --lgpl was given, blank otherwise
199 # - libtool true if --libtool was given, blank otherwise
200 # - do_changelog false if --no-changelog was given, : otherwise
201 # - dry_run true if --dry-run was given, blank otherwise
222 while test $# -gt 0; do
227 --import | --impor | --impo | --imp | --im | --i )
230 --create-testdir | --create-testdi | --create-testd | --create-test | --create-tes | --create-te | --create-t )
233 --create-megatestdir | --create-megatestdi | --create-megatestd | --create-megatest | --create-megates | --create-megate | --create-megat | --create-mega | --create-meg | --create-me | --create-m )
234 mode=create-megatestdir
236 --test | --tes | --te | --t )
239 --megatest | --megates | --megate | --megat | --mega | --meg | --me | --m )
243 mode=`echo "X$1" | sed -e 's/^X--//'`
248 func_fatal_error "missing argument for --dir"
253 destdir=`echo "X$1" | sed -e 's/^X--dir=//'`
258 func_fatal_error "missing argument for --lib"
261 supplied_libname=true
264 libname=`echo "X$1" | sed -e 's/^X--lib=//'`
265 supplied_libname=true
270 func_fatal_error "missing argument for --source-base"
275 sourcebase=`echo "X$1" | sed -e 's/^X--source-base=//'`
280 func_fatal_error "missing argument for --m4-base"
285 m4base=`echo "X$1" | sed -e 's/^X--m4-base=//'`
290 func_fatal_error "missing argument for --tests-base"
295 testsbase=`echo "X$1" | sed -e 's/^X--tests-base=//'`
300 func_fatal_error "missing argument for --aux-dir"
305 auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
313 func_fatal_error "missing argument for --avoid"
315 avoidlist="$avoidlist $1"
318 avoidlist="$avoidlist "`echo "X$1" | sed -e 's/^X--avoid=//'`
329 func_fatal_error "missing argument for --macro-prefix"
334 macro_prefix=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
336 --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
342 -s | --symbolic | --symlink )
345 --help | --hel | --he | --h )
348 --version | --versio | --versi | --vers | --ver | --ve | --v )
352 # Stop option prcessing
356 echo "gnulib-tool: unknown option $1" 1>&2
357 echo "Try 'gnulib-tool --help' for more information." 1>&2
366 /*) self_abspathname="$0" ;;
367 */*) self_abspathname=`pwd`/"$0" ;;
368 *) for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`; do
369 if test -x "$d/$0" && test ! -d "$d/$0"; then
370 self_abspathname="$d/$0"
374 if test -z "$self_abspathname"; then
375 func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?"
379 while test -h "$self_abspathname"; do
380 # Resolve symbolic link.
381 sedexpr1='s, -> ,#%%#,'
382 sedexpr2='s,^.*#%%#\(.*\)$,\1,p'
383 linkval=`LC_ALL=C ls -l "$self_abspathname" | sed -e "$sedexpr1" | sed -n -e "$sedexpr2"`
384 test -n "$linkval" || break
386 /* ) self_abspathname="$linkval" ;;
387 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
390 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
395 # Filter out metainformation files like README, which are not modules.
396 # Filter out unit test modules; they can be retrieved through
397 # --extract-tests-module if desired.
398 (cd "$gnulib_dir/modules" && ls -1) \
399 | sed -e '/^CVS$/d' -e '/^ChangeLog$/d' -e '/^README$/d' -e '/^TEMPLATE$/d' -e '/^TEMPLATE-TESTS$/d' -e '/~$/d' \
400 | sed -e '/-tests$/d' \
405 # verifies a module name
406 func_verify_module ()
408 if test ! -f "$gnulib_dir/modules/$module" \
409 || test "CVS" = "$module" \
410 || test "ChangeLog" = "$module" \
411 || test "README" = "$module" \
412 || test "TEMPLATE" = "$module" \
413 || test "TEMPLATE-TESTS" = "$module"; then
414 echo "gnulib-tool: module $module doesn't exist" 1>&2
419 # func_verify_nontests_module
420 # verifies a module name, excluding tests modules
421 func_verify_nontests_module ()
425 * ) func_verify_module ;;
429 # func_verify_tests_module
430 # verifies a module name, considering only tests modules
431 func_verify_tests_module ()
434 *-tests ) func_verify_module ;;
439 sed_extract_prog=':[ ]*$/ {
442 s/^Description:[ ]*$//
444 s/^Depends-on:[ ]*$//
445 s/^configure\.ac:[ ]*$//
446 s/^Makefile\.am:[ ]*$//
449 s/^Maintainer:[ ]*$//
456 # func_get_description module
457 func_get_description ()
459 sed -n -e "/^Description$sed_extract_prog" < "$gnulib_dir/modules/$1"
462 # func_get_filelist module
465 sed -n -e "/^Files$sed_extract_prog" < "$gnulib_dir/modules/$1"
467 echo m4/onceonly_2_57.m4
470 # func_get_dependencies module
471 func_get_dependencies ()
473 # ${module}-tests always implicitly depends on ${module}.
474 echo "$1" | sed -n -e 's/-tests//p'
475 # Then the explicit dependencies listed in the module description.
476 sed -n -e "/^Depends-on$sed_extract_prog" < "$gnulib_dir/modules/$1"
479 # func_get_autoconf_snippet module
480 func_get_autoconf_snippet ()
482 sed -n -e "/^configure\.ac$sed_extract_prog" < "$gnulib_dir/modules/$1"
485 # func_get_automake_snippet module
486 func_get_automake_snippet ()
488 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$gnulib_dir/modules/$1"
491 # func_get_include_directive module
492 func_get_include_directive ()
494 sed -n -e "/^Include$sed_extract_prog" < "$gnulib_dir/modules/$1" | \
495 sed -e 's/^\(["<]\)/#include \1/'
498 # func_get_license module
501 sed -n -e "/^License$sed_extract_prog" < "$gnulib_dir/modules/$1"
504 # func_get_maintainer module
505 func_get_maintainer ()
507 sed -n -e "/^Maintainer$sed_extract_prog" < "$gnulib_dir/modules/$1"
510 # func_get_tests_module module
511 func_get_tests_module ()
513 # The naming convention for tests modules is hardwired: ${module}-tests.
514 if test -f modules/"$1"-tests; then
519 # func_acceptable module
520 # tests whether a module is acceptable.
522 # - avoidlist list of modules to avoid
525 for avoid in $avoidlist; do
526 if test "$avoid" = "$1"; then
533 # func_modules_transitive_closure
535 # - modules list of specified modules
536 # - inctests true if tests should be included, blank otherwise
537 # - avoidlist list of modules to avoid
539 # - modules list of modules, including dependencies
540 func_modules_transitive_closure ()
544 for module in $modules; do
546 if test -n "$module"; then
547 # Duplicate dependencies are harmless, but Jim wants a warning.
548 duplicated_deps=`func_get_dependencies $module | sort | uniq -d`
549 if test -n "$duplicated_deps"; then
550 echo "warning: module $module has duplicated dependencies: "`echo $duplicated_deps` 1>&2
552 if func_acceptable $module; then
553 xmodules="$xmodules $module"
554 for depmodule in `func_get_dependencies $module`; do
555 if func_acceptable $depmodule; then
556 xmodules="$xmodules $depmodule"
559 if test -n "$inctests"; then
560 testsmodule=`func_get_tests_module $module`
561 if test -n "$testsmodule"; then
562 if func_acceptable $testsmodule; then
563 xmodules="$xmodules $testsmodule"
564 for depmodule in `func_get_dependencies $testsmodule`; do
565 if func_acceptable $depmodule; then
566 xmodules="$xmodules $depmodule"
575 xmodules=`for m in $xmodules; do echo $m; done | sort | uniq`
576 if test "$xmodules" = "$modules"; then
583 # func_modules_to_filelist
585 # - modules list of modules, including dependencies
587 # - files list of files
588 func_modules_to_filelist ()
591 for module in $modules; do
593 if test -n "$module"; then
594 files="$files "`func_get_filelist $module`
597 files=`for f in $files; do echo $f; done | sort | uniq`
600 # func_emit_lib_Makefile_am
601 # emits the contents of lib/Makefile.am to standard output.
603 # - modules list of modules, including dependencies
604 # - libname library name
605 # - libtool true if libtool will be used, blank otherwise
606 # - actioncmd (optional) command that will reproduce this invocation
607 func_emit_lib_Makefile_am ()
609 if test -n "$libtool"; then
616 echo "## Process this file with automake to produce Makefile.in."
617 echo "# Copyright (C) 2004 Free Software Foundation, Inc."
619 echo "# This file is free software, distributed under the terms of the GNU"
620 echo "# General Public License. As a special exception to the GNU General"
621 echo "# Public License, this file may be distributed as part of a program"
622 echo "# that contains a configuration script generated by Automake, under"
623 echo "# the same distribution terms as the rest of that program."
625 echo "# Generated by gnulib-tool."
626 if test -n "$actioncmd"; then
627 echo "# Reproduce by: $actioncmd"
630 # No need to generate dependencies since the sources are in gnulib, not here.
631 echo "AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies"
633 echo "noinst_${perhapsLT}LIBRARIES = $libname.$libext"
635 echo "${libname}_${libext}_SOURCES ="
636 echo "${libname}_${libext}_LIBADD = @${perhapsLT}LIBOBJS@"
638 echo "BUILT_SOURCES ="
640 echo "MOSTLYCLEANFILES ="
642 echo "DISTCLEANFILES ="
643 echo "MAINTAINERCLEANFILES ="
645 for module in $modules; do
646 func_verify_nontests_module
647 if test -n "$module"; then
649 func_get_automake_snippet "$module" |
650 sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
651 if test "$module" = 'alloca'; then
652 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
655 # Skip the contents if its entirely empty.
656 if grep '[^ ]' amsnippet.tmp > /dev/null ; then
657 echo "## begin gnulib module $module"
660 echo "## end gnulib module $module"
667 echo "# Makefile.am ends here"
670 # func_emit_tests_Makefile_am
671 # emits the contents of tests/Makefile.am to standard output.
673 # - modules list of modules, including dependencies
674 # - libname library name
675 # - libtool true if libtool will be used, blank otherwise
676 # - sourcebase relative directory containing lib source code
677 func_emit_tests_Makefile_am ()
679 if test -n "$libtool"; then
684 echo "## Process this file with automake to produce Makefile.in."
685 echo "# Copyright (C) 2004-2005 Free Software Foundation, Inc."
687 echo "# This file is free software, distributed under the terms of the GNU"
688 echo "# General Public License. As a special exception to the GNU General"
689 echo "# Public License, this file may be distributed as part of a program"
690 echo "# that contains a configuration script generated by Automake, under"
691 echo "# the same distribution terms as the rest of that program."
693 echo "# Generated by gnulib-tool."
695 # Generate dependencies here, since it eases the debugging of test failures.
696 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
698 echo "ACLOCAL_AMFLAGS = -I ../m4"
701 echo "noinst_PROGRAMS ="
703 echo "BUILT_SOURCES ="
705 echo "MOSTLYCLEANFILES ="
707 echo "DISTCLEANFILES ="
708 echo "MAINTAINERCLEANFILES ="
710 echo "AM_CPPFLAGS = \\"
711 echo " -I. -I\$(srcdir) \\"
712 echo " -I.. -I\$(srcdir)/.. \\"
713 echo " -I../${sourcebase-lib} -I\$(srcdir)/../${sourcebase-lib}"
715 echo "LDADD = ../${sourcebase-lib}/${libname}.${libext}"
717 for module in $modules; do
718 func_verify_tests_module
719 if test -n "$module"; then
720 func_get_automake_snippet "$module" > amsnippet.tmp
721 # Skip the contents if its entirely empty.
722 if grep '[^ ]' amsnippet.tmp > /dev/null ; then
723 echo "## begin gnulib module $module"
726 echo "## end gnulib module $module"
732 echo "# Clean up after Solaris cc."
734 echo " rm -rf SunWS_cache"
736 echo "# Makefile.am ends here"
739 # func_import modules
740 # Uses also the variables
741 # - destdir target directory
742 # - libname library name
743 # - sourcebase directory relative to destdir where to place source code
744 # - m4base directory relative to destdir where to place *.m4 macros
745 # - auxdir directory relative to destdir where to place build aux files
746 # - avoidlist list of modules to avoid, from --avoid
747 # - lgpl true if library's license shall be LGPL, blank otherwise
748 # - libtool true if libtool will be used, blank otherwise
749 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
750 # - dry_run true if actions shall only be printed, blank otherwise
751 # - symbolic true if files should be symlinked, copied otherwise
754 # Get the cached settings.
755 cached_specified_modules=
764 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
770 s,^.*gl_MODULES([[ ]*\([^])]*\).*$,cached_specified_modules="\1",p
773 s,^.*gl_AVOID([[ ]*\([^])]*\).*$,cached_avoidlist="\1",p
776 s,^.*gl_SOURCE_BASE([[ ]*\([^])]*\).*$,cached_sourcebase="\1",p
779 s,^.*gl_M4_BASE([[ ]*\([^])]*\).*$,cached_m4base="\1",p
782 s,^.*gl_LIB([[ ]*\([^])]*\).*$,cached_libname="\1",p
785 s,^.*$,cached_lgpl=true,p
788 s,^.*$,cached_libtool=true,p
791 s,^.*gl_MACRO_PREFIX([[ ]*\([^])]*\).*$,cached_macro_prefix="\1",p
793 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
794 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
799 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
800 s,^.*$,cached_files=",p
812 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
816 # Merge the cached settings with the specified ones.
817 # The m4base must be the same as expected from the pathname.
818 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
819 func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
821 # Append the cached and the specified module names. So that
822 # "gnulib-tool --import foo" means to add the module foo.
823 specified_modules="$cached_specified_modules $1"
824 # Append the cached and the specified avoidlist. This is probably better
825 # than dropping the cached one when --avoid is specified at least once.
826 avoidlist=`echo $cached_avoidlist $avoidlist`
827 # The sourcebase defaults to the cached one.
828 if test -z "$sourcebase"; then
829 sourcebase="$cached_sourcebase"
830 if test -z "$sourcebase"; then
831 func_fatal_error "missing --source-base option"
834 # The libname defaults to the cached one.
835 if test -z "$libname"; then
836 libname="$cached_libname"
837 if test -z "$libname"; then
838 func_fatal_error "missing --lib option"
841 # Require LGPL if specified either way.
842 if test -z "$lgpl"; then
845 # Use libtool if specified either way.
846 if test -z "$libtool"; then
847 libtool="$cached_libtool"
849 # The macro_prefix defaults to the cached one.
850 if test -z "$macro_prefix"; then
851 macro_prefix="$cached_macro_prefix"
852 if test -z "$macro_prefix"; then
853 func_fatal_error "missing --macro-prefix option"
857 # Canonicalize the list of specified modules.
858 specified_modules=`for m in $specified_modules; do echo $m; done | sort | uniq`
860 # Determine final module list.
861 modules="$specified_modules"
862 func_modules_transitive_closure
863 echo "Module list with included dependencies:"
864 echo "$modules" | sed -e 's/^/ /'
866 # If --lgpl, check the license of modules are compatible.
867 if test -n "$lgpl"; then
868 for module in $modules; do
869 license=`func_get_license $module`
871 LGPL | 'public domain' | 'unlimited') ;;
872 *) func_fatal_error "incompatible license on module $module: $license" ;;
877 # Determine final file list.
878 func_modules_to_filelist
880 echo "$files" | sed -e 's/^/ /'
883 || func_fatal_error "refusing to do nothing"
885 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
886 new_files="$files m4/gnulib-tool.m4"
887 old_files="$cached_files"
888 if test -f "$destdir"/$m4base/gnulib-tool.m4; then
889 old_files="$old_files m4/gnulib-tool.m4"
892 # Copy files or make symbolic links. Remove obsolete files.
893 for f1 in $old_files; do
895 build-aux/*) g1=`echo "$f1" | sed -e "s,^build-aux/,$auxdir/,"` ;;
896 lib/*) g1=`echo "$f1" | sed -e "s,^lib/,$cached_sourcebase/,"` ;;
897 m4/*) g1=`echo "$f1" | sed -e "s,^m4/,$cached_m4base/,"` ;;
901 for f2 in $new_files; do
903 build-aux/*) g2=`echo "$f2" | sed -e "s,^build-aux/,$auxdir/,"` ;;
904 lib/*) g2=`echo "$f2" | sed -e "s,^lib/,$sourcebase/,"` ;;
905 m4/*) g2=`echo "$f2" | sed -e "s,^m4/,$m4base/,"` ;;
908 if test "$g2" = "$g1"; then
913 if test -z "$still_present"; then
914 # Remove the file. Do nothing if the user already removed it.
915 if test -f "$destdir/$g1"; then
916 echo "Removing file $g1 (backup in ${g1}~)"
917 test -n "$dry_run" && dry=echo
918 $dry mv -f "$destdir/$g1" "$destdir/${g1}~" || func_fatal_error "failed"
922 for f2 in $new_files; do
924 build-aux/*) g2=`echo "$f2" | sed -e "s,^build-aux/,$auxdir/,"` ;;
925 lib/*) g2=`echo "$f2" | sed -e "s,^lib/,$sourcebase/,"` ;;
926 m4/*) g2=`echo "$f2" | sed -e "s,^m4/,$m4base/,"` ;;
930 for f1 in $old_files; do
932 build-aux/*) g1=`echo "$f1" | sed -e "s,^build-aux/,$auxdir/,"` ;;
933 lib/*) g1=`echo "$f1" | sed -e "s,^lib/,$cached_sourcebase/,"` ;;
934 m4/*) g1=`echo "$f1" | sed -e "s,^m4/,$cached_m4base/,"` ;;
937 if test "$g1" = "$g2"; then
942 cp "$gnulib_dir/$f2" "$destdir/$g2.tmp" || func_fatal_error "failed"
943 if test -n "$lgpl"; then
947 sed -e 's/GNU General/GNU Lesser General/g' \
948 -e 's/version 2\([ ,]\)/version 2.1\1/g' \
949 < "$gnulib_dir/$f2" > "$destdir/$g2.tmp" || func_fatal_error "failed"
953 if test -f "$destdir/$g2"; then
954 # The file already exists.
955 if cmp "$destdir/$g2" "$destdir/$g2.tmp" > /dev/null; then
956 : # The file has not changed.
959 if test -n "$already_present"; then
960 echo "Updating file $g2 (backup in ${g2}~)"
962 echo "Replacing file $g2 (non-gnulib code backuped in ${g2}~) !!"
964 test -n "$dry_run" && dry=echo
965 $dry mv -f "$destdir/$g2" "$destdir/${g2}~" || func_fatal_error "failed"
966 if test -z "$symbolic" && cmp "$gnulib_dir/$f2" "$destdir/$g2.tmp"; then
967 func_ln_if_changed "$gnulib_dir/$f2" "$destdir/$g2"
969 $dry mv -f "$destdir/$g2.tmp" "$destdir/${g2}" || func_fatal_error "failed"
974 # Don't protest if the file should be there but isn't: it happens
975 # frequently that developers don't put autogenerated files into CVS.
976 echo "Copying file $g2"
977 test -n "$dry_run" && dry=echo
978 if test -z "$symbolic" && cmp "$gnulib_dir/$f2" "$destdir/$g2.tmp"; then
979 func_ln_if_changed "$gnulib_dir/$f2" "$destdir/$g2"
981 $dry mv -f "$destdir/$g2.tmp" "$destdir/${g2}" || func_fatal_error "failed"
986 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
987 actioncmd="gnulib-tool --import"
988 actioncmd="$actioncmd --dir=$destdir"
989 actioncmd="$actioncmd --lib=$libname"
990 actioncmd="$actioncmd --source-base=$sourcebase"
991 actioncmd="$actioncmd --m4-base=$m4base"
992 actioncmd="$actioncmd --aux-dir=$auxdir"
993 for module in $avoidlist; do
994 actioncmd="$actioncmd --avoid=$module"
996 if test -n "$lgpl"; then
997 actioncmd="$actioncmd --lgpl"
999 if test -n "$libtool"; then
1000 actioncmd="$actioncmd --libtool"
1002 actioncmd="$actioncmd -macro-prefix=$macro_prefix"
1003 actioncmd="$actioncmd `echo $specified_modules`"
1005 # Create lib/Makefile.am.
1006 if test -z "$dry_run"; then
1007 func_emit_lib_Makefile_am > "$destdir"/$sourcebase/Makefile.am.tmp
1008 if test -f "$destdir"/$sourcebase/Makefile.am; then
1009 if cmp "$destdir"/$sourcebase/Makefile.am "$destdir"/$sourcebase/Makefile.am.tmp > /dev/null; then
1010 rm -f "$destdir"/$sourcebase/Makefile.am.tmp
1012 echo "Updating $sourcebase/Makefile.am (backup in $sourcebase/Makefile.am~)"
1013 mv -f "$destdir"/$sourcebase/Makefile.am "$destdir"/$sourcebase/Makefile.am~
1014 mv -f "$destdir"/$sourcebase/Makefile.am.tmp "$destdir"/$sourcebase/Makefile.am
1017 echo "Creating $sourcebase/Makefile.am"
1018 mv -f "$destdir"/$sourcebase/Makefile.am.tmp "$destdir"/$sourcebase/Makefile.am
1021 echo "Creating $sourcebase/Makefile.am..."
1022 func_emit_lib_Makefile_am
1025 # Create m4/gnulib-cache.m4.
1027 if test -z "$dry_run"; then
1028 exec > "$destdir"/$m4base/gnulib-cache.m4.tmp
1030 echo "Creating $m4base/gnulib-cache.m4..."
1031 echo "# $destdir/$m4base/gnulib-cache.m4"
1033 echo "# Copyright (C) 2004 Free Software Foundation, Inc."
1034 echo "# This file is free software, distributed under the terms of the GNU"
1035 echo "# General Public License. As a special exception to the GNU General"
1036 echo "# Public License, this file may be distributed as part of a program"
1037 echo "# that contains a configuration script generated by Autoconf, under"
1038 echo "# the same distribution terms as the rest of that program."
1040 echo "# Generated by gnulib-tool."
1042 echo "# This file represents the specification of how gnulib-tool is used."
1043 echo "# It acts as a cache: It is written and read by gnulib-tool."
1044 echo "# In projects using CVS, this file is meant to be stored in CVS,"
1045 echo "# like the configure.ac and various Makefile.am files."
1048 echo "# Specification in the form of a command-line invocation:"
1051 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
1052 echo "gl_MODULES(["`echo $specified_modules`"])"
1053 echo "gl_AVOID([$avoidlist])"
1054 echo "gl_SOURCE_BASE([$sourcebase])"
1055 echo "gl_M4_BASE([$m4base])"
1056 echo "gl_LIB([$libname])"
1057 test -z "$lgpl" || echo "gl_LGPL"
1058 test -z "$libtool" || echo "gl_LIBTOOL"
1059 echo "gl_MACRO_PREFIX([$macro_prefix])"
1061 echo "# gnulib-cache.m4 ends here"
1063 if test -z "$dry_run"; then
1064 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
1065 if cmp "$destdir"/$m4base/gnulib-cache.m4 "$destdir"/$m4base/gnulib-cache.m4.tmp > /dev/null; then
1066 rm -f "$destdir"/$m4base/gnulib-cache.m4.tmp
1068 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
1069 mv -f "$destdir"/$m4base/gnulib-cache.m4 "$destdir"/$m4base/gnulib-cache.m4~
1070 mv -f "$destdir"/$m4base/gnulib-cache.m4.tmp "$destdir"/$m4base/gnulib-cache.m4
1073 echo "Creating $m4base/gnulib-cache.m4"
1074 mv -f "$destdir"/$m4base/gnulib-cache.m4.tmp "$destdir"/$m4base/gnulib-cache.m4
1078 # Create m4/gnulib-comp.m4.
1080 if test -z "$dry_run"; then
1081 exec > "$destdir"/$m4base/gnulib-comp.m4.tmp
1083 echo "Creating $m4base/gnulib-comp.m4..."
1084 echo "# $destdir/$m4base/gnulib-comp.m4"
1086 echo "# Copyright (C) 2004 Free Software Foundation, Inc."
1087 echo "# This file is free software, distributed under the terms of the GNU"
1088 echo "# General Public License. As a special exception to the GNU General"
1089 echo "# Public License, this file may be distributed as part of a program"
1090 echo "# that contains a configuration script generated by Autoconf, under"
1091 echo "# the same distribution terms as the rest of that program."
1093 echo "# Generated by gnulib-tool."
1095 echo "# This file represents the compiled summary of the specification in"
1096 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
1097 echo "# to be invoked from configure.ac."
1098 echo "# In projects using CVS, this file can be treated like other built files."
1101 echo "# This macro should be invoked from $configure_ac, in the section"
1102 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
1103 echo "# any checks for libraries, header files, types and library functions."
1104 echo "AC_DEFUN([${macro_prefix}_EARLY],"
1106 if grep AC_GNU_SOURCE "$destdir"/$m4base/*.m4 > /dev/null; then
1107 echo " AC_REQUIRE([AC_GNU_SOURCE])"
1109 if grep gl_USE_SYSTEM_EXTENSIONS "$destdir"/$m4base/*.m4 > /dev/null; then
1110 echo " AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])"
1114 echo "# This macro should be invoked from $configure_ac, in the section"
1115 echo "# \"Check for header files, types and library functions\"."
1116 echo "AC_DEFUN([${macro_prefix}_INIT],"
1118 for module in $modules; do
1120 if test -n "$module"; then
1121 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./'
1122 if test "$module" = 'alloca' && test -n "$libtool"; then
1123 echo 'changequote(,)dnl'
1124 echo 'LTALLOCA=`echo "$ALLOCA" | sed '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
1125 echo 'changequote([, ])dnl'
1126 echo 'AC_SUBST([LTALLOCA])'
1132 echo "# This macro records the list of files which have been installed by"
1133 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
1134 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
1135 echo "$files" | sed -e 's,^, ,'
1138 echo "# gnulib-comp.m4 ends here"
1140 if test -z "$dry_run"; then
1141 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
1142 if cmp "$destdir"/$m4base/gnulib-comp.m4 "$destdir"/$m4base/gnulib-comp.m4.tmp > /dev/null; then
1143 rm -f "$destdir"/$m4base/gnulib-comp.m4.tmp
1145 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
1146 mv -f "$destdir"/$m4base/gnulib-comp.m4 "$destdir"/$m4base/gnulib-comp.m4~
1147 mv -f "$destdir"/$m4base/gnulib-comp.m4.tmp "$destdir"/$m4base/gnulib-comp.m4
1150 echo "Creating $m4base/gnulib-comp.m4"
1151 mv -f "$destdir"/$m4base/gnulib-comp.m4.tmp "$destdir"/$m4base/gnulib-comp.m4
1157 echo "You may need to add #include directives for the following .h files."
1158 for module in $modules; do
1159 func_get_include_directive "$module"
1160 done | LC_ALL=C sort -u | sed -e '/^$/d;' -e 's/^/ /'
1162 echo "Don't forget to"
1163 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
1164 sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
1165 sourcebase_base=`basename "$sourcebase"`
1166 echo " - mention \"${sourcebase_base}\" in SUBDIRS in ${sourcebase_dir}Makefile.am,"
1167 echo " - mention \"-I ${m4base}\" in ACLOCAL_AMFLAGS in Makefile.am,"
1168 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after AC_PROG_CC,"
1169 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
1172 # func_create_testdir testdir modules
1174 # - auxdir directory relative to destdir where to place build aux files
1175 func_create_testdir ()
1179 modules=`for m in $modules; do echo $m; done | sort | uniq`
1181 # Determine final module list.
1182 func_modules_transitive_closure
1183 echo "Module list with included dependencies:"
1184 echo "$modules" | sed -e 's/^/ /'
1186 # Determine final file list.
1187 func_modules_to_filelist
1189 echo "$files" | sed -e 's/^/ /'
1191 # Create directories.
1192 for d in `echo "$files" | sed -n -e 's,^\(.*\)/[^/]*,\1,p'`; do
1193 if test "$d" = build-aux; then
1194 mkdir -p "$testdir/$auxdir"
1196 mkdir -p "$testdir/$d"
1200 # Copy files or make symbolic links.
1203 build-aux/*) g=`echo "$f" | sed -e "s,^build-aux/,$auxdir/,"` ;;
1206 ln "$gnulib_dir/$f" "$testdir/$g" 2>/dev/null ||
1207 if test -z "$symbolic"; then
1208 cp -p "$gnulib_dir/$f" "$testdir/$g"
1210 ln -s "$gnulib_dir/$f" "$testdir/$g"
1214 # Create lib/Makefile.am.
1215 mkdir -p "$testdir/lib"
1216 func_emit_lib_Makefile_am > "$testdir/lib/Makefile.am"
1218 # Create m4/Makefile.am.
1219 mkdir -p "$testdir/m4"
1220 (echo "## Process this file with automake to produce Makefile.in."
1226 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
1229 ) > "$testdir/m4/Makefile.am"
1232 subdirs_with_configure_ac=""
1234 if test -f "$testdir"/m4/gettext.m4; then
1235 # Avoid stupid error message from automake:
1236 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
1237 mkdir -p "$testdir/po"
1238 (echo "## Process this file with automake to produce Makefile.in."
1239 ) > "$testdir/po/Makefile.am"
1240 subdirs="$subdirs po"
1243 if test -n "$inctests"; then
1244 test -d "$testdir/tests" || mkdir "$testdir/tests"
1245 # Create tests/Makefile.am.
1247 func_emit_tests_Makefile_am > "$testdir/tests/Makefile.am"
1248 # Create tests/configure.ac.
1249 (echo "# Process this file with autoconf to produce a configure script."
1250 echo "AC_INIT([dummy], [0])"
1251 echo "AC_CONFIG_AUX_DIR([../$auxdir])"
1252 echo "AM_INIT_AUTOMAKE"
1254 echo "AM_CONFIG_HEADER([config.h])"
1257 echo "AC_PROG_INSTALL"
1258 echo "AC_PROG_MAKE_SET"
1259 echo "AC_PROG_RANLIB"
1261 if grep AC_GNU_SOURCE "$testdir"/m4/*.m4 > /dev/null; then
1262 echo "AC_GNU_SOURCE"
1265 if grep gl_USE_SYSTEM_EXTENSIONS "$testdir"/m4/*.m4 > /dev/null; then
1266 echo "gl_USE_SYSTEM_EXTENSIONS"
1269 # We don't have explicit ordering constraints between the various
1270 # autoconf snippets. It's cleanest to put those of the library before
1271 # those of the tests.
1272 for module in $modules; do
1273 func_verify_nontests_module
1274 if test -n "$module"; then
1275 func_get_autoconf_snippet "$module"
1278 for module in $modules; do
1279 func_verify_tests_module
1280 if test -n "$module"; then
1281 func_get_autoconf_snippet "$module"
1285 # Usually tests/config.h will be a superset of config.h. Verify this by
1286 # "merging" config.h into tests/config.h; look out for gcc warnings.
1287 echo "AH_TOP([#include \"../config.h\"])"
1289 echo "AC_OUTPUT([Makefile])"
1290 ) > "$testdir/tests/configure.ac"
1291 subdirs="$subdirs tests"
1292 subdirs_with_configure_ac="$subdirs_with_configure_ac tests"
1295 # Create Makefile.am.
1296 (echo "## Process this file with automake to produce Makefile.in."
1298 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
1300 echo "SUBDIRS = $subdirs"
1302 echo "ACLOCAL_AMFLAGS = -I m4"
1303 ) > "$testdir/Makefile.am"
1305 # Create configure.ac.
1306 (echo "# Process this file with autoconf to produce a configure script."
1307 echo "AC_INIT([dummy], [0])"
1308 if test "$auxdir" != "."; then
1309 echo "AC_CONFIG_AUX_DIR([$auxdir])"
1311 echo "AM_INIT_AUTOMAKE"
1313 echo "AM_CONFIG_HEADER([config.h])"
1316 echo "AC_PROG_INSTALL"
1317 echo "AC_PROG_MAKE_SET"
1318 echo "AC_PROG_RANLIB"
1320 if grep AC_GNU_SOURCE "$testdir"/m4/*.m4 > /dev/null; then
1321 echo "AC_GNU_SOURCE"
1324 if grep gl_USE_SYSTEM_EXTENSIONS "$testdir"/m4/*.m4 > /dev/null; then
1325 echo "gl_USE_SYSTEM_EXTENSIONS"
1328 for module in $modules; do
1329 func_verify_nontests_module
1330 if test -n "$module"; then
1331 func_get_autoconf_snippet "$module"
1335 if test -n "$subdirs_with_configure_ac"; then
1336 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
1338 makefiles="Makefile"
1339 for d in $subdirs; do
1340 # For subdirs that have a configure.ac by their own, it's the subdir's
1341 # configure.ac which creates the subdir's Makefile.am, not this one.
1342 case " $subdirs_with_configure_ac " in
1344 *) makefiles="$makefiles $d/Makefile" ;;
1347 echo "AC_OUTPUT([$makefiles])"
1348 ) > "$testdir/configure.ac"
1350 # Create autogenerated files.
1352 echo "executing ${AUTORECONF} --force --install"
1353 ${AUTORECONF} --force --install
1355 if grep '^BUILT_SOURCES *+=' "$testdir/lib/Makefile.am" > /dev/null; then
1359 built_sources=`grep '^BUILT_SOURCES *=' Makefile.in | sed -e 's/^BUILT_SOURCES *=//'`
1360 if test -n "$built_sources"; then
1369 # func_create_megatestdir megatestdir allmodules
1371 # - auxdir directory relative to destdir where to place build aux files
1372 func_create_megatestdir ()
1376 if test -z "$allmodules"; then
1377 allmodules=`func_all_modules`
1381 # First, all modules one by one.
1382 for onemodule in $allmodules; do
1383 func_create_testdir "$megatestdir/$onemodule" $onemodule
1384 megasubdirs="${megasubdirs}$onemodule "
1386 # Then, all modules all together.
1387 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
1388 allmodules=`for m in $allmodules; do if test $m != fnmatch-posix; then echo $m; fi; done`
1389 func_create_testdir "$megatestdir/ALL" "$allmodules"
1390 megasubdirs="${megasubdirs}ALL"
1392 # Create Makefile.am.
1393 (echo "## Process this file with automake to produce Makefile.in."
1395 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
1397 echo "SUBDIRS = $megasubdirs"
1398 ) > "$megatestdir/Makefile.am"
1400 # Create configure.ac.
1401 (echo "# Process this file with autoconf to produce a configure script."
1402 echo "AC_INIT([dummy], [0])"
1403 if test "$auxdir" != "."; then
1404 echo "AC_CONFIG_AUX_DIR([$auxdir])"
1406 echo "AM_INIT_AUTOMAKE"
1408 echo "AC_PROG_MAKE_SET"
1410 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
1411 echo "AC_OUTPUT([Makefile])"
1412 ) > "$megatestdir/configure.ac"
1414 # Create autogenerated files.
1416 echo "executing ${AUTORECONF} --install"
1417 ${AUTORECONF} --install
1423 func_fatal_error "no mode specified" ;;
1431 if test -z "$destdir"; then
1434 test -d "$destdir" \
1435 || func_fatal_error "destination directory does not exist: $destdir"
1437 # Prefer configure.ac to configure.in
1438 test -f "$destdir"/configure.in && configure_ac="$destdir/configure.in"
1439 test -f "$destdir"/configure.ac && configure_ac="$destdir/configure.ac"
1440 test -f "$configure_ac" \
1441 || func_fatal_error "cannot find $destdir/configure.ac"
1444 my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
1446 s,^.*gl_MODULES([[ ]*\([^])]*\).*$,cached_modules="\1",; p;
1449 s,^.*gl_AVOID([[ ]*\([^])]*\).*$,cached_avoidlist="\1",; p;
1452 s,^.*gl_SOURCE_BASE([[ ]*\([^])]*\).*$,cached_sourcebase="\1",; p;
1455 s,^.*gl_M4_BASE([[ ]*\([^])]*\).*$,cached_m4base="\1",; p;
1458 s,^.*gl_LIB([[ ]*\([^])]*\).*$,cached_libname="\1",; p;
1460 /AC_CONFIG_AUX_DIR/ {
1461 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^])]*\).*$,ac_auxdir="\1",; p;
1463 /A[CM]_PROG_LIBTOOL/ { s,^.*$,seen_libtool=:,; p; };
1464 /LT_INIT/ { s,^.*$,seen_libtool=:,; p; };
1465 /gl_LGPL/ { s,^.*$,cached_lgpl=true,; p; };
1466 /gl_LIBTOOL/ { s,^.*$,cached_libtool=:,; p; };
1468 s,^.*gl_MACRO_PREFIX([[ ]*\([^])]*\).*$,cached_macro_prefix="\1",; p;
1471 eval `cat $configure_ac | sed "$my_sed_traces"`
1474 if test -z "$supplied_libname" && test -n "$cached_libname"; then
1475 libname="$cached_libname"
1478 # Set up source base.
1479 test -z "$sourcebase" && sourcebase="$cached_sourcebase"
1480 test -z "$sourcebase" && sourcebase="lib"
1481 test -d "$destdir/$sourcebase" \
1482 || { test -z "$dry_run" && mkdir "$destdir/$sourcebase"; } \
1483 || func_fatal_error "source base $destdir/$sourcebase doesn't exist"
1486 test -z "$m4base" && m4base="$cached_m4base"
1487 test -z "$m4base" && m4base="m4"
1488 test -d "$destdir/$m4base" \
1489 || { test -z "$dry_run" && mkdir "$destdir/$m4base"; } \
1490 || func_fatal_error "m4 base $destdir/$m4base doesn't exist"
1492 # Set up auxiliary directory.
1493 test -z "$auxdir" && auxdir="$ac_auxdir"
1494 test -z "$auxdir" && auxdir="build-aux"
1495 test -d "$destdir/$auxdir" \
1496 || { test -z "$dry_run" && mkdir "$destdir/$auxdir"; } \
1497 || func_fatal_error "aux directory $destdir/$auxdir doesn't exist"
1500 if test -n "$cached_lgpl"; then
1505 if test -n "$seen_libtool" || test -n "$cached_libtool"; then
1510 test -z "$macro_prefix" && macro_prefix="$cached_macro_prefix"
1511 test -z "$macro_prefix" && macro_prefix="gl"
1513 # What modules to extract.
1514 if test $# = 0; then
1515 modules="$cached_modules"
1520 # Which modules to avoid?
1521 avoidlist=`echo $avoidlist $cached_avoidlist`
1523 func_import "$modules"
1527 if test -z "$destdir"; then
1528 func_fatal_error "please specify --dir option"
1531 test -d "$destdir" \
1532 || func_fatal_error "could not create destination directory"
1533 test -n "$auxdir" || auxdir="build-aux"
1534 func_create_testdir "$destdir" "$*"
1537 create-megatestdir )
1538 if test -z "$destdir"; then
1539 func_fatal_error "please specify --dir option"
1541 mkdir "$destdir" || func_fatal_error "could not create destination directory"
1542 test -n "$auxdir" || auxdir="build-aux"
1543 func_create_megatestdir "$destdir" "$*"
1547 test -n "$destdir" || destdir=testdir$$
1548 mkdir "$destdir" || func_fatal_error "could not create destination directory"
1549 test -n "$auxdir" || auxdir="build-aux"
1550 func_create_testdir "$destdir" "$*"
1558 remaining=`find . -type f -print`
1559 if test -n "$remaining"; then
1560 echo "Remaining files:" $remaining 1>&2
1561 echo "gnulib-tool: *** Stop." 1>&2
1570 test -n "$destdir" || destdir=testdir$$
1571 mkdir "$destdir" || func_fatal_error "could not create destination directory"
1572 test -n "$auxdir" || auxdir="build-aux"
1573 func_create_megatestdir "$destdir" "$*"
1581 remaining=`find . -type f -print`
1582 if test -n "$remaining"; then
1583 echo "Remaining files:" $remaining 1>&2
1584 echo "gnulib-tool: *** Stop." 1>&2
1592 extract-description )
1596 if test -n "$module"; then
1597 func_get_description "$module"
1606 if test -n "$module"; then
1607 func_get_filelist "$module"
1612 extract-dependencies )
1616 if test -n "$module"; then
1617 func_get_dependencies "$module"
1622 extract-autoconf-snippet )
1626 if test -n "$module"; then
1627 func_get_autoconf_snippet "$module"
1632 extract-automake-snippet )
1636 if test -n "$module"; then
1637 func_get_automake_snippet "$module"
1642 extract-include-directive )
1646 if test -n "$module"; then
1647 func_get_include_directive "$module"
1656 if test -n "$module"; then
1657 func_get_license "$module"
1662 extract-maintainer )
1666 if test -n "$module"; then
1667 func_get_maintainer "$module"
1672 extract-tests-module )
1676 if test -n "$module"; then
1677 func_get_tests_module "$module"
1683 func_fatal_error "unknown operation mode --$mode" ;;