3 # Copyright (C) 2002, 2003, 2004 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 # This program is meant for authors or maintainers which want to import
21 # modules from gnulib into their packages.
25 cvsdatestamp='$Date: 2004-10-15 15:40:45 $'
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
61 --list print the available module names
62 --import import the given modules into the current package
63 --create-testdir create a scratch package with the given modules
64 --create-megatestdir create a mega scratch package with the given modules
65 one by one and all together
66 --test test the combination of the given modules
67 (recommended to use CC=\"gcc -Wall\" here)
68 --megatest test the given modules one by one and all together
69 (recommended to use CC=\"gcc -Wall\" here)
70 --extract-description extract the description
71 --extract-filelist extract the list of files
72 --extract-dependencies extract the dependencies
73 --extract-autoconf-snippet extract the snippet for configure.ac
74 --extract-automake-snippet extract the snippet for lib/Makefile.am
75 --extract-include-directive extract the #include directive
76 --extract-license report the license terms of the source files
78 --extract-maintainer report the maintainer(s) inside gnulib
81 --dir=DIRECTORY specify the target directory
82 For --import, this specifies where your
83 configure.ac can be found. Defaults to current
85 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
86 --source-base=DIRECTORY
87 Directory relative --dir where source code is
88 placed (default \"lib\"), for --import.
89 --m4-base=DIRECTORY Directory relative --dir where *.m4 macros are
90 placed (default \"m4\"), for --import.
91 --lgpl Abort if modules aren't available under the LGPL.
92 Also modify license template from GPL to LGPL.
93 --libtool Use libtool rules, for --import.
94 --no-changelog don't update or create ChangeLog files
95 --dry-run For --import, only print what would have been done.
97 Report bugs to <bug-gnulib@gnu.org>."
101 # outputs to stdout the --version message.
104 echo "$progname (GNU $package) $version"
105 echo "Copyright (C) 2002 Free Software Foundation, Inc.
106 This is free software; see the source for copying conditions. There is NO
107 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
108 echo "Written by" "Bruno Haible"
111 # func_fatal_error message
112 # outputs to stderr a fatal error message, and terminates the program.
115 echo "gnulib-tool: *** $1" 1>&2
116 echo "gnulib-tool: *** Stop." 1>&2
120 # Command-line option processing.
121 # Removes the OPTIONS from the arguments. Sets the variables:
122 # - mode list or import or create-testdir or create-megatestdir
123 # - destdir from --dir
124 # - libname, supplied_libname from --lib
125 # - sourcebase from --source-base
126 # - m4base from --m4-base
127 # - libtool true if --libtool was given, blank otherwise
128 # - lgpl true if --lgpl was given, blank otherwise
129 # - do_changelog false if --no-changelog was given, : otherwise
130 # - dry_run true if --dry-run was given, blank otherwise
146 while test $# -gt 0; do
151 --import | --impor | --impo | --imp | --im | --i )
154 --create-testdir | --create-testdi | --create-testd | --create-test | --create-tes | --create-te | --create-t )
157 --create-megatestdir | --create-megatestdi | --create-megatestd | --create-megatest | --create-megates | --create-megate | --create-megat | --create-mega | --create-meg | --create-me | --create-m )
158 mode=create-megatestdir
160 --test | --tes | --te | --t )
163 --megatest | --megates | --megate | --megat | --mega | --meg | --me | --m )
167 mode=`echo "X$1" | sed -e 's/^X--//'`
172 func_fatal_error "missing argument for --dir"
177 destdir=`echo "X$1" | sed -e 's/^X--dir=//'`
182 func_fatal_error "missing argument for --lib"
185 supplied_libname=true
188 libname=`echo "X$1" | sed -e 's/^X--lib=//'`
189 supplied_libname=true
194 func_fatal_error "missing argument for --source-base"
199 sourcebase=`echo "X$1" | sed -e 's/^X--source-base=//'`
204 func_fatal_error "missing argument for --m4-base"
209 m4base=`echo "X$1" | sed -e 's/^X--m4-base=//'`
217 --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
223 --help | --hel | --he | --h )
226 --version | --versio | --versi | --vers | --ver | --ve | --v )
230 # Stop option prcessing
234 echo "gnulib-tool: unknown option $1" 1>&2
235 echo "Try 'gnulib-tool --help' for more information." 1>&2
244 /*) self_abspathname="$0" ;;
245 */*) self_abspathname=`pwd`/"$0" ;;
246 *) for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`; do
247 if test -x "$d/$0" && test ! -d "$d/$0"; then
248 self_abspathname="$d/$0"
252 if test -z "$self_abspathname"; then
253 func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?"
257 while test -h "$self_abspathname"; do
258 # Resolve symbolic link.
259 sedexpr1='s, -> ,#%%#,'
260 sedexpr2='s,^.*#%%#\(.*\)$,\1,p'
261 linkval=`LC_ALL=C ls -l "$self_abspathname" | sed -e "$sedexpr1" | sed -n -e "$sedexpr2"`
262 test -n "$linkval" || break
264 /* ) self_abspathname="$linkval" ;;
265 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
268 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
273 (cd "$gnulib_dir/modules" && ls -1) \
274 | sed -e '/^CVS$/d' -e '/^ChangeLog$/d' -e '/^README$/d' -e '/^TEMPLATE$/d' -e '/~$/d' \
279 # verifies a module name
280 func_verify_module ()
282 if test ! -f "$gnulib_dir/modules/$module" \
283 || test "CVS" = "$module" \
284 || test "ChangeLog" = "$module" \
285 || test "README" = "$module" \
286 || test "TEMPLATE" = "$module"; then
287 echo "gnulib-tool: module $module doesn't exist" 1>&2
292 sed_extract_prog=':[ ]*$/ {
295 s/^Description:[ ]*$//
297 s/^Depends-on:[ ]*$//
298 s/^configure\.ac:[ ]*$//
299 s/^Makefile\.am:[ ]*$//
302 s/^Maintainer:[ ]*$//
309 # func_get_description module
310 func_get_description ()
312 sed -n -e "/^Description$sed_extract_prog" < "$gnulib_dir/modules/$1"
315 # func_get_filelist module
318 sed -n -e "/^Files$sed_extract_prog" < "$gnulib_dir/modules/$1"
320 echo m4/onceonly_2_57.m4
323 # func_get_dependencies module
324 func_get_dependencies ()
326 sed -n -e "/^Depends-on$sed_extract_prog" < "$gnulib_dir/modules/$1"
329 # func_get_autoconf_snippet module
330 func_get_autoconf_snippet ()
332 sed -n -e "/^configure\.ac$sed_extract_prog" < "$gnulib_dir/modules/$1"
335 # func_get_automake_snippet module
336 func_get_automake_snippet ()
338 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$gnulib_dir/modules/$1"
341 # func_get_include_directive module
342 func_get_include_directive ()
344 sed -n -e "/^Include$sed_extract_prog" < "$gnulib_dir/modules/$1" | \
345 sed -e 's/^\(["<]\)/#include \1/'
348 # func_get_license module
351 sed -n -e "/^License$sed_extract_prog" < "$gnulib_dir/modules/$1"
354 # func_get_maintainer module
355 func_get_maintainer ()
357 sed -n -e "/^Maintainer$sed_extract_prog" < "$gnulib_dir/modules/$1"
360 # func_modules_transitive_closure
362 # - modules list of specified modules
364 # - modules list of modules, including dependencies
365 func_modules_transitive_closure ()
369 for module in $modules; do
371 if test -n "$module"; then
372 # Duplicate dependenies are harmless, but Jim wants a warning.
373 duplicated_deps=`func_get_dependencies $module | sort | uniq -d`
374 if test -n "$duplicated_deps"; then
375 echo "warning: module $module has duplicated dependencies: "`echo $duplicated_deps` 1>&2
377 xmodules="$xmodules $module "`func_get_dependencies $module`
380 xmodules=`for m in $xmodules; do echo $m; done | sort | uniq`
381 if test "$xmodules" = "$modules"; then
388 # func_modules_to_filelist
390 # - modules list of modules, including dependencies
392 # - files list of files
393 func_modules_to_filelist ()
396 for module in $modules; do
398 if test -n "$module"; then
399 files="$files "`func_get_filelist $module`
402 files=`for f in $files; do echo $f; done | sort | uniq`
405 # func_import modules
406 # Uses also the variables
407 # - destdir target directory
408 # - libname library name
409 # - sourcebase directory relative to destdir where to place source code
410 # - m4base directory relative to destdir where to place *.m4 macros
411 # - lgpl true if library's license shall be LGPL, blank otherwise
412 # - dry_run true if actions shall only be printed, blank otherwise
413 # - supplied_opts all options passed to gnulib-tool
417 modules=`for m in $modules; do echo $m; done | sort | uniq`
419 # Determine final module list.
420 func_modules_transitive_closure
421 echo "Module list with included dependencies:"
422 echo "$modules" | sed -e 's/^/ /'
424 # If --lgpl, check the license of modules are compatible.
425 if test -n "$lgpl"; then
426 for module in $modules; do
427 license=`func_get_license $module`
428 if test $license != LGPL; then
429 func_fatal_error "incompatible license on module \`$module\`: $license"
434 # Determine final file list.
435 func_modules_to_filelist
437 echo "$files" | sed -e 's/^/ /'
440 || func_fatal_error "refusing to do nothing"
446 config/*) g=`echo "$f" | sed -e 's,^config/,,'` ;;
447 lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"`; source=true ;;
448 m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;;
451 test -n "$dry_run" && dry=echo
452 $dry cp -p "$gnulib_dir/$f" "$destdir/$g"
454 if test -z "$dry_run" -a -n "$lgpl" -a -n "$source"; then
455 perl -pi -e 's/GNU General/GNU Lesser General/g;' \
456 -e 's/version 2([ ,])/version 2.1\1/g' \
461 # Commands printed in a comment in generated files.
462 cmd="gnulib-tool $supplied_opts"
464 if test -n "$libtool"; then
465 opt_libtool="--libtool"
467 if test -n "$lgpl"; then
470 actioncmd="gnulib-tool --import --dir=$destdir --lib=$libname --source-base=$sourcebase --m4-base=$m4base $opt_libtool $opt_lgpl `echo $modules`"
472 # Create lib/Makefile.am.
473 echo "Creating $destdir/$sourcebase/Makefile.am..."
474 if test -n "$libtool"; then
482 if test -z "$dry_run"; then
483 exec > $destdir/$sourcebase/Makefile.am
485 echo "# $destdir/$sourcebase/Makefile.am"
487 echo "## Process this file with automake to produce Makefile.in."
488 echo "# Copyright (C) 2004 Free Software Foundation, Inc."
490 echo "# This file is free software, distributed under the terms of the GNU"
491 echo "# General Public License. As a special exception to the GNU General"
492 echo "# Public License, this file may be distributed as part of a program"
493 echo "# that contains a configuration script generated by Automake, under"
494 echo "# the same distribution terms as the rest of that program."
496 echo "# Generated by gnulib-tool."
498 echo "# Invoked as: $cmd"
499 echo "# Reproduce by: $actioncmd"
501 echo "AUTOMAKE_OPTIONS = 1.8 gnits"
503 echo "noinst_${perhapsLT}LIBRARIES = $libname.$libext"
505 echo "${libname}_${libext}_SOURCES ="
506 echo "${libname}_${libext}_LIBADD = @${perhapsLT}LIBOBJS@"
508 echo "BUILT_SOURCES ="
510 echo "MOSTLYCLEANFILES ="
512 echo "DISTCLEANFILES ="
513 echo "MAINTAINERCLEANFILES ="
514 for module in $modules; do
516 if test -n "$module"; then
517 func_get_automake_snippet "$module" | sed -e "s,lib_SOURCES,${libname}_${libext}_SOURCES,g" -e "s,lib_OBJECTS,${libname}_${libext}_OBJECTS,g"
518 if test "$module" = 'alloca'; then
519 echo "${libname}_${libext}_LIBADD += @ALLOCA@"
524 echo "# Makefile.am ends here"
528 echo "Creating $destdir/$m4base/gnulib.m4..."
530 if test -z "$dry_run"; then
531 exec > $destdir/$m4base/gnulib.m4
533 echo "# $destdir/$m4base/gnulib.m4"
535 echo "# Copyright (C) 2004 Free Software Foundation, Inc."
536 echo "# This file is free software, distributed under the terms of the GNU"
537 echo "# General Public License. As a special exception to the GNU General"
538 echo "# Public License, this file may be distributed as part of a program"
539 echo "# that contains a configuration script generated by Autoconf, under"
540 echo "# the same distribution terms as the rest of that program."
542 echo "# Generated by gnulib-tool."
544 echo "# Invoked as: $cmd"
545 echo "# Reproduce by: $actioncmd"
547 echo "AC_DEFUN([gl_EARLY],"
549 if grep AC_GNU_SOURCE "$destdir"/$m4base/*.m4 > /dev/null; then
550 echo " AC_GNU_SOURCE"
552 if grep gl_USE_SYSTEM_EXTENSIONS "$destdir"/$m4base/*.m4 > /dev/null; then
553 echo " gl_USE_SYSTEM_EXTENSIONS"
557 echo "AC_DEFUN([gl_INIT],"
559 for module in $modules; do
561 if test -n "$module"; then
562 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./'
567 echo "dnl Usage: gl_MODULES(module1 module2 ...)"
568 echo "AC_DEFUN([gl_MODULES], [])"
570 echo "dnl Usage: gl_SOURCE_BASE(DIR)"
571 echo "AC_DEFUN([gl_SOURCE_BASE], [])"
573 echo "dnl Usage: gl_M4_BASE(DIR)"
574 echo "AC_DEFUN([gl_M4_BASE], [])"
576 echo "dnl Usage: gl_LIB(LIBNAME)"
577 echo "AC_DEFUN([gl_LIB], [])"
579 echo "dnl Usage: gl_LGPL"
580 echo "AC_DEFUN([gl_LGPL], [])"
582 echo "# gnulib.m4 ends here"
586 echo "Don't forget to add \"$sourcebase/Makefile\""
587 echo "to AC_CONFIG_FILES in \"$configure_ac\" and to mention"
588 echo "\"`basename $sourcebase`\" in SUBDIRS in some Makefile.am."
591 # func_create_testdir testdir modules
592 func_create_testdir ()
596 modules=`for m in $modules; do echo $m; done | sort | uniq`
598 # Determine final module list.
599 func_modules_transitive_closure
600 echo "Module list with included dependencies:"
601 echo "$modules" | sed -e 's/^/ /'
603 # Determine final file list.
604 func_modules_to_filelist
606 echo "$files" | sed -e 's/^/ /'
608 # Create directories.
609 for d in `echo "$files" | sed -n -e 's,^\(.*\)/[^/]*,\1,p'`; do
610 if test "$d" != config; then
611 mkdir -p "$testdir/$d"
618 config/*) g=`echo "$f" | sed -e 's,^config/,,'` ;;
621 ln "$gnulib_dir/$f" "$testdir/$g" 2>/dev/null ||
622 cp -p "$gnulib_dir/$f" "$testdir/$g"
625 # Create lib/Makefile.am.
626 mkdir -p "$testdir/lib"
627 (echo "## Process this file with automake to produce Makefile.in."
629 echo "AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies"
631 echo "noinst_LIBRARIES = $libname.a"
633 echo "$libname"'_a_SOURCES ='
634 echo "$libname"'_a_LIBADD = @LIBOBJS@'
635 echo '#'"$libname"'_la_LIBADD = @LTLIBOBJS@'
637 echo "BUILT_SOURCES ="
639 echo "MOSTLYCLEANFILES ="
641 echo "DISTCLEANFILES ="
642 echo "MAINTAINERCLEANFILES ="
643 for module in $modules; do
645 if test -n "$module"; then
646 func_get_automake_snippet "$module" | sed -e "s,lib_SOURCES,$libname"'_a_SOURCES,g' -e "s,lib_OBJECTS,$libname"'_a_OBJECTS,g'
647 if test "$module" = 'alloca'; then
648 echo "$libname"'_a_LIBADD += @ALLOCA@'
649 echo '#'"$libname"'_la_LIBADD += @LTALLOCA@'
653 ) > "$testdir/lib/Makefile.am"
655 # Create m4/Makefile.am.
656 mkdir -p "$testdir/m4"
657 (echo "## Process this file with automake to produce Makefile.in."
663 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
666 ) > "$testdir/m4/Makefile.am"
670 if test -f "$testdir"/m4/gettext.m4; then
671 # Avoid stupid error message from automake:
672 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
673 mkdir -p "$testdir/po"
674 (echo "## Process this file with automake to produce Makefile.in."
675 ) > "$testdir/po/Makefile.am"
676 subdirs="$subdirs po"
679 # Create Makefile.am.
680 (echo "## Process this file with automake to produce Makefile.in."
682 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
684 echo "SUBDIRS = $subdirs"
686 echo "ACLOCAL_AMFLAGS = -I m4"
687 ) > "$testdir/Makefile.am"
689 # Create configure.ac.
690 (echo "# Process this file with autoconf to produce a configure script."
691 echo "AC_INIT(dummy,0)"
692 echo "AM_INIT_AUTOMAKE"
694 echo "AM_CONFIG_HEADER(config.h)"
697 echo "AC_PROG_INSTALL"
698 echo "AC_PROG_MAKE_SET"
699 echo "AC_PROG_RANLIB"
701 if grep AC_GNU_SOURCE "$testdir"/m4/*.m4 > /dev/null; then
705 if grep gl_USE_SYSTEM_EXTENSIONS "$testdir"/m4/*.m4 > /dev/null; then
706 echo "gl_USE_SYSTEM_EXTENSIONS"
709 for module in $modules; do
711 if test -n "$module"; then
712 func_get_autoconf_snippet "$module"
717 for d in $subdirs; do
718 makefiles="$makefiles $d/Makefile"
720 echo "AC_OUTPUT([$makefiles])"
721 ) > "$testdir/configure.ac"
723 # Create autogenerated files.
725 echo "executing ${AUTORECONF} --force --install"
726 ${AUTORECONF} --force --install
728 if grep '^BUILT_SOURCES *+=' "$testdir/lib/Makefile.am" > /dev/null; then
732 built_sources=`grep '^BUILT_SOURCES *=' Makefile.in | sed -e 's/^BUILT_SOURCES *=//'`
733 if test -n "$built_sources"; then
742 # func_create_megatestdir megatestdir allmodules
743 func_create_megatestdir ()
747 if test -z "$allmodules"; then
748 allmodules=`func_all_modules`
752 # First, all modules one by one.
753 for onemodule in $allmodules; do
754 func_create_testdir "$megatestdir/$onemodule" $onemodule
755 megasubdirs="${megasubdirs}$onemodule "
757 # Then, all modules all together.
758 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
759 allmodules=`for m in $allmodules; do if test $m != fnmatch-posix; then echo $m; fi; done`
760 func_create_testdir "$megatestdir/ALL" "$allmodules"
761 megasubdirs="${megasubdirs}ALL"
763 # Create Makefile.am.
764 (echo "## Process this file with automake to produce Makefile.in."
766 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
768 echo "SUBDIRS = $megasubdirs"
769 ) > "$megatestdir/Makefile.am"
771 # Create configure.ac.
772 (echo "# Process this file with autoconf to produce a configure script."
773 echo "AC_INIT(dummy,0)"
774 echo "AM_INIT_AUTOMAKE"
776 echo "AC_PROG_MAKE_SET"
778 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
779 echo "AC_OUTPUT([Makefile])"
780 ) > "$megatestdir/configure.ac"
782 # Create autogenerated files.
784 echo "executing ${AUTORECONF} --force --install"
785 ${AUTORECONF} --force --install
791 func_fatal_error "no mode specified" ;;
799 if test -z "$destdir"; then
803 || func_fatal_error "destination directory does not exist: $destdir"
805 # Prefer configure.ac to configure.in
806 test -f $destdir/configure.in && configure_ac=$destdir/configure.in
807 test -f $destdir/configure.ac && configure_ac=$destdir/configure.ac
808 test -f "$configure_ac" \
809 || func_fatal_error "cannot find $destdir/configure.ac"
812 my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
814 s,^.*gl_MODULES([[ ]*\([^])]*\).*$,ac_modules="\1",; p;
817 s,^.*gl_SOURCE_BASE([[ ]*\([^])]*\).*$,ac_sourcebase="\1",; p;
820 s,^.*gl_M4_BASE([[ ]*\([^])]*\).*$,ac_m4base="\1",; p;
823 s,^.*gl_LIB([[ ]*\([^])]*\).*$,ac_libname="\1",; p;
825 /A[CM]_PROG_LIBTOOL/ { s,^.*$,seen_libtool=:,; p; };
826 /LT_INIT/ { s,^.*$,seen_libtool=:,; p; };
827 /gl_LGPL/ { s,^.*$,lgpl=true,; p; };
829 eval `cat $configure_ac | sed "$my_sed_traces"`
832 if test -z "$supplied_libname" && test -n "$ac_libname"; then
833 libname="$ac_libname"
836 # Set up source base.
837 test -z "$sourcebase" && sourcebase="$ac_sourcebase"
838 test -z "$sourcebase" && sourcebase="lib"
839 test -d "$destdir/$sourcebase" \
840 || (test -z "$dry_run" && mkdir "$destdir/$sourcebase") \
841 || func_fatal_error "source base $destdir/$sourcebase doesn't exist"
844 test -z "$m4base" && m4base="$ac_m4base"
845 test -z "$m4base" && m4base="m4"
846 test -d "$destdir/$m4base" \
847 || (test -z "$dry_run" && mkdir "$destdir/$m4base") \
848 || func_fatal_error "m4 base $destdir/$m4base doesn't exist"
851 if test -n "$seen_libtool"; then
855 # What modules to extract.
857 modules="$ac_modules"
862 func_import "$modules"
866 if test -z "$destdir"; then
867 func_fatal_error "please specify --dir option"
871 || func_fatal_error "could not create destination directory"
872 func_create_testdir "$destdir" "$*"
876 if test -z "$destdir"; then
877 func_fatal_error "please specify --dir option"
879 mkdir "$destdir" || func_fatal_error "could not create destination directory"
880 func_create_megatestdir "$destdir" "$*"
884 test -n "$destdir" || destdir=testdir$$
885 mkdir "$destdir" || func_fatal_error "could not create destination directory"
886 func_create_testdir "$destdir" "$*"
894 remaining=`find . -type f -print`
895 if test -n "$remaining"; then
896 echo "Remaining files:" $remaining 1>&2
897 echo "gnulib-tool: *** Stop." 1>&2
906 test -n "$destdir" || destdir=testdir$$
907 mkdir "$destdir" || func_fatal_error "could not create destination directory"
908 func_create_megatestdir "$destdir" "$*"
916 remaining=`find . -type f -print`
917 if test -n "$remaining"; then
918 echo "Remaining files:" $remaining 1>&2
919 echo "gnulib-tool: *** Stop." 1>&2
927 extract-description )
931 if test -n "$module"; then
932 func_get_description "$module"
941 if test -n "$module"; then
942 func_get_filelist "$module"
947 extract-dependencies )
951 if test -n "$module"; then
952 func_get_dependencies "$module"
957 extract-autoconf-snippet )
961 if test -n "$module"; then
962 func_get_autoconf_snippet "$module"
967 extract-automake-snippet )
971 if test -n "$module"; then
972 func_get_automake_snippet "$module"
977 extract-include-directive )
981 if test -n "$module"; then
982 func_get_include_directive "$module"
991 if test -n "$module"; then
992 func_get_license "$module"
1001 if test -n "$module"; then
1002 func_get_maintainer "$module"
1008 func_fatal_error "unknown operation mode --$mode" ;;