libtool: Using libtool
1
1 3 Using libtool
1 ***************
1
1 It makes little sense to talk about using libtool in your own packages
1 until you have seen how it makes your life simpler. The examples in
1 this chapter introduce the main features of libtool by comparing the
1 standard library building procedure to libtool's operation on two
1 different platforms:
1
1 'a23'
1 An Ultrix 4.2 platform with only static libraries.
1
1 'burger'
1 A NetBSD/i386 1.2 platform with shared libraries.
1
1 You can follow these examples on your own platform, using the
11 preconfigured libtool script that was installed with libtool (⇒
Configuring).
1
1 Source files for the following examples are taken from the 'demo'
1 subdirectory of the libtool distribution. Assume that we are building a
1 library, 'libhello', out of the files 'foo.c' and 'hello.c'.
1
1 Note that the 'foo.c' source file uses the 'cos' math library
1 function, which is usually found in the standalone math library, and not
1 the C library (⇒Trigonometric Functions (libc)Trig Functions.).
1 So, we need to add '-lm' to the end of the link line whenever we link
11 'foo.lo' into an executable or a library (⇒Inter-library
dependencies).
1
1 The same rule applies whenever you use functions that don't appear in
1 the standard C library... you need to add the appropriate '-lNAME' flag
1 to the end of the link line when you link against those objects.
1
1 After we have built that library, we want to create a program by
1 linking 'main.o' against 'libhello'.
1
Menu