Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 5 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 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@
6 magnus 42
@@ -14,6 +15,8 @@ PACKAGE_VERSION       = @PACKAGE_VERSION@
5 magnus 43
 
6 magnus 44
 @ENCAP_DEFS@
45
 
46
+SHELL           = @SHELL@
47
+
48
 ### Installation programs and flags
49
 INSTALL                = @INSTALL@
50
 INSTALL_PROGRAM        = @INSTALL_PROGRAM@ -s
51
@@ -23,6 +26,7 @@ MKDIR         = @MKDIR@
52
 
5 magnus 53
 ### Compiler and link options
54
 CC             = @CC@
55
+LIBTOOL         = @LIBTOOL@
56
 CPPFLAGS       = -I. \
57
                  -I.. \
58
                  -I${srcdir} \
6 magnus 59
@@ -32,7 +36,7 @@ CPPFLAGS      = -I. \
5 magnus 60
 CFLAGS         = @CFLAGS@
61
 LDFLAGS                = @LDFLAGS@
62
 LIBS           = @LIBS@
63
-LIBOBJS                = @LIBOBJS@
64
+LTLIBOBJS      = @LTLIBOBJS@
65
 RANLIB         = @RANLIB@
66
 @SET_MAKE@
67
 VPATH          = @srcdir@:@top_srcdir@/compat:../listhash
6 magnus 68
@@ -40,24 +44,26 @@ VPATH               = @srcdir@:@top_srcdir@/compat:..
5 magnus 69
 
70
 ### Makefile rules - no user-servicable parts below
71
 
72
-LIBTAR_OBJS    = append.o \
73
-                 block.o \
74
-                 decode.o \
75
-                 encode.o \
76
-                 extract.o \
77
-                 handle.o \
78
-                 libtar_hash.o \
79
-                 libtar_list.o \
80
-                 output.o \
81
-                 util.o \
82
-                 wrapper.o
83
+LIBTAR_OBJS    = append.lo \
84
+                 block.lo \
85
+                 decode.lo \
86
+                 encode.lo \
87
+                 extract.lo \
88
+                 handle.lo \
89
+                 libtar_hash.lo \
90
+                 libtar_list.lo \
91
+                 output.lo \
92
+                 util.lo \
93
+                 wrapper.lo
94
 LIBTAR_HDRS    = ../config.h \
95
                  ${top_srcdir}/compat/compat.h \
96
                  ${srcdir}/libtar.h \
97
                  ${srcdir}/internal.h \
98
                  ../listhash/libtar_listhash.h
99
-LIBTAR_LIBS    = ./libtar.a
100
-ALL            = libtar.a
101
+LIBTAR_LIBS    = ./libtar.la
102
+ALL            = libtar.la
103
+LDFLAGS                = @LDFLAGS@
104
+CFLAGS         = @CFLAGS@
105
 
106
 DISTCLEANFILES = ../listhash/libtar_listhash.h \
107
                  ../listhash/libtar_list.c \
6 magnus 108
@@ -68,24 +74,31 @@ all: ${ALL}
5 magnus 109
 
110
 .PHONY: clean distclean install
111
 
112
-libtar.a: ${LIBTAR_OBJS} ${LIBOBJS}
113
-       ${AR} rc libtar.a ${LIBTAR_OBJS} ${LIBOBJS}
114
-       ${RANLIB} libtar.a
115
+libtar.la: ${LIBTAR_OBJS} ${LTLIBOBJS}
116
+       $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o libtar.la $(LIBTAR_OBJS) $(LTLIBOBJS) -rpath $(libdir)
117
+#      ${AR} rc libtar.a ${LIBTAR_OBJS} ${LIBOBJS}
118
+#      ${RANLIB} libtar.a
119
 
120
 ${LIBTAR_OBJS}: ${LIBTAR_HDRS}
121
 
122
-.c.o:
123
-       ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
124
+%.lo: $(srcdir)/%.c
125
+       $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
126
+
127
+%.lo: listhash/%.c
128
+       $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
129
+
130
+%.lo: compat/%.c
131
+       $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
132
 
133
 clean:
134
-       rm -f *~ *.o ${ALL} core
135
+       rm -rf *~ *.o $(LIBTAR_OBJS) ${ALL} core .libs $(LTLIBOBJS)
136
 
137
 distclean: clean
138
        rm -f Makefile ${DISTCLEANFILES}
139
 
140
 install: ${ALL}
141
        ${MKDIR} ${DESTDIR}${libdir}
142
-       ${INSTALL_DATA} libtar.a ${DESTDIR}${libdir}
143
+       $(LIBTOOL) --mode=install ${INSTALL_DATA} libtar.la ${DESTDIR}${libdir}
144
        ${MKDIR} ${DESTDIR}${includedir}
145
        ${INSTALL_DATA} ${srcdir}/libtar.h ${DESTDIR}${includedir}
146
        ${INSTALL_DATA} ../listhash/libtar_listhash.h ${DESTDIR}${includedir}
147
--- a/libtar/Makefile.in
148
+++ b/libtar/Makefile.in
149
@@ -3,6 +3,7 @@
150
 ### Path settings
151
 srcdir         = @srcdir@
152
 top_srcdir     = @top_srcdir@
153
+top_builddir    = @top_builddir@
154
 prefix         = @prefix@
155
 exec_prefix    = @exec_prefix@
156
 bindir         = @bindir@
6 magnus 157
@@ -14,6 +15,8 @@ PACKAGE_VERSION       = @PACKAGE_VERSION@
5 magnus 158
 
6 magnus 159
 @ENCAP_DEFS@
160
 
161
+SHELL           = @SHELL@
162
+
163
 ### Installation programs and flags
164
 INSTALL                = @INSTALL@
165
 INSTALL_PROGRAM        = @INSTALL_PROGRAM@ -s
166
@@ -23,6 +26,7 @@ MKDIR         = @MKDIR@
167
 
5 magnus 168
 ### Compiler and link options
169
 CC             = @CC@
170
+LIBTOOL         = @LIBTOOL@
171
 CPPFLAGS       = -I.. \
172
                  -I../lib \
173
                  -I../listhash \
6 magnus 174
@@ -31,7 +35,7 @@ CPPFLAGS      = -I.. \
5 magnus 175
                  @CPPFLAGS@
176
 CFLAGS         = @CFLAGS@
177
 LDFLAGS                = @LDFLAGS@
178
-LIBS           = @LIBS@
179
+LIBS           = @LIBS@ -ltar
180
 LIBOBJS                = @LIBOBJS@
181
 RANLIB         = @RANLIB@
182
 @SET_MAKE@
6 magnus 183
@@ -40,12 +44,12 @@ VPATH               = @srcdir@
5 magnus 184
 
185
 ### Makefile rules - no user-servicable parts below
186
 
187
-LIBTAR_OBJS    = libtar.o
188
+LIBTAR_OBJS    = libtar.lo
189
 LIBTAR_HDRS    = ../config.h \
190
                  ${top_srcdir}/compat/compat.h \
191
                  ${top_srcdir}/lib/libtar.h \
192
                  ../listhash/libtar_listhash.h
193
-LIBTAR_LIBS    = ../lib/libtar.a
194
+LIBTAR_LIBS    = $(top_builddir)/lib
195
 ALL            = libtar
196
 
197
 
6 magnus 198
@@ -54,20 +58,20 @@ all: ${ALL}
5 magnus 199
 .PHONY: clean distclean install
200
 
201
 libtar: ${LIBTAR_OBJS} ${LIBTAR_LIBS} ${LIBTAR_HDRS}
202
-       ${CC} ${CFLAGS} ${LDFLAGS} -o libtar libtar.o ${LIBTAR_LIBS} ${LIBS}
203
+       $(LIBTOOL) --mode=link ${CC} ${CFLAGS} ${LDFLAGS} -o libtar $(LIBTAR_OBJS) -L${LIBTAR_LIBS} ${LIBS}
204
 
205
 ${LIBTAR_OBJS}: ${LIBTAR_HDRS}
206
 
207
-.c.o:
208
-       ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
209
+%.lo: %.c
210
+       $(LIBTOOL) --mode=compile ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
211
 
212
 clean:
213
-       rm -f *~ *.o ${ALL} core
214
+       rm -rf *~ *.o ${ALL} $(LIBTAR_OBJS) core .libs
215
 
216
 distclean: clean
217
        rm -f Makefile
218
 
219
 install: ${ALL}
220
        ${MKDIR} ${DESTDIR}${bindir}
221
-       ${INSTALL_PROGRAM} libtar ${DESTDIR}${bindir}
222
+       $(LIBTOOL) --mode=install ${INSTALL_PROGRAM} libtar ${DESTDIR}${bindir}
223