File: autoconf.patch

package info (click to toggle)
libmurmurhash 1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 204 kB
  • sloc: ansic: 935; makefile: 46; sh: 9
file content (333 lines) | stat: -rw-r--r-- 9,028 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
From: Andreas Tille <tille@debian.org>
Date: Mon, 11 Feb 2019 13:29:33 +0000
Description: Add autoconf stuff to enable simple library creation

Last-Update: Wed, 22 Jun 2016 16:27:46 +0200
---
 Makefile            | 130 ----------------------------------------------------
 Makefile.am         |  41 +++++++++++++++++
 Makefile.check      |  27 +++++++++++
 configure.ac        |  61 ++++++++++++++++++++++++
 libmurmurhash.pc.in |  11 +++++
 test/Makefile       |   7 +++
 6 files changed, 147 insertions(+), 130 deletions(-)
 delete mode 100644 Makefile
 create mode 100644 Makefile.am
 create mode 100644 Makefile.check
 create mode 100644 configure.ac
 create mode 100644 libmurmurhash.pc.in
 create mode 100644 test/Makefile

diff --git a/Makefile b/Makefile
deleted file mode 100644
index e851b5f..0000000
--- a/Makefile
+++ /dev/null
@@ -1,130 +0,0 @@
-
-CPPFLAGS+=-Wall -Wextra -Wno-implicit-fallthrough
-CFLAGS+=-ggdb -O2 -fPIC
-SHELL=bash
-
-
-VERSION=1.3
-SOVERSION=1
-PROJECT_VERSION=libmurmurhash-$(VERSION)
-TARBALL=$(PROJECT_VERSION).tar.gz
-
-DESTDIR?=/usr
-LIBDIR?=$(DESTDIR)/lib
-INCLUDEDIR?=$(DESTDIR)/include
-MANDIR?=$(DESTDIR)/share/man
-INSTALL?=install
-
-SONAME=libmurmurhash.so.$(SOVERSION)
-OBJECTS=PMurHash.o murmurhash.o
-
-.DEFAULT: all
-.PHONY: all clean check format
-all: libmurmurhash.a $(SONAME) mmh
-
-## build the library
-PMurHash.o: PMurHash.c PMurHash.h
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ PMurHash.c
-
-murmurhash.o: murmurhash.c murmurhash.h
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ murmurhash.c
-
-libmurmurhash.a: $(OBJECTS)
-	$(AR) -qs $@ $^
-
-$(SONAME): libmurmurhash.a
-	$(CC) -Wl,-soname,$(SONAME) -shared -o $@ -Wl,--whole-archive -L. -lmurmurhash -Wl,--no-whole-archive
-
-## installation
-.PHONY: install install-dev install-lib uninstall dist distcheck
-
-install: install-dev install-lib
-
-install-dev:
-	$(INSTALL) -D -m0644 -t "$(INCLUDEDIR)" murmurhash.h
-	$(INSTALL) -D -m0644 -t "$(MANDIR)/man3" murmurhash.3
-	ln -f -r -s "$(MANDIR)/man3/murmurhash.3" "$(MANDIR)/man3/MurmurHash3_x86_32.3"
-	ln -f -r -s "$(MANDIR)/man3/murmurhash.3" "$(MANDIR)/man3/MurmurHash3_x86_128.3"
-	ln -f -r -s "$(MANDIR)/man3/murmurhash.3" "$(MANDIR)/man3/MurmurHash3_x64_128.3"
-	ln -f -r -s "$(MANDIR)/man3/murmurhash.3" "$(MANDIR)/man3/lmmh_x86_32.3"
-	ln -f -r -s "$(MANDIR)/man3/murmurhash.3" "$(MANDIR)/man3/lmmh_x86_128.3"
-	ln -f -r -s "$(MANDIR)/man3/murmurhash.3" "$(MANDIR)/man3/lmmh_x64_128.3"
-
-install-lib: $(SONAME)
-	$(INSTALL) -D -t "$(LIBDIR)" $(SONAME)
-	ln -f -r -s "$(LIBDIR)/$(SONAME)" "$(LIBDIR)/libmurmurhash.so"
-
-uninstall:
-	$(RM) "$(INCLUDEDIR)/murmurhash.h"
-	$(RM) "$(LIBDIR)/libmurmurhash.so"
-	$(RM) "$(LIBDIR)/$(SONAME)"
-	$(RM) "$(MANDIR)/man3/murmurhash.3"
-	$(RM) "$(MANDIR)/man3/MurmurHash3_*"
-	$(RM) "$(MANDIR)/man3/lmmh_*"
-
-$(TARBALL):
-	mkdir -p "$(PROJECT_VERSION)"/test
-	cp Makefile Readme.md NOLICENSE "$(PROJECT_VERSION)"
-	cp *.h *.c "$(PROJECT_VERSION)"
-	cp test/*.c test/*.h "$(PROJECT_VERSION)/test"
-	cp test/almostempty test/almostempty.hash "$(PROJECT_VERSION)/test"
-	cp murmurhash.3 "$(PROJECT_VERSION)"
-	tar -ca -f $@ "$(PROJECT_VERSION)"
-	$(RM) -r "$(PROJECT_VERSION)"
-
-dist: $(TARBALL)
-
-distcheck: dist
-	tar -xzvf "$(TARBALL)"
-	$(MAKE) -C "$(PROJECT_VERSION)"
-	$(MAKE) -C "$(PROJECT_VERSION)" check
-	$(RM) -r "$(PROJECT_VERSION)"
-
-## checks
-mmh.o: test/mmh.c
-	$(CC) -I. $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
-
-mmh_old.o: test/mmh_old.c
-	$(CC) -I. $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
-
-MurmurHash3.o: test/MurmurHash3.c test/MurmurHash3.h
-	$(CC) -I. $(CPPFLAGS) $(CFLAGS) -c -o $@ test/MurmurHash3.c
-
-# new interface, static linking
-mmh: mmh.o libmurmurhash.a
-	$(CC) $(CFLAGS) -o $@ $^ -L. -lmurmurhash
-
-# new interface, dynamic linking
-mmh_dyn: test/mmh.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ -lmurmurhash
-
-# old interface, static linking
-mmh_old: mmh_old.o libmurmurhash.a
-	$(CC) $(CFLAGS) -o $@ $^ -L. -lmurmurhash
-
-# old interface, reference implementation
-mmh_ref: mmh_old.o MurmurHash3.o
-	$(CC) $(CFLAGS) -o $@ $^
-
-check: mmh mmh_old
-	diff test/almostempty.hash <(./mmh test/almostempty)
-	diff test/almostempty.hash <(./mmh_old test/almostempty)
-
-# Will fail on all but (64bit) little endian systems
-check-reference: mmh_ref
-	diff test/almostempty.hash <(./mmh_ref test/almostempty)
-
-# should be checked after installation!
-check-dynamic: mmh_dyn
-	diff test/almostempty.hash <(./mmh_dyn test/almostempty)
-
-
-## misc
-
-format:
-	clang-format -i *.c *.h test/*.c test/*.h
-
-clean:
-	$(RM) *.o *.a *.so *.so.* mmh mmh_*
-	$(RM) test/*.o *.tar.gz
-	$(RM) -r "$(PROJECT_VERSION)"
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..e075fd1
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,41 @@
+lib_LTLIBRARIES  = libmurmurhash.la
+
+libmurmurhashdir=$(includedir)
+libmurmurhash_HEADERS= murmurhash.h
+libmurmurhash_la_SOURCES = PMurHash.c murmurhash.c PMurHash.h
+libmurmurhash_la_LDFLAGS = -version-info @LIB_VERSION@
+
+libmurmurhash_la_CPPFLAGS = $(INCLUDES)
+
+
+pkgconfigdir=$(libdir)/pkgconfig
+pkgconfig_DATA = libmurmurhash.pc
+
+
+## checks
+mmh.o: test/mmh.c
+	$(CC) -I. $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
+
+MurmurHash3.o: test/MurmurHash3.c test/MurmurHash3.h
+	$(CC) -I. $(CPPFLAGS) $(CFLAGS) -c -o $@ test/MurmurHash3.c
+
+mmh: mmh.o libmurmurhash.la
+	$(CC) $(CFLAGS) -o $@ mmh.o .libs/libmurmurhash.a # -L.libs -lmurmurhash
+
+mmh_d: test/mmh.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ .libs/libmurmurhash.a
+
+mmh_r: mmh.o MurmurHash3.o
+	$(CC) $(CFLAGS) -o $@ $^
+
+check: mmh mmh_r
+	diff test/almostempty.hash <(./mmh test/almostempty)
+
+check-dynamic: mmh_d
+	diff test/almostempty.hash <(./mmh_d test/almostempty)
+
+## misc
+
+format:
+	clang-format -i *.c *.h test/*.c test/*.h
+
diff --git a/Makefile.check b/Makefile.check
new file mode 100644
index 0000000..0d3cd7a
--- /dev/null
+++ b/Makefile.check
@@ -0,0 +1,27 @@
+## checks
+mmh.o: test/mmh.c
+	$(CC) -I. $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
+
+MurmurHash3.o: test/MurmurHash3.c test/MurmurHash3.h
+	$(CC) -I. $(CPPFLAGS) $(CFLAGS) -c -o $@ test/MurmurHash3.c
+
+mmh: mmh.o libmurmurhash.a
+	$(CC) $(CFLAGS) -o $@ $^ -L. -lmurmurhash
+
+mmh_d: test/mmh.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ -lmurmurhash
+
+mmh_r: mmh.o MurmurHash3.o
+	$(CC) $(CFLAGS) -o $@ $^
+
+check: mmh mmh_r
+	diff test/almostempty.hash <(./mmh test/almostempty)
+
+check-dynamic: mmh_d
+	diff test/almostempty.hash <(./mmh_d test/almostempty)
+
+## misc
+
+format:
+	clang-format -i *.c *.h test/*.c test/*.h
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..f45bee8
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,61 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_INIT(murmurhash, 1, kloetzl@evolbio.mpg.de)
+AC_CONFIG_HEADERS([config.h])
+
+AC_PREREQ(2.57)
+
+#	Directory that contains install-sh and other auxiliary files
+AC_CONFIG_AUX_DIR([config])
+
+################################################################################
+#	According to (http://www.mail-archive.com/autoconf@gnu.org/msg14232.html)
+#		this macro should be after AC_INIT but before AM_INIT_AUTOMAKE
+################################################################################
+AC_CONFIG_MACRO_DIR(config)
+
+AM_INIT_AUTOMAKE([1.6 foreign dist-zip tar-ustar filename-length-max=299])
+
+LIB_VERSION=1:1
+
+AC_SUBST([VERSION])
+AC_SUBST([LIB_VERSION])
+
+AC_SUBST([VERSION])
+
+# Checks for programs.
+AC_PROG_LN_S
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+
+################################################################################
+# calling AC_PROG_CXX resets CXXFLAGS, we use our own flags set in the
+#	the AX_CXXFLAGS macro below.
+# So we cache the argument to configure
+#	here in ARG_CXX_FLAGS (so that our macro does not override them)
+################################################################################
+ARG_CXX_FLAGS="$CXXFLAGS"
+AC_PROG_CXX
+
+#Ranlib handled by check for libtool
+CXXFLAGS="$ARG_CXX_FLAGS"
+AX_CXXFLAGS
+
+AC_SUBST(CXXFLAGS)
+
+CPPFLAGS="-I\$(top_srcdir) $CPPFLAGS"
+# Checks for libraries.
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdlib.h])
+
+AC_PROG_MAKE_SET
+
+AC_CONFIG_FILES([
+	Makefile
+	libmurmurhash.pc
+	])
+AC_OUTPUT
+
diff --git a/libmurmurhash.pc.in b/libmurmurhash.pc.in
new file mode 100644
index 0000000..337311c
--- /dev/null
+++ b/libmurmurhash.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+
+Name: libmurmurhash
+Version: @VERSION@
+Description: Portable MurmurHash Implementation
+Libs: -L${libdir} -lmurmurhash
+Cflags: -I${includedir}
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000..f5a4b8a
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,7 @@
+all: check-dynamic
+
+mmh_d: mmh.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ -lmurmurhash
+
+check-dynamic: mmh_d
+	./mmh_d almostempty | diff almostempty.hash -