annotate doc/gnulib-tool.texi @ 8276:0ead70460e39

Followup to the 2007-02-12 patch, using suggestions from Bruno Haible in <http://lists.gnu.org/archive/html/bug-gnulib/2007-02/msg00136.html>. * doc/gnulib-tool.texi (Initial import): Mention _FILE_OFFSET_BITS as another example. * lib/time_.h: Fix misspelling. * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Require gl_HEADER_TIME_H_DEFAULTS. * m4/strptime.m4 (gl_FUNC_STRPTIME): Likewise. * m4/time_r.m4 (gl_TIME_R): Likewise. * m4/timegm.m4 (gl_FUNC_TIMEGM): Likewise.
author Paul Eggert <eggert@cs.ucla.edu>
date Thu, 01 Mar 2007 21:24:55 +0000
parents a9c102ecab15
children 5aa192831f07
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 @node Invoking gnulib-tool
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 @chapter Invoking gnulib-tool
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
4 @c Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
7139
adb21c293305 Add copyright notices to long-enough files that lack them, since
Paul Eggert <eggert@cs.ucla.edu>
parents: 7077
diff changeset
5
adb21c293305 Add copyright notices to long-enough files that lack them, since
Paul Eggert <eggert@cs.ucla.edu>
parents: 7077
diff changeset
6 @c Permission is granted to copy, distribute and/or modify this document
adb21c293305 Add copyright notices to long-enough files that lack them, since
Paul Eggert <eggert@cs.ucla.edu>
parents: 7077
diff changeset
7 @c under the terms of the GNU Free Documentation License, Version 1.2 or
adb21c293305 Add copyright notices to long-enough files that lack them, since
Paul Eggert <eggert@cs.ucla.edu>
parents: 7077
diff changeset
8 @c any later version published by the Free Software Foundation; with no
adb21c293305 Add copyright notices to long-enough files that lack them, since
Paul Eggert <eggert@cs.ucla.edu>
parents: 7077
diff changeset
9 @c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
adb21c293305 Add copyright notices to long-enough files that lack them, since
Paul Eggert <eggert@cs.ucla.edu>
parents: 7077
diff changeset
10 @c Texts. A copy of the license is included in the ``GNU Free
adb21c293305 Add copyright notices to long-enough files that lack them, since
Paul Eggert <eggert@cs.ucla.edu>
parents: 7077
diff changeset
11 @c Documentation License'' file as part of this distribution.
adb21c293305 Add copyright notices to long-enough files that lack them, since
Paul Eggert <eggert@cs.ucla.edu>
parents: 7077
diff changeset
12
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 @pindex gnulib-tool
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 @cindex invoking @command{gnulib-tool}
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15
6842
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
16 The @command{gnulib-tool} command is the recommended way to import
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
17 Gnulib modules. It is possible to borrow Gnulib modules in a package
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
18 without using @command{gnulib-tool}, relying only on the
6945
aa195d9ecb02 * functions.texi, gnulib-tool.texi, gnulib.texi: Fix some typos.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 6842
diff changeset
19 meta-information stored in the @file{modules/*} files, but with a
6842
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
20 growing number of modules this becomes tedious. @command{gnulib-tool}
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
21 simplifies the management of source files, @file{Makefile.am}s and
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
22 @file{configure.ac} in packages incorporating Gnulib modules.
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
6842
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
24 Run @samp{gnulib-tool --help} for information. To get familiar with
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
25 @command{gnulib-tool} without affecting your sources, you can also try
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
26 some commands with the option @samp{--dry-run}; then
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
27 @code{gnulib-tool} will only report which actions it would perform in
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
28 a real run without changing anything.
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 @menu
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 * Initial import:: First import of Gnulib modules.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 * Modified imports:: Changing the import specification.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 * Simple update:: Tracking Gnulib development.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 * CVS Issues:: Integration with CVS.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 @end menu
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 @node Initial import
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 @section Initial import
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 @cindex initial import
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 Gnulib assumes your project uses Autoconf and Automake. Invoking
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 @samp{gnulib-tool --import} will copy source files, create a
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 @file{Makefile.am} to build them, generate a file @file{gnulib-comp.m4} with
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 Autoconf M4 macro declarations used by @file{configure.ac}, and generate
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 a file @file{gnulib-cache.m4} containing the cached specification of how
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 Gnulib is used.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 Our example will be a library that uses Autoconf, Automake and
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 Libtool. It calls @code{strdup}, and you wish to use gnulib to make
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
51 the package portable to C89 and C99 (which don't have @code{strdup}).
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 @example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 ~/src/libfoo$ gnulib-tool --import strdup
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 Module list with included dependencies:
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
56 absolute-header
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
57 extensions
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 strdup
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
59 string
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 File list:
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
61 lib/dummy.c
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 lib/strdup.c
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
63 lib/string_.h
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
64 m4/absolute-header.m4
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
65 m4/extensions.m4
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
66 m4/gnulib-common.m4
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 m4/strdup.m4
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
68 m4/string_h.m4
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
69 Creating directory ./lib
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
70 Creating directory ./m4
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
71 Copying file lib/dummy.c
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 Copying file lib/strdup.c
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
73 Copying file lib/string_.h
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
74 Copying file m4/absolute-header.m4
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
75 Copying file m4/extensions.m4
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
76 Copying file m4/gnulib-common.m4
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
77 Copying file m4/gnulib-tool.m4
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 Copying file m4/strdup.m4
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
79 Copying file m4/string_h.m4
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 Creating lib/Makefile.am
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 Creating m4/gnulib-cache.m4
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82 Creating m4/gnulib-comp.m4
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83 Finished.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
84
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 You may need to add #include directives for the following .h files.
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
86 #include <string.h>
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 Don't forget to
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 - add "lib/Makefile" to AC_CONFIG_FILES in ./configure.ac,
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 - mention "lib" in SUBDIRS in Makefile.am,
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 - mention "-I m4" in ACLOCAL_AMFLAGS in Makefile.am,
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 - invoke gl_EARLY in ./configure.ac, right after AC_PROG_CC,
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 - invoke gl_INIT in ./configure.ac.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 ~/src/libfoo$
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 @end example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 By default, the source code is copied into @file{lib/} and the M4
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98 macros in @file{m4/}. You can override these paths by using
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 @code{--source-base=DIRECTORY} and @code{--m4-base=DIRECTORY}. Some
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 modules also provide other files necessary for building. These files
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 are copied into the directory specified by @samp{AC_CONFIG_AUX_DIR} in
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102 @file{configure.ac} or by the @code{--aux-dir=DIRECTORY} option. If
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 neither is specified, the current directory is assumed.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 @code{gnulib-tool} can make symbolic links instead of copying the
7460
b82874ef9c54 Emphasize the drawbacks of the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7139
diff changeset
106 source files. The option to specify for this is @samp{--symlink}, or
b82874ef9c54 Emphasize the drawbacks of the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7139
diff changeset
107 @samp{-s} for short. This can be useful to save a few kilobytes of disk
b82874ef9c54 Emphasize the drawbacks of the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7139
diff changeset
108 space. But it is likely to introduce bugs when @code{gnulib} is updated;
b82874ef9c54 Emphasize the drawbacks of the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7139
diff changeset
109 it is more reliable to use @samp{gnulib-tool --update} (see below)
b82874ef9c54 Emphasize the drawbacks of the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7139
diff changeset
110 to update to newer versions of @code{gnulib}. Furthermore it requires
b82874ef9c54 Emphasize the drawbacks of the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7139
diff changeset
111 extra effort to create self-contained tarballs, and it may disturb some
b82874ef9c54 Emphasize the drawbacks of the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7139
diff changeset
112 mechanism the maintainer applies to the sources. For these reasons,
b82874ef9c54 Emphasize the drawbacks of the --symlink option.
Bruno Haible <bruno@clisp.org>
parents: 7139
diff changeset
113 this option is generally discouraged.
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115 @code{gnulib-tool} will overwrite any pre-existing files, in
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116 particular @file{Makefile.am}. Unfortunately, separating the
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 generated @file{Makefile.am} content (for building the gnulib library)
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 into a separate file, say @file{gnulib.mk}, that could be included
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
119 by your handwritten @file{Makefile.am} is not possible, due to how
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 variable assignments are handled by Automake.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122 Consequently, it is a good idea to choose directories that are not
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123 already used by your projects, to separate gnulib imported files from
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 your own files. This approach is also useful if you want to avoid
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125 conflicts between other tools (e.g., @code{gettextize} that also copy
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 M4 files into your package. Simon Josefsson successfully uses a source
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 base of @file{gl/}, and a M4 base of @file{gl/m4/}, in several
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 packages.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 After the @samp{--import} option on the command line comes the list of
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 Gnulib modules that you want to incorporate in your package. The names
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 of the modules coincide with the filenames in Gnulib's @file{modules/}
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 directory.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135 Some Gnulib modules depend on other Gnulib modules. @code{gnulib-tool}
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 will automatically add the needed modules as well; you need not list
6945
aa195d9ecb02 * functions.texi, gnulib-tool.texi, gnulib.texi: Fix some typos.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 6842
diff changeset
137 them explicitly. @code{gnulib-tool} will also memorize which dependent
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 modules it has added, so that when someday a dependency is dropped, the
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 implicitly added module is dropped as well (unless you have explicitly
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
140 requested that module).
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
141
6945
aa195d9ecb02 * functions.texi, gnulib-tool.texi, gnulib.texi: Fix some typos.
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents: 6842
diff changeset
142 If you want to cut a dependency, i.e., not add a module although one of
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
143 your requested modules depends on it, you may use the option
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144 @samp{--avoid=@var{module}} to do so. Multiple uses of this option are
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
145 possible. Of course, you will then need to implement the same interface
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146 as the removed module.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
147
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148 A few manual steps are required to finish the initial import.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
149 @code{gnulib-tool} printed a summary of these steps.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
150
6842
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
151 First, you must ensure Autoconf can find the macro definitions in
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
152 @file{gnulib-comp.m4}. Use the @code{ACLOCAL_AMFLAGS} specifier in
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
153 your top-level @file{Makefile.am} file, as in:
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155 @example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 ACLOCAL_AMFLAGS = -I m4
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
157 @end example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
158
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
159 You are now ready to call the M4 macros in @code{gnulib-comp.m4} from
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
160 @file{configure.ac}. The macro @code{gl_EARLY} must be called as soon
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
161 as possible after verifying that the C compiler is working.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
162 Typically, this is immediately after @code{AC_PROG_CC}, as in:
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
163
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
164 @example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
165 ...
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
166 AC_PROG_CC
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
167 gl_EARLY
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
168 ...
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
169 @end example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
170
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
171 The core part of the gnulib checks are done by the macro
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
172 @code{gl_INIT}. Place it further down in the file, typically where
6842
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
173 you normally check for header files or functions. It must come after
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
174 other checks which may affect the compiler invocation, such as
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
175 @code{AC_MINIX}. For example:
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
176
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
177 @example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
178 ...
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
179 # For gnulib.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
180 gl_INIT
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
181 ...
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
182 @end example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
183
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
184 @code{gl_INIT} will in turn call the macros related with the
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
185 gnulib functions, be it specific gnulib macros, like @code{gl_FUNC_ALLOCA}
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
186 or autoconf or automake macros like @code{AC_FUNC_ALLOCA} or
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
187 @code{AM_FUNC_GETLINE}. So there is no need to call those macros yourself
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
188 when you use the corresponding gnulib modules.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
189
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
190 You must also make sure that the gnulib library is built. Add the
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
191 @code{Makefile} in the gnulib source base directory to
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
192 @code{AC_CONFIG_FILES}, as in:
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
193
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
194 @example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
195 AC_CONFIG_FILES(... lib/Makefile ...)
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
196 @end example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
197
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
198 You must also make sure that @code{make} will recurse into the gnulib
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
199 directory. To achieve this, add the gnulib source base directory to a
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
200 @code{SUBDIRS} Makefile.am statement, as in:
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
201
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
202 @example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
203 SUBDIRS = lib
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
204 @end example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
205
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
206 or if you, more likely, already have a few entries in @code{SUBDIRS},
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
207 you can add something like:
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
208
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
209 @example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
210 SUBDIRS += lib
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
211 @end example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
212
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
213 Finally, you have to add compiler and linker flags in the appropriate
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
214 source directories, so that you can make use of the gnulib library.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
215 Since some modules (@samp{getopt}, for example) may copy files into
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
216 the build directory, @file{top_builddir/lib} is needed as well
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
217 as @file{top_srcdir/lib}. For example:
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
218
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
219 @example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
220 ...
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
221 AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_builddir)/lib
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
222 ...
6842
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
223 LDADD = lib/libgnu.a
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
224 ...
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
225 @end example
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
226
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
227 Don't forget to @code{#include} the various header files. In this
7944
a1d177cd9523 * doc/gnulib-tool.texi (Initial import): Update to match current
Paul Eggert <eggert@cs.ucla.edu>
parents: 7460
diff changeset
228 example, you would need to make sure that @samp{#include <string.h>}
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229 is evaluated when compiling all source code files, that want to make
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
230 use of @code{strdup}.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
231
8146
b31580167c2b New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents: 7944
diff changeset
232 In the usual case where Autoconf is creating a @file{config.h} file,
b31580167c2b New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents: 7944
diff changeset
233 you should include @file{config.h} first, before any other include
b31580167c2b New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents: 7944
diff changeset
234 file. That way, for example, if @file{config.h} defines
8276
0ead70460e39 Followup to the 2007-02-12 patch, using suggestions from Bruno Haible in
Paul Eggert <eggert@cs.ucla.edu>
parents: 8225
diff changeset
235 @samp{restrict} to be the empty string on a pre-C99 host, or a macro
0ead70460e39 Followup to the 2007-02-12 patch, using suggestions from Bruno Haible in
Paul Eggert <eggert@cs.ucla.edu>
parents: 8225
diff changeset
236 like @samp{_FILE_OFFSET_BITS} that affects the layout of data
0ead70460e39 Followup to the 2007-02-12 patch, using suggestions from Bruno Haible in
Paul Eggert <eggert@cs.ucla.edu>
parents: 8225
diff changeset
237 structures, the definition is consistent for all include files.
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
238
8146
b31580167c2b New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents: 7944
diff changeset
239 You should include Gnulib-provided headers before system headers,
b31580167c2b New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents: 7944
diff changeset
240 so that Gnulib-provided headers can adjust how a system header
b31580167c2b New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents: 7944
diff changeset
241 behaves.
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
242
6842
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
243 A final word of warning: Gnulib currently assumes it will be
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
244 responsible for @emph{all} functions that end up in the Autoconf
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
245 @code{@@LIBOBJS@@} variables (and/or @code{@@LTLIBOBJS@@} if using
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
246 Libtool), e.g., those specified in @code{AC_REPLACE_FUNCS} in your
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
247 @file{configure.ac}. Therefore, if you have any functions which are
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
248 not covered by Gnulib which need that treatment, you have to
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
249 essentially reimplement AC_REPLACE_FUNCS using different names; for an
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
250 example, see the Findutils sources. Perhaps this will be improved in
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
251 the future.
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
252
1b6de7675435 mention that Gnulib takes over LIBOBJS
Karl Berry <karl@freefriends.org>
parents: 6724
diff changeset
253
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
254 @node Modified imports
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
255 @section Modified imports
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
256
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
257 You can at any moment decide to use Gnulib differently than the last time.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
258
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
259 If you only want to use more Gnulib modules, simply invoke
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
260 @command{gnulib-tool --import @var{new-modules}}. @code{gnulib-tool}
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
261 remembers which modules were used last time. The list of modules that
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
262 you pass after @samp{--import} is @emph{added} to the previous list of
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
263 modules.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
264
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
265 For most changes, such as added or removed modules, or even different
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
266 choices of @samp{--lib}, @samp{--source-base} or @samp{--aux-dir}, there
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
267 are two ways to perform the change.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
268
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
269 The standard way is to modify manually the file @file{gnulib-cache.m4}
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
270 in the M4 macros directory, then launch @samp{gnulib-tool --import}.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
271
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
272 The other way is to call @command{gnulib-tool} again, with the changed
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
273 command-line options. Note that this doesn't let you remove modules,
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
274 because as you just learned, the list of modules is always cumulated.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
275 Also this way is often impractical, because you don't remember the way
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
276 you invoked @code{gnulib-tool} last time.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
277
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
278 The only change for which this doesn't work is a change of the
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
279 @samp{--m4-base} directory. Because, when you pass a different value of
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
280 @samp{--m4-base}, @code{gnulib-tool} will not find the previous
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
281 @file{gnulib-cache.m4} file any more... A possible solution is to manually
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
282 copy the @file{gnulib-cache.m4} into the new M4 macro directory.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
283
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
284 In the @file{gnulib-cache.m4}, the macros have the following meaning:
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
285 @table @code
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
286 @item gl_MODULES
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
287 The argument is a space separated list of the requested modules, not including
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
288 dependencies.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
289
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
290 @item gl_AVOID
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
291 The argument is a space separated list of modules that should not be used,
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
292 even if they occur as dependencies. Corresponds to the @samp{--avoid}
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
293 command line argument.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
294
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
295 @item gl_SOURCE_BASE
6724
68cc9b819542 * gnulib-tool.texi (Modified imports): pathname -> file name.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6255
diff changeset
296 The argument is the relative file name of the directory containing the gnulib
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
297 source files (mostly *.c and *.h files). Corresponds to the
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
298 @samp{--source-base} command line argument.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
299
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
300 @item gl_M4_BASE
6724
68cc9b819542 * gnulib-tool.texi (Modified imports): pathname -> file name.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6255
diff changeset
301 The argument is the relative file name of the directory containing the gnulib
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
302 M4 macros (*.m4 files). Corresponds to the @samp{--m4-base} command line
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
303 argument.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
304
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
305 @item gl_TESTS_BASE
6724
68cc9b819542 * gnulib-tool.texi (Modified imports): pathname -> file name.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6255
diff changeset
306 The argument is the relative file name of the directory containing the gnulib
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
307 unit test files. Corresponds to the @samp{--tests-base} command line argument.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
308
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
309 @item gl_LIB
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
310 The argument is the name of the library to be created. Corresponds to the
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
311 @samp{--lib} command line argument.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
312
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
313 @item gl_LGPL
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
314 The presence of this macro corresponds to the @samp{--lgpl} command line
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
315 argument. It takes no arguments.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
316
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
317 @item gl_LIBTOOL
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
318 The presence of this macro corresponds to the @samp{--libtool} command line
7077
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 6945
diff changeset
319 argument and to the absence of the @samp{--no-libtool} command line argument.
c2122624e8ed New option --no-libtool.
Bruno Haible <bruno@clisp.org>
parents: 6945
diff changeset
320 It takes no arguments.
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
321
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
322 @item gl_MACRO_PREFIX
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
323 The argument is the prefix to use for macros in the @file{gnulib-comp.m4}
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
324 file. Corresponds to the @samp{--macro-prefix} command line argument.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
325 @end table
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
326
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
327 @node Simple update
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
328 @section Simple update
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
329
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
330 When you want to update to a more recent version of Gnulib, without
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
331 changing the list of modules or other parameters, a simple call
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
332 does it:
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
333
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
334 @smallexample
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
335 $ gnulib-tool --import
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
336 @end smallexample
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
337
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
338 This will create, update or remove files, as needed.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
339
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
340 @node CVS Issues
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
341 @section CVS Issues
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
342
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
343 All files created by @code{gnulib-tool}, except @file{gnulib-cache.m4},
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
344 should be treated like generated source files, like for example a
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
345 @file{parser.c} file is generated from @file{parser.y}.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
346
8225
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
347 @itemize
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
348
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
349 @item
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
350 In projects which commit all source files, whether generated or not, into
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
351 CVS, the @code{gnulib-tool} generated files should all be committed.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
352
8225
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
353 Gnulib also contains files generated by @command{make} (and removed by
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
354 @code{make clean}, using information determined by @command{configure}
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
355 They should not be checked into CVS, but instead added to
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
356 @file{.cvsignore}. When you have a Gnulib source file of the form
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
357 @file{lib/foo_.h}, the corresponding @file{lib/foo.h} is such a file.
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
358
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
359
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
360 @item
6255
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
361 In projects which customarily omit from the CVS all files that generated
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
362 from other source files, all these files and directories would not be
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
363 added into CVS. The only file that must be added to CVS is
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
364 @file{gnulib-cache.m4} in the M4 macros directory. Also, the script for
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
365 restoring files not in CVS, customarily called @file{autogen.sh} or
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
366 @file{bootstrap.sh}, will typically contain the statement for restoring
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
367 the omitted files:
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
368
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
369 @smallexample
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
370 $ gnulib-tool --update
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
371 @end smallexample
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
372
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
373 The @samp{--update} option operates much like the @samp{--import} option,
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
374 but it does not offer the possibility to change the way Gnulib is used.
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
375 Also it does not report in the ChangeLogs the files that it had to add
049aab67c353 Documentation of gnulib-tool.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
376 because they were missing.
8225
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
377
a9c102ecab15 if have foo_.h, cvs-ignore foo.h
Karl Berry <karl@freefriends.org>
parents: 8146
diff changeset
378 @end itemize