3 # Copyright (C) 2002-2006 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 Foundation,
17 # 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: 2006-11-13 12:34:33 $'
26 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
27 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
31 # You can set AUTOCONFPATH to empty if autoconf 2.57 is already in your PATH.
35 # AUTOCONFBINDIR=/packages/gnu-inst-autoconf/2.57/bin
36 # AUTOCONFPATH="eval env PATH=${AUTOCONFBINDIR}:\$PATH "
40 # You can set AUTOMAKEPATH to empty if automake 1.9.x is already in your PATH.
43 # You can set GETTEXTPATH to empty if autopoint 0.15 is already in your PATH.
46 # If you didn't set AUTOCONFPATH and AUTOMAKEPATH, you can also set the
47 # variables AUTOCONF, AUTOHEADER, ACLOCAL, AUTOMAKE, AUTORECONF individually.
48 if test -z "${AUTOCONF}" || test -n "${AUTOCONFPATH}"; then
49 AUTOCONF="${AUTOCONFPATH}autoconf"
51 if test -z "${AUTOHEADER}" || test -n "${AUTOCONFPATH}"; then
52 AUTOHEADER="${AUTOCONFPATH}autoheader"
54 if test -z "${ACLOCAL}" || test -n "${AUTOMAKEPATH}"; then
55 ACLOCAL="${AUTOMAKEPATH}aclocal"
57 if test -z "${AUTOMAKE}" || test -n "${AUTOMAKEPATH}"; then
58 AUTOMAKE="${AUTOMAKEPATH}automake"
60 if test -z "${AUTORECONF}" || test -n "${AUTOCONFPATH}"; then
61 AUTORECONF="${AUTOCONFPATH}autoreconf"
64 # If you didn't set GETTEXTPATH, you can also set the variable AUTOPOINT.
65 if test -z "${AUTOPOINT}" || test -n "${GETTEXTPATH}"; then
66 AUTOPOINT="${GETTEXTPATH}autopoint"
69 # GNU sort is needed. Set SORT to its location (not needed if it's called
70 # 'sort' and already in the PATH).
71 if test -z "$SORT"; then
76 # outputs to stdout the --help usage message.
80 Usage: gnulib-tool --list
81 gnulib-tool --import [module1 ... moduleN]
83 gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
84 gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
85 gnulib-tool --test --dir=directory module1 ... moduleN
86 gnulib-tool --megatest --dir=directory [module1 ... moduleN]
87 gnulib-tool --extract-description module
88 gnulib-tool --extract-filelist module
89 gnulib-tool --extract-dependencies module
90 gnulib-tool --extract-autoconf-snippet module
91 gnulib-tool --extract-automake-snippet module
92 gnulib-tool --extract-include-directive module
93 gnulib-tool --extract-license module
94 gnulib-tool --extract-maintainer module
95 gnulib-tool --extract-tests-module module
98 --list print the available module names
99 --import import the given modules into the current package;
100 if no modules are specified, update the current
101 package from the current gnulib
102 --update update the current package, restore files omitted
104 --create-testdir create a scratch package with the given modules
105 --create-megatestdir create a mega scratch package with the given modules
106 one by one and all together
107 --test test the combination of the given modules
108 (recommended to use CC=\"gcc -Wall\" here)
109 --megatest test the given modules one by one and all together
110 (recommended to use CC=\"gcc -Wall\" here)
111 --extract-description extract the description
112 --extract-filelist extract the list of files
113 --extract-dependencies extract the dependencies
114 --extract-autoconf-snippet extract the snippet for configure.ac
115 --extract-automake-snippet extract the snippet for library makefile
116 --extract-include-directive extract the #include directive
117 --extract-license report the license terms of the source files
119 --extract-maintainer report the maintainer(s) inside gnulib
120 --extract-tests-module report the unit test module, if it exists
123 --dir=DIRECTORY Specify the target directory.
124 For --import, this specifies where your
125 configure.ac can be found. Defaults to current
127 --local-dir=DIRECTORY Specify a local override directory where to look
128 up files before looking in gnulib's directory.
130 Options for --import:
131 --lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
132 --source-base=DIRECTORY
133 Directory relative to --dir where source code is
134 placed (default \"lib\").
135 --m4-base=DIRECTORY Directory relative to --dir where *.m4 macros are
136 placed (default \"m4\").
137 --doc-base=DIRECTORY Directory relative to --dir where doc files are
138 placed (default \"doc\").
139 --tests-base=DIRECTORY
140 Directory relative to --dir where unit tests are
141 placed (default \"tests\").
142 --aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
143 tools are placed (default \"build-aux\").
144 --with-tests Include unit tests for the included modules.
145 --avoid=MODULE Avoid including the given MODULE. Useful if you
146 have code that provides equivalent functionality.
147 This option can be repeated.
148 --lgpl Abort if modules aren't available under the LGPL.
149 Also modify license template from GPL to LGPL.
150 --makefile-name=NAME Name of makefile in automake syntax in the
151 source-base and tests-base directories
152 (default \"Makefile.am\").
153 --libtool Use libtool rules.
154 --no-libtool Don't use libtool rules.
155 --macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
156 'gl_INIT'. Default is 'gl'.
157 --no-changelog don't update or create ChangeLog files
159 Options for --import and --update:
160 --dry-run For --import, only print what would have been done.
161 -s, --symbolic, --symlink Make symbolic links instead of copying files.
163 Report bugs to <bug-gnulib@gnu.org>."
167 # outputs to stdout the --version message.
170 year=`echo "$last_checkin_date" | sed -e 's,/.*$,,'`
172 $progname (GNU $package) $version
173 Copyright (C) $year Free Software Foundation, Inc.
174 This is free software; see the source for copying conditions. There is NO
175 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
176 Written by" "Bruno Haible" "and" "Simon Josefsson"
179 # func_emit_copyright_notice
180 # outputs to stdout a header for a generated file.
181 func_emit_copyright_notice ()
183 echo "# Copyright (C) 2004-2006 Free Software Foundation, Inc."
185 echo "# This file is free software, distributed under the terms of the GNU"
186 echo "# General Public License. As a special exception to the GNU General"
187 echo "# Public License, this file may be distributed as part of a program"
188 echo "# that contains a configuration script generated by Autoconf, under"
189 echo "# the same distribution terms as the rest of that program."
191 echo "# Generated by gnulib-tool."
202 # creates a temporary directory.
204 # - tmp pathname of freshly created temporary directory
207 # Use the environment variable TMPDIR, falling back to /tmp. This allows
208 # users to specify a different temporary directory, for example, if their
209 # /tmp is filled up or too small.
212 # Use the mktemp program if available. If not available, hide the error
214 tmp=`(umask 077 && mktemp -d "$TMPDIR/glXXXXXX") 2>/dev/null` &&
215 test -n "$tmp" && test -d "$tmp"
218 # Use a simple mkdir command. It is guaranteed to fail if the directory
219 # already exists. $RANDOM is bash specific and expands to empty in shells
220 # other than bash, ksh and zsh. Its use does not increase security;
221 # rather, it minimizes the probability of failure in a very cluttered /tmp
223 tmp=$TMPDIR/gl$$-$RANDOM
224 (umask 077 && mkdir "$tmp")
227 echo "$0: cannot create a temporary directory in $TMPDIR" >&2
232 # func_append var value
233 # appends the given value to the shell variable var.
234 if ( foo=bar; foo+=baz && test "$foo" = barbaz ) >/dev/null 2>&1; then
235 # Use bash's += operator. It reduces complexity of appending repeatedly to
236 # a single variable from O(n^2) to O(n).
244 eval "$1=\"\$$1\$2\""
248 # func_fatal_error message
249 # outputs to stderr a fatal error message, and terminates the program.
252 echo "gnulib-tool: *** $1" 1>&2
253 echo "gnulib-tool: *** Stop." 1>&2
257 # func_readlink SYMLINK
258 # outputs the target of the given symlink.
259 if (type -p readlink) > /dev/null 2>&1; then
262 # Use the readlink program from GNU coreutils.
268 # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
269 # would do the wrong thing if the link target contains " -> ".
270 LC_ALL=C ls -l "$1" | sed -e 's, -> ,#%%#,' | sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
274 # func_relativize DIR1 DIR2
275 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
277 # - DIR1 relative pathname, relative to the current directory
278 # - DIR2 relative pathname, relative to the current directory
280 # - reldir relative pathname of DIR2, relative to DIR1
286 sed_first='s,^\([^/]*\)/.*$,\1,'
287 sed_rest='s,^[^/]*/*,,'
288 sed_last='s,^.*/\([^/]*\)$,\1,'
289 sed_butlast='s,/*[^/]*$,,'
290 while test -n "$dir1"; do
291 first=`echo "$dir1" | sed -e "$sed_first"`
292 if test "$first" != "."; then
293 if test "$first" = ".."; then
294 dir2=`echo "$dir0" | sed -e "$sed_last"`/"$dir2"
295 dir0=`echo "$dir0" | sed -e "$sed_butlast"`
297 first2=`echo "$dir2" | sed -e "$sed_first"`
298 if test "$first2" = "$first"; then
299 dir2=`echo "$dir2" | sed -e "$sed_rest"`
303 dir0="$dir0"/"$first"
306 dir1=`echo "$dir1" | sed -e "$sed_rest"`
311 # func_relconcat DIR1 DIR2
312 # computes a relative pathname DIR1/DIR2, with obvious simplifications.
314 # - DIR1 relative pathname, relative to the current directory
315 # - DIR2 relative pathname, relative to DIR1
317 # - relconcat DIR1/DIR2, relative to the current directory
322 sed_first='s,^\([^/]*\)/.*$,\1,'
323 sed_rest='s,^[^/]*/*,,'
324 sed_last='s,^.*/\([^/]*\)$,\1,'
325 sed_butlast='s,/*[^/]*$,,'
327 first=`echo "$dir2" | sed -e "$sed_first"`
328 if test "$first" = "."; then
329 dir2=`echo "$dir2" | sed -e "$sed_rest"`
330 if test -z "$dir2"; then
335 last=`echo "$dir1" | sed -e "$sed_last"`
336 while test "$last" = "."; do
337 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
338 last=`echo "$dir1" | sed -e "$sed_last"`
340 if test -z "$dir1"; then
344 if test "$first" = ".."; then
345 if test "$last" = ".."; then
346 relconcat="$dir1/$dir2"
349 dir1=`echo "$dir1" | sed -e "$sed_butlast"`
350 dir2=`echo "$dir2" | sed -e "$sed_rest"`
351 if test -z "$dir1"; then
355 if test -z "$dir2"; then
360 relconcat="$dir1/$dir2"
368 # Like ln -s, except that SRC is given relative to the current directory (or
369 # absolute), not given relative to the directory of DEST.
375 *) # SRC is relative.
378 ln -s "`pwd`/$1" "$2" ;;
379 *) # DEST is relative too.
380 ln_destdir=`echo "$2" | sed -e 's,[^/]*$,,'`
381 test -n "$ln_destdir" || ln_destdir="."
382 func_relativize "$ln_destdir" "$1"
390 # func_ln_if_changed SRC DEST
391 # Like func_ln, but avoids munging timestamps if the link is correct.
392 func_ln_if_changed ()
394 if test $# -ne 2; then
395 echo "usage: func_ln_if_changed SRC DEST" >&2
397 ln_target=`func_readlink "$2"`
398 if test -L "$2" && test "$1" = "$ln_target"; then
406 # Command-line option processing.
407 # Removes the OPTIONS from the arguments. Sets the variables:
408 # - mode list or import or create-testdir or create-megatestdir
409 # - destdir from --dir
410 # - local_gnulib_dir from --local-dir
411 # - libname, supplied_libname from --lib
412 # - sourcebase from --source-base
413 # - m4base from --m4-base
414 # - docbase from --doc-base
415 # - testsbase from --tests-base
416 # - auxdir from --aux-dir
417 # - inctests true if --with-tests was given, blank otherwise
418 # - avoidlist list of modules to avoid, from --avoid
419 # - lgpl true if --lgpl was given, blank otherwise
420 # - makefile_name from --makefile-name
421 # - libtool true if --libtool was given, false if --no-libtool was
422 # given, blank otherwise
423 # - macro_prefix from --macro-prefix
424 # - autoconf_minversion minimum supported autoconf version
425 # - do_changelog false if --no-changelog was given, : otherwise
426 # - doit : if actions shall be executed, false if only to be printed
427 # - symbolic true if --symbolic was given, blank otherwise
451 while test $# -gt 0; do
456 --import | --impor | --impo | --imp | --im | --i )
459 --update | --updat | --upda | --upd | --up | --u )
462 --create-testdir | --create-testdi | --create-testd | --create-test | --create-tes | --create-te | --create-t )
465 --create-megatestdir | --create-megatestdi | --create-megatestd | --create-megatest | --create-megates | --create-megate | --create-megat | --create-mega | --create-meg | --create-me | --create-m )
466 mode=create-megatestdir
468 --test | --tes | --te | --t )
471 --megatest | --megates | --megate | --megat | --mega | --meg | --me | --m )
475 mode=`echo "X$1" | sed -e 's/^X--//'`
480 func_fatal_error "missing argument for --dir"
485 destdir=`echo "X$1" | sed -e 's/^X--dir=//'`
490 func_fatal_error "missing argument for --local-dir"
495 local_gnulib_dir=`echo "X$1" | sed -e 's/^X--local-dir=//'`
500 func_fatal_error "missing argument for --lib"
503 supplied_libname=true
506 libname=`echo "X$1" | sed -e 's/^X--lib=//'`
507 supplied_libname=true
512 func_fatal_error "missing argument for --source-base"
517 sourcebase=`echo "X$1" | sed -e 's/^X--source-base=//'`
522 func_fatal_error "missing argument for --m4-base"
527 m4base=`echo "X$1" | sed -e 's/^X--m4-base=//'`
532 func_fatal_error "missing argument for --doc-base"
537 docbase=`echo "X$1" | sed -e 's/^X--doc-base=//'`
542 func_fatal_error "missing argument for --tests-base"
547 testsbase=`echo "X$1" | sed -e 's/^X--tests-base=//'`
552 func_fatal_error "missing argument for --aux-dir"
557 auxdir=`echo "X$1" | sed -e 's/^X--aux-dir=//'`
565 func_fatal_error "missing argument for --avoid"
567 func_append avoidlist " $1"
570 arg=`echo "X$1" | sed -e 's/^X--avoid=//'`
571 func_append avoidlist " $arg"
579 func_fatal_error "missing argument for --makefile-name"
584 makefile_name=`echo "X$1" | sed -e 's/^X--makefile-name=//'`
595 func_fatal_error "missing argument for --macro-prefix"
600 macro_prefix=`echo "X$1" | sed -e 's/^X--macro-prefix=//'`
602 --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
608 -s | --symbolic | --symboli | --symbol | --symbo | --symb | --symlink | --symlin | --symli | --syml | --sym | --sy )
611 --help | --hel | --he | --h )
614 --version | --versio | --versi | --vers | --ver | --ve | --v )
618 # Stop option processing
622 echo "gnulib-tool: unknown option $1" 1>&2
623 echo "Try 'gnulib-tool --help' for more information." 1>&2
630 if test "$mode" = update; then
631 if test $# != 0; then
632 echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
633 echo "Try 'gnulib-tool --help' for more information." 1>&2
634 echo "If you really want to modify the gnulib configuration of your project," 1>&2
635 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
638 if test -n "$local_gnulib_dir" || test -n "$supplied_libname" \
639 || test -n "$sourcebase" || test -n "$m4base" \
640 || test -n "$docbase" || test -n "$testsbase" || test -n "$auxdir" \
641 || test -n "$inctests" || test -n "$avoidlist" || test -n "$lgpl" \
642 || test -n "$makefile_name" || test -n "$macro_prefix"; then
643 echo "gnulib-tool: invalid options for 'update' mode" 1>&2
644 echo "Try 'gnulib-tool --help' for more information." 1>&2
645 echo "If you really want to modify the gnulib configuration of your project," 1>&2
646 echo "you need to use 'gnulib --import' - at your own risk!" 1>&2
652 # Determine the minimum supported autoconf version from the project's
654 DEFAULT_AUTOCONF_MINVERSION="2.59"
657 if { test "$mode" = import || test "$mode" = update; } && test -n "$destdir"; then
658 if test -f "$destdir"/configure.ac; then
659 configure_ac="$destdir/configure.ac"
661 if test -f "$destdir"/configure.in; then
662 configure_ac="$destdir/configure.in"
666 if test -f configure.ac; then
667 configure_ac="configure.ac"
669 if test -f configure.in; then
670 configure_ac="configure.in"
674 if test -n "$configure_ac"; then
675 # Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
676 # because when some m4 files are omitted from a CVS repository,
677 # "autoconf --trace=AC_PREREQ" fails with an error message like this:
678 # m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
679 # autom4te: m4 failed with exit status: 1
686 s,^.*AC_PREREQ([[ ]*\([^])]*\).*$,prereqs="$prereqs \1",p
688 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
689 if test -n "$prereqs"; then
690 autoconf_minversion=`for version in $prereqs; do echo $version; done | $SORT -g -u | tail -1`
693 if test -z "$autoconf_minversion"; then
694 autoconf_minversion=$DEFAULT_AUTOCONF_MINVERSION
696 case "$autoconf_minversion" in
697 1.* | 2.[0-4]* | 2.5[0-8]*)
698 func_fatal_error "minimum supported autoconf version is 2.59. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
701 # Remove trailing slashes from the directory names. This is necessary for
702 # m4base (to avoid an error in func_import) and optional for the others.
703 sed_trimtrailingslashes='s,\([^/]\)//*$,\1,'
704 case "$local_gnulib_dir" in
705 */ ) local_gnulib_dir=`echo "$local_gnulib_dir" | sed -e "$sed_trimtrailingslashes"` ;;
707 case "$sourcebase" in
708 */ ) sourcebase=`echo "$sourcebase" | sed -e "$sed_trimtrailingslashes"` ;;
711 */ ) m4base=`echo "$m4base" | sed -e "$sed_trimtrailingslashes"` ;;
714 */ ) docbase=`echo "$docbase" | sed -e "$sed_trimtrailingslashes"` ;;
717 */ ) testsbase=`echo "$testsbase" | sed -e "$sed_trimtrailingslashes"` ;;
720 */ ) auxdir=`echo "$auxdir" | sed -e "$sed_trimtrailingslashes"` ;;
725 /*) self_abspathname="$0" ;;
726 */*) self_abspathname=`pwd`/"$0" ;;
727 *) for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`; do
728 if test -x "$d/$0" && test ! -d "$d/$0"; then
729 self_abspathname="$d/$0"
733 if test -z "$self_abspathname"; then
734 func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?"
738 while test -h "$self_abspathname"; do
739 # Resolve symbolic link.
740 linkval=`func_readlink "$self_abspathname"`
741 test -n "$linkval" || break
743 /* ) self_abspathname="$linkval" ;;
744 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
747 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
751 if test "$signal" != 0; then
752 echo "caught signal $signal" >&2
756 for signal in 1 2 3 13 15; do
757 trap '{ signal='$signal'; func_exit 1; }' $signal
761 # func_lookup_file file
762 # looks up a file in $local_gnulib_dir or $gnulib_dir, or combines it through
765 # - local_gnulib_dir from --local-dir
767 # - lookedup_file name of the merged (combined) file
768 # - lookedup_tmp true if it is located in the tmp directory, blank otherwise
772 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile"; then
773 lookedup_file="$local_gnulib_dir/$lkfile"
776 if test -f "$gnulib_dir/$lkfile"; then
777 if test -n "$local_gnulib_dir" && test -f "$local_gnulib_dir/$lkfile.diff"; then
778 lkbase=`echo "$lkfile" | sed -e 's,^.*/,,'`
780 cp "$gnulib_dir/$lkfile" "$tmp/$lkbase"
781 patch -s "$tmp/$lkbase" < "$local_gnulib_dir/$lkfile.diff" \
782 || func_fatal_error "patch file $local_gnulib_dir/$lkfile.diff didn't apply cleanly"
783 lookedup_file="$tmp/$lkbase"
786 lookedup_file="$gnulib_dir/$lkfile"
790 func_fatal_error "file $gnulib_dir/$lkfile not found"
797 # - local_gnulib_dir from --local-dir
800 # Filter out metainformation files like README, which are not modules.
801 # Filter out unit test modules; they can be retrieved through
802 # --extract-tests-module if desired.
804 (cd "$gnulib_dir/modules" && ls -1)
805 if test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules"; then
806 (cd "$local_gnulib_dir/modules" && ls -1 | sed -e 's,\.diff$,,')
809 | sed -e '/^CVS$/d' -e '/^ChangeLog$/d' -e '/^COPYING$/d' -e '/^README$/d' -e '/^TEMPLATE$/d' -e '/^TEMPLATE-TESTS$/d' -e '/~$/d' \
810 | sed -e '/-tests$/d' \
815 # verifies a module name
817 # - local_gnulib_dir from --local-dir
818 # - module module name argument
819 func_verify_module ()
821 if { test -f "$gnulib_dir/modules/$module" \
822 || { test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
823 && test -f "$local_gnulib_dir/modules/$module"; }; } \
824 && test "CVS" != "$module" \
825 && test "ChangeLog" != "$module" \
826 && test "COPYING" != "$module" \
827 && test "README" != "$module" \
828 && test "TEMPLATE" != "$module" \
829 && test "TEMPLATE-TESTS" != "$module"; then
830 # OK, $module is a correct module name.
831 # Verify that building the module description with 'patch' succeeds.
832 func_lookup_file "modules/$module"
834 echo "gnulib-tool: module $module doesn't exist" 1>&2
839 # func_verify_nontests_module
840 # verifies a module name, excluding tests modules
842 # - local_gnulib_dir from --local-dir
843 # - module module name argument
844 func_verify_nontests_module ()
848 * ) func_verify_module ;;
852 # func_verify_tests_module
853 # verifies a module name, considering only tests modules
855 # - local_gnulib_dir from --local-dir
856 # - module module name argument
857 func_verify_tests_module ()
860 *-tests ) func_verify_module ;;
865 sed_extract_prog=':[ ]*$/ {
868 s/^Description:[ ]*$//
870 s/^Depends-on:[ ]*$//
871 s/^configure\.ac:[ ]*$//
872 s/^Makefile\.am:[ ]*$//
875 s/^Maintainer:[ ]*$//
882 # func_get_description module
884 # - local_gnulib_dir from --local-dir
885 func_get_description ()
887 func_lookup_file "modules/$1"
888 sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
891 # func_get_filelist module
893 # - local_gnulib_dir from --local-dir
896 func_lookup_file "modules/$1"
897 sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
898 case "$autoconf_minversion" in
901 echo m4/onceonly_2_57.m4
906 # func_get_dependencies module
908 # - local_gnulib_dir from --local-dir
909 func_get_dependencies ()
911 # ${module}-tests always implicitly depends on ${module}.
912 echo "$1" | sed -n -e 's/-tests//p'
913 # Then the explicit dependencies listed in the module description.
914 func_lookup_file "modules/$1"
915 sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
918 # func_get_autoconf_snippet module
920 # - local_gnulib_dir from --local-dir
921 func_get_autoconf_snippet ()
923 func_lookup_file "modules/$1"
924 sed -n -e "/^configure\.ac$sed_extract_prog" < "$lookedup_file"
927 # func_get_automake_snippet module
929 # - local_gnulib_dir from --local-dir
930 func_get_automake_snippet ()
932 func_lookup_file "modules/$1"
933 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
936 # *-tests module live in tests/, not lib/.
939 # Synthesize an EXTRA_DIST augmentation.
940 sed_combine_lines='/\\$/{
947 sed_extract_mentioned_files='s/^lib_SOURCES[ ]*+=[ ]*//p'
948 already_mentioned_files=` \
949 sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file" \
950 | sed -e "$sed_combine_lines" \
951 | sed -n -e "$sed_extract_mentioned_files" | sed -e 's/#.*//'`
952 all_files=`func_get_filelist $1`
953 lib_files=`for f in $all_files; do \
957 done | sed -e 's,^lib/,,'`
958 # Remove $already_mentioned_files from $lib_files.
959 echo "$lib_files" | LC_ALL=C sort -u > "$tmp"/lib-files
960 extra_files=`for f in $already_mentioned_files; do echo $f; done \
961 | LC_ALL=C sort -u | LC_ALL=C join -v 2 - "$tmp"/lib-files`
962 if test -n "$extra_files"; then
963 echo "EXTRA_DIST +=" $extra_files
966 # Synthesize also an EXTRA_lib_SOURCES augmentation.
967 # This is necessary so that automake can generate the right list of
969 # A possible approach would be to use autom4te --trace of the redefined
970 # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
971 # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
972 # inside autoconf's built-in macros are not missed).
973 # But it's simpler and more robust to do it here, based on the file list.
974 # If some .c file exists and is not used with AC_LIBOBJ - for example,
975 # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
976 # automake will generate a useless dependency; this is harmless.
977 sed_extract_c_files='/\.c$/p'
978 extra_files=`echo "$extra_files" | sed -n -e "$sed_extract_c_files"`
979 if test -n "$extra_files"; then
980 echo "EXTRA_lib_SOURCES +=" $extra_files
987 # func_get_include_directive module
989 # - local_gnulib_dir from --local-dir
990 func_get_include_directive ()
992 func_lookup_file "modules/$1"
993 sed -n -e "/^Include$sed_extract_prog" < "$lookedup_file" | \
994 sed -e 's/^\(["<]\)/#include \1/'
997 # func_get_license module
999 # - local_gnulib_dir from --local-dir
1002 func_lookup_file "modules/$1"
1003 sed -n -e "/^License$sed_extract_prog" < "$lookedup_file"
1006 # func_get_maintainer module
1008 # - local_gnulib_dir from --local-dir
1009 func_get_maintainer ()
1011 func_lookup_file "modules/$1"
1012 sed -n -e "/^Maintainer$sed_extract_prog" < "$lookedup_file"
1015 # func_get_tests_module module
1017 # - local_gnulib_dir from --local-dir
1018 func_get_tests_module ()
1020 # The naming convention for tests modules is hardwired: ${module}-tests.
1021 if test -f "$gnulib_dir/modules/$1"-tests \
1022 || { test -n "$local_gnulib_dir" && test -d "$local_gnulib_dir/modules" \
1023 && test -f "$local_gnulib_dir/modules/$1"-tests; }; then
1028 # func_acceptable module
1029 # tests whether a module is acceptable.
1031 # - avoidlist list of modules to avoid
1034 for avoid in $avoidlist; do
1035 if test "$avoid" = "$1"; then
1042 # func_modules_transitive_closure
1044 # - local_gnulib_dir from --local-dir
1045 # - modules list of specified modules
1046 # - inctests true if tests should be included, blank otherwise
1047 # - avoidlist list of modules to avoid
1048 # - tmp pathname of a temporary directory
1050 # - modules list of modules, including dependencies
1051 func_modules_transitive_closure ()
1053 # In order to process every module only once (for speed), process an "input
1054 # list" of modules, producing an "output list" of modules. During each round,
1055 # more modules can be queued in the input list. Once a module on the input
1056 # list has been processed, it is added to the "handled list", so we can avoid
1057 # to process it again.
1059 inmodules="$modules"
1061 while test -n "$inmodules"; do
1062 inmodules_this_round="$inmodules"
1063 inmodules= # Accumulator, queue for next round
1064 for module in $inmodules_this_round; do
1066 if test -n "$module"; then
1067 if func_acceptable $module; then
1068 func_append outmodules " $module"
1069 deps=`func_get_dependencies $module`
1070 # Duplicate dependencies are harmless, but Jim wants a warning.
1071 duplicated_deps=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
1072 if test -n "$duplicated_deps"; then
1073 echo "warning: module $module has duplicated dependencies: "`echo $duplicated_deps` 1>&2
1075 func_append inmodules " $deps"
1076 if test -n "$inctests"; then
1077 testsmodule=`func_get_tests_module $module`
1078 if test -n "$testsmodule"; then
1079 func_append inmodules " $testsmodule"
1085 handledmodules=`for m in $handledmodules $inmodules_this_round; do echo $m; done | LC_ALL=C sort -u`
1086 # Remove $handledmodules from $inmodules.
1087 for m in $inmodules; do echo $m; done | LC_ALL=C sort -u > "$tmp"/queued-modules
1088 inmodules=`echo "$handledmodules" | LC_ALL=C join -v 2 - "$tmp"/queued-modules`
1090 modules=`for m in $outmodules; do echo $m; done | LC_ALL=C sort -u`
1091 rm -f "$tmp"/queued-modules
1094 # func_modules_add_dummy
1096 # - local_gnulib_dir from --local-dir
1097 # - modules list of modules, including dependencies
1099 # - modules list of modules, including 'dummy' if needed
1100 func_modules_add_dummy ()
1103 sed_remove_backslash_newline=':a
1110 for module in $modules; do
1111 func_verify_nontests_module
1112 if test -n "$module"; then
1113 # Extract the value of "lib_SOURCES += ...".
1114 for file in `func_get_automake_snippet "$module" | sed -e "$sed_remove_backslash_newline" | sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'`; do
1115 # Ignore .h files since they are not compiled.
1118 *) have_lib_SOURCES=yes ;;
1123 # Add the dummy module, to make sure the library will be non-empty.
1124 if test -z "$have_lib_SOURCES"; then
1125 func_append modules " dummy"
1129 # func_modules_to_filelist
1131 # - local_gnulib_dir from --local-dir
1132 # - modules list of modules, including dependencies
1134 # - files list of files
1135 func_modules_to_filelist ()
1138 for module in $modules; do
1140 if test -n "$module"; then
1141 fs=`func_get_filelist $module`
1142 func_append files " $fs"
1145 files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
1148 # func_emit_lib_Makefile_am
1149 # emits the contents of library makefile to standard output.
1151 # - local_gnulib_dir from --local-dir
1152 # - modules list of modules, including dependencies
1153 # - libname library name
1154 # - makefile_name from --makefile-name
1155 # - libtool true if libtool will be used, false or blank otherwise
1156 # - macro_prefix prefix of gl_LIBOBJS macros to use
1157 # - actioncmd (optional) command that will reproduce this invocation
1159 # - uses_subdirs nonempty if object files in subdirs exist
1160 func_emit_lib_Makefile_am ()
1162 # When creating an includable Makefile.am snippet, augment variables with
1163 # += instead of assigning them.
1164 if test -n "$makefile_name"; then
1169 if test "$libtool" = true; then
1172 sed_eliminate_LDFLAGS=
1176 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
1178 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
1179 echo "## Process this file with automake to produce Makefile.in."
1180 func_emit_copyright_notice
1181 if test -n "$actioncmd"; then
1182 echo "# Reproduce by: $actioncmd"
1187 for module in $modules; do
1188 func_verify_nontests_module
1189 if test -n "$module"; then
1191 func_get_automake_snippet "$module" |
1192 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
1193 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' |
1194 sed -e "$sed_eliminate_LDFLAGS" |
1195 sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' |
1196 sed -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
1197 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g'
1198 if test "$module" = 'alloca'; then
1199 echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
1200 echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
1203 # Skip the contents if its entirely empty.
1204 if grep '[^ ]' amsnippet.tmp > /dev/null ; then
1205 echo "## begin gnulib module $module"
1208 echo "## end gnulib module $module"
1212 # Test whether there are some source files in subdirectories.
1213 for f in `func_get_filelist "$module"`; do
1215 lib/*/*.c) uses_subdirs=yes ;;
1221 if test -z "$makefile_name"; then
1222 # If there are source files in subdirectories, prevent collision of the
1223 # object files (example: hash.c and libxml/hash.c).
1225 if test -n "$uses_subdirs"; then
1226 subdir_options=' subdir-objects'
1228 echo "AUTOMAKE_OPTIONS = 1.5 gnits${subdir_options}"
1231 if grep "^[a-zA-Z0-9_]*_${perhapsLT}LIBRARIES *= *$libname\\.$libext\$" allsnippets.tmp > /dev/null; then
1232 # One of the snippets already specifies an installation location for the
1233 # library. Don't confuse automake by saying it should not be installed.
1236 # By default, the generated library should not be installed.
1237 echo "noinst_${perhapsLT}LIBRARIES $assign $libname.$libext"
1240 echo "${libname}_${libext}_SOURCES ="
1241 # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However,
1242 # automake during its analyses looks for $(LIBOBJS), not for @LIBOBJS@.
1243 echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
1244 echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
1245 echo "EXTRA_${libname}_${libext}_SOURCES ="
1246 if test "$libtool" = true; then
1247 echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
1249 if test -z "$makefile_name"; then
1250 echo "noinst_HEADERS ="
1251 # Automake versions < 1.9b create an empty pkgdatadir at installation time
1252 # if you specify pkgdata_DATA to empty. This is a workaround.
1253 if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
1254 echo "pkgdata_DATA ="
1257 echo "BUILT_SOURCES ="
1260 echo "MOSTLYCLEANFILES $assign core *.stackdump"
1261 if test -z "$makefile_name"; then
1262 echo "MOSTLYCLEANDIRS ="
1264 echo "DISTCLEANFILES ="
1265 echo "MAINTAINERCLEANFILES ="
1267 echo "AM_CPPFLAGS ="
1272 echo "mostlyclean-local: mostlyclean-generic"
1273 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
1274 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
1275 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
1278 rm -f allsnippets.tmp
1281 # func_emit_tests_Makefile_am
1282 # emits the contents of tests makefile to standard output.
1284 # - local_gnulib_dir from --local-dir
1285 # - modules list of modules, including dependencies
1286 # - libname library name
1287 # - makefile_name from --makefile-name
1288 # - libtool true if libtool will be used, false or blank otherwise
1289 # - sourcebase relative directory containing lib source code
1290 # - m4base relative directory containing autoconf macros
1291 # - testsbase relative directory containing unit test code
1292 func_emit_tests_Makefile_am ()
1294 if test "$libtool" = true; then
1299 if test "$libtool" = true; then
1301 sed_eliminate_LDFLAGS=
1304 sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
1306 testsbase_inverse=`echo "$testsbase" | sed -e 's,/$,,' | sed -e 's,[^/][^/]*,..,g'`
1307 echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
1308 echo "## Process this file with automake to produce Makefile.in."
1309 func_emit_copyright_notice
1311 # Generate dependencies here, since it eases the debugging of test failures.
1312 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
1314 echo "ACLOCAL_AMFLAGS = -I ${testsbase_inverse}/${m4base}"
1317 for module in $modules; do
1318 func_verify_tests_module
1319 if test -n "$module"; then
1321 func_get_automake_snippet "$module" |
1322 sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
1323 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' |
1324 sed -e "$sed_eliminate_LDFLAGS" |
1325 sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' |
1326 sed -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
1327 -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g'
1329 # Skip the contents if its entirely empty.
1330 if grep '[^ ]' amsnippet.tmp > /dev/null ; then
1331 echo "## begin gnulib module $module"
1334 echo "## end gnulib module $module"
1341 # Nothing is being added to SUBDIRS; nevertheless the existence of this
1342 # variable is needed to avoid an error from automake:
1343 # "AM_GNU_GETTEXT used but SUBDIRS not defined"
1346 echo "TESTS_ENVIRONMENT ="
1347 echo "noinst_PROGRAMS ="
1348 echo "check_PROGRAMS ="
1349 echo "noinst_HEADERS ="
1350 if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
1351 echo "pkgdata_DATA ="
1354 echo "BUILT_SOURCES ="
1356 echo "MOSTLYCLEANFILES = core *.stackdump"
1357 echo "MOSTLYCLEANDIRS ="
1359 echo "DISTCLEANFILES ="
1360 echo "MAINTAINERCLEANFILES ="
1362 echo "AM_CPPFLAGS = \\"
1363 echo " -I. -I\$(srcdir) \\"
1364 echo " -I${testsbase_inverse} -I\$(srcdir)/${testsbase_inverse} \\"
1365 echo " -I${testsbase_inverse}/${sourcebase-lib} -I\$(srcdir)/${testsbase_inverse}/${sourcebase-lib}"
1367 echo "LDADD = ${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext}"
1370 echo "# Clean up after Solaris cc."
1372 echo " rm -rf SunWS_cache"
1374 echo "mostlyclean-local: mostlyclean-generic"
1375 echo " @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
1376 echo " if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
1377 echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
1380 rm -f allsnippets.tmp
1383 # func_emit_initmacro_start
1384 # emits the first few statements of the gl_INIT macro to standard output.
1385 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
1386 func_emit_initmacro_start ()
1388 echo " m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix}_LIBOBJ]))"
1389 echo " m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix}_REPLACE_FUNCS]))"
1392 # func_emit_initmacro_end
1393 # emits the last few statements of the gl_INIT macro to standard output.
1394 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
1395 func_emit_initmacro_end ()
1397 echo " m4_popdef([AC_REPLACE_FUNCS])"
1398 echo " m4_popdef([AC_LIBOBJ])"
1399 echo " AC_CONFIG_COMMANDS_PRE(["
1400 echo " ${macro_prefix}_libobjs="
1401 echo " ${macro_prefix}_ltlibobjs="
1402 echo " if test -n \"\$${macro_prefix}_LIBOBJS\"; then"
1403 echo " # Remove the extension."
1404 echo " sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
1405 echo " for i in \`for i in \$${macro_prefix}_LIBOBJS; do echo \"\$i\"; done | sed \"\$sed_drop_objext\" | sort | uniq\`; do"
1406 echo " ${macro_prefix}_libobjs=\"\$${macro_prefix}_libobjs \$i.\$ac_objext\""
1407 echo " ${macro_prefix}_ltlibobjs=\"\$${macro_prefix}_ltlibobjs \$i.lo\""
1410 echo " AC_SUBST([${macro_prefix}_LIBOBJS], [\$${macro_prefix}_libobjs])"
1411 echo " AC_SUBST([${macro_prefix}_LTLIBOBJS], [\$${macro_prefix}_ltlibobjs])"
1415 # func_emit_initmacro_done
1416 # emits a few statements after the gl_INIT macro to standard output.
1417 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
1418 func_emit_initmacro_done ()
1421 echo "# Like AC_LIBOBJ, except that the module name goes"
1422 echo "# into ${macro_prefix}_LIBOBJS instead of into LIBOBJS."
1423 echo "AC_DEFUN([${macro_prefix}_LIBOBJ],"
1424 echo " [${macro_prefix}_LIBOBJS=\"\$${macro_prefix}_LIBOBJS \$1.\$ac_objext\"])"
1426 echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
1427 echo "# into ${macro_prefix}_LIBOBJS instead of into LIBOBJS."
1428 echo "AC_DEFUN([${macro_prefix}_REPLACE_FUNCS],"
1429 echo " [AC_CHECK_FUNCS([\$1], , [${macro_prefix}_LIBOBJ(\$ac_func)])])"
1432 # func_import modules
1433 # Uses also the variables
1434 # - destdir target directory
1435 # - local_gnulib_dir from --local-dir
1436 # - libname library name
1437 # - sourcebase directory relative to destdir where to place source code
1438 # - m4base directory relative to destdir where to place *.m4 macros
1439 # - docbase directory relative to destdir where to place doc files
1440 # - testsbase directory relative to destdir where to place unit test code
1441 # - auxdir directory relative to destdir where to place build aux files
1442 # - inctests true if --with-tests was given, blank otherwise
1443 # - avoidlist list of modules to avoid, from --avoid
1444 # - lgpl true if library's license shall be LGPL, blank otherwise
1445 # - makefile_name from --makefile-name
1446 # - libtool true if --libtool was given, false if --no-libtool was
1447 # given, blank otherwise
1448 # - guessed_libtool true if the configure.ac file uses libtool, false otherwise
1449 # - macro_prefix prefix of gl_EARLY, gl_INIT macros to use
1450 # - autoconf_minversion minimum supported autoconf version
1451 # - doit : if actions shall be executed, false if only to be printed
1452 # - symbolic true if files should be symlinked, copied otherwise
1455 # Get the cached settings.
1456 cached_local_gnulib_dir=
1457 cached_specified_modules=
1465 cached_makefile_name=
1467 cached_macro_prefix=
1469 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
1470 cached_libtool=false
1476 s,^.*gl_LOCAL_DIR([[ ]*\([^])]*\).*$,cached_local_gnulib_dir="\1",p
1479 s,^.*gl_MODULES([[ ]*\([^])]*\).*$,cached_specified_modules="\1",p
1482 s,^.*gl_AVOID([[ ]*\([^])]*\).*$,cached_avoidlist="\1",p
1485 s,^.*gl_SOURCE_BASE([[ ]*\([^])]*\).*$,cached_sourcebase="\1",p
1488 s,^.*gl_M4_BASE([[ ]*\([^])]*\).*$,cached_m4base="\1",p
1491 s,^.*gl_DOC_BASE([[ ]*\([^])]*\).*$,cached_docbase="\1",p
1494 s,^.*gl_TESTS_BASE([[ ]*\([^])]*\).*$,cached_testsbase="\1",p
1497 s,^.*gl_LIB([[ ]*\([^])]*\).*$,cached_libname="\1",p
1500 s,^.*$,cached_lgpl=true,p
1502 /gl_MAKEFILE_NAME(/ {
1503 s,^.*gl_MAKEFILE_NAME([[ ]*\([^])]*\).*$,cached_makefile_name="\1",p
1506 s,^.*$,cached_libtool=true,p
1508 /gl_MACRO_PREFIX(/ {
1509 s,^.*gl_MACRO_PREFIX([[ ]*\([^])]*\).*$,cached_macro_prefix="\1",p
1511 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-cache.m4`
1512 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
1517 /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
1518 s,^.*$,cached_files=",p
1530 eval `sed -n -e "$my_sed_traces" < "$destdir"/$m4base/gnulib-comp.m4`
1534 # Merge the cached settings with the specified ones.
1535 # The m4base must be the same as expected from the pathname.
1536 if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
1537 func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
1539 # The local_gnulib_dir defaults to the cached one. Recall that the cached one
1540 # is relative to $destdir, whereas the one we use is relative to . or absolute.
1541 if test -z "$local_gnulib_dir"; then
1542 if test -n "$cached_local_gnulib_dir"; then
1545 local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
1547 case "$cached_local_gnulib_dir" in
1549 local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
1551 func_relconcat "$destdir" "$cached_local_gnulib_dir"
1552 local_gnulib_dir="$relconcat" ;;
1557 # Append the cached and the specified module names. So that
1558 # "gnulib-tool --import foo" means to add the module foo.
1559 specified_modules="$cached_specified_modules $1"
1560 # Append the cached and the specified avoidlist. This is probably better
1561 # than dropping the cached one when --avoid is specified at least once.
1562 avoidlist=`echo $cached_avoidlist $avoidlist`
1563 # The sourcebase defaults to the cached one.
1564 if test -z "$sourcebase"; then
1565 sourcebase="$cached_sourcebase"
1566 if test -z "$sourcebase"; then
1567 func_fatal_error "missing --source-base option"
1570 # The docbase defaults to the cached one.
1571 if test -z "$docbase"; then
1572 docbase="$cached_docbase"
1573 if test -z "$docbase"; then
1574 func_fatal_error "missing --doc-base option. --doc-base has been introduced on 2006-07-11; if your last invocation of 'gnulib-tool --import' is before that date, you need to run 'gnulib-tool --import' once, with a --doc-base option."
1577 # The testsbase defaults to the cached one.
1578 if test -z "$testsbase"; then
1579 testsbase="$cached_testsbase"
1580 if test -z "$testsbase"; then
1581 func_fatal_error "missing --tests-base option"
1584 # The libname defaults to the cached one.
1585 if test -z "$supplied_libname"; then
1586 libname="$cached_libname"
1587 if test -z "$libname"; then
1588 func_fatal_error "missing --lib option"
1591 # Require LGPL if specified either way.
1592 if test -z "$lgpl"; then
1595 # The makefile_name defaults to the cached one.
1596 if test -z "$makefile_name"; then
1597 makefile_name="$cached_makefile_name"
1599 # Use libtool if specified either way, or if guessed.
1600 if test -z "$libtool"; then
1601 if test -n "$cached_m4base"; then
1602 libtool="$cached_libtool"
1604 libtool="$guessed_libtool"
1607 # The macro_prefix defaults to the cached one.
1608 if test -z "$macro_prefix"; then
1609 macro_prefix="$cached_macro_prefix"
1610 if test -z "$macro_prefix"; then
1611 func_fatal_error "missing --macro-prefix option"
1615 # Canonicalize the list of specified modules.
1616 specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
1618 # Determine final module list.
1619 modules="$specified_modules"
1620 func_modules_transitive_closure
1621 echo "Module list with included dependencies:"
1622 echo "$modules" | sed -e 's/^/ /'
1624 # Add the dummy module if needed.
1625 func_modules_add_dummy
1627 # If --lgpl, verify that the licenses of modules are compatible.
1628 if test -n "$lgpl"; then
1629 for module in $modules; do
1630 license=`func_get_license $module`
1632 LGPL | 'GPLed build tool') ;;
1633 'public domain' | 'unlimited' | 'unmodifiable license text') ;;
1634 *) func_fatal_error "incompatible license on module $module: $license" ;;
1639 # Determine script to apply to imported library files.
1640 sed_transform_lib_file=
1641 for module in $modules; do
1642 if test $module = config-h; then
1643 # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
1644 sed_transform_lib_file=$sed_transform_lib_file'
1645 s/^#ifdef[ ]*HAVE_CONFIG_H[ ]*$/#if 1/
1650 if test -n "$lgpl"; then
1652 sed_transform_lib_file=$sed_transform_lib_file'
1653 s/GNU General/GNU Lesser General/g
1654 s/version 2\([ ,]\)/version 2.1\1/g
1658 # Determine final file list.
1659 func_modules_to_filelist
1661 echo "$files" | sed -e 's/^/ /'
1664 || func_fatal_error "refusing to do nothing"
1666 # Add m4/gnulib-tool.m4 to the file list. It is not part of any module.
1667 new_files="$files m4/gnulib-tool.m4"
1668 old_files="$cached_files"
1669 if test -f "$destdir"/$m4base/gnulib-tool.m4; then
1670 func_append old_files " m4/gnulib-tool.m4"
1673 sed_rewrite_old_files="\
1674 s,^build-aux/,$auxdir/,
1675 s,^doc/,$cached_docbase/,
1676 s,^lib/,$cached_sourcebase/,
1677 s,^m4/,$cached_m4base/,
1678 s,^tests/,$cached_testsbase/,"
1679 sed_rewrite_new_files="\
1680 s,^build-aux/,$auxdir/,
1682 s,^lib/,$sourcebase/,
1684 s,^tests/,$testsbase/,"
1686 # Create directories.
1687 { echo "$sourcebase"
1689 docfiles=`echo "$files" | sed -n -e 's,^doc/,,p'`
1690 if test -n "$docfiles"; then
1693 if test -n "$inctests"; then
1697 for f in $files; do echo $f; done \
1698 | sed -e "$sed_rewrite_new_files" \
1699 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
1702 { # Rearrange file descriptors. Needed because "while ... done < ..."
1703 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
1704 exec 5<&0 < "$tmp"/dirs
1706 if test ! -d "$destdir/$d"; then
1708 echo "Creating directory $destdir/$d"
1709 mkdir -p "$destdir/$d" || func_fatal_error "failed"
1711 echo "Create directory $destdir/$d"
1718 # func_dest_tmpfilename file
1719 # determines the name of a temporary file (file is relative to destdir).
1721 # - tmpfile absolute filename of the temporary file
1722 func_dest_tmpfilename ()
1725 # Put the new contents of $file in a file in the same directory (needed
1726 # to guarantee that an 'mv' to "$destdir/$file" works).
1727 tmpfile="$destdir/$1.tmp"
1729 # Put the new contents of $file in a file in a temporary directory
1730 # (because the directory of "$file" might not exist).
1731 tmpfile="$tmp"/`basename "$1"`.tmp
1735 # Copy files or make symbolic links. Remove obsolete files.
1737 # Construct a table with 2 columns: rewritten-file-name original-file-name,
1738 # representing the files according to the last gnulib-tool invocation.
1739 for f in $old_files; do echo $f; done \
1740 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_old_files" \
1743 # Construct a table with 2 columns: rewritten-file-name original-file-name,
1744 # representing the files after this gnulib-tool invocation.
1745 for f in $new_files; do echo $f; done \
1746 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" \
1749 # First the files that are in old-files, but not in new-files:
1750 sed_take_first_column='s,'"$delimiter"'.*,,'
1751 for g in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
1752 # Remove the file. Do nothing if the user already removed it.
1753 if test -f "$destdir/$g"; then
1755 echo "Removing file $g (backup in ${g}~)"
1756 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
1758 echo "Remove file $g (backup in ${g}~)"
1762 # func_add_or_update handles a file that ought to be present afterwards.
1764 # - f the original file name
1765 # - g the rewritten file name
1766 # - already_present nonempty if the file already exists, empty otherwise
1767 func_add_or_update ()
1769 func_dest_tmpfilename "$g"
1770 func_lookup_file "$f"
1771 cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
1772 if test -n "$sed_transform_lib_file"; then
1775 sed -e "$sed_transform_lib_file" \
1776 < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
1780 if test -f "$destdir/$g"; then
1781 # The file already exists.
1782 if cmp "$destdir/$g" "$tmpfile" > /dev/null; then
1783 : # The file has not changed.
1787 if test -n "$already_present"; then
1788 echo "Updating file $g (backup in ${g}~)"
1790 echo "Replacing file $g (non-gnulib code backuped in ${g}~) !!"
1792 mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
1793 if test -n "$symbolic" && test -z "$lookedup_tmp" \
1794 && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
1795 func_ln_if_changed "$lookedup_file" "$destdir/$g"
1797 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
1800 if test -n "$already_present"; then
1801 echo "Update file $g (backup in ${g}~)"
1803 echo "Replace file $g (non-gnulib code backuped in ${g}~) !!"
1809 # Don't protest if the file should be there but isn't: it happens
1810 # frequently that developers don't put autogenerated files into CVS.
1812 echo "Copying file $g"
1813 if test -n "$symbolic" && test -z "$lookedup_tmp" \
1814 && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
1815 func_ln_if_changed "$lookedup_file" "$destdir/$g"
1817 mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
1825 # Then the files that are in new-files, but not in old-files:
1826 sed_take_last_column='s,^.*'"$delimiter"',,'
1828 LC_ALL=C join -t"$delimiter" -v2 "$tmp"/old-files "$tmp"/new-files \
1829 | sed -e "$sed_take_last_column" \
1830 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/added-files
1831 { # Rearrange file descriptors. Needed because "while ... done < ..."
1832 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
1833 exec 5<&0 < "$tmp"/added-files
1839 # Then the files that are in new-files and in old-files:
1840 already_present=true
1841 LC_ALL=C join -t"$delimiter" "$tmp"/old-files "$tmp"/new-files \
1842 | sed -e "$sed_take_last_column" \
1843 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-files
1844 { # Rearrange file descriptors. Needed because "while ... done < ..."
1845 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
1846 exec 5<&0 < "$tmp"/kept-files
1853 # Command-line invocation printed in a comment in generated gnulib-cache.m4.
1854 actioncmd="gnulib-tool --import"
1855 func_append actioncmd " --dir=$destdir"
1856 if test -n "$local_gnulib_dir"; then
1857 func_append actioncmd " --local-dir=$local_gnulib_dir"
1859 func_append actioncmd " --lib=$libname"
1860 func_append actioncmd " --source-base=$sourcebase"
1861 func_append actioncmd " --m4-base=$m4base"
1862 func_append actioncmd " --doc-base=$docbase"
1863 func_append actioncmd " --aux-dir=$auxdir"
1864 for module in $avoidlist; do
1865 func_append actioncmd " --avoid=$module"
1867 if test -n "$lgpl"; then
1868 func_append actioncmd " --lgpl"
1870 if test -n "$makefile_name"; then
1871 func_append actioncmd " --makefile-name=$makefile_name"
1873 if test "$libtool" = true; then
1874 func_append actioncmd " --libtool"
1876 func_append actioncmd " --no-libtool"
1878 func_append actioncmd " --macro-prefix=$macro_prefix"
1879 func_append actioncmd " `echo $specified_modules`"
1881 # Default the makefile name to Makefile.am.
1882 if test -n "$makefile_name"; then
1883 makefile_am=$makefile_name
1885 makefile_am=Makefile.am
1888 # Create library makefile.
1889 func_dest_tmpfilename $sourcebase/$makefile_am
1890 func_emit_lib_Makefile_am > "$tmpfile"
1891 if test -f "$destdir"/$sourcebase/$makefile_am; then
1892 if cmp "$destdir"/$sourcebase/$makefile_am "$tmpfile" > /dev/null; then
1896 echo "Updating $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
1897 mv -f "$destdir"/$sourcebase/$makefile_am "$destdir"/$sourcebase/$makefile_am~
1898 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
1900 echo "Update $sourcebase/$makefile_am (backup in $sourcebase/$makefile_am~)"
1906 echo "Creating $sourcebase/$makefile_am"
1907 mv -f "$tmpfile" "$destdir"/$sourcebase/$makefile_am
1909 echo "Create $sourcebase/$makefile_am"
1914 # Create m4/gnulib-cache.m4.
1915 func_dest_tmpfilename $m4base/gnulib-cache.m4
1917 func_emit_copyright_notice
1919 echo "# This file represents the specification of how gnulib-tool is used."
1920 echo "# It acts as a cache: It is written and read by gnulib-tool."
1921 echo "# In projects using CVS, this file is meant to be stored in CVS,"
1922 echo "# like the configure.ac and various Makefile.am files."
1925 echo "# Specification in the form of a command-line invocation:"
1928 echo "# Specification in the form of a few gnulib-tool.m4 macro invocations:"
1929 # Store the local_gnulib_dir relative to destdir.
1930 case "$local_gnulib_dir" in
1932 relative_local_gnulib_dir="$local_gnulib_dir" ;;
1935 /*) relative_local_gnulib_dir="$local_gnulib_dir" ;;
1937 # destdir, local_gnulib_dir are both relative.
1938 func_relativize "$destdir" "$local_gnulib_dir"
1939 relative_local_gnulib_dir="$reldir" ;;
1942 echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
1943 echo "gl_MODULES(["`echo $specified_modules`"])"
1944 echo "gl_AVOID([$avoidlist])"
1945 echo "gl_SOURCE_BASE([$sourcebase])"
1946 echo "gl_M4_BASE([$m4base])"
1947 echo "gl_DOC_BASE([$docbase])"
1948 echo "gl_TESTS_BASE([$testsbase])"
1949 echo "gl_LIB([$libname])"
1950 test -z "$lgpl" || echo "gl_LGPL"
1951 echo "gl_MAKEFILE_NAME([$makefile_name])"
1952 if test "$libtool" = true; then
1955 echo "gl_MACRO_PREFIX([$macro_prefix])"
1957 if test -f "$destdir"/$m4base/gnulib-cache.m4; then
1958 if cmp "$destdir"/$m4base/gnulib-cache.m4 "$tmpfile" > /dev/null; then
1962 echo "Updating $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
1963 mv -f "$destdir"/$m4base/gnulib-cache.m4 "$destdir"/$m4base/gnulib-cache.m4~
1964 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
1966 echo "Update $m4base/gnulib-cache.m4 (backup in $m4base/gnulib-cache.m4~)"
1970 echo "# gnulib-cache.m4 ends here"
1977 echo "Creating $m4base/gnulib-cache.m4"
1978 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-cache.m4
1980 echo "Create $m4base/gnulib-cache.m4"
1986 # Create m4/gnulib-comp.m4.
1987 func_dest_tmpfilename $m4base/gnulib-comp.m4
1989 echo "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
1990 func_emit_copyright_notice
1992 echo "# This file represents the compiled summary of the specification in"
1993 echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
1994 echo "# to be invoked from configure.ac."
1995 echo "# In projects using CVS, this file can be treated like other built files."
1998 echo "# This macro should be invoked from $configure_ac, in the section"
1999 echo "# \"Checks for programs\", right after AC_PROG_CC, and certainly before"
2000 echo "# any checks for libraries, header files, types and library functions."
2001 echo "AC_DEFUN([${macro_prefix}_EARLY],"
2003 echo " m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
2004 echo " m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
2005 echo " m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
2006 echo " m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
2007 echo " AC_REQUIRE([AC_PROG_RANLIB])"
2008 if test -n "$uses_subdirs"; then
2009 echo " AC_REQUIRE([AM_PROG_CC_C_O])"
2011 if grep AC_GNU_SOURCE "$destdir"/$m4base/*.m4 >/dev/null 2>/dev/null; then
2012 echo " AC_REQUIRE([AC_GNU_SOURCE])"
2014 if grep gl_USE_SYSTEM_EXTENSIONS "$destdir"/$m4base/*.m4 >/dev/null 2>/dev/null; then
2015 echo " AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])"
2017 if grep gl_LOCK "$destdir"/$m4base/*.m4 >/dev/null 2>/dev/null; then
2018 echo " AC_REQUIRE([gl_LOCK_EARLY])"
2022 echo "# This macro should be invoked from $configure_ac, in the section"
2023 echo "# \"Check for header files, types and library functions\"."
2024 echo "AC_DEFUN([${macro_prefix}_INIT],"
2026 func_emit_initmacro_start
2027 if test "$libtool" = true; then
2028 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
2029 echo " gl_cond_libtool=true"
2031 echo " AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
2032 echo " gl_cond_libtool=false"
2034 echo " gl_ltlibdeps="
2036 echo " gl_source_base='$sourcebase'"
2037 if test "$auxdir" != "build-aux"; then
2038 sed_replace_build_aux='
2040 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
2041 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
2044 sed_replace_build_aux=`echo "$sed_replace_build_aux" | sed -e 1d -e 's/^ *//'`
2046 sed_replace_build_aux=
2048 for module in $modules; do
2050 if test -n "$module"; then
2051 func_get_autoconf_snippet "$module" \
2052 | sed -e '/^$/d;' -e 's/^/ /' \
2053 -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
2054 -e "$sed_replace_build_aux"
2055 if test "$module" = 'alloca' && test "$libtool" = true; then
2056 echo 'changequote(,)dnl'
2057 echo 'LTALLOCA=`echo "$ALLOCA" | sed '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
2058 echo 'changequote([, ])dnl'
2059 echo 'AC_SUBST([LTALLOCA])'
2063 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
2064 # created using libtool, because libtool already handles the dependencies.
2065 if test "$libtool" != true; then
2066 libname_upper=`echo "$libname" | tr 'a-z' 'A-Z'`
2067 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
2068 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
2069 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
2070 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
2072 func_emit_initmacro_end
2074 func_emit_initmacro_done
2076 echo "# This macro records the list of files which have been installed by"
2077 echo "# gnulib-tool and may be removed by future gnulib-tool invocations."
2078 echo "AC_DEFUN([${macro_prefix}_FILE_LIST], ["
2079 echo "$files" | sed -e 's,^, ,'
2082 if test -f "$destdir"/$m4base/gnulib-comp.m4; then
2083 if cmp "$destdir"/$m4base/gnulib-comp.m4 "$tmpfile" > /dev/null; then
2087 echo "Updating $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
2088 mv -f "$destdir"/$m4base/gnulib-comp.m4 "$destdir"/$m4base/gnulib-comp.m4~
2089 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
2091 echo "Update $m4base/gnulib-comp.m4 (backup in $m4base/gnulib-comp.m4~)"
2095 echo "# gnulib-comp.m4 ends here"
2102 echo "Creating $m4base/gnulib-comp.m4"
2103 mv -f "$tmpfile" "$destdir"/$m4base/gnulib-comp.m4
2105 echo "Create $m4base/gnulib-comp.m4"
2111 if test -n "$inctests"; then
2112 # Create tests makefile.
2113 func_dest_tmpfilename $testsbase/$makefile_am
2114 func_emit_tests_Makefile_am > "$tmpfile"
2115 if test -f "$destdir"/$testsbase/$makefile_am; then
2116 if cmp "$destdir"/$testsbase/$makefile_am "$tmpfile" > /dev/null; then
2120 echo "Updating $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
2121 mv -f "$destdir"/$testsbase/$makefile_am "$destdir"/$testsbase/$makefile_am~
2122 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
2124 echo "Update $testsbase/$makefile_am (backup in $testsbase/$makefile_am~)"
2130 echo "Creating $testsbase/$makefile_am"
2131 mv -f "$tmpfile" "$destdir"/$testsbase/$makefile_am
2133 echo "Create $testsbase/$makefile_am"
2141 echo "You may need to add #include directives for the following .h files."
2142 # First the #include <...> directives without #ifs, sorted for convenience,
2143 # then the #include "..." directives without #ifs, sorted for convenience,
2144 # then the #include directives that are surrounded by #ifs. Not sorted.
2145 for module in $modules; do
2146 include_directive=`func_get_include_directive "$module"`
2147 case "$nl$include_directive" in
2149 echo "$include_directive" 1>&5
2152 echo "$include_directive" | grep -v 'include "' 1>&6
2153 echo "$include_directive" | grep 'include "' 1>&7
2156 done 5> "$tmp"/include-if 6> "$tmp"/include-angles 7> "$tmp"/include-quotes
2158 LC_ALL=C sort -u "$tmp"/include-angles
2159 LC_ALL=C sort -u "$tmp"/include-quotes
2160 cat "$tmp"/include-if
2161 ) | sed -e '/^$/d' -e 's/^/ /'
2162 rm -f "$tmp"/include-angles "$tmp"/include-quotes "$tmp"/include-if
2165 echo "Don't forget to"
2166 if test "$makefile_am" = Makefile.am; then
2167 echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
2169 echo " - \"include $makefile_name\" from within \"$sourcebase/Makefile.am\","
2171 if test -n "$inctests"; then
2172 if test "$makefile_am" = Makefile.am; then
2173 echo " - add \"$testsbase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"
2175 echo " - \"include $makefile_name\" from within \"$testsbase/Makefile.am\","
2178 if test "$makefile_am" = Makefile.am; then
2179 sourcebase_dir=`echo "$sourcebase" | sed -n -e 's,/[^/]*$,/,p'`
2180 sourcebase_base=`basename "$sourcebase"`
2181 echo " - mention \"${sourcebase_base}\" in SUBDIRS in ${sourcebase_dir}Makefile.am,"
2183 if test -n "$inctests"; then
2184 if test "$makefile_am" = Makefile.am; then
2185 testsbase_dir=`echo "$testsbase" | sed -n -e 's,/[^/]*$,/,p'`
2186 testsbase_base=`basename "$testsbase"`
2187 echo " - mention \"${testsbase_base}\" in SUBDIRS in ${testsbase_dir}Makefile.am,"
2190 echo " - mention \"-I ${m4base}\" in ACLOCAL_AMFLAGS in Makefile.am,"
2191 echo " - invoke ${macro_prefix}_EARLY in $configure_ac, right after AC_PROG_CC,"
2192 echo " - invoke ${macro_prefix}_INIT in $configure_ac."
2195 # func_create_testdir testdir modules
2197 # - local_gnulib_dir from --local-dir
2198 # - auxdir directory relative to destdir where to place build aux files
2199 func_create_testdir ()
2203 if test -z "$modules"; then
2204 # All modules together.
2205 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
2206 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
2207 # Except ftruncate, mountlist, which abort the configuration on mingw. FIXME.
2208 modules=`func_all_modules`
2209 modules=`for m in $modules; do case $m in config-h | fnmatch-posix | ftruncate | mountlist) ;; *) echo $m;; esac; done`
2211 modules=`for m in $modules; do echo $m; done | LC_ALL=C sort -u`
2213 # Subdirectory names.
2220 # Determine final module list.
2221 func_modules_transitive_closure
2222 echo "Module list with included dependencies:"
2223 echo "$modules" | sed -e 's/^/ /'
2225 # Add the dummy module if needed.
2226 func_modules_add_dummy
2228 # Determine final file list.
2229 func_modules_to_filelist
2231 echo "$files" | sed -e 's/^/ /'
2233 sed_rewrite_files="\
2234 s,^build-aux/,$auxdir/,
2236 s,^lib/,$sourcebase/,
2238 s,^tests/,$testsbase/,"
2240 # Create directories.
2241 for f in $files; do echo $f; done \
2242 | sed -e "$sed_rewrite_files" \
2243 | sed -n -e 's,^\(.*\)/[^/]*,\1,p' \
2244 | LC_ALL=C sort -u \
2246 { # Rearrange file descriptors. Needed because "while ... done < ..."
2247 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
2248 exec 5<&0 < "$tmp"/dirs
2250 mkdir -p "$testdir/$d"
2255 # Copy files or make symbolic links.
2257 for f in $files; do echo $f; done \
2258 | sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_files" \
2261 { # Rearrange file descriptors. Needed because "while ... done < ..."
2262 # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
2263 exec 5<&0 < "$tmp"/files
2265 func_lookup_file "$f"
2266 if test -n "$lookedup_tmp"; then
2267 cp -p "$lookedup_file" "$testdir/$g"
2269 ln "$lookedup_file" "$testdir/$g" 2>/dev/null ||
2270 if test -z "$symbolic"; then
2271 cp -p "$lookedup_file" "$testdir/$g"
2273 func_ln "$lookedup_file" "$testdir/$g"
2280 # Create $sourcebase/Makefile.am.
2281 mkdir -p "$testdir/$sourcebase"
2282 func_emit_lib_Makefile_am > "$testdir/$sourcebase/Makefile.am"
2284 # Create $m4base/Makefile.am.
2285 mkdir -p "$testdir/$m4base"
2286 (echo "## Process this file with automake to produce Makefile.in."
2292 echo "EXTRA_DIST += "`echo "$f" | sed -e 's,^m4/,,'` ;;
2295 ) > "$testdir/$m4base/Makefile.am"
2297 subdirs="$sourcebase $m4base"
2298 subdirs_with_configure_ac=""
2300 if false && test -f "$testdir"/$m4base/gettext.m4; then
2301 # Avoid stupid error message from automake:
2302 # "AM_GNU_GETTEXT used but `po' not in SUBDIRS"
2303 mkdir -p "$testdir/po"
2304 (echo "## Process this file with automake to produce Makefile.in."
2305 ) > "$testdir/po/Makefile.am"
2306 func_append subdirs " po"
2309 if test -n "$inctests"; then
2310 test -d "$testdir/$testsbase" || mkdir "$testdir/$testsbase"
2311 # Create $testsbase/Makefile.am.
2312 func_emit_tests_Makefile_am > "$testdir/$testsbase/Makefile.am"
2313 # Create $testsbase/configure.ac.
2314 (echo "# Process this file with autoconf to produce a configure script."
2315 echo "AC_INIT([dummy], [0])"
2316 echo "AC_CONFIG_AUX_DIR([../$auxdir])"
2317 echo "AM_INIT_AUTOMAKE"
2319 echo "AM_CONFIG_HEADER([config.h])"
2322 echo "AC_PROG_INSTALL"
2323 echo "AC_PROG_MAKE_SET"
2324 echo "AC_PROG_RANLIB"
2326 if grep AC_GNU_SOURCE "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
2327 echo "AC_GNU_SOURCE"
2330 if grep gl_USE_SYSTEM_EXTENSIONS "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
2331 echo "gl_USE_SYSTEM_EXTENSIONS"
2334 if grep gl_LOCK "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
2335 echo "gl_LOCK_EARLY"
2338 if test "$libtool" = true; then
2339 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
2340 echo "gl_cond_libtool=true"
2342 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
2343 echo "gl_cond_libtool=false"
2345 echo "gl_ltlibdeps="
2347 echo "gl_source_base='$testsbase'"
2348 # Wrap the set of autoconf snippets into an autoconf macro that is then
2349 # invoked. This is needed because autoconf does not support AC_REQUIRE
2351 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
2352 # but we want the AC_REQUIRE to have its normal meaning (provide one
2353 # expansion of the required macro before the current point, and only one
2355 echo "AC_DEFUN([gl_INIT], ["
2356 func_emit_initmacro_start
2357 sed_replace_build_aux='
2359 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
2360 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:../'"$auxdir"'/\2)|
2363 sed_replace_build_aux=`echo "$sed_replace_build_aux" | sed -e 1d -e 's/^ *//'`
2364 # We don't have explicit ordering constraints between the various
2365 # autoconf snippets. It's cleanest to put those of the library before
2366 # those of the tests.
2367 for module in $modules; do
2368 func_verify_nontests_module
2369 if test -n "$module"; then
2370 func_get_autoconf_snippet "$module" \
2371 | sed -e "$sed_replace_build_aux"
2374 for module in $modules; do
2375 func_verify_tests_module
2376 if test -n "$module"; then
2377 func_get_autoconf_snippet "$module" \
2378 | sed -e "$sed_replace_build_aux"
2381 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
2382 # created using libtool, because libtool already handles the dependencies.
2383 if test "$libtool" != true; then
2384 libname_upper=`echo "$libname" | tr 'a-z' 'A-Z'`
2385 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
2386 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
2387 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
2388 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
2390 func_emit_initmacro_end
2392 func_emit_initmacro_done
2396 # Usually $testsbase/config.h will be a superset of config.h. Verify this
2397 # by "merging" config.h into $testsbase/config.h; look out for gcc warnings.
2398 echo "AH_TOP([#include \"../config.h\"])"
2400 echo "AC_OUTPUT([Makefile])"
2401 ) > "$testdir/$testsbase/configure.ac"
2402 func_append subdirs " $testsbase"
2403 subdirs_with_configure_ac="$subdirs_with_configure_ac $testsbase"
2406 # Create Makefile.am.
2407 (echo "## Process this file with automake to produce Makefile.in."
2409 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
2411 echo "SUBDIRS = $subdirs"
2413 echo "ACLOCAL_AMFLAGS = -I $m4base"
2414 ) > "$testdir/Makefile.am"
2416 # Create configure.ac.
2417 (echo "# Process this file with autoconf to produce a configure script."
2418 echo "AC_INIT([dummy], [0])"
2419 if test "$auxdir" != "."; then
2420 echo "AC_CONFIG_AUX_DIR([$auxdir])"
2422 echo "AM_INIT_AUTOMAKE"
2424 echo "AM_CONFIG_HEADER([config.h])"
2427 echo "AC_PROG_INSTALL"
2428 echo "AC_PROG_MAKE_SET"
2430 echo "m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace"
2431 echo "m4_pattern_allow([^gl_ES\$])dnl a valid locale name"
2432 echo "m4_pattern_allow([^gl_LIBOBJS\$])dnl a variable"
2433 echo "m4_pattern_allow([^gl_LTLIBOBJS\$])dnl a variable"
2435 echo "AC_PROG_RANLIB"
2437 if test -n "$uses_subdirs"; then
2438 echo "AM_PROG_CC_C_O"
2441 if grep AC_GNU_SOURCE "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
2442 echo "AC_GNU_SOURCE"
2445 if grep gl_USE_SYSTEM_EXTENSIONS "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
2446 echo "gl_USE_SYSTEM_EXTENSIONS"
2449 if grep gl_LOCK "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then
2450 echo "gl_LOCK_EARLY"
2453 if test "$libtool" = true; then
2454 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
2455 echo "gl_cond_libtool=true"
2457 echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [false])"
2458 echo "gl_cond_libtool=false"
2460 echo "gl_ltlibdeps="
2462 echo "gl_source_base='$sourcebase'"
2463 # Wrap the set of autoconf snippets into an autoconf macro that is then
2464 # invoked. This is needed because autoconf does not support AC_REQUIRE
2466 # error: AC_REQUIRE(gt_CSHARPCOMP): cannot be used outside of an AC_DEFUN'd macro
2467 # but we want the AC_REQUIRE to have its normal meaning (provide one
2468 # expansion of the required macro before the current point, and only one
2470 echo "AC_DEFUN([gl_INIT], ["
2471 func_emit_initmacro_start
2472 if test "$auxdir" != "build-aux"; then
2473 sed_replace_build_aux='
2475 /AC_CONFIG_FILES(.*:build-aux\/.*)/{
2476 s|AC_CONFIG_FILES(\(.*\):build-aux/\(.*\))|AC_CONFIG_FILES(\1:'"$auxdir"'/\2)|
2479 sed_replace_build_aux=`echo "$sed_replace_build_aux" | sed -e 1d -e 's/^ *//'`
2481 sed_replace_build_aux=
2483 for module in $modules; do
2484 func_verify_nontests_module
2485 if test -n "$module"; then
2486 func_get_autoconf_snippet "$module" \
2487 | sed -e "$sed_replace_build_aux"
2490 # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
2491 # created using libtool, because libtool already handles the dependencies.
2492 if test "$libtool" != true; then
2493 libname_upper=`echo "$libname" | tr 'a-z' 'A-Z'`
2494 echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
2495 echo " AC_SUBST([${libname_upper}_LIBDEPS])"
2496 echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
2497 echo " AC_SUBST([${libname_upper}_LTLIBDEPS])"
2499 func_emit_initmacro_end
2501 func_emit_initmacro_done
2505 if test -n "$subdirs_with_configure_ac"; then
2506 echo "AC_CONFIG_SUBDIRS(["`echo $subdirs_with_configure_ac`"])"
2508 makefiles="Makefile"
2509 for d in $subdirs; do
2510 # For subdirs that have a configure.ac by their own, it's the subdir's
2511 # configure.ac which creates the subdir's Makefile.am, not this one.
2512 case " $subdirs_with_configure_ac " in
2514 *) func_append makefiles " $d/Makefile" ;;
2517 echo "AC_OUTPUT([$makefiles])"
2518 ) > "$testdir/configure.ac"
2520 # Create autogenerated files.
2522 # Do not use "${AUTORECONF} --force --install", because it may invoke
2523 # autopoint, which brings in older versions of some of our .m4 files.
2524 if test -f $m4base/gettext.m4; then
2525 echo "executing ${AUTOPOINT} --force"
2526 ${AUTOPOINT} --force || func_exit 1
2527 for f in $m4base/*.m4~; do
2528 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
2531 echo "executing ${ACLOCAL} -I $m4base"
2532 ${ACLOCAL} -I $m4base || func_exit 1
2533 if ! test -d build-aux; then
2534 echo "executing mkdir build-aux"
2535 mkdir build-aux || func_exit 1
2537 echo "executing ${AUTOCONF}"
2538 ${AUTOCONF} || func_exit 1
2539 echo "executing ${AUTOHEADER}"
2540 ${AUTOHEADER} || func_exit 1
2541 echo "executing ${AUTOMAKE} --add-missing --copy"
2542 ${AUTOMAKE} --add-missing --copy || func_exit 1
2544 if test -n "$inctests"; then
2545 # Create autogenerated files.
2546 (cd "$testdir/$testsbase" || func_exit 1
2547 # Do not use "${AUTORECONF} --force --install", because it may invoke
2548 # autopoint, which brings in older versions of some of our .m4 files.
2549 if test -f ../$m4base/gettext.m4; then
2550 echo "executing ${AUTOPOINT} --force"
2551 ${AUTOPOINT} --force || func_exit 1
2552 for f in ../$m4base/*.m4~; do
2553 mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
2556 echo "executing ${ACLOCAL} -I ../$m4base"
2557 ${ACLOCAL} -I ../$m4base || func_exit 1
2558 if ! test -d ../build-aux; then
2559 echo "executing mkdir ../build-aux"
2562 echo "executing ${AUTOCONF}"
2563 ${AUTOCONF} || func_exit 1
2564 echo "executing ${AUTOHEADER}"
2565 ${AUTOHEADER} || func_exit 1
2566 echo "executing ${AUTOMAKE} --add-missing --copy"
2567 ${AUTOMAKE} --add-missing --copy || func_exit 1
2570 if grep '^BUILT_SOURCES *+=' "$testdir/$sourcebase/Makefile.am" > /dev/null; then
2572 ./configure || func_exit 1
2574 echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
2575 make built_sources || func_exit 1
2577 make distclean || func_exit 1
2582 # func_create_megatestdir megatestdir allmodules
2584 # - local_gnulib_dir from --local-dir
2585 # - auxdir directory relative to destdir where to place build aux files
2586 func_create_megatestdir ()
2590 if test -z "$allmodules"; then
2591 allmodules=`func_all_modules`
2595 # First, all modules one by one.
2596 for onemodule in $allmodules; do
2597 func_create_testdir "$megatestdir/$onemodule" $onemodule
2598 func_append megasubdirs "$onemodule "
2600 # Then, all modules all together.
2601 # Except config-h, which breaks all modules which use HAVE_CONFIG_H.
2602 # Except fnmatch-posix, which conflicts with fnmatch-gnu. FIXME.
2603 allmodules=`for m in $allmodules; do if test $m != config-h && test $m != fnmatch-posix; then echo $m; fi; done`
2604 func_create_testdir "$megatestdir/ALL" "$allmodules"
2605 func_append megasubdirs "ALL"
2607 # Create Makefile.am.
2608 (echo "## Process this file with automake to produce Makefile.in."
2610 echo "AUTOMAKE_OPTIONS = 1.5 foreign"
2612 echo "SUBDIRS = $megasubdirs"
2613 ) > "$megatestdir/Makefile.am"
2615 # Create configure.ac.
2616 (echo "# Process this file with autoconf to produce a configure script."
2617 echo "AC_INIT([dummy], [0])"
2618 if test "$auxdir" != "."; then
2619 echo "AC_CONFIG_AUX_DIR([$auxdir])"
2621 echo "AM_INIT_AUTOMAKE"
2623 echo "AC_PROG_MAKE_SET"
2625 echo "AC_CONFIG_SUBDIRS([$megasubdirs])"
2626 echo "AC_OUTPUT([Makefile])"
2627 ) > "$megatestdir/configure.ac"
2629 # Create autogenerated files.
2631 # Do not use "${AUTORECONF} --install", because autoreconf operates
2632 # recursively, but the subdirectories are already finished, therefore
2633 # calling autoreconf here would only waste lots of CPU time.
2634 echo "executing ${ACLOCAL}"
2635 ${ACLOCAL} || func_exit 1
2636 echo "executing mkdir build-aux"
2638 echo "executing ${AUTOCONF}"
2639 ${AUTOCONF} || func_exit 1
2640 echo "executing ${AUTOMAKE} --add-missing --copy"
2641 ${AUTOMAKE} --add-missing --copy || func_exit 1
2647 func_fatal_error "no mode specified" ;;
2656 if test -z "$destdir"; then
2659 test -d "$destdir" \
2660 || func_fatal_error "destination directory does not exist: $destdir"
2662 # Prefer configure.ac to configure.in.
2663 if test -f "$destdir"/configure.ac; then
2664 configure_ac="$destdir/configure.ac"
2666 if test -f "$destdir"/configure.in; then
2667 configure_ac="$destdir/configure.in"
2669 func_fatal_error "cannot find $destdir/configure.ac"
2673 # Analyze configure.ac.
2675 guessed_libtool=false
2680 /AC_CONFIG_AUX_DIR/ {
2681 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^])]*\).*$,guessed_auxdir="\1",p
2683 /A[CM]_PROG_LIBTOOL/ {
2684 s,^.*$,guessed_libtool=true,p
2686 eval `sed -n -e "$my_sed_traces" < "$configure_ac"`
2688 if test -z "$auxdir"; then
2689 auxdir="$guessed_auxdir"
2692 # Determine where to apply func_import.
2693 if test -n "$m4base"; then
2694 # Apply func_import to a particular gnulib directory.
2695 # Any number of additional modules can be given.
2696 if test ! -f "$destdir/$m4base"/gnulib-cache.m4; then
2697 # First use of gnulib in the given m4base.
2698 test -n "$supplied_libname" || supplied_libname=true
2699 test -n "$sourcebase" || sourcebase="lib"
2700 test -n "$docbase" || docbase="doc"
2701 test -n "$testsbase" || testsbase="tests"
2702 test -n "$macro_prefix" || macro_prefix="gl"
2706 # Apply func_import to all gnulib directories.
2707 # To get this list of directories, look at Makefile.am. (Not at
2708 # configure, because it may be omitted from CVS. Also, don't run
2709 # "find $destdir -name gnulib-cache.m4", as it might be too expensive.)
2712 if test -f "$destdir"/Makefile.am; then
2713 aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[ ]*=' "$destdir"/Makefile.am | sed -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/'`
2715 for arg in $aclocal_amflags; do
2716 if test -n "$m4dir_is_next"; then
2717 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
2721 if test -f "$destdir/$arg"/gnulib-cache.m4; then
2722 func_append m4dirs " $arg"
2723 m4dirs_count=`expr $m4dirs_count + 1`
2728 if test "X$arg" = "X-I"; then
2736 # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
2737 if test -f "$destdir"/aclocal.m4; then
2738 sedexpr1='s,^m4_include(\[\(.*\)])$,\1,p'
2739 sedexpr2='s,^[^/]*$,.,'
2740 sedexpr3='s,/[^/]*$,,'
2741 m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
2742 m4dirs_count=`echo "$m4dirs" | wc -l`
2745 if test $m4dirs_count = 0; then
2746 # First use of gnulib in a package.
2747 # Any number of additional modules can be given.
2748 test -n "$supplied_libname" || supplied_libname=true
2749 test -n "$sourcebase" || sourcebase="lib"
2751 test -n "$docbase" || docbase="doc"
2752 test -n "$testsbase" || testsbase="tests"
2753 test -n "$macro_prefix" || macro_prefix="gl"
2756 if test $m4dirs_count = 1; then
2757 # There's only one use of gnulib here. Assume the user means it.
2758 # Any number of additional modules can be given.
2759 for m4base in $m4dirs; do
2763 # Ambiguous - guess what the user meant.
2764 if test $# = 0; then
2765 # No further arguments. Guess the user wants to update all of them.
2766 for m4base in $m4dirs; do
2767 # Perform func_import in a subshell, so that variable values
2769 # local_gnulib_dir, avoidlist, sourcebase, m4base, docbase,
2770 # testsbase, libname, lgpl, makefile_name, libtool, macro_prefix
2771 # don't propagate from one directory to another.
2772 (func_import) || func_exit 1
2776 func_fatal_error "Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
2784 if test -z "$destdir"; then
2785 func_fatal_error "please specify --dir option"
2788 test -d "$destdir" \
2789 || func_fatal_error "could not create destination directory"
2790 test -n "$auxdir" || auxdir="build-aux"
2791 func_create_testdir "$destdir" "$*"
2794 create-megatestdir )
2795 if test -z "$destdir"; then
2796 func_fatal_error "please specify --dir option"
2798 mkdir "$destdir" || func_fatal_error "could not create destination directory"
2799 test -n "$auxdir" || auxdir="build-aux"
2800 func_create_megatestdir "$destdir" "$*"
2804 test -n "$destdir" || destdir=testdir$$
2805 mkdir "$destdir" || func_fatal_error "could not create destination directory"
2806 test -n "$auxdir" || auxdir="build-aux"
2807 func_create_testdir "$destdir" "$*"
2811 ../configure || func_exit 1
2813 make check || func_exit 1
2814 make distclean || func_exit 1
2815 remaining=`find . -type f -print`
2816 if test -n "$remaining"; then
2817 echo "Remaining files:" $remaining 1>&2
2818 echo "gnulib-tool: *** Stop." 1>&2
2827 test -n "$destdir" || destdir=testdir$$
2828 mkdir "$destdir" || func_fatal_error "could not create destination directory"
2829 test -n "$auxdir" || auxdir="build-aux"
2830 func_create_megatestdir "$destdir" "$*"
2838 remaining=`find . -type f -print`
2839 if test -n "$remaining"; then
2840 echo "Remaining files:" $remaining 1>&2
2841 echo "gnulib-tool: *** Stop." 1>&2
2849 extract-description )
2853 if test -n "$module"; then
2854 func_get_description "$module"
2863 if test -n "$module"; then
2864 func_get_filelist "$module"
2869 extract-dependencies )
2873 if test -n "$module"; then
2874 func_get_dependencies "$module"
2879 extract-autoconf-snippet )
2883 if test -n "$module"; then
2884 func_get_autoconf_snippet "$module"
2889 extract-automake-snippet )
2893 if test -n "$module"; then
2894 func_get_automake_snippet "$module"
2899 extract-include-directive )
2903 if test -n "$module"; then
2904 func_get_include_directive "$module"
2913 if test -n "$module"; then
2914 func_get_license "$module"
2919 extract-maintainer )
2923 if test -n "$module"; then
2924 func_get_maintainer "$module"
2929 extract-tests-module )
2933 if test -n "$module"; then
2934 func_get_tests_module "$module"
2940 func_fatal_error "unknown operation mode --$mode" ;;
2944 # Undo the effect of the previous 'trap' command. Some shellology:
2945 # We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
2946 # execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
2947 # exit); for the others we need to call 'exit' explicitly. The value of $? is
2948 # 128 + signal number and is set before the trap-registered command is run.
2950 trap 'func_exit $?' 1 2 3 13 15
2955 # indent-tabs-mode: nil
2956 # whitespace-check-buffer-indent: nil