OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / gnumaniak / original / man1 / libtool.1
1 .\" You may copy, distribute and modify under the terms of the LDP General
2 .\" Public License as specified in the LICENSE file that comes with the
3 .\" gnumaniak distribution
4 .\"
5 .\" The author kindly requests that no comments regarding the "better"
6 .\" suitability or up-to-date notices of any info documentation alternative
7 .\" is added without contacting him first.
8 .\"
9 .\" (C) 1999-2002 Ragnar Hojland Espinosa <ragnar@ragnar-hojland.com>
10 .\"
11 .\"     libtool man page
12 .\"     man pages are NOT obsolete!
13 .\"     <ragnar@ragnar-hojland.com>
14 .TH LIBTOOL 301 "June 2002" "libtool 1.4.2"
15 .SH NAME
16 \fBlibtool\fR \- compile, build, install and uninstall libraries
17 .SH SYNOPSIS
18 .B libtool
19 .RB [ \-n ]
20 .RB [ \-\-config ]
21 .RB [ \-\-debug ]
22 .RB [ \-\-dry\-run ]
23 .RB [ \-\-features ]
24 .RB [ \-\-finish ]
25 .RB [ \-\-mode=\fIMODE ]
26 .RB [ \-\-quiet ] 
27 .RB [ \-\-silent ]
28 .RI [ MODE\-ARGS... ]
29
30 Link Mode: [\fB\-l\fINAME\fR] [\fB\-o \fI OUTPUT\-FILE\fR] [\fB\-L\fILIBDIR\fR]
31 [\fB\-R \fILIBDIR\fR]
32 .RB [ \-all\-static ]
33 .RB [ \-avoid\-version ]
34 .RB [ "\-dlopen \fIFILE" ]
35 .RB [ "\-dlpreopen \fIFILE" ]
36 .RB [ \-export\-dynamic ]
37 .RB [ "\-\-export\-symbols \fIFILE" ]
38 .RB [ "\-\-export\-symbols \fIREGEX" ]
39 .RB [ \-\-module ]
40 .RB [ \-no\-undefined ]
41 .RB [ "\-release \fIRELEASE" ]
42 .RB [ "\-rpath \fILIBDIR" ]
43 .RB [ \-static ]
44 .RB [ "\-version\-info \fICURRENT\fR[\fB:\fIREVISION\fR[\fB:\fIAGE" ]]
45
46 Execute Mode: [\fB\-dlopen \fIFILE\fR]
47
48 .BR libtool " [" \-\-features "] [" \-\-help "] [" \-\-version ]
49 .SH DESCRIPTION
50 .B libtool
51 simplifies the complexity of compiling, linking, installing and unistalling
52 both static and shared libraries so that the complete functionality of
53 different platforms is available via a generic interface but nasty quirks
54 are hidden from the programmer.
55
56 .B libtool
57 can operate in six modes: compile, execute, link, finish, install, uninstall.
58 .SS Compile Mode
59 For \fBcompile\fR mode, \fIMODE\-ARGS\fR is a compiler command to be used in
60 creating a standard object file.  These arguments should begin with
61 the name of the C compiler, and contain the \fB\-c\fR compiler flag so that
62 only an object file is created.
63
64 \fBlibtool\fR determines the name of the output file by removing the
65 directory component from the source file name, then substituting the C
66 source code suffix `.c' with the library object suffix, `.lo'.
67
68 If shared libraries are being built, any necessary PIC generation
69 flags are substituted into the compilation command.  The \fB\-static\fR
70 option will cause \fBlibtool\fR to generate `.o' files even if it was
71 configured with \fB\-\-disable\-static\fR
72
73 The \fB\-o\fR option is emulated on platforms that don't support it directly
74 (by locking and moving the object files generated by the compiler) so you
75 can use the usual syntax:
76 .sp
77 .RS
78 .nf
79 lightside:% libtool cc -c foo/x.c -o foo/x.lo
80 .fi
81 .RE
82 .sp
83 If the platform doesn't support \fB\-c\fR and \fB\-o\fR then it is
84 impossible to build `foo/x.lo' without overwriting an old `foo/x.o', and
85 that in this case you must make sure `foo/x.o' is (re)built after `foo/x.lo'
86
87 .SS Link Mode
88 \fBlink\fR mode links together object files (including library objects)
89 to form another library or to create an executable program.
90
91 \fIMODE\-ARGS\fR consist of a command using the C compiler to create an
92 output file \fIOUTPUT\-FILE\fR (with the \fB\-o\fR flag) from several object
93 files.  The type of file depends on the extension of \fIOUTPUT\-FILE\fR:
94 .TP
95 .B .la
96 A libtool library is created, which must be built only from library objects
97 (`.lo' files).  The \fB\-rpath\fR option is required.  In the current
98 implementation, libtool libraries may not depend on other uninstalled
99 libtool libraries.
100 .TP
101 .B .a
102 A standard library is created using \fBar\fR(1) and possibly \fBranlib\fR(1).
103 .TP
104 .B .o .lo
105 A reloadable object file is created from the input files (generally using
106 `ld \-r').  This method is often called ``partial linking''.
107 .TP
108 .B other
109 An executable program is created.
110 .SS Execute Mode
111 For \fBexecute\fR mode, the library path environment variable is
112 automatically set (and modified according \fB\-dlopen\fR), then a program
113 is executed.
114
115 The first of the \fIMODE-ARGS\fR is treated as a program name, with the
116 rest as arguments to that program.
117
118 If any of the arguments are libtool executable wrappers, then they are
119 translated into the name of their corresponding uninstalled binary, and
120 any of their required library directories are added to the library path.
121 .SS Install Mode
122 In \fBinstall\fR mode, libtool interprets \fIMODE\-ARGS\fR as an installation
123 command beginning with \fBcp\fR(1), or a BSD-compatible \fBinstall\fR(1)
124 program.
125
126 The rest of the \fBMODE\-ARGS\fR are interpreted as arguments to that
127 command.
128
129 The command is run, and any necessary unprivileged post-installation
130 commands are also completed.
131 .SS Finish Mode
132 \fBfinish\fR mode helps system administrators install libtool libraries
133 so that they can be located and linked into user programs.
134
135 Each \fIMODE\-ARG\fR is interpreted as the name of a library directory.
136 Running this command may require superuser privileges, so the
137 \fB\-\-dry\-run\fR option may be useful.
138 .SS Uninstall Mode
139 This mode deletes installed libraries (and other files).
140
141 The first \fIMODE\-ARG\fR is the name of the program to use to delete files
142 (typically `/bin/rm').
143
144 The remaining \fIMODE\-ARGS\fR are either flags for the deletion program
145 (beginning with a `\-'), or the names of files to delete.
146 .SH OPTIONS
147 .SS Global Options
148 .TP
149 .B \-\-config
150 Display libtool's configuration variables and exit.
151 .TP
152 .B \-\-debug
153 Enables shell script trace mode, writing to standard output.
154 .TP
155 .B \-n, \-\-dry\-run
156 Don't create, modify, or delete any files, just show what commands
157 would be executed by \fBlibtool\fR.
158 .TP
159 .B \-\-features
160 Displays basic features regarding libtool and whether static and shared
161 library support is enabled.
162 .TP
163 .B \-\-finish
164 Same as \fB\-\-mode=finish\fR.
165 .TP
166 .B \-\-mode=\fIMODE
167 Use \fIMODE\fR as the operation mode.  By default, the
168 operation mode is inferred from the contents of \fIMODE\-ARGS\fR.
169 If \fIMODE\fR is specified, it must be one of the following:
170 .RS
171 .TP
172 .B compile
173 Compile a source file into a libtool object.
174 .TP
175 .B execute
176 Automatically set the library path so that another program
177 can use uninstalled libtool-generated programs or libraries.
178 .TP
179 .B finish
180 Complete the installation of libtool libraries on the system.
181 .TP
182 .B install
183 Install libraries or executables.
184 .TP
185 .B link
186 Create a library or an executable.
187 .TP
188 .B uninstall
189 Delete installed libraries or executables.
190 .RE
191 .TP
192 .B \-\-features
193 Display libtool configuration information and exit.  This provides
194 a way for packages to determine whether shared or static libraries will be
195 built.
196 .TP
197 .B "\-\-help"
198 Print a usage message on standard output and exit successfully.  If
199 \fB\-\-mode=\fIMODE\fR is specified, help on selected mode is printed.
200 .TP
201 .B "\-\-version"
202 Print version information on standard output then exit successfully.
203 .SS Link Mode Options
204 .TP
205 .B -l\fINAME
206 \fIOUTPUT\-FILE\fR requires the installed library \fBlib\fINAME\fR.  This
207 option is required even when \fIOUTPUT\-FILE\fR is not an executable.
208 .TP
209 .B \-o \fIOUTPUT\-FILE
210 Create \fIOUTPUT\-FILE\fR from the specified objects and libraries.
211 .TP
212 .B \-L\fILIBDIR
213 Search \fILIBDIR\fR for required libraries that have already been installed.
214 .TP
215 .B \-R \fILIBDIR
216 If \fIOUTPUT\-FILE\fR is an executable, add \fILIBDIR\fR to its run-time
217 path.  If \fIOUTPUT-FILE\fR is a library, add `-RLIBDIR' to its
218 \fBDEPENDENCY_LIBS\fR so that, whenever the library is linked into an
219 executable, \fILIBDIR\fR will be added to its run-time path.
220 .TP
221 .B \-all\-static
222 If \fIOUTPUT\-FILE\fR is a program, then do not link it against any
223 shared libraries at all.  If \fIOUTPUT-FILE\fR is a library, then only
224 create a static library.
225 .TP
226 .B \-avoid\-version
227 Tries to avoid using any kind of versioning (no version info is stored and
228 no symbolic links are created).  This option has no effect on platforms which
229 require versioning.
230 .TP
231 .B \-dlopen \fIFILE
232 Same as \fB\-dlpreopen \fIFILE\fR, if native dlopening is not
233 supported on the host platform or if the executable is linked using
234 \fB\-static\fR or \fB\-all\-static\fR.  Otherwise, no effect.
235
236 If \fIFILE\fR is `self', then libtool will make sure that the executable can
237 \fBdlopen\fR(3) itself by using \fB\-export\-dynamic\fR or \fB\-dlpreopen\fR.
238 .TP
239 .B \-dlpreopen \fIFILE
240 Link \fIFILE\fR into the output program, and add its symbols to
241 \fBLT_PRELOADED_SYMBOLS\fR.
242
243 If \fIFILE\fR is `self', then the symbols of the output program itself will
244 be added to \fBLT_PRELOADED_SYMBOLS\fR.
245 .TP
246 .B \-export\-dynamic
247 Allow symbols from \fIOUTPUT\-FILE\fR to be resolved with \fBdlsym\fR(3).
248 .TP
249 .B \-export\-symbols \fIFILE
250 On platforms which support it, the linker will only export symbols listed in
251 \fIFILE\fR.  The name of \fIFILE\fR must end in `.sym' and contain on symbol
252 per line.  By default all symbols are exported.
253 .TP
254 .B \-export\-symbols\-regex \fIREGEX
255 As \fB\-export\-symbols\fR, except that only symbols that match the
256 \fIREGEX\fR \fBregex\fR(7) are exported.
257 .TP
258 .B \-module
259 Creates a library that can be dlopened.  Module names don't need to be
260 prefixed with `lib', however in order to prevent name clashes `libname' and
261 `name' must not be used at the same time in your package.
262 .TP
263 .B \-no\-undefined
264 Declare that \fIOUTPUT\-FILE\fR does not depend on any other libraries.
265 Some platforms cannot create shared libraries that depend on other
266 libraries.
267 .TP
268 .B \-release \fIRELEASE
269 Specify that the library was generated by release \fIRELEASE\fR of your
270 package, so that users can easily tell which versions are newer
271 than others.  Be warned that no two releases of your package will
272 be binary compatible if you use this flag.  If you want binary
273 compatibility, use the \fB\-version\-info\fR flag.
274 .TP
275 .B \-rpath \fILIBDIR
276 If \fIOUTPUT\-FILE\fR is a library, it will eventually be installed in
277 \fILIBDIR\fR.
278 .TP
279 .B \-static
280 If \fIOUTPUT\-FILE\fR is a program, then do not link it against any
281 uninstalled shared libtool libraries.  If \fIOUTPUT\-FILE\fR is a
282 library, then only create a static library.
283 .TP
284 .B \-version\-info \fICURRENT\fR[\fB:\fIREVISION\fR[\fB:\fIAGE\fR]]
285 If \fIOUTPUT\-FILE\fR is a libtool library, use interface version
286 information \fICURRENT\fR, \fIREVISION\fR, and \fIAGE\fR to build it
287 Do \fBnot\fR use this flag to specify package release information, rather
288 see the \fR\-release\fB flag.
289 .SS Execute Mode Options
290 .TP
291 .B \-dlopen \fIFILE
292 Add the directory containing \fIFILE\fR to the library path.
293 .SH VERSIONING
294 .B libtool
295 has it's own versioning system for shared libraries. If you want to use this
296 system, you must use the \fB\-version\-info\fR option.  This option accepts
297 an argument of the form \fICURRENT\fR[\fB:\fIREVISION\fR[\fB:\fIAGE\fR]]
298 .TP
299 .I CURRENT
300 Interface version, understanding interface as anything visible to the
301 "outside" world: variables, function prototypes, output format, etc.
302 .TP
303 .I REVISION
304 Implementation version, relative to \fICURRENT\fR version.
305 .TP
306 .I AGE
307 The difference between the newest and oldest interfaces that this
308 library implements.  In other words, the library implements all the
309 interface numbers in the range from `\fICURRENT \- \fIAGE\fR' to
310 \fICURRENT\fR, and any executable can use the library if it has been linked
311 against a library in this range.
312 .PP
313 If either \fIREVISION\fR or \fIAGE\fR are omitted, they default to 0.  Also
314 note that \fIAGE\fR must be less than or equal to the \fICURRENT\fR
315 interface number.  If two libraries have identical \fICURRENT\fR and \fIAGE\fR
316 numbers, then the dynamic linker chooses the library with the greater
317 \fIREVISION\fR.
318
319 Some versioning guidelines:
320
321 \fB\(bu\ 1.\fR Start with version information of `0:0:0' for each libtool
322 library.
323
324 \fB\(bu\ 2.\fR Update the version information only immediately before a public
325 release of your software.  More frequent updates are unnecessary,
326 and only guarantee that the current interface number gets larger
327 faster.
328
329 \fB\(bu\ 3.\fR If the library source code has changed at all since
330 the last update, then increment \fIREVISION\fR (\fIC\fB:\fIR\fB:\fIA\fR
331 becomes \fIC\fB:\fIR+1\fB:A\fR). 
332
333 \fB\(bu\ 4.\fR If any interfaces have been added, removed, or changed since the
334 last update, increment \fICURRENT\fR, and set \fIREVISION\fR to 0.
335
336 \fB\(bu\ 5.\fR If any interfaces have been added since the last public release,
337 then increment \fIAGE\fR.
338
339 \fB\(bu\ 6.\fR If any interfaces have been removed since the last
340 public release, then set \fIAGE\fR to 0.
341
342 If you want to encode the package version in the library name, or use
343 another versioning system without conflicting with \fBlibtool\fR's
344 versioning, use \fB\-release\fR.  `libbfd.so.2.7.0.2' for example, comes with
345 binutils\-2.7.0.2 and clearly conflicts with \fBlibtool\fR's versioning.  We
346 can use `\-release 2.7.0' and end up with `libbfd\-2.7.0.so.0.0.0' which is ok.
347
348 Note that libraries with different \fICURRENT\fR version, and libraries with
349 different \fB\-release\fR, will be binary incompatible.
350 .SH INTERFACE DESIGN
351 Writing a good library interface takes practice and thorough understanding
352 of the problem that the library is intended to solve.  If you design a good
353 interface, it won't have to change often, you won't have to keep updating
354 documentation, and clients won't have to keep relearning how to use the
355 library. 
356
357 Some design guidelines:
358
359 \fB\(bu\fR Plan ahead
360 .br
361 Try to make every interface minimal, so that you won't need to delete entry
362 points very often.
363
364 \fB\(bu\fR Avoid interface changes
365 .br
366 If you must redesign an interface, try to leave compatibility functions
367 behind so that clients don't need to rewrite their existing code.
368
369 \fB\(bu\fR Use opaque data types
370 .br
371 The fewer data type definitions a client has access to, the
372 better.  If possible, design your functions to accept a generic
373 pointer (which you can cast to an internal data type), and provide
374 access functions rather than allowing the client to directly
375 manipulate the data.  That way, you have the freedom to change the
376 data structures without changing the interface. 
377
378 \fB\(bu\fR Use header files
379 .br
380 If you write each of your library's global functions and variables in
381 header files, and include them in your library source files, then the
382 compiler will let you know if you make any interface changes by
383 accident.
384
385 \fB\(bu\fR Use \fBstatic\fRs (or equivalent) whenever possible
386 .br
387 The fewer global functions your library has, the more flexibility
388 you will have in changing them.  \fBstatic\fR functions and variables may
389 change as often as you like, since clients cannot access them and therefore
390 they aren't considered interface changes.
391 .SH WRITING AUTOMAKE RULES
392 \fBlibtool\fR library support is implemented under the \fBLTLIBRARIES\fR
393 primary.
394
395 To link a program against a \fBlibtool\fR library, just use the
396 \fIprogram\fB_LDADD\fR variable to specify the library name.  You may use
397 \fIprogram\fB_LDFLAGS\fR to pass any options to libtool, such as
398 \fB\-static\fR. 
399
400 To build a \fBlibtool\fR library, use \fIlib\fB_LTLIBRARIES\fR to specify the
401 library name and \fB, and, for example, \fIlib\fB_LDFLAGS\fR to pass the
402 \fB\-version\-info\fR option to \fBlibtool\fR.  You will find an example in
403 the next section.
404
405 You will also have to include some basic files in your package, or use 
406 \fBlibtoolize\fR to do the work for you.  Do not include the \fBlibtool\fR
407 script directly.
408 .TP
409 .B config.guess
410 Attempt to guess a canonical system name.
411 .TP
412 .B config.sub
413 Canonical system name validation subroutine script.
414 .TP
415 .B ltconfig
416 Generate a libtool script for a given system.
417 .TP
418 .B ltmain.sh
419 A generic script implementing basic libtool functionality.
420 .SH DLOPENING MODULES
421 To use \fBlibtool\fR's dlopening support, you must use the macro
422 \fBAC_LIBTOOL_DLOPEN\fR in your \fBconfigure.in\fR, before
423 \fBAM_PROG_LIBTOOL\fR. Otherwise \fBlibtool\fR will assume there's no
424 dlopening mechanism available on the platform and will simulate it.
425 In order to use this simulation feature you must declare the objects you
426 want to dlopen by using the \fB\-dlopen\fR and \fB\-dlreopen\fR flags when
427 linking your executable. \fBlibtool\fR will link the object files and create
428 data structures holding the executable's symbol table:
429 .sp
430 .RS
431 .nf
432 struct lt_dlsymlist { const char *NAME; lt_ptr_t ADDRESS; }
433 .fi
434 .RE
435 .sp
436 \fINAME\fR holds an asciiz string with the symbol name, such as "fprintf".
437 \fIADDRESS\fR is a generic pointer to the appropriate object, such as
438 &fprintf.
439 .sp
440 .RS
441 .nf
442 const lt_dlsymlist * lt_preloaded_symbols;
443 .fi
444 .RE
445 .sp
446 This array represents all the preloaded symbols linked into the executable.
447 For each \fB\-dlpreloaded\fR file there is an element with the \fINAME\fR of
448 the file and a \fIADDRESS\fR of `\fB0\fR', followed by all symbols exported from
449 this file.  For the executable itself the special name \fB@PROGRAM@\fR is used.
450 The last element has a \fINAME\fR and \fIADDRESS\fR of `\fB0\fR'.
451
452
453 When linking either a library that is going to be dlopened or an executable
454 that is going to dlopen a module, remember to specify the \fB\-module\fR
455 flag.
456
457 If an executable needs to reference an external symbol of a library that you
458 are going to dlopen, use \fB\-export\-dynamic\fR when linking the executable.
459
460 Due variations in library names, your program needs to determine which is
461 the correct file to dlopen.  A straightforward approach is to examine the
462 `\fB.la\fR' files, looking for the \fBdlname='\fIDLNAME\fB'\fR line, where
463 \fBDLNAME\fR is either empty if the library can't be dlopened, or holds the
464 dlname of the library.
465
466 .SH EXAMPLES
467 We are about to create a library called `libbaz' from the source files
468 `foo.c', `bar.c', and then link `a.c' with `libbaz' to create an executable
469 named `a'
470 .SS Creating The Library
471 \fB\(bu\fR Compile mode: since Linux supports shared libraries, \fBlibtool\fR
472 will generate two object files: one for the static library (`foo.lo') and
473 one for the shared library (`foo.o').  The \fB\-c\fR option is mandatory,
474 since we don't want the compiler to do the linking on its own.
475 .sp
476 .RS
477 .nf
478 lightside:~% libtool cc \-c foo.c
479 cc \-c \-fPIC \-DPIC foo.c -o .libs/foo.lo
480 cc \-c foo.c >/dev/null 2>&1
481 lightside:~% libtool cc -c bar.c
482 cc \-c \-fPIC \-DPIC bar.c -o .libs/bar.lo
483 cc \-c bar.c >/dev/null 2>&1
484 .fi
485 .RE          
486 .sp
487 \fB\(bu\fR Link mode, build only a static library: We specify the `.o'
488 object files generated previously.  The \fB\-o\fR option is mandatory.
489 .sp
490 .RS
491 .nf
492 lightside:~% libtool cc -o libbaz.a foo.o bar.o
493 ar cru libbaz.a foo.o bar.o
494 ranlib libbaz.a
495 .fi
496 .RE          
497 .sp
498 \fB\(bu\fR Link mode, build static and shared libraries: We specify the
499 `.lo' object files.  Mandatory options are \fB\-o\fR like before, and
500 \fB\-rpath\fR to indicate which will be the installation directory for our
501 library.  The library will be created in the `.libs' directory.
502 .sp
503 .RS
504 .nf
505 lightside:~% libtool cc \-o libbaz.la foo.lo bar.lo \e
506     \-rpath /usr/local/lib
507 cc \-shared \-Wl,\-soname \-Wl,libbaz.so.0 \e
508     \-o .libs/libbaz.so.0.0.0 foo.lo bar.lo
509 (cd .libs && ln \-s libbaz.so.0.0.0 libbaz.so.0)
510 (cd .libs && ln \-s libbaz.so.0.0.0 libbaz.so)
511 ar cru .libs/libbaz.a foo.o bar.o
512 ranlib .libs/libbaz.a
513 creating libbaz.la
514 (cd .libs && ln \-s ../libbaz.la libbaz.la)
515 .fi
516 .RE          
517 .sp
518 \fB\(bu\fR Install mode: This will run the necessary commands to install the
519 library in the specified path (in our case, `/usr/local/lib').  It will
520 install the shared (`.so') and static (`.a') libraries, as well as the
521 libtool file (`.la'), for unistallation and informational purposes.
522
523 Since this is often done as a privileged user, it's useful to specify the
524 \fB\-n\fR or \fB\-\-dry\-run\fR option to check the results.
525 .sp
526 .RS
527 .nf
528 lightside:/tmp% libtool \-n install libbaz.la /usr/local/lib
529 install .libs/libbaz.so.0.0.0 /usr/local/lib/libbaz.so.0.0.0
530 (cd /usr/local/lib && ln \-s libbaz.so.0.0.0 libbaz.so.0)
531 (cd /usr/local/lib && ln \-s libbaz.so.0.0.0 libbaz.so)
532 install libbaz.la /usr/local/lib/libbaz.la
533 install .libs/libbaz.a /usr/local/lib/libbaz.a
534 ranlib /usr/local/lib/libbaz.a
535 chmod 644 /usr/local/lib/libbaz.a
536 .fi
537 .RE          
538 .sp
539 .SS Creating the Executable
540 First we compile `a.c'
541 .sp
542 .RS
543 .nf
544 cc \-c a.c
545 .fi
546 .RE          
547 .sp
548 If the library has already been installed you can proceed as usual
549 .sp
550 .RS
551 .nf
552 cc a.c \-lbaz \-L/usr/local/lib
553 .fi
554 .RE          
555 .sp
556 If the library hasn't been installed yet, \fBlibtool\fR must be used to 
557 do the linking, debugging and installation of the executable (this last thing,
558 once the library has been installed).  Note that the real executable will be
559 in `.libs' until it is installed, and the the executable on the work
560 directory is merely a wrapper.
561
562 In order to avoid ambiguities, never use \fB\-l\fR or \fB\-L\fR to link
563 against an uninstalled shared library.  Just specify the path to the `.la'
564 file.  Installed libraries aren't a problem, as we see below (`\-lm').
565 .sp
566 .RS
567 .nf
568 lightside:~% libtool cc a.o libbaz.la \-o a -lm
569 cc a.o \-Wl,\-\-rpath \-Wl,/usr/local/lib \e
570     .libs/libbaz.so \-o .libs/a -lm
571 lightside:~% libtool gdb a
572 [snipped hairy debugging session]
573 lightside:~% libtool install \-c a /usr/local/bin/a
574 install \-c .libs/a /usr/local/bin/a
575 .fi
576 .RE          
577 .sp
578 .SS Creating Makefile.am
579 \fB\(bu\fR\ First create a brief \fBconfigure.in\fR, remembering to add the
580 macros for \fBautomake\fR and \fBlibtool\fR.
581 .sp
582 .RS
583 .nf
584 AC_DEFUN(AM_INIT_AUTOMAKE)
585 AC_INIT(a.c)
586 AM_INIT_AUTOMAKE(a, 1.0)
587 AC_PROG_CC
588 AM_PROG_LIBTOOL
589 AC_OUTPUT(Makefile)
590 .fi
591 .RE
592 .sp
593 \fB\(bu\fR\ Then the corresponding \fBMakefile.am\fR
594 .sp
595 .RS
596 .nf
597 # Build the library
598 lib_LTLIBRARIES=libbaz.la
599 libbaz_la_SOURCES = foo.c bar.c
600 libbaz_la_LDFLAGS = -version-info 0:0:0
601
602 bin_PROGRAMS = a a.debug
603
604 # Build a from a.c and libbaz.la
605 a_SOURCES = a.c
606 a_LDADD = libbaz.la
607
608 # Create a static debugging version
609 a_debug_SOURCES = a.c
610 a_debug_LDADD = libbaz.la
611 a_debug_LDFLAGS = \-static
612 .fi
613 .RE
614 .sp
615 \fB\(bu\fR\ And finally give it a try
616 .sp
617 .RS
618 .nf
619 lightside:~% aclocal; libtoolize; automake \-\-add\-missing; autoconf
620 lightside:~% ./configure; make
621 .fi
622 .RE
623 .sp
624 .SH SEE ALSO
625  \fBlibtoolize\fR(1), \fBlibltdl\fR(3)
626 .SH NOTES
627 Report bugs to <bug-libtool@gnu.org>.
628 .br
629 Man page by Ragnar Hojland Espinosa <ragnar@ragnar-hojland.com>