Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | magnus | 1 | Author: Glenn McGrath <bug1@optushome.com.au> |
2 | Description: Use libtool to build dynamic library |
||
3 | |||
4 | --- a/configure.ac |
||
5 | +++ b/configure.ac |
||
6 | @@ -1,6 +1,6 @@ |
||
7 | dnl ### Normal initialization. ###################################### |
||
8 | AC_INIT([libtar], [1.2.11]) |
||
9 | -AC_PREREQ([2.57]) |
||
10 | +AC_PREREQ([2.61]) |
||
11 | AC_CONFIG_AUX_DIR([autoconf]) |
||
12 | AC_CONFIG_HEADERS([config.h]) |
||
13 | AC_COPYRIGHT([[ |
||
14 | @@ -26,15 +26,15 @@ AC_SUBST([MKDIR]) |
||
15 | |||
16 | |||
17 | dnl ### Check for compiler et al. ################################### |
||
18 | +AC_USE_SYSTEM_EXTENSIONS |
||
19 | AC_PROG_CC |
||
20 | -AC_PROG_RANLIB |
||
21 | +AC_PROG_LIBTOOL |
||
22 | AC_PROG_INSTALL |
||
23 | AC_PROG_LN_S |
||
24 | AC_PROG_MAKE_SET |
||
25 | |||
26 | |||
27 | dnl ### Compiler characteristics. ################################## |
||
28 | -AC_AIX |
||
29 | AC_C_CONST |
||
30 | |||
31 | |||
32 | --- a/lib/Makefile.in |
||
33 | +++ b/lib/Makefile.in |
||
34 | @@ -3,6 +3,7 @@ |
||
35 | ### Path settings |
||
36 | srcdir = @srcdir@ |
||
37 | top_srcdir = @top_srcdir@ |
||
38 | +top_builddir = @top_builddir@ |
||
39 | prefix = @prefix@ |
||
40 | exec_prefix = @exec_prefix@ |
||
41 | bindir = @bindir@ |
||
42 | @@ -23,6 +24,7 @@ MKDIR = @MKDIR@ |
||
43 | |||
44 | ### Compiler and link options |
||
45 | CC = @CC@ |
||
46 | +LIBTOOL = @LIBTOOL@ |
||
47 | CPPFLAGS = -I. \ |
||
48 | -I.. \ |
||
49 | -I${srcdir} \ |
||
50 | @@ -32,7 +34,7 @@ CPPFLAGS = -I. \ |
||
51 | CFLAGS = @CFLAGS@ |
||
52 | LDFLAGS = @LDFLAGS@ |
||
53 | LIBS = @LIBS@ |
||
54 | -LIBOBJS = @LIBOBJS@ |
||
55 | +LTLIBOBJS = @LTLIBOBJS@ |
||
56 | RANLIB = @RANLIB@ |
||
57 | @SET_MAKE@ |
||
58 | VPATH = @srcdir@:@top_srcdir@/compat:../listhash |
||
59 | @@ -40,24 +42,26 @@ VPATH = @srcdir@:@top_srcdir@/compat:.. |
||
60 | |||
61 | ### Makefile rules - no user-servicable parts below |
||
62 | |||
63 | -LIBTAR_OBJS = append.o \ |
||
64 | - block.o \ |
||
65 | - decode.o \ |
||
66 | - encode.o \ |
||
67 | - extract.o \ |
||
68 | - handle.o \ |
||
69 | - libtar_hash.o \ |
||
70 | - libtar_list.o \ |
||
71 | - output.o \ |
||
72 | - util.o \ |
||
73 | - wrapper.o |
||
74 | +LIBTAR_OBJS = append.lo \ |
||
75 | + block.lo \ |
||
76 | + decode.lo \ |
||
77 | + encode.lo \ |
||
78 | + extract.lo \ |
||
79 | + handle.lo \ |
||
80 | + libtar_hash.lo \ |
||
81 | + libtar_list.lo \ |
||
82 | + output.lo \ |
||
83 | + util.lo \ |
||
84 | + wrapper.lo |
||
85 | LIBTAR_HDRS = ../config.h \ |
||
86 | ${top_srcdir}/compat/compat.h \ |
||
87 | ${srcdir}/libtar.h \ |
||
88 | ${srcdir}/internal.h \ |
||
89 | ../listhash/libtar_listhash.h |
||
90 | -LIBTAR_LIBS = ./libtar.a |
||
91 | -ALL = libtar.a |
||
92 | +LIBTAR_LIBS = ./libtar.la |
||
93 | +ALL = libtar.la |
||
94 | +LDFLAGS = @LDFLAGS@ |
||
95 | +CFLAGS = @CFLAGS@ |
||
96 | |||
97 | DISTCLEANFILES = ../listhash/libtar_listhash.h \ |
||
98 | ../listhash/libtar_list.c \ |
||
99 | @@ -68,24 +72,31 @@ all: ${ALL} |
||
100 | |||
101 | .PHONY: clean distclean install |
||
102 | |||
103 | -libtar.a: ${LIBTAR_OBJS} ${LIBOBJS} |
||
104 | - ${AR} rc libtar.a ${LIBTAR_OBJS} ${LIBOBJS} |
||
105 | - ${RANLIB} libtar.a |
||
106 | +libtar.la: ${LIBTAR_OBJS} ${LTLIBOBJS} |
||
107 | + $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o libtar.la $(LIBTAR_OBJS) $(LTLIBOBJS) -rpath $(libdir) |
||
108 | +# ${AR} rc libtar.a ${LIBTAR_OBJS} ${LIBOBJS} |
||
109 | +# ${RANLIB} libtar.a |
||
110 | |||
111 | ${LIBTAR_OBJS}: ${LIBTAR_HDRS} |
||
112 | |||
113 | -.c.o: |
||
114 | - ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $< |
||
115 | +%.lo: $(srcdir)/%.c |
||
116 | + $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $< |
||
117 | + |
||
118 | +%.lo: listhash/%.c |
||
119 | + $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $< |
||
120 | + |
||
121 | +%.lo: compat/%.c |
||
122 | + $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $< |
||
123 | |||
124 | clean: |
||
125 | - rm -f *~ *.o ${ALL} core |
||
126 | + rm -rf *~ *.o $(LIBTAR_OBJS) ${ALL} core .libs $(LTLIBOBJS) |
||
127 | |||
128 | distclean: clean |
||
129 | rm -f Makefile ${DISTCLEANFILES} |
||
130 | |||
131 | install: ${ALL} |
||
132 | ${MKDIR} ${DESTDIR}${libdir} |
||
133 | - ${INSTALL_DATA} libtar.a ${DESTDIR}${libdir} |
||
134 | + $(LIBTOOL) --mode=install ${INSTALL_DATA} libtar.la ${DESTDIR}${libdir} |
||
135 | ${MKDIR} ${DESTDIR}${includedir} |
||
136 | ${INSTALL_DATA} ${srcdir}/libtar.h ${DESTDIR}${includedir} |
||
137 | ${INSTALL_DATA} ../listhash/libtar_listhash.h ${DESTDIR}${includedir} |
||
138 | --- a/libtar/Makefile.in |
||
139 | +++ b/libtar/Makefile.in |
||
140 | @@ -3,6 +3,7 @@ |
||
141 | ### Path settings |
||
142 | srcdir = @srcdir@ |
||
143 | top_srcdir = @top_srcdir@ |
||
144 | +top_builddir = @top_builddir@ |
||
145 | prefix = @prefix@ |
||
146 | exec_prefix = @exec_prefix@ |
||
147 | bindir = @bindir@ |
||
148 | @@ -23,6 +24,7 @@ MKDIR = @MKDIR@ |
||
149 | |||
150 | ### Compiler and link options |
||
151 | CC = @CC@ |
||
152 | +LIBTOOL = @LIBTOOL@ |
||
153 | CPPFLAGS = -I.. \ |
||
154 | -I../lib \ |
||
155 | -I../listhash \ |
||
156 | @@ -31,7 +33,7 @@ CPPFLAGS = -I.. \ |
||
157 | @CPPFLAGS@ |
||
158 | CFLAGS = @CFLAGS@ |
||
159 | LDFLAGS = @LDFLAGS@ |
||
160 | -LIBS = @LIBS@ |
||
161 | +LIBS = @LIBS@ -ltar |
||
162 | LIBOBJS = @LIBOBJS@ |
||
163 | RANLIB = @RANLIB@ |
||
164 | @SET_MAKE@ |
||
165 | @@ -40,12 +42,12 @@ VPATH = @srcdir@ |
||
166 | |||
167 | ### Makefile rules - no user-servicable parts below |
||
168 | |||
169 | -LIBTAR_OBJS = libtar.o |
||
170 | +LIBTAR_OBJS = libtar.lo |
||
171 | LIBTAR_HDRS = ../config.h \ |
||
172 | ${top_srcdir}/compat/compat.h \ |
||
173 | ${top_srcdir}/lib/libtar.h \ |
||
174 | ../listhash/libtar_listhash.h |
||
175 | -LIBTAR_LIBS = ../lib/libtar.a |
||
176 | +LIBTAR_LIBS = $(top_builddir)/lib |
||
177 | ALL = libtar |
||
178 | |||
179 | |||
180 | @@ -54,20 +56,20 @@ all: ${ALL} |
||
181 | .PHONY: clean distclean install |
||
182 | |||
183 | libtar: ${LIBTAR_OBJS} ${LIBTAR_LIBS} ${LIBTAR_HDRS} |
||
184 | - ${CC} ${CFLAGS} ${LDFLAGS} -o libtar libtar.o ${LIBTAR_LIBS} ${LIBS} |
||
185 | + $(LIBTOOL) --mode=link ${CC} ${CFLAGS} ${LDFLAGS} -o libtar $(LIBTAR_OBJS) -L${LIBTAR_LIBS} ${LIBS} |
||
186 | |||
187 | ${LIBTAR_OBJS}: ${LIBTAR_HDRS} |
||
188 | |||
189 | -.c.o: |
||
190 | - ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $< |
||
191 | +%.lo: %.c |
||
192 | + $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $< |
||
193 | |||
194 | clean: |
||
195 | - rm -f *~ *.o ${ALL} core |
||
196 | + rm -rf *~ *.o ${ALL} $(LIBTAR_OBJS) core .libs |
||
197 | |||
198 | distclean: clean |
||
199 | rm -f Makefile |
||
200 | |||
201 | install: ${ALL} |
||
202 | ${MKDIR} ${DESTDIR}${bindir} |
||
203 | - ${INSTALL_PROGRAM} libtar ${DESTDIR}${bindir} |
||
204 | + $(LIBTOOL) --mode=install ${INSTALL_PROGRAM} libtar ${DESTDIR}${bindir} |
||
205 |