Merge remote-tracking branch 'vanilla/next' into gaps-next
Ingo Bürk
3 years ago
51 | 51 | # e.g. by listing your directory in .git/info/exclude. |
52 | 52 | /build |
53 | 53 | |
54 | # TODO(autotools-removal): remove autotools from .gitignore: | |
55 | ||
56 | ################################################################################ | |
57 | # https://raw.githubusercontent.com/github/gitignore/master/Autotools.gitignore | |
58 | ################################################################################ | |
59 | ||
60 | # http://www.gnu.org/software/automake | |
61 | ||
62 | Makefile.in | |
63 | /ar-lib | |
64 | /test-driver | |
65 | ||
66 | # http://www.gnu.org/software/autoconf | |
67 | ||
68 | /autom4te.cache | |
69 | /autoscan.log | |
70 | /autoscan-*.log | |
71 | /aclocal.m4 | |
72 | /compile | |
73 | /config.h.in | |
74 | /config.guess | |
75 | /config.sub | |
76 | /configure | |
77 | /configure.scan | |
78 | /depcomp | |
79 | /install-sh | |
80 | /missing | |
81 | /stamp-h1 |
30 | 30 | script: |
31 | 31 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-safe-wrappers.sh |
32 | 32 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-formatting.sh |
33 | # # TODO(autotools-removal): autoconf build has to keep working until i3 4.19 | |
34 | # is released, so we keep building it in travis. | |
35 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'autoreconf -fi && mkdir -p build && cd build && (../configure || (cat config.log; false)) && make -j CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror -fno-common"' | |
36 | 33 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'rm -rf build; mkdir -p build && cd build && CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror -fno-common" meson .. -Ddocs=true -Dmans=true -Db_sanitize=address && ninja -v' |
37 | 34 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-spelling.pl |
38 | 35 | - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} ./travis/run-tests.sh |
0 | @CODE_COVERAGE_RULES@ | |
1 | ||
2 | echo-version: | |
3 | @echo "@I3_VERSION@" | |
4 | ||
5 | bin_PROGRAMS = \ | |
6 | i3 \ | |
7 | i3bar \ | |
8 | i3-config-wizard \ | |
9 | i3-dump-log \ | |
10 | i3-input \ | |
11 | i3-msg \ | |
12 | i3-nagbar | |
13 | ||
14 | install-exec-hook: | |
15 | $(LN_S) -f i3 $(DESTDIR)$(bindir)/i3-with-shmlog | |
16 | ||
17 | uninstall-hook: | |
18 | rm -f $(DESTDIR)$(bindir)/i3-with-shmlog | |
19 | ||
20 | i3includedir=$(includedir)/i3 | |
21 | i3include_HEADERS = \ | |
22 | include/i3/ipc.h | |
23 | ||
24 | dist_bin_SCRIPTS = \ | |
25 | i3-dmenu-desktop \ | |
26 | i3-migrate-config-to-v4 \ | |
27 | i3-save-tree \ | |
28 | i3-sensible-editor \ | |
29 | i3-sensible-pager \ | |
30 | i3-sensible-terminal | |
31 | ||
32 | i3confdir = $(sysconfdir)/i3 | |
33 | dist_i3conf_DATA = \ | |
34 | etc/config \ | |
35 | etc/config.keycodes | |
36 | ||
37 | I3STATUS_INSTALL_NAME = $(shell echo i3status | sed '@program_transform_name@') | |
38 | ||
39 | etc/config: etc/$(dirstamp) | |
40 | $(AM_V_GEN) sed "s,status_command i3status,status_command $(I3STATUS_INSTALL_NAME),g" $(top_srcdir)/etc/config > etc/config | |
41 | ||
42 | etc/config.keycodes: etc/$(dirstamp) | |
43 | $(AM_V_GEN) sed "s,status_command i3status,status_command $(I3STATUS_INSTALL_NAME),g" $(top_srcdir)/etc/config.keycodes > etc/config.keycodes | |
44 | ||
45 | applicationsdir = $(datarootdir)/applications | |
46 | xsessionsdir = $(datarootdir)/xsessions | |
47 | dist_applications_DATA = \ | |
48 | share/applications/i3.desktop | |
49 | dist_xsessions_DATA = \ | |
50 | share/xsessions/i3.desktop \ | |
51 | share/xsessions/i3-with-shmlog.desktop | |
52 | ||
53 | noinst_LIBRARIES = libi3.a | |
54 | ||
55 | check_PROGRAMS = \ | |
56 | test.commands_parser \ | |
57 | test.config_parser \ | |
58 | test.inject_randr15 | |
59 | ||
60 | check_SCRIPTS = \ | |
61 | testcases/complete-run.pl | |
62 | ||
63 | check_DATA = \ | |
64 | anyevent-i3.stamp | |
65 | ||
66 | clean-check: | |
67 | rm -rf testsuite-* latest i3-cfg-for-* _Inline | |
68 | clean-local: clean-check | |
69 | ||
70 | TESTS = testcases/complete-run.pl | |
71 | ||
72 | EXTRA_DIST = \ | |
73 | $(dist_docs_toc_DATA:.html=) \ | |
74 | $(dist_docs_notoc_DATA:.html=) \ | |
75 | AnyEvent-I3/Changes \ | |
76 | AnyEvent-I3/MANIFEST \ | |
77 | AnyEvent-I3/MANIFEST.SKIP \ | |
78 | AnyEvent-I3/Makefile.PL \ | |
79 | AnyEvent-I3/README \ | |
80 | AnyEvent-I3/lib/AnyEvent/I3.pm \ | |
81 | AnyEvent-I3/t/00-load.t \ | |
82 | AnyEvent-I3/t/01-workspaces.t \ | |
83 | AnyEvent-I3/t/02-sugar.t \ | |
84 | AnyEvent-I3/t/boilerplate.t \ | |
85 | AnyEvent-I3/t/manifest.t \ | |
86 | AnyEvent-I3/t/pod-coverage.t \ | |
87 | AnyEvent-I3/t/pod.t \ | |
88 | contrib/dump-asy.pl \ | |
89 | contrib/gtk-tree-watch.pl \ | |
90 | contrib/i3-wsbar \ | |
91 | contrib/per-workspace-layout.pl \ | |
92 | contrib/trivial-bar-script.sh \ | |
93 | docs/asciidoc-git.conf \ | |
94 | docs/bigpicture.png \ | |
95 | docs/i3-pod2html \ | |
96 | docs/i3-sync.dia \ | |
97 | docs/i3-sync.png \ | |
98 | docs/i3-sync-working.dia \ | |
99 | docs/i3-sync-working.png \ | |
100 | docs/keyboard-layer1.png \ | |
101 | docs/keyboard-layer2.png \ | |
102 | docs/layout-saving-1.png \ | |
103 | docs/logo-30.png \ | |
104 | docs/modes.png \ | |
105 | docs/refcard.html \ | |
106 | docs/refcard_style.css \ | |
107 | docs/single_terminal.png \ | |
108 | docs/snapping.png \ | |
109 | docs/tree-layout1.png \ | |
110 | docs/tree-layout2.png \ | |
111 | docs/tree-shot1.png \ | |
112 | docs/tree-shot2.png \ | |
113 | docs/tree-shot3.png \ | |
114 | docs/tree-shot4.png \ | |
115 | docs/two_columns.png \ | |
116 | docs/two_terminals.png \ | |
117 | docs/wsbar.dia \ | |
118 | docs/wsbar.png \ | |
119 | i3bar/LICENSE \ | |
120 | libi3/README \ | |
121 | $(asciidoc_MANS:.1=.man) \ | |
122 | $(asciidoc_MANS:.1=.man) \ | |
123 | man/asciidoc.conf.in \ | |
124 | DEPENDS \ | |
125 | I3_VERSION \ | |
126 | LICENSE \ | |
127 | PACKAGE-MAINTAINER \ | |
128 | RELEASE-NOTES-4.18.3 \ | |
129 | generate-command-parser.pl \ | |
130 | parser-specs/commands.spec \ | |
131 | parser-specs/config.spec \ | |
132 | parser-specs/highlighting.vim \ | |
133 | pseudo-doc.doxygen \ | |
134 | testcases/complete-run.pl.in \ | |
135 | testcases/i3-test.config \ | |
136 | testcases/lib/i3test/Test.pm \ | |
137 | testcases/lib/i3test/Util.pm \ | |
138 | testcases/lib/i3test/XTEST.pm \ | |
139 | testcases/lib/i3test.pm.in \ | |
140 | testcases/lib/SocketActivation.pm \ | |
141 | testcases/lib/StartXServer.pm \ | |
142 | testcases/lib/StatusLine.pm \ | |
143 | testcases/lib/TestWorker.pm \ | |
144 | testcases/Makefile.PL \ | |
145 | testcases/new-test \ | |
146 | testcases/restart-state.golden \ | |
147 | testcases/t \ | |
148 | testcases/valgrind.supp | |
149 | ||
150 | # dirstamps contains directories which we want to be created in $(top_builddir) | |
151 | # so that our custom rules can store files in them. | |
152 | dirstamp = .dirstamp | |
153 | dirstamps = \ | |
154 | docs/$(dirstamp) \ | |
155 | man/$(dirstamp) \ | |
156 | parser/$(dirstamp) \ | |
157 | etc/$(dirstamp) | |
158 | DISTCLEANFILES = $(dirstamps) | |
159 | ||
160 | $(dirstamps): | |
161 | @stamp='$@'; $(MKDIR_P) "$${stamp%/*}" | |
162 | @: > $@ | |
163 | ||
164 | ################################################################################ | |
165 | # docs generation | |
166 | ################################################################################ | |
167 | ||
168 | docs_tocdir = ${docdir} | |
169 | docs_notocdir = ${docdir} | |
170 | docs_poddir = ${docdir} | |
171 | if BUILD_DOCS | |
172 | dist_docs_toc_DATA = \ | |
173 | docs/hacking-howto.html \ | |
174 | docs/userguide.html \ | |
175 | docs/ipc.html \ | |
176 | docs/multi-monitor.html \ | |
177 | docs/wsbar.html \ | |
178 | docs/testsuite.html \ | |
179 | docs/i3bar-protocol.html \ | |
180 | docs/layout-saving.html | |
181 | ||
182 | dist_docs_notoc_DATA = \ | |
183 | docs/debugging.html | |
184 | ||
185 | dist_docs_pod_DATA = \ | |
186 | docs/lib-i3test.html \ | |
187 | docs/lib-i3test-test.html | |
188 | ||
189 | $(dist_docs_toc_DATA): docs/%.html: docs/% docs/$(dirstamp) | |
190 | $(AM_V_GEN) @PATH_ASCIIDOC@ -a toc -n -o $@ $< | |
191 | ||
192 | $(dist_docs_notoc_DATA): docs/%.html: docs/% docs/$(dirstamp) | |
193 | $(AM_V_GEN) @PATH_ASCIIDOC@ -n -o $@ $< | |
194 | ||
195 | docs/lib-i3test.html: testcases/lib/i3test.pm docs/$(dirstamp) | |
196 | $(AM_V_GEN) $(top_srcdir)/docs/i3-pod2html $< $@ | |
197 | ||
198 | docs/lib-i3test-test.html: testcases/lib/i3test/Test.pm docs/$(dirstamp) | |
199 | $(AM_V_GEN) $(top_srcdir)/docs/i3-pod2html $< $@ | |
200 | ||
201 | else | |
202 | dist_docs_toc_DATA = | |
203 | dist_docs_notoc_DATA = | |
204 | dist_docs_pod_DATA = | |
205 | endif | |
206 | ||
207 | ################################################################################ | |
208 | # manpage generation | |
209 | ################################################################################ | |
210 | ||
211 | if BUILD_MANS | |
212 | dist_man1_MANS = \ | |
213 | $(asciidoc_MANS) \ | |
214 | $(pod_MANS) | |
215 | ||
216 | asciidoc_MANS = \ | |
217 | man/i3.1 \ | |
218 | man/i3bar.1 \ | |
219 | man/i3-msg.1 \ | |
220 | man/i3-input.1 \ | |
221 | man/i3-nagbar.1 \ | |
222 | man/i3-config-wizard.1 \ | |
223 | man/i3-migrate-config-to-v4.1 \ | |
224 | man/i3-sensible-editor.1 \ | |
225 | man/i3-sensible-pager.1 \ | |
226 | man/i3-sensible-terminal.1 \ | |
227 | man/i3-dump-log.1 | |
228 | ||
229 | pod_MANS = \ | |
230 | man/i3-dmenu-desktop.1 \ | |
231 | man/i3-save-tree.1 | |
232 | ||
233 | $(asciidoc_MANS): man/%.1: man/%.xml man/$(dirstamp) | |
234 | $(AM_V_GEN) out='$@'; @PATH_XMLTO@ man -o "$${out%/*}" $< | |
235 | @stamp='$@'; $(MKDIR_P) "$${stamp%/*}" | |
236 | ||
237 | man/%.xml: man/%.man man/asciidoc.conf man/$(dirstamp) | |
238 | $(AM_V_GEN) @PATH_ASCIIDOC@ -d manpage -b docbook -f $(top_builddir)/man/asciidoc.conf -o $@ $< | |
239 | ||
240 | $(pod_MANS): man/%.1: % man/$(dirstamp) | |
241 | $(AM_V_GEN) @PATH_POD2MAN@ --utf8 $< > $@ | |
242 | else | |
243 | asciidoc_MANS = | |
244 | endif | |
245 | ||
246 | AM_CPPFLAGS = \ | |
247 | -DSYSCONFDIR="\"$(sysconfdir)\"" \ | |
248 | -I$(top_builddir)/parser \ | |
249 | -I$(top_srcdir)/include \ | |
250 | @AX_EXTEND_SRCDIR_CPPFLAGS@ | |
251 | ||
252 | i3_CFLAGS = \ | |
253 | $(AM_CFLAGS) \ | |
254 | $(libi3_CFLAGS) \ | |
255 | $(LIBSN_CFLAGS) \ | |
256 | $(XCB_CFLAGS) \ | |
257 | $(XCB_UTIL_CURSOR_CFLAGS) \ | |
258 | $(XCB_UTIL_KEYSYM_CFLAGS) \ | |
259 | $(XCB_UTIL_WM_CFLAGS) \ | |
260 | $(XCB_UTIL_XRM_CFLAGS) \ | |
261 | $(XKBCOMMON_CFLAGS) \ | |
262 | $(YAJL_CFLAGS) \ | |
263 | $(LIBPCRE_CFLAGS) \ | |
264 | $(PTHREAD_CFLAGS) \ | |
265 | $(CODE_COVERAGE_CFLAGS) | |
266 | ||
267 | i3_CPPFLAGS = \ | |
268 | $(AM_CPPFLAGS) \ | |
269 | $(CODE_COVERAGE_CPPFLAGS) | |
270 | ||
271 | i3_LDADD = \ | |
272 | $(libi3_LIBS) \ | |
273 | $(LIBSN_LIBS) \ | |
274 | $(XCB_LIBS) \ | |
275 | $(XCB_UTIL_CURSOR_LIBS) \ | |
276 | $(XCB_UTIL_KEYSYMS_LIBS) \ | |
277 | $(XCB_UTIL_WM_LIBS) \ | |
278 | $(XCB_UTIL_XRM_LIBS) \ | |
279 | $(XKBCOMMON_LIBS) \ | |
280 | $(YAJL_LIBS) \ | |
281 | $(LIBPCRE_LIBS) \ | |
282 | $(PANGOCAIRO_LIBS) \ | |
283 | $(PTHREAD_LIBS) \ | |
284 | $(CODE_COVERAGE_LDFLAGS) | |
285 | ||
286 | libi3_CFLAGS = \ | |
287 | $(AM_CFLAGS) \ | |
288 | $(GLIBGOBJECT_CFLAGS) \ | |
289 | $(XCB_CFLAGS) \ | |
290 | $(XCB_UTIL_CFLAGS) \ | |
291 | $(XCB_UTIL_XRM_CFLAGS) \ | |
292 | $(YAJL_CFLAGS) \ | |
293 | $(PANGOCAIRO_CFLAGS) | |
294 | ||
295 | libi3_LIBS = \ | |
296 | $(top_builddir)/libi3.a \ | |
297 | $(GLIBGOBJECT_LIBS) \ | |
298 | $(XCB_LIBS) \ | |
299 | $(XCB_UTIL_LIBS) \ | |
300 | $(XCB_UTIL_XRM_LIBS) \ | |
301 | $(YAJL_LIBS) \ | |
302 | $(PANGOCAIRO_LIBS) | |
303 | ||
304 | libi3_a_CFLAGS = \ | |
305 | $(libi3_CFLAGS) | |
306 | ||
307 | libi3_a_SOURCES = \ | |
308 | include/libi3.h \ | |
309 | libi3/dpi.c \ | |
310 | libi3/draw_util.c \ | |
311 | libi3/fake_configure_notify.c \ | |
312 | libi3/font.c \ | |
313 | libi3/format_placeholders.c \ | |
314 | libi3/g_utf8_make_valid.c \ | |
315 | libi3/get_colorpixel.c \ | |
316 | libi3/get_config_path.c \ | |
317 | libi3/get_exe_path.c \ | |
318 | libi3/get_mod_mask.c \ | |
319 | libi3/get_process_filename.c \ | |
320 | libi3/get_visualtype.c \ | |
321 | libi3/ipc_connect.c \ | |
322 | libi3/ipc_recv_message.c \ | |
323 | libi3/ipc_send_message.c \ | |
324 | libi3/is_debug_build.c \ | |
325 | libi3/mkdirp.c \ | |
326 | libi3/resolve_tilde.c \ | |
327 | libi3/root_atom_contents.c \ | |
328 | libi3/safewrappers.c \ | |
329 | libi3/string.c \ | |
330 | libi3/strndup.c \ | |
331 | libi3/ucs2_conversion.c | |
332 | ||
333 | i3_dump_log_CFLAGS = \ | |
334 | $(AM_CFLAGS) \ | |
335 | $(PTHREAD_CFLAGS) \ | |
336 | $(libi3_CFLAGS) | |
337 | ||
338 | i3_dump_log_LDADD = \ | |
339 | $(PTHREAD_LIBS) \ | |
340 | $(libi3_LIBS) | |
341 | ||
342 | i3_dump_log_SOURCES = \ | |
343 | i3-dump-log/main.c | |
344 | ||
345 | i3_input_CFLAGS = \ | |
346 | $(AM_CFLAGS) \ | |
347 | $(libi3_CFLAGS) | |
348 | ||
349 | i3_input_LDADD = \ | |
350 | $(libi3_LIBS) \ | |
351 | $(XCB_UTIL_KEYSYMS_LIBS) | |
352 | ||
353 | i3_input_SOURCES = \ | |
354 | i3-input/i3-input.h \ | |
355 | i3-input/keysym2ucs.c \ | |
356 | i3-input/keysym2ucs.h \ | |
357 | i3-input/main.c | |
358 | ||
359 | i3_msg_CFLAGS = \ | |
360 | $(AM_CFLAGS) \ | |
361 | $(libi3_CFLAGS) | |
362 | ||
363 | i3_msg_LDADD = \ | |
364 | $(libi3_LIBS) | |
365 | ||
366 | i3_msg_SOURCES = \ | |
367 | i3-msg/main.c | |
368 | ||
369 | i3_nagbar_CFLAGS = \ | |
370 | $(AM_CFLAGS) \ | |
371 | $(LIBSN_CFLAGS) \ | |
372 | $(libi3_CFLAGS) | |
373 | ||
374 | i3_nagbar_LDADD = \ | |
375 | $(libi3_LIBS) \ | |
376 | $(LIBSN_LIBS) \ | |
377 | $(XCB_UTIL_CURSOR_LIBS) | |
378 | ||
379 | i3_nagbar_SOURCES = \ | |
380 | i3-nagbar/i3-nagbar-atoms.xmacro.h \ | |
381 | i3-nagbar/main.c | |
382 | ||
383 | i3bar_CPPFLAGS = \ | |
384 | $(AM_CPPFLAGS) \ | |
385 | -I$(top_srcdir)/i3bar/include | |
386 | ||
387 | i3bar_CFLAGS = \ | |
388 | $(AM_CFLAGS) \ | |
389 | $(libi3_CFLAGS) \ | |
390 | $(XCB_CFLAGS) \ | |
391 | $(XKBCOMMON_CFLAGS) \ | |
392 | $(PANGOCAIRO_CFLAGS) \ | |
393 | $(YAJL_CFLAGS) | |
394 | ||
395 | i3bar_LDADD = \ | |
396 | $(libi3_LIBS) \ | |
397 | $(XCB_LIBS) \ | |
398 | $(XCB_UTIL_CURSOR_LIBS) \ | |
399 | $(XKBCOMMON_LIBS) \ | |
400 | $(PANGOCAIRO_LIBS) \ | |
401 | $(YAJL_LIBS) | |
402 | ||
403 | i3bar_SOURCES = \ | |
404 | i3bar/include/child.h \ | |
405 | i3bar/include/common.h \ | |
406 | i3bar/include/configuration.h \ | |
407 | i3bar/include/ipc.h \ | |
408 | i3bar/include/mode.h \ | |
409 | i3bar/include/outputs.h \ | |
410 | i3bar/include/parse_json_header.h \ | |
411 | i3bar/include/trayclients.h \ | |
412 | i3bar/include/util.h \ | |
413 | i3bar/include/workspaces.h \ | |
414 | i3bar/include/xcb_atoms.def \ | |
415 | i3bar/include/xcb.h \ | |
416 | i3bar/src/child.c \ | |
417 | i3bar/src/config.c \ | |
418 | i3bar/src/ipc.c \ | |
419 | i3bar/src/main.c \ | |
420 | i3bar/src/mode.c \ | |
421 | i3bar/src/outputs.c \ | |
422 | i3bar/src/parse_json_header.c \ | |
423 | i3bar/src/workspaces.c \ | |
424 | i3bar/src/xcb.c | |
425 | ||
426 | i3_config_wizard_CFLAGS = \ | |
427 | $(AM_CFLAGS) \ | |
428 | $(libi3_CFLAGS) \ | |
429 | $(LIBSN_CFLAGS) \ | |
430 | $(XKBCOMMON_CFLAGS) | |
431 | ||
432 | i3_config_wizard_LDADD = \ | |
433 | $(libi3_LIBS) \ | |
434 | $(LIBSN_LIBS) \ | |
435 | $(XCB_UTIL_KEYSYMS_LIBS) \ | |
436 | $(XKBCOMMON_LIBS) | |
437 | ||
438 | i3_config_wizard_SOURCES = \ | |
439 | i3-config-wizard/i3-config-wizard-atoms.xmacro.h \ | |
440 | i3-config-wizard/main.c \ | |
441 | i3-config-wizard/xcb.h | |
442 | ||
443 | i3_config_wizard_DEPENDENCIES = \ | |
444 | $(top_builddir)/libi3.a | |
445 | ||
446 | test_inject_randr15_CPPFLAGS = \ | |
447 | $(AM_CPPFLAGS) | |
448 | ||
449 | test_inject_randr15_CFLAGS = \ | |
450 | $(AM_CFLAGS) \ | |
451 | $(i3_CFLAGS) | |
452 | ||
453 | test_inject_randr15_SOURCES = \ | |
454 | testcases/inject_randr1.5.c | |
455 | ||
456 | test_inject_randr15_LDADD = \ | |
457 | $(i3_LDADD) | |
458 | ||
459 | test_commands_parser_CPPFLAGS = \ | |
460 | $(AM_CPPFLAGS) \ | |
461 | -DTEST_PARSER | |
462 | ||
463 | test_commands_parser_CFLAGS = \ | |
464 | $(AM_CFLAGS) \ | |
465 | $(i3_CFLAGS) | |
466 | ||
467 | test_commands_parser_SOURCES = \ | |
468 | src/commands_parser.c | |
469 | ||
470 | test_commands_parser_LDADD = \ | |
471 | $(i3_LDADD) | |
472 | ||
473 | test_config_parser_CPPFLAGS = \ | |
474 | $(AM_CPPFLAGS) \ | |
475 | -DTEST_PARSER | |
476 | ||
477 | test_config_parser_CFLAGS = \ | |
478 | $(AM_CFLAGS) \ | |
479 | $(i3_CFLAGS) | |
480 | ||
481 | test_config_parser_SOURCES = \ | |
482 | src/config_parser.c | |
483 | ||
484 | test_config_parser_LDADD = \ | |
485 | $(i3_LDADD) | |
486 | ||
487 | command_parser_SOURCES = \ | |
488 | parser/GENERATED_command_enums.h \ | |
489 | parser/GENERATED_command_tokens.h \ | |
490 | parser/GENERATED_command_call.h | |
491 | ||
492 | config_parser_SOURCES = \ | |
493 | parser/GENERATED_config_enums.h \ | |
494 | parser/GENERATED_config_tokens.h \ | |
495 | parser/GENERATED_config_call.h | |
496 | ||
497 | BUILT_SOURCES = $(command_parser_SOURCES) $(config_parser_SOURCES) | |
498 | ||
499 | i3_SOURCES = \ | |
500 | include/all.h \ | |
501 | include/assignments.h \ | |
502 | include/i3-atoms_NET_SUPPORTED.xmacro.h \ | |
503 | include/i3-atoms_rest.xmacro.h \ | |
504 | include/bindings.h \ | |
505 | include/click.h \ | |
506 | include/cmdparse.h \ | |
507 | include/commands.h \ | |
508 | include/commands_parser.h \ | |
509 | include/config_directives.h \ | |
510 | include/configuration.h \ | |
511 | include/config_parser.h \ | |
512 | include/con.h \ | |
513 | include/data.h \ | |
514 | include/display_version.h \ | |
515 | include/drag.h \ | |
516 | include/ewmh.h \ | |
517 | include/fake_outputs.h \ | |
518 | include/floating.h \ | |
519 | include/handlers.h \ | |
520 | include/i3.h \ | |
521 | include/ipc.h \ | |
522 | include/key_press.h \ | |
523 | include/load_layout.h \ | |
524 | include/log.h \ | |
525 | include/main.h \ | |
526 | include/manage.h \ | |
527 | include/match.h \ | |
528 | include/move.h \ | |
529 | include/output.h \ | |
530 | include/queue.h \ | |
531 | include/randr.h \ | |
532 | include/regex.h \ | |
533 | include/render.h \ | |
534 | include/resize.h \ | |
535 | include/restore_layout.h \ | |
536 | include/scratchpad.h \ | |
537 | include/sd-daemon.h \ | |
538 | include/shmlog.h \ | |
539 | include/sighandler.h \ | |
540 | include/startup.h \ | |
541 | include/sync.h \ | |
542 | include/tree.h \ | |
543 | include/util.h \ | |
544 | include/window.h \ | |
545 | include/workspace.h \ | |
546 | include/xcb.h \ | |
547 | include/xcursor.h \ | |
548 | include/x.h \ | |
549 | include/xinerama.h \ | |
550 | include/yajl_utils.h \ | |
551 | src/assignments.c \ | |
552 | src/bindings.c \ | |
553 | src/click.c \ | |
554 | src/commands.c \ | |
555 | src/commands_parser.c \ | |
556 | src/con.c \ | |
557 | src/config.c \ | |
558 | src/config_directives.c \ | |
559 | src/config_parser.c \ | |
560 | src/display_version.c \ | |
561 | src/drag.c \ | |
562 | src/ewmh.c \ | |
563 | src/fake_outputs.c \ | |
564 | src/floating.c \ | |
565 | src/handlers.c \ | |
566 | src/ipc.c \ | |
567 | src/key_press.c \ | |
568 | src/load_layout.c \ | |
569 | src/log.c \ | |
570 | src/main.c \ | |
571 | src/manage.c \ | |
572 | src/match.c \ | |
573 | src/move.c \ | |
574 | src/output.c \ | |
575 | src/randr.c \ | |
576 | src/regex.c \ | |
577 | src/render.c \ | |
578 | src/resize.c \ | |
579 | src/restore_layout.c \ | |
580 | src/scratchpad.c \ | |
581 | src/sd-daemon.c \ | |
582 | src/sighandler.c \ | |
583 | src/startup.c \ | |
584 | src/sync.c \ | |
585 | src/tree.c \ | |
586 | src/util.c \ | |
587 | src/version.c \ | |
588 | src/window.c \ | |
589 | src/workspace.c \ | |
590 | src/x.c \ | |
591 | src/xcb.c \ | |
592 | src/xcursor.c \ | |
593 | src/xinerama.c | |
594 | ||
595 | ################################################################################ | |
596 | # parser generation | |
597 | ################################################################################ | |
598 | ||
599 | $(command_parser_SOURCES): %.h: i3-command-parser.stamp | |
600 | ||
601 | $(config_parser_SOURCES): %.h: i3-config-parser.stamp | |
602 | ||
603 | src/i3-commands_parser.$(OBJEXT): i3-command-parser.stamp | |
604 | ||
605 | src/i3-config_parser.$(OBJEXT): i3-config-parser.stamp | |
606 | ||
607 | i3-command-parser.stamp: parser/$(dirstamp) generate-command-parser.pl parser-specs/commands.spec | |
608 | $(AM_V_GEN) $(top_srcdir)/generate-command-parser.pl --input=$(top_srcdir)/parser-specs/commands.spec --prefix=command | |
609 | $(AM_V_at) mv GENERATED_command_* $(top_builddir)/parser | |
610 | $(AM_V_at) touch $@ | |
611 | ||
612 | i3-config-parser.stamp: parser/$(dirstamp) generate-command-parser.pl parser-specs/config.spec | |
613 | $(AM_V_GEN) $(top_srcdir)/generate-command-parser.pl --input=$(top_srcdir)/parser-specs/config.spec --prefix=config | |
614 | $(AM_V_at) mv GENERATED_config_* $(top_builddir)/parser | |
615 | $(AM_V_at) touch $@ | |
616 | ||
617 | ################################################################################ | |
618 | # AnyEvent-I3 build process | |
619 | ################################################################################ | |
620 | ||
621 | anyevent-i3.stamp: AnyEvent-I3/lib/AnyEvent/I3.pm | |
622 | $(AM_V_BUILD) (cp -r $(top_srcdir)/AnyEvent-I3 . && cd AnyEvent-I3 && perl Makefile.PL && make) | |
623 | $(AM_V_at) touch $@ | |
624 | ||
625 | CLEANFILES = \ | |
626 | i3-command-parser.stamp \ | |
627 | i3-config-parser.stamp \ | |
628 | anyevent-i3.stamp | |
629 | ||
630 | ################################################################################ | |
631 | # Language Server support | |
632 | ################################################################################ | |
633 | ||
634 | # Recursively run make through https://github.com/rizsotto/Bear, | |
635 | # which generates a compile_commands.json file in the source directory. | |
636 | # This is useful for running e.g. the clangd or ccls language servers: | |
637 | # https://clang.llvm.org/extra/clangd/ | |
638 | # https://github.com/MaskRay/ccls/wiki | |
639 | .PHONY: bear | |
640 | bear: clean | |
641 | bear -o $(top_srcdir)/compile_commands.json $(MAKE) $(MAKEFLAGS) |
20 | 20 | If your distribution has a mechanism to get the preferred terminal, such as the |
21 | 21 | x-terminal-emulator symlink in Debian, please use it in i3-sensible-terminal. |
22 | 22 | |
23 | On debian, compilation and installing the manpages looks like this: | |
23 | You can build i3 like you build any other software package which uses | |
24 | https://mesonbuild.com/; see | |
25 | https://mesonbuild.com/Quick-guide.html#compiling-a-meson-project | |
26 | In case you’re unfamiliar: | |
24 | 27 | |
25 | autoreconf -fi | |
26 | mkdir -p build && cd build | |
27 | ../configure | |
28 | make -j8 install | |
28 | $ mkdir -p build && cd build | |
29 | $ meson .. | |
30 | $ ninja | |
29 | 31 | |
30 | 32 | Please make sure that i3-migrate-config-to-v4 and i3-config-wizard are |
31 | 33 | installed with i3. The Perl script is necessary to (automatically) convert v3 |
34 | 36 | start of i3 (it will automatically exit if it finds a config file). |
35 | 37 | |
36 | 38 | If you have any questions, ideas, hints, problems or whatever, please do not |
37 | hesitate to contact me. I will help you out. Just drop me an E-Mail (find the | |
38 | address at https://michael.stapelberg.de/Impressum/, scroll down to bottom), | |
39 | contact me using the same address in jabber or ask on our IRC channel: | |
40 | (#i3 on irc.freenode.net). | |
39 | hesitate to contact me. I will help you out. Please see | |
40 | https://i3wm.org/contact/ | |
41 | 41 | |
42 | 42 | Thanks again for your efforts, |
43 | 43 | Michael |
0 | # -*- Autoconf -*- | |
1 | # Run autoreconf -fi to generate a configure script from this file. | |
2 | ||
3 | AC_PREREQ([2.69]) | |
4 | AC_INIT([i3], [4.18.3], [https://github.com/i3/i3/issues]) | |
5 | # For AX_EXTEND_SRCDIR | |
6 | AX_ENABLE_BUILDDIR | |
7 | AM_INIT_AUTOMAKE([foreign -Wall no-dist-gzip dist-bzip2]) | |
8 | # Default to silent rules, use V=1 to get verbose compilation output. | |
9 | AM_SILENT_RULES([yes]) | |
10 | # Make it possible to disable maintainer mode to disable re-generation of build | |
11 | # system files. | |
12 | AM_MAINTAINER_MODE([enable]) | |
13 | AC_CONFIG_SRCDIR([libi3/ipc_recv_message.c]) | |
14 | AC_CONFIG_HEADERS([config.h]) | |
15 | AC_CONFIG_MACRO_DIR([m4]) | |
16 | ||
17 | dnl Verify macros defined in m4/ such as AX_SANITIZERS are not present in the | |
18 | dnl output, i.e. are replaced as expected. This line results in a better error | |
19 | dnl message when using aclocal < 1.13 (which does not understand | |
20 | dnl AC_CONFIG_MACRO_DIR) without passing the -I m4 parameter. | |
21 | m4_pattern_forbid([AX_SANITIZERS]) | |
22 | ||
23 | # Verify we are using GNU make because we use '%'-style pattern rules in | |
24 | # Makefile.am, which are a GNU make extension. Pull requests to replace | |
25 | # '%'-style pattern rules with a more portable alternative are welcome. | |
26 | AX_CHECK_GNU_MAKE | |
27 | AS_VAR_IF([_cv_gnu_make_command], [""], [AC_MSG_ERROR([the i3 Makefile.am requires GNU make])]) | |
28 | ||
29 | AX_EXTEND_SRCDIR | |
30 | ||
31 | AS_IF([test -e ${srcdir}/.git], | |
32 | [ | |
33 | VERSION="$(git -C ${srcdir} describe --tags --abbrev=0)" | |
34 | I3_VERSION="$(git -C ${srcdir} describe --tags --always) ($(git -C ${srcdir} rev-list --format=%cd --date=short -n1 $(git rev-parse HEAD) | tail -n1), branch \\\"$(git -C ${srcdir} describe --tags --always --all | sed s:heads/::)\\\")" | |
35 | # Mirrors what libi3/is_debug_build.c does: | |
36 | is_release=$(test $(echo "${I3_VERSION}" | cut -d '(' -f 1 | wc -m) -lt 10 && echo yes || echo no) | |
37 | ], | |
38 | [ | |
39 | VERSION="$(cut -d '-' -f 1 ${srcdir}/I3_VERSION | cut -d ' ' -f 1)" | |
40 | I3_VERSION="$(sed -e 's/@<:@\"?\\@:>@/\\&/g' ${srcdir}/I3_VERSION)" | |
41 | is_release="$(grep -q non-git ${srcdir}/I3_VERSION && echo no || echo yes)" | |
42 | ]) | |
43 | AC_SUBST([I3_VERSION], [$I3_VERSION]) | |
44 | MAJOR_VERSION="$(echo ${VERSION} | cut -d '.' -f 1)" | |
45 | MINOR_VERSION="$(echo ${VERSION} | cut -d '.' -f 2)" | |
46 | PATCH_VERSION="$(echo ${VERSION} | cut -d '.' -f 3)" | |
47 | AS_IF([test "x${PATCH_VERSION}" = x], [PATCH_VERSION=0]) | |
48 | AC_DEFINE_UNQUOTED([I3_VERSION], ["${I3_VERSION}"], [i3 version]) | |
49 | AC_DEFINE_UNQUOTED([MAJOR_VERSION], [${MAJOR_VERSION}], [i3 major version]) | |
50 | AC_DEFINE_UNQUOTED([MINOR_VERSION], [${MINOR_VERSION}], [i3 minor version]) | |
51 | AC_DEFINE_UNQUOTED([PATCH_VERSION], [${PATCH_VERSION}], [i3 patch version]) | |
52 | ||
53 | AX_CODE_COVERAGE | |
54 | ||
55 | dnl is_release must be lowercase because AX_CHECK_ENABLE_DEBUG calls m4_tolower | |
56 | dnl on its fourth argument. | |
57 | AX_CHECK_ENABLE_DEBUG([yes], , [UNUSED_NDEBUG], [$is_release]) | |
58 | ||
59 | AC_PROG_CC_C99 | |
60 | ||
61 | # For strnlen() and vasprintf(). | |
62 | AC_USE_SYSTEM_EXTENSIONS | |
63 | ||
64 | # Checks for typedefs, structures, and compiler characteristics. | |
65 | AC_CHECK_HEADER_STDBOOL | |
66 | dnl The error message should include the specific type which could not be | |
67 | dnl found, but I do not see a way to achieve that. | |
68 | AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t], , [AC_MSG_FAILURE([cannot find required type])]) | |
69 | ||
70 | # Checks for library functions. | |
71 | AC_FUNC_FORK | |
72 | AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK | |
73 | AC_FUNC_STRNLEN | |
74 | AC_CHECK_FUNCS([atexit dup2 ftruncate getcwd gettimeofday localtime_r memchr memset mkdir rmdir setlocale socket strcasecmp strchr strdup strerror strncasecmp strrchr strspn strstr strtol strtoul], , [AC_MSG_FAILURE([cannot find the $ac_func function, which i3 requires])]) | |
75 | AC_REPLACE_FUNCS([mkdirp strndup]) | |
76 | ||
77 | # Checks for libraries. | |
78 | ||
79 | AC_SEARCH_LIBS([floor], [m], , [AC_MSG_FAILURE([cannot find the required floor() function despite trying to link with -lm])]) | |
80 | ||
81 | # libev does not ship with a pkg-config file :(. | |
82 | AC_SEARCH_LIBS([ev_run], [ev], , [AC_MSG_FAILURE([cannot find the required ev_run() function despite trying to link with -lev])]) | |
83 | ||
84 | AC_SEARCH_LIBS([shm_open], [rt], [], [], [-pthread]) | |
85 | ||
86 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <iconv.h>], [iconv_open(0, 0)])], , | |
87 | [LIBS="-liconv $LIBS" | |
88 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <iconv.h>], [iconv_open(0, 0)])], , | |
89 | [AC_MSG_FAILURE([cannot find the required iconv_open() function despite trying to link with -liconv])])] | |
90 | ) | |
91 | ||
92 | AX_PTHREAD | |
93 | ||
94 | dnl Each prefix corresponds to a source tarball which users might have | |
95 | dnl downloaded in a newer version and would like to overwrite. | |
96 | PKG_CHECK_MODULES([LIBSN], [libstartup-notification-1.0]) | |
97 | PKG_CHECK_MODULES([XCB], [xcb xcb-xkb xcb-xinerama xcb-randr xcb-shape]) | |
98 | PKG_CHECK_MODULES([XCB_UTIL], [xcb-event xcb-util]) | |
99 | PKG_CHECK_MODULES([XCB_UTIL_CURSOR], [xcb-cursor]) | |
100 | PKG_CHECK_MODULES([XCB_UTIL_KEYSYMS], [xcb-keysyms]) | |
101 | PKG_CHECK_MODULES([XCB_UTIL_WM], [xcb-icccm]) | |
102 | PKG_CHECK_MODULES([XCB_UTIL_XRM], [xcb-xrm]) | |
103 | PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon xkbcommon-x11]) | |
104 | PKG_CHECK_MODULES([YAJL], [yajl]) | |
105 | PKG_CHECK_MODULES([LIBPCRE], [libpcre >= 8.10]) | |
106 | PKG_CHECK_MODULES([PANGOCAIRO], [cairo >= 1.14.4 pangocairo]) | |
107 | PKG_CHECK_MODULES([GLIBGOBJECT], [glib-2.0 gobject-2.0]) | |
108 | ||
109 | # Checks for programs. | |
110 | AC_PROG_AWK | |
111 | AC_PROG_CPP | |
112 | AC_PROG_INSTALL | |
113 | AC_PROG_MAKE_SET | |
114 | AC_PROG_RANLIB | |
115 | AC_PROG_LN_S | |
116 | ||
117 | AC_ARG_ENABLE(docs, | |
118 | AS_HELP_STRING( | |
119 | [--disable-docs], | |
120 | [disable building documentation]), | |
121 | [ax_docs=$enableval], | |
122 | [ax_docs=yes]) | |
123 | AC_ARG_ENABLE(mans, | |
124 | AS_HELP_STRING( | |
125 | [--disable-mans], | |
126 | [disable building manual pages]), | |
127 | [ax_mans=$enableval], | |
128 | [ax_mans=yes]) | |
129 | AS_IF([test x$ax_docs = xyes || test x$ax_mans = xyes], [ | |
130 | AC_PATH_PROG([PATH_ASCIIDOC], [asciidoc]) | |
131 | ]) | |
132 | AS_IF([test x$ax_mans = xyes], [ | |
133 | AC_PATH_PROG([PATH_XMLTO], [xmlto]) | |
134 | AC_PATH_PROG([PATH_POD2MAN], [pod2man]) | |
135 | ]) | |
136 | AM_CONDITIONAL([BUILD_MANS], [test x$ax_mans = xyes && test x$PATH_ASCIIDOC != x && test x$PATH_XMLTO != x && test x$PATH_POD2MAN != x]) | |
137 | AM_CONDITIONAL([BUILD_DOCS], [test x$ax_docs = xyes && test x$PATH_ASCIIDOC != x]) | |
138 | ||
139 | AM_PROG_AR | |
140 | ||
141 | AX_FLAGS_WARN_ALL | |
142 | AX_CHECK_COMPILE_FLAG([-Wunused-value], [AX_APPEND_FLAG([-Wunused-value], [AM_CFLAGS])]) | |
143 | AC_SUBST(AM_CFLAGS) | |
144 | ||
145 | # Checks for header files. | |
146 | AC_CHECK_HEADERS([fcntl.h float.h inttypes.h limits.h locale.h netinet/in.h paths.h stddef.h stdint.h stdlib.h string.h sys/param.h sys/socket.h sys/time.h unistd.h], , [AC_MSG_FAILURE([cannot find the $ac_header header, which i3 requires])]) | |
147 | ||
148 | AC_CONFIG_FILES([Makefile testcases/lib/i3test.pm man/asciidoc.conf]) | |
149 | AC_CONFIG_FILES([testcases/complete-run.pl], [chmod +x testcases/complete-run.pl]) | |
150 | ||
151 | # Enable address sanitizer for non-release builds. The performance hit is a | |
152 | # 50% increase of wallclock time for the testsuite on my machine. | |
153 | if test x$is_release = xyes; then | |
154 | default_sanitizers= | |
155 | else | |
156 | default_sanitizers=address | |
157 | fi | |
158 | AX_SANITIZERS(, [$default_sanitizers], [AC_DEFINE([I3_ASAN_ENABLED], [], [Enable ASAN])]) | |
159 | ||
160 | AC_OUTPUT | |
161 | ||
162 | if test -z "${BUILD_DOCS_TRUE}"; then | |
163 | print_BUILD_DOCS=yes | |
164 | else | |
165 | print_BUILD_DOCS=no | |
166 | fi | |
167 | ||
168 | ||
169 | if test -z "${BUILD_MANS_TRUE}"; then | |
170 | print_BUILD_MANS=yes | |
171 | else | |
172 | print_BUILD_MANS=no | |
173 | fi | |
174 | ||
175 | in_git_worktree=`git rev-parse --is-inside-work-tree 2>/dev/null` | |
176 | if [[ "$in_git_worktree" = "true" ]]; then | |
177 | git_dir=`git rev-parse --git-dir 2>/dev/null` | |
178 | srcdir=`dirname "$git_dir"` | |
179 | exclude_dir=`pwd | sed "s,^$srcdir,,g"` | |
180 | if ! grep -q "^$exclude_dir" "$git_dir/info/exclude"; then | |
181 | echo "$exclude_dir" >> "$git_dir/info/exclude" | |
182 | fi | |
183 | fi | |
184 | ||
185 | echo \ | |
186 | "-------------------------------------------------------------------------------- | |
187 | build configured: | |
188 | ||
189 | AS_HELP_STRING([i3 version:], [`echo ${I3_VERSION} | sed 's,\\\\,,g'`]) | |
190 | AS_HELP_STRING([is release version:], [${is_release}]) | |
191 | ||
192 | AS_HELP_STRING([build manpages:], [${print_BUILD_MANS}]) | |
193 | AS_HELP_STRING([build docs:], [${print_BUILD_DOCS}]) | |
194 | AS_HELP_STRING([enable debug flags:], [${ax_enable_debug}]) | |
195 | AS_HELP_STRING([code coverage:], [${CODE_COVERAGE_ENABLED}]) | |
196 | AS_HELP_STRING([enabled sanitizers:], [${ax_enabled_sanitizers}]) | |
197 | ||
198 | To compile, run: | |
199 | ||
200 | cd `pwd` && make -j8 | |
201 | --------------------------------------------------------------------------------" |
12 | 12 | override_dh_auto_test: |
13 | 13 | # TODO: enable tests |
14 | 14 | |
15 | # TODO(autotools-removal): remove this override: | |
16 | override_dh_autoreconf: | |
17 | # Not needed with meson, but not a no-op either until we get rid of the | |
18 | # autotools files. | |
19 | ||
20 | 15 | override_dh_auto_configure: |
21 | 16 | # Set -Ddocdir; the default is /usr/share/doc/i3 |
22 | 17 | dh_auto_configure -- -Ddocdir=/usr/share/doc/i3-wm -Dmans=true |
22 | 22 | |
23 | 23 | == Building i3 |
24 | 24 | |
25 | You can build i3 like you build any other software package which uses meson. | |
26 | Here’s a memory refresher: | |
25 | You can build i3 like you build any other software package which uses | |
26 | https://mesonbuild.com/[The Meson Build system]; see | |
27 | https://mesonbuild.com/Quick-guide.html#compiling-a-meson-project[Quickstart | |
28 | Guide → Compiling a Meson project]. In case you’re unfamiliar: | |
27 | 29 | |
28 | 30 | $ mkdir -p build && cd build |
29 | 31 | $ meson .. |
119 | 119 | --------------------------------------- |
120 | 120 | $ cd ~/i3 |
121 | 121 | |
122 | $ autoreconf -fi | |
123 | ||
124 | 122 | $ mkdir -p build && cd build |
125 | 123 | |
126 | $ ../configure | |
127 | ||
128 | $ make -j8 | |
124 | $ meson .. | |
125 | ||
126 | $ ninja | |
129 | 127 | # output omitted because it is very long |
130 | 128 | |
131 | 129 | $ cd testcases |
182 | 180 | --------------------------------------- |
183 | 181 | $ cd ~/i3 |
184 | 182 | |
185 | $ autoreconf -fi | |
186 | ||
187 | 183 | $ mkdir -p build && cd build |
188 | 184 | |
189 | $ ../configure | |
190 | ||
191 | $ make -j8 | |
185 | $ meson .. | |
186 | ||
187 | $ ninja | |
192 | 188 | # output omitted because it is very long |
193 | 189 | |
194 | 190 | $ make check |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_append_flag.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # FLAG is appended to the FLAGS-VARIABLE shell variable, with a space | |
11 | # added in between. | |
12 | # | |
13 | # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. | |
14 | # CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains | |
15 | # FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly | |
16 | # FLAG. | |
17 | # | |
18 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. | |
19 | # | |
20 | # LICENSE | |
21 | # | |
22 | # Copyright (c) 2008 Guido U. Draheim <[email protected]> | |
23 | # Copyright (c) 2011 Maarten Bosmans <[email protected]> | |
24 | # | |
25 | # This program is free software: you can redistribute it and/or modify it | |
26 | # under the terms of the GNU General Public License as published by the | |
27 | # Free Software Foundation, either version 3 of the License, or (at your | |
28 | # option) any later version. | |
29 | # | |
30 | # This program is distributed in the hope that it will be useful, but | |
31 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
32 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |
33 | # Public License for more details. | |
34 | # | |
35 | # You should have received a copy of the GNU General Public License along | |
36 | # with this program. If not, see <http://www.gnu.org/licenses/>. | |
37 | # | |
38 | # As a special exception, the respective Autoconf Macro's copyright owner | |
39 | # gives unlimited permission to copy, distribute and modify the configure | |
40 | # scripts that are the output of Autoconf when processing the Macro. You | |
41 | # need not follow the terms of the GNU General Public License when using | |
42 | # or distributing such scripts, even though portions of the text of the | |
43 | # Macro appear in them. The GNU General Public License (GPL) does govern | |
44 | # all other use of the material that constitutes the Autoconf Macro. | |
45 | # | |
46 | # This special exception to the GPL applies to versions of the Autoconf | |
47 | # Macro released by the Autoconf Archive. When you make and distribute a | |
48 | # modified version of the Autoconf Macro, you may extend this special | |
49 | # exception to the GPL to apply to your modified version as well. | |
50 | ||
51 | #serial 6 | |
52 | ||
53 | AC_DEFUN([AX_APPEND_FLAG], | |
54 | [dnl | |
55 | AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF | |
56 | AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) | |
57 | AS_VAR_SET_IF(FLAGS,[ | |
58 | AS_CASE([" AS_VAR_GET(FLAGS) "], | |
59 | [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], | |
60 | [ | |
61 | AS_VAR_APPEND(FLAGS,[" $1"]) | |
62 | AC_RUN_LOG([: FLAGS="$FLAGS"]) | |
63 | ]) | |
64 | ], | |
65 | [ | |
66 | AS_VAR_SET(FLAGS,[$1]) | |
67 | AC_RUN_LOG([: FLAGS="$FLAGS"]) | |
68 | ]) | |
69 | AS_VAR_POPDEF([FLAGS])dnl | |
70 | ])dnl AX_APPEND_FLAG |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] | |
7 | # AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] | |
8 | # AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] | |
9 | # | |
10 | # DESCRIPTION | |
11 | # | |
12 | # Try to find a compiler option that enables most reasonable warnings. | |
13 | # | |
14 | # For the GNU compiler it will be -Wall (and -ansi -pedantic) The result | |
15 | # is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default. | |
16 | # | |
17 | # Currently this macro knows about the GCC, Solaris, Digital Unix, AIX, | |
18 | # HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and | |
19 | # Intel compilers. For a given compiler, the Fortran flags are much more | |
20 | # experimental than their C equivalents. | |
21 | # | |
22 | # - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS | |
23 | # - $2 add-value-if-not-found : nothing | |
24 | # - $3 action-if-found : add value to shellvariable | |
25 | # - $4 action-if-not-found : nothing | |
26 | # | |
27 | # NOTE: These macros depend on AX_APPEND_FLAG. | |
28 | # | |
29 | # LICENSE | |
30 | # | |
31 | # Copyright (c) 2008 Guido U. Draheim <[email protected]> | |
32 | # Copyright (c) 2010 Rhys Ulerich <[email protected]> | |
33 | # | |
34 | # This program is free software; you can redistribute it and/or modify it | |
35 | # under the terms of the GNU General Public License as published by the | |
36 | # Free Software Foundation; either version 3 of the License, or (at your | |
37 | # option) any later version. | |
38 | # | |
39 | # This program is distributed in the hope that it will be useful, but | |
40 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
41 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |
42 | # Public License for more details. | |
43 | # | |
44 | # You should have received a copy of the GNU General Public License along | |
45 | # with this program. If not, see <http://www.gnu.org/licenses/>. | |
46 | # | |
47 | # As a special exception, the respective Autoconf Macro's copyright owner | |
48 | # gives unlimited permission to copy, distribute and modify the configure | |
49 | # scripts that are the output of Autoconf when processing the Macro. You | |
50 | # need not follow the terms of the GNU General Public License when using | |
51 | # or distributing such scripts, even though portions of the text of the | |
52 | # Macro appear in them. The GNU General Public License (GPL) does govern | |
53 | # all other use of the material that constitutes the Autoconf Macro. | |
54 | # | |
55 | # This special exception to the GPL applies to versions of the Autoconf | |
56 | # Macro released by the Autoconf Archive. When you make and distribute a | |
57 | # modified version of the Autoconf Macro, you may extend this special | |
58 | # exception to the GPL to apply to your modified version as well. | |
59 | ||
60 | #serial 15 | |
61 | ||
62 | AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl | |
63 | AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl | |
64 | AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl | |
65 | AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], | |
66 | VAR,[VAR="no, unknown" | |
67 | ac_save_[]FLAGS="$[]FLAGS" | |
68 | for ac_arg dnl | |
69 | in "-warn all % -warn all" dnl Intel | |
70 | "-pedantic % -Wall" dnl GCC | |
71 | "-xstrconst % -v" dnl Solaris C | |
72 | "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix | |
73 | "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX | |
74 | "-ansi -ansiE % -fullwarn" dnl IRIX | |
75 | "+ESlit % +w1" dnl HP-UX C | |
76 | "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) | |
77 | "-h conform % -h msglevel 2" dnl Cray C (Unicos) | |
78 | # | |
79 | do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` | |
80 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM], | |
81 | [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) | |
82 | done | |
83 | FLAGS="$ac_save_[]FLAGS" | |
84 | ]) | |
85 | AS_VAR_POPDEF([FLAGS])dnl | |
86 | AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) | |
87 | case ".$VAR" in | |
88 | .ok|.ok,*) m4_ifvaln($3,$3) ;; | |
89 | .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;; | |
90 | *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;; | |
91 | esac | |
92 | AS_VAR_POPDEF([VAR])dnl | |
93 | ])dnl AX_FLAGS_WARN_ALL | |
94 | dnl implementation tactics: | |
95 | dnl the for-argument contains a list of options. The first part of | |
96 | dnl these does only exist to detect the compiler - usually it is | |
97 | dnl a global option to enable -ansi or -extrawarnings. All other | |
98 | dnl compilers will fail about it. That was needed since a lot of | |
99 | dnl compilers will give false positives for some option-syntax | |
100 | dnl like -Woption or -Xoption as they think of it is a pass-through | |
101 | dnl to later compile stages or something. The "%" is used as a | |
102 | dnl delimiter. A non-option comment can be given after "%%" marks | |
103 | dnl which will be shown but not added to the respective C/CXXFLAGS. | |
104 | ||
105 | AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl | |
106 | AC_LANG_PUSH([C]) | |
107 | AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) | |
108 | AC_LANG_POP([C]) | |
109 | ]) | |
110 | ||
111 | AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl | |
112 | AC_LANG_PUSH([C++]) | |
113 | AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) | |
114 | AC_LANG_POP([C++]) | |
115 | ]) | |
116 | ||
117 | AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl | |
118 | AC_LANG_PUSH([Fortran]) | |
119 | AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) | |
120 | AC_LANG_POP([Fortran]) | |
121 | ]) |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # Check whether the given FLAG works with the current language's compiler | |
11 | # or gives an error. (Warnings, however, are ignored) | |
12 | # | |
13 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on | |
14 | # success/failure. | |
15 | # | |
16 | # If EXTRA-FLAGS is defined, it is added to the current language's default | |
17 | # flags (e.g. CFLAGS) when the check is done. The check is thus made with | |
18 | # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to | |
19 | # force the compiler to issue an error when a bad flag is given. | |
20 | # | |
21 | # INPUT gives an alternative input source to AC_COMPILE_IFELSE. | |
22 | # | |
23 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this | |
24 | # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. | |
25 | # | |
26 | # LICENSE | |
27 | # | |
28 | # Copyright (c) 2008 Guido U. Draheim <[email protected]> | |
29 | # Copyright (c) 2011 Maarten Bosmans <[email protected]> | |
30 | # | |
31 | # This program is free software: you can redistribute it and/or modify it | |
32 | # under the terms of the GNU General Public License as published by the | |
33 | # Free Software Foundation, either version 3 of the License, or (at your | |
34 | # option) any later version. | |
35 | # | |
36 | # This program is distributed in the hope that it will be useful, but | |
37 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
38 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |
39 | # Public License for more details. | |
40 | # | |
41 | # You should have received a copy of the GNU General Public License along | |
42 | # with this program. If not, see <http://www.gnu.org/licenses/>. | |
43 | # | |
44 | # As a special exception, the respective Autoconf Macro's copyright owner | |
45 | # gives unlimited permission to copy, distribute and modify the configure | |
46 | # scripts that are the output of Autoconf when processing the Macro. You | |
47 | # need not follow the terms of the GNU General Public License when using | |
48 | # or distributing such scripts, even though portions of the text of the | |
49 | # Macro appear in them. The GNU General Public License (GPL) does govern | |
50 | # all other use of the material that constitutes the Autoconf Macro. | |
51 | # | |
52 | # This special exception to the GPL applies to versions of the Autoconf | |
53 | # Macro released by the Autoconf Archive. When you make and distribute a | |
54 | # modified version of the Autoconf Macro, you may extend this special | |
55 | # exception to the GPL to apply to your modified version as well. | |
56 | ||
57 | #serial 4 | |
58 | ||
59 | AC_DEFUN([AX_CHECK_COMPILE_FLAG], | |
60 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF | |
61 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl | |
62 | AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ | |
63 | ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS | |
64 | _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" | |
65 | AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], | |
66 | [AS_VAR_SET(CACHEVAR,[yes])], | |
67 | [AS_VAR_SET(CACHEVAR,[no])]) | |
68 | _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) | |
69 | AS_VAR_IF(CACHEVAR,yes, | |
70 | [m4_default([$2], :)], | |
71 | [m4_default([$3], :)]) | |
72 | AS_VAR_POPDEF([CACHEVAR])dnl | |
73 | ])dnl AX_CHECK_COMPILE_FLAGS |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_check_enable_debug.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no], [ENABLE DEBUG VARIABLES ...], [DISABLE DEBUG VARIABLES NDEBUG ...], [IS-RELEASE]) | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # Check for the presence of an --enable-debug option to configure, with | |
11 | # the specified default value used when the option is not present. Return | |
12 | # the value in the variable $ax_enable_debug. | |
13 | # | |
14 | # Specifying 'yes' adds '-g -O0' to the compilation flags for all | |
15 | # languages. Specifying 'info' adds '-g' to the compilation flags. | |
16 | # Specifying 'profile' adds '-g -pg' to the compilation flags and '-pg' to | |
17 | # the linking flags. Otherwise, nothing is added. | |
18 | # | |
19 | # Define the variables listed in the second argument if debug is enabled, | |
20 | # defaulting to no variables. Defines the variables listed in the third | |
21 | # argument if debug is disabled, defaulting to NDEBUG. All lists of | |
22 | # variables should be space-separated. | |
23 | # | |
24 | # If debug is not enabled, ensure AC_PROG_* will not add debugging flags. | |
25 | # Should be invoked prior to any AC_PROG_* compiler checks. | |
26 | # | |
27 | # IS-RELEASE can be used to change the default to 'no' when making a | |
28 | # release. Set IS-RELEASE to 'yes' or 'no' as appropriate. By default, it | |
29 | # uses the value of $ax_is_release, so if you are using the AX_IS_RELEASE | |
30 | # macro, there is no need to pass this parameter. | |
31 | # | |
32 | # AX_IS_RELEASE([git-directory]) | |
33 | # AX_CHECK_ENABLE_DEBUG() | |
34 | # | |
35 | # LICENSE | |
36 | # | |
37 | # Copyright (c) 2011 Rhys Ulerich <[email protected]> | |
38 | # Copyright (c) 2014, 2015 Philip Withnall <[email protected]> | |
39 | # | |
40 | # Copying and distribution of this file, with or without modification, are | |
41 | # permitted in any medium without royalty provided the copyright notice | |
42 | # and this notice are preserved. | |
43 | ||
44 | #serial 5 | |
45 | ||
46 | AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[ | |
47 | AC_BEFORE([$0],[AC_PROG_CC])dnl | |
48 | AC_BEFORE([$0],[AC_PROG_CXX])dnl | |
49 | AC_BEFORE([$0],[AC_PROG_F77])dnl | |
50 | AC_BEFORE([$0],[AC_PROG_FC])dnl | |
51 | ||
52 | AC_MSG_CHECKING(whether to enable debugging) | |
53 | ||
54 | ax_enable_debug_default=m4_tolower(m4_normalize(ifelse([$1],,[no],[$1]))) | |
55 | ax_enable_debug_is_release=m4_tolower(m4_normalize(ifelse([$4],, | |
56 | [$ax_is_release], | |
57 | [$4]))) | |
58 | ||
59 | # If this is a release, override the default. | |
60 | AS_IF([test "$ax_enable_debug_is_release" = "yes"], | |
61 | [ax_enable_debug_default="no"]) | |
62 | ||
63 | m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))]) | |
64 | m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))]) | |
65 | ||
66 | AC_ARG_ENABLE(debug, | |
67 | [AS_HELP_STRING([--enable-debug=]@<:@yes/info/profile/no@:>@,[compile with debugging])], | |
68 | [],enable_debug=$ax_enable_debug_default) | |
69 | ||
70 | # empty mean debug yes | |
71 | AS_IF([test "x$enable_debug" = "x"], | |
72 | [enable_debug="yes"]) | |
73 | ||
74 | # case of debug | |
75 | AS_CASE([$enable_debug], | |
76 | [yes],[ | |
77 | AC_MSG_RESULT(yes) | |
78 | CFLAGS="${CFLAGS} -g -O0" | |
79 | CXXFLAGS="${CXXFLAGS} -g -O0" | |
80 | FFLAGS="${FFLAGS} -g -O0" | |
81 | FCFLAGS="${FCFLAGS} -g -O0" | |
82 | OBJCFLAGS="${OBJCFLAGS} -g -O0" | |
83 | ], | |
84 | [info],[ | |
85 | AC_MSG_RESULT(info) | |
86 | CFLAGS="${CFLAGS} -g" | |
87 | CXXFLAGS="${CXXFLAGS} -g" | |
88 | FFLAGS="${FFLAGS} -g" | |
89 | FCFLAGS="${FCFLAGS} -g" | |
90 | OBJCFLAGS="${OBJCFLAGS} -g" | |
91 | ], | |
92 | [profile],[ | |
93 | AC_MSG_RESULT(profile) | |
94 | CFLAGS="${CFLAGS} -g -pg" | |
95 | CXXFLAGS="${CXXFLAGS} -g -pg" | |
96 | FFLAGS="${FFLAGS} -g -pg" | |
97 | FCFLAGS="${FCFLAGS} -g -pg" | |
98 | OBJCFLAGS="${OBJCFLAGS} -g -pg" | |
99 | LDFLAGS="${LDFLAGS} -pg" | |
100 | ], | |
101 | [ | |
102 | AC_MSG_RESULT(no) | |
103 | dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags | |
104 | dnl by setting any unset environment flag variables | |
105 | AS_IF([test "x${CFLAGS+set}" != "xset"], | |
106 | [CFLAGS=""]) | |
107 | AS_IF([test "x${CXXFLAGS+set}" != "xset"], | |
108 | [CXXFLAGS=""]) | |
109 | AS_IF([test "x${FFLAGS+set}" != "xset"], | |
110 | [FFLAGS=""]) | |
111 | AS_IF([test "x${FCFLAGS+set}" != "xset"], | |
112 | [FCFLAGS=""]) | |
113 | AS_IF([test "x${OBJCFLAGS+set}" != "xset"], | |
114 | [OBJCFLAGS=""]) | |
115 | ]) | |
116 | ||
117 | dnl Define various variables if debugging is disabled. | |
118 | dnl assert.h is a NOP if NDEBUG is defined, so define it by default. | |
119 | AS_IF([test "x$enable_debug" = "xyes"], | |
120 | [m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])], | |
121 | [m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])]) | |
122 | ax_enable_debug=$enable_debug | |
123 | ]) |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_CHECK_GNU_MAKE() | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # This macro searches for a GNU version of make. If a match is found: | |
11 | # | |
12 | # * The makefile variable `ifGNUmake' is set to the empty string, otherwise | |
13 | # it is set to "#". This is useful for including a special features in a | |
14 | # Makefile, which cannot be handled by other versions of make. | |
15 | # * The variable `_cv_gnu_make_command` is set to the command to invoke | |
16 | # GNU make if it exists, the empty string otherwise. | |
17 | # * The variable `ax_cv_gnu_make_command` is set to the command to invoke | |
18 | # GNU make by copying `_cv_gnu_make_command`, otherwise it is unset. | |
19 | # * If GNU Make is found, its version is extracted from the output of | |
20 | # `make --version` as the last field of a record of space-separated | |
21 | # columns and saved into the variable `ax_check_gnu_make_version`. | |
22 | # | |
23 | # Here is an example of its use: | |
24 | # | |
25 | # Makefile.in might contain: | |
26 | # | |
27 | # # A failsafe way of putting a dependency rule into a makefile | |
28 | # $(DEPEND): | |
29 | # $(CC) -MM $(srcdir)/*.c > $(DEPEND) | |
30 | # | |
31 | # @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) | |
32 | # @ifGNUmake@ include $(DEPEND) | |
33 | # @ifGNUmake@ endif | |
34 | # | |
35 | # Then configure.in would normally contain: | |
36 | # | |
37 | # AX_CHECK_GNU_MAKE() | |
38 | # AC_OUTPUT(Makefile) | |
39 | # | |
40 | # Then perhaps to cause gnu make to override any other make, we could do | |
41 | # something like this (note that GNU make always looks for GNUmakefile | |
42 | # first): | |
43 | # | |
44 | # if ! test x$_cv_gnu_make_command = x ; then | |
45 | # mv Makefile GNUmakefile | |
46 | # echo .DEFAULT: > Makefile ; | |
47 | # echo \ $_cv_gnu_make_command \$@ >> Makefile; | |
48 | # fi | |
49 | # | |
50 | # Then, if any (well almost any) other make is called, and GNU make also | |
51 | # exists, then the other make wraps the GNU make. | |
52 | # | |
53 | # LICENSE | |
54 | # | |
55 | # Copyright (c) 2008 John Darrington <[email protected]> | |
56 | # Copyright (c) 2015 Enrico M. Crisostomo <[email protected]> | |
57 | # | |
58 | # Copying and distribution of this file, with or without modification, are | |
59 | # permitted in any medium without royalty provided the copyright notice | |
60 | # and this notice are preserved. This file is offered as-is, without any | |
61 | # warranty. | |
62 | ||
63 | #serial 8 | |
64 | ||
65 | AC_DEFUN([AX_CHECK_GNU_MAKE],dnl | |
66 | [AC_PROG_AWK | |
67 | AC_CACHE_CHECK([for GNU make],[_cv_gnu_make_command],[dnl | |
68 | _cv_gnu_make_command="" ; | |
69 | dnl Search all the common names for GNU make | |
70 | for a in "$MAKE" make gmake gnumake ; do | |
71 | if test -z "$a" ; then continue ; fi ; | |
72 | if "$a" --version 2> /dev/null | grep GNU 2>&1 > /dev/null ; then | |
73 | _cv_gnu_make_command=$a ; | |
74 | AX_CHECK_GNU_MAKE_HEADLINE=$("$a" --version 2> /dev/null | grep "GNU Make") | |
75 | ax_check_gnu_make_version=$(echo ${AX_CHECK_GNU_MAKE_HEADLINE} | ${AWK} -F " " '{ print $(NF); }') | |
76 | break ; | |
77 | fi | |
78 | done ;]) | |
79 | dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise | |
80 | AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifGNUmake], ["#"])], [AS_VAR_SET([ifGNUmake], [""])]) | |
81 | AS_VAR_IF([_cv_gnu_make_command], [""], [AS_UNSET(ax_cv_gnu_make_command)], [AS_VAR_SET([ax_cv_gnu_make_command], [${_cv_gnu_make_command}])]) | |
82 | AC_SUBST([ifGNUmake]) | |
83 | ]) |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # Check whether the given FLAG works with the linker or gives an error. | |
11 | # (Warnings, however, are ignored) | |
12 | # | |
13 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on | |
14 | # success/failure. | |
15 | # | |
16 | # If EXTRA-FLAGS is defined, it is added to the linker's default flags | |
17 | # when the check is done. The check is thus made with the flags: "LDFLAGS | |
18 | # EXTRA-FLAGS FLAG". This can for example be used to force the linker to | |
19 | # issue an error when a bad flag is given. | |
20 | # | |
21 | # INPUT gives an alternative input source to AC_LINK_IFELSE. | |
22 | # | |
23 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this | |
24 | # macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. | |
25 | # | |
26 | # LICENSE | |
27 | # | |
28 | # Copyright (c) 2008 Guido U. Draheim <[email protected]> | |
29 | # Copyright (c) 2011 Maarten Bosmans <[email protected]> | |
30 | # | |
31 | # This program is free software: you can redistribute it and/or modify it | |
32 | # under the terms of the GNU General Public License as published by the | |
33 | # Free Software Foundation, either version 3 of the License, or (at your | |
34 | # option) any later version. | |
35 | # | |
36 | # This program is distributed in the hope that it will be useful, but | |
37 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
38 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |
39 | # Public License for more details. | |
40 | # | |
41 | # You should have received a copy of the GNU General Public License along | |
42 | # with this program. If not, see <http://www.gnu.org/licenses/>. | |
43 | # | |
44 | # As a special exception, the respective Autoconf Macro's copyright owner | |
45 | # gives unlimited permission to copy, distribute and modify the configure | |
46 | # scripts that are the output of Autoconf when processing the Macro. You | |
47 | # need not follow the terms of the GNU General Public License when using | |
48 | # or distributing such scripts, even though portions of the text of the | |
49 | # Macro appear in them. The GNU General Public License (GPL) does govern | |
50 | # all other use of the material that constitutes the Autoconf Macro. | |
51 | # | |
52 | # This special exception to the GPL applies to versions of the Autoconf | |
53 | # Macro released by the Autoconf Archive. When you make and distribute a | |
54 | # modified version of the Autoconf Macro, you may extend this special | |
55 | # exception to the GPL to apply to your modified version as well. | |
56 | ||
57 | #serial 4 | |
58 | ||
59 | AC_DEFUN([AX_CHECK_LINK_FLAG], | |
60 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF | |
61 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl | |
62 | AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ | |
63 | ax_check_save_flags=$LDFLAGS | |
64 | LDFLAGS="$LDFLAGS $4 $1" | |
65 | AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], | |
66 | [AS_VAR_SET(CACHEVAR,[yes])], | |
67 | [AS_VAR_SET(CACHEVAR,[no])]) | |
68 | LDFLAGS=$ax_check_save_flags]) | |
69 | AS_VAR_IF(CACHEVAR,yes, | |
70 | [m4_default([$2], :)], | |
71 | [m4_default([$3], :)]) | |
72 | AS_VAR_POPDEF([CACHEVAR])dnl | |
73 | ])dnl AX_CHECK_LINK_FLAGS |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_code_coverage.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_CODE_COVERAGE() | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS, | |
11 | # CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LDFLAGS which should be | |
12 | # included in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LDFLAGS variables of | |
13 | # every build target (program or library) which should be built with code | |
14 | # coverage support. Also defines CODE_COVERAGE_RULES which should be | |
15 | # substituted in your Makefile; and $enable_code_coverage which can be | |
16 | # used in subsequent configure output. CODE_COVERAGE_ENABLED is defined | |
17 | # and substituted, and corresponds to the value of the | |
18 | # --enable-code-coverage option, which defaults to being disabled. | |
19 | # | |
20 | # Test also for gcov program and create GCOV variable that could be | |
21 | # substituted. | |
22 | # | |
23 | # Note that all optimisation flags in CFLAGS must be disabled when code | |
24 | # coverage is enabled. | |
25 | # | |
26 | # Usage example: | |
27 | # | |
28 | # configure.ac: | |
29 | # | |
30 | # AX_CODE_COVERAGE | |
31 | # | |
32 | # Makefile.am: | |
33 | # | |
34 | # @CODE_COVERAGE_RULES@ | |
35 | # my_program_LIBS = ... $(CODE_COVERAGE_LDFLAGS) ... | |
36 | # my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ... | |
37 | # my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ... | |
38 | # my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ... | |
39 | # | |
40 | # This results in a "check-code-coverage" rule being added to any | |
41 | # Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module | |
42 | # has been configured with --enable-code-coverage). Running `make | |
43 | # check-code-coverage` in that directory will run the module's test suite | |
44 | # (`make check`) and build a code coverage report detailing the code which | |
45 | # was touched, then print the URI for the report. | |
46 | # | |
47 | # This code was derived from Makefile.decl in GLib, originally licenced | |
48 | # under LGPLv2.1+. | |
49 | # | |
50 | # LICENSE | |
51 | # | |
52 | # Copyright (c) 2012, 2016 Philip Withnall | |
53 | # Copyright (c) 2012 Xan Lopez | |
54 | # Copyright (c) 2012 Christian Persch | |
55 | # Copyright (c) 2012 Paolo Borelli | |
56 | # Copyright (c) 2012 Dan Winship | |
57 | # Copyright (c) 2015 Bastien ROUCARIES | |
58 | # | |
59 | # This library is free software; you can redistribute it and/or modify it | |
60 | # under the terms of the GNU Lesser General Public License as published by | |
61 | # the Free Software Foundation; either version 2.1 of the License, or (at | |
62 | # your option) any later version. | |
63 | # | |
64 | # This library is distributed in the hope that it will be useful, but | |
65 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
66 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | |
67 | # General Public License for more details. | |
68 | # | |
69 | # You should have received a copy of the GNU Lesser General Public License | |
70 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
71 | ||
72 | #serial 15 | |
73 | ||
74 | AC_DEFUN([AX_CODE_COVERAGE],[ | |
75 | dnl Check for --enable-code-coverage | |
76 | AC_REQUIRE([AC_PROG_SED]) | |
77 | ||
78 | # allow to override gcov location | |
79 | AC_ARG_WITH([gcov], | |
80 | [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])], | |
81 | [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov], | |
82 | [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov]) | |
83 | ||
84 | AC_MSG_CHECKING([whether to build with code coverage support]) | |
85 | AC_ARG_ENABLE([code-coverage], | |
86 | AS_HELP_STRING([--enable-code-coverage], | |
87 | [Whether to enable code coverage support]),, | |
88 | enable_code_coverage=no) | |
89 | ||
90 | AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes]) | |
91 | AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage]) | |
92 | AC_MSG_RESULT($enable_code_coverage) | |
93 | ||
94 | AS_IF([ test "$enable_code_coverage" = "yes" ], [ | |
95 | # check for gcov | |
96 | AC_CHECK_TOOL([GCOV], | |
97 | [$_AX_CODE_COVERAGE_GCOV_PROG_WITH], | |
98 | [:]) | |
99 | AS_IF([test "X$GCOV" = "X:"], | |
100 | [AC_MSG_ERROR([gcov is needed to do coverage])]) | |
101 | AC_SUBST([GCOV]) | |
102 | ||
103 | dnl Check if gcc is being used | |
104 | AS_IF([ test "$GCC" = "no" ], [ | |
105 | AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage]) | |
106 | ]) | |
107 | ||
108 | # List of supported lcov versions. | |
109 | lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13" | |
110 | ||
111 | AC_CHECK_PROG([LCOV], [lcov], [lcov]) | |
112 | AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) | |
113 | ||
114 | AS_IF([ test "$LCOV" ], [ | |
115 | AC_CACHE_CHECK([for lcov version], ax_cv_lcov_version, [ | |
116 | ax_cv_lcov_version=invalid | |
117 | lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` | |
118 | for lcov_check_version in $lcov_version_list; do | |
119 | if test "$lcov_version" = "$lcov_check_version"; then | |
120 | ax_cv_lcov_version="$lcov_check_version (ok)" | |
121 | fi | |
122 | done | |
123 | ]) | |
124 | ], [ | |
125 | lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" | |
126 | AC_MSG_ERROR([$lcov_msg]) | |
127 | ]) | |
128 | ||
129 | case $ax_cv_lcov_version in | |
130 | ""|invalid[)] | |
131 | lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." | |
132 | AC_MSG_ERROR([$lcov_msg]) | |
133 | LCOV="exit 0;" | |
134 | ;; | |
135 | esac | |
136 | ||
137 | AS_IF([ test -z "$GENHTML" ], [ | |
138 | AC_MSG_ERROR([Could not find genhtml from the lcov package]) | |
139 | ]) | |
140 | ||
141 | dnl Build the code coverage flags | |
142 | CODE_COVERAGE_CPPFLAGS="-DNDEBUG" | |
143 | CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" | |
144 | CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" | |
145 | CODE_COVERAGE_LDFLAGS="-lgcov" | |
146 | ||
147 | AC_SUBST([CODE_COVERAGE_CPPFLAGS]) | |
148 | AC_SUBST([CODE_COVERAGE_CFLAGS]) | |
149 | AC_SUBST([CODE_COVERAGE_CXXFLAGS]) | |
150 | AC_SUBST([CODE_COVERAGE_LDFLAGS]) | |
151 | ]) | |
152 | ||
153 | [CODE_COVERAGE_RULES=' | |
154 | # Code coverage | |
155 | # | |
156 | # Optional: | |
157 | # - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. | |
158 | # Multiple directories may be specified, separated by whitespace. | |
159 | # (Default: $(top_builddir)) | |
160 | # - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated | |
161 | # by lcov for code coverage. (Default: | |
162 | # $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) | |
163 | # - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage | |
164 | # reports to be created. (Default: | |
165 | # $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) | |
166 | # - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, | |
167 | # set to 0 to disable it and leave empty to stay with the default. | |
168 | # (Default: empty) | |
169 | # - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov | |
170 | # instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) | |
171 | # - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov | |
172 | # instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) | |
173 | # - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov | |
174 | # - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the | |
175 | # collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) | |
176 | # - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov | |
177 | # instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) | |
178 | # - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering | |
179 | # lcov instance. (Default: empty) | |
180 | # - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov | |
181 | # instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) | |
182 | # - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the | |
183 | # genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) | |
184 | # - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml | |
185 | # instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) | |
186 | # - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore | |
187 | # | |
188 | # The generated report will be titled using the $(PACKAGE_NAME) and | |
189 | # $(PACKAGE_VERSION). In order to add the current git hash to the title, | |
190 | # use the git-version-gen script, available online. | |
191 | ||
192 | # Optional variables | |
193 | CODE_COVERAGE_DIRECTORY ?= $(top_builddir) | |
194 | CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info | |
195 | CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage | |
196 | CODE_COVERAGE_BRANCH_COVERAGE ?= | |
197 | CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ | |
198 | --rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) | |
199 | CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) | |
200 | CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" | |
201 | CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) | |
202 | CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) | |
203 | CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= | |
204 | CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) | |
205 | CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\ | |
206 | $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ | |
207 | --rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) | |
208 | CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULTS) | |
209 | CODE_COVERAGE_IGNORE_PATTERN ?= | |
210 | ||
211 | code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) | |
212 | code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) | |
213 | code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\ | |
214 | $(CODE_COVERAGE_OUTPUT_FILE); | |
215 | code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) | |
216 | code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) | |
217 | code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\ | |
218 | $(CODE_COVERAGE_IGNORE_PATTERN); | |
219 | code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) | |
220 | code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) | |
221 | code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY); | |
222 | code_coverage_quiet = $(code_coverage_quiet_$(V)) | |
223 | code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) | |
224 | code_coverage_quiet_0 = --quiet | |
225 | ||
226 | # sanitizes the test-name: replaces with underscores: dashes and dots | |
227 | code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) | |
228 | ||
229 | # Use recursive makes in order to ignore errors during check | |
230 | check-code-coverage: | |
231 | ifeq ($(CODE_COVERAGE_ENABLED),yes) | |
232 | -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check | |
233 | $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture | |
234 | else | |
235 | @echo "Need to reconfigure with --enable-code-coverage" | |
236 | endif | |
237 | ||
238 | # Capture code coverage data | |
239 | code-coverage-capture: code-coverage-capture-hook | |
240 | ifeq ($(CODE_COVERAGE_ENABLED),yes) | |
241 | $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) | |
242 | $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) | |
243 | -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp | |
244 | $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) | |
245 | @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" | |
246 | else | |
247 | @echo "Need to reconfigure with --enable-code-coverage" | |
248 | endif | |
249 | ||
250 | # Hook rule executed before code-coverage-capture, overridable by the user | |
251 | code-coverage-capture-hook: | |
252 | ||
253 | ifeq ($(CODE_COVERAGE_ENABLED),yes) | |
254 | clean: code-coverage-clean | |
255 | code-coverage-clean: | |
256 | -$(LCOV) --directory $(top_builddir) -z | |
257 | -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) | |
258 | -find . -name "*.gcda" -o -name "*.gcov" -delete | |
259 | endif | |
260 | ||
261 | GITIGNOREFILES ?= | |
262 | GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) | |
263 | ||
264 | A''M_DISTCHECK_CONFIGURE_FLAGS ?= | |
265 | A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage | |
266 | ||
267 | .PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean | |
268 | '] | |
269 | ||
270 | AC_SUBST([CODE_COVERAGE_RULES]) | |
271 | m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])]) | |
272 | ]) |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_configure_args.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_CONFIGURE_ARGS | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # Helper macro for AX_ENABLE_BUILDDIR. | |
11 | # | |
12 | # The traditional way of starting a subdir-configure is running the script | |
13 | # with ${1+"$@"} but since autoconf 2.60 this is broken. Instead we have | |
14 | # to rely on eval'ing $ac_configure_args however some old autoconf | |
15 | # versions do not provide that. To ensure maximum portability of autoconf | |
16 | # extension macros this helper can be AC_REQUIRE'd so that | |
17 | # $ac_configure_args will alsways be present. | |
18 | # | |
19 | # Sadly, the traditional "exec $SHELL" of the enable_builddir macros is | |
20 | # spoiled now and must be replaced by "eval + exit $?". | |
21 | # | |
22 | # Example: | |
23 | # | |
24 | # AC_DEFUN([AX_ENABLE_SUBDIR],[dnl | |
25 | # AC_REQUIRE([AX_CONFIGURE_ARGS])dnl | |
26 | # eval $SHELL $ac_configure_args || exit $? | |
27 | # ...]) | |
28 | # | |
29 | # LICENSE | |
30 | # | |
31 | # Copyright (c) 2008 Guido U. Draheim <[email protected]> | |
32 | # | |
33 | # This program is free software; you can redistribute it and/or modify it | |
34 | # under the terms of the GNU General Public License as published by the | |
35 | # Free Software Foundation; either version 3 of the License, or (at your | |
36 | # option) any later version. | |
37 | # | |
38 | # This program is distributed in the hope that it will be useful, but | |
39 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
40 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |
41 | # Public License for more details. | |
42 | # | |
43 | # You should have received a copy of the GNU General Public License along | |
44 | # with this program. If not, see <http://www.gnu.org/licenses/>. | |
45 | # | |
46 | # As a special exception, the respective Autoconf Macro's copyright owner | |
47 | # gives unlimited permission to copy, distribute and modify the configure | |
48 | # scripts that are the output of Autoconf when processing the Macro. You | |
49 | # need not follow the terms of the GNU General Public License when using | |
50 | # or distributing such scripts, even though portions of the text of the | |
51 | # Macro appear in them. The GNU General Public License (GPL) does govern | |
52 | # all other use of the material that constitutes the Autoconf Macro. | |
53 | # | |
54 | # This special exception to the GPL applies to versions of the Autoconf | |
55 | # Macro released by the Autoconf Archive. When you make and distribute a | |
56 | # modified version of the Autoconf Macro, you may extend this special | |
57 | # exception to the GPL to apply to your modified version as well. | |
58 | ||
59 | #serial 9 | |
60 | ||
61 | AC_DEFUN([AX_CONFIGURE_ARGS],[ | |
62 | # [$]@ is unsable in 2.60+ but earlier autoconf had no ac_configure_args | |
63 | if test "${ac_configure_args+set}" != "set" ; then | |
64 | ac_configure_args= | |
65 | for ac_arg in ${1+"[$]@"}; do | |
66 | ac_configure_args="$ac_configure_args '$ac_arg'" | |
67 | done | |
68 | fi | |
69 | ]) |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_enable_builddir.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_ENABLE_BUILDDIR [(dirstring-or-command [,Makefile.mk [,-all]])] | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # If the current configure was run within the srcdir then we move all | |
11 | # configure-files into a subdir and let the configure steps continue | |
12 | # there. We provide an option --disable-builddir to suppress the move into | |
13 | # a separate builddir. | |
14 | # | |
15 | # Defaults: | |
16 | # | |
17 | # $1 = $host (overridden with $HOST) | |
18 | # $2 = Makefile.mk | |
19 | # $3 = -all | |
20 | # | |
21 | # This macro must be called before AM_INIT_AUTOMAKE. It creates a default | |
22 | # toplevel srcdir Makefile from the information found in the created | |
23 | # toplevel builddir Makefile. It just copies the variables and | |
24 | # rule-targets, each extended with a default rule-execution that recurses | |
25 | # into the build directory of the current "HOST". You can override the | |
26 | # auto-dection through `config.guess` and build-time of course, as in | |
27 | # | |
28 | # make HOST=i386-mingw-cross | |
29 | # | |
30 | # which can of course set at configure time as well using | |
31 | # | |
32 | # configure --host=i386-mingw-cross | |
33 | # | |
34 | # After the default has been created, additional rules can be appended | |
35 | # that will not just recurse into the subdirectories and only ever exist | |
36 | # in the srcdir toplevel makefile - these parts are read from the $2 = | |
37 | # Makefile.mk file | |
38 | # | |
39 | # The automatic rules are usually scanning the toplevel Makefile for lines | |
40 | # like '#### $host |$builddir' to recognize the place where to recurse | |
41 | # into. Usually, the last one is the only one used. However, almost all | |
42 | # targets have an additional "*-all" rule which makes the script to | |
43 | # recurse into _all_ variants of the current HOST (!!) setting. The "-all" | |
44 | # suffix can be overriden for the macro as well. | |
45 | # | |
46 | # a special rule is only given for things like "dist" that will copy the | |
47 | # tarball from the builddir to the sourcedir (or $(PUB)) for reason of | |
48 | # convenience. | |
49 | # | |
50 | # LICENSE | |
51 | # | |
52 | # Copyright (c) 2009 Guido U. Draheim <[email protected]> | |
53 | # Copyright (c) 2009 Alan Jenkins <[email protected]> | |
54 | # | |
55 | # This program is free software; you can redistribute it and/or modify it | |
56 | # under the terms of the GNU General Public License as published by the | |
57 | # Free Software Foundation; either version 3 of the License, or (at your | |
58 | # option) any later version. | |
59 | # | |
60 | # This program is distributed in the hope that it will be useful, but | |
61 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
62 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |
63 | # Public License for more details. | |
64 | # | |
65 | # You should have received a copy of the GNU General Public License along | |
66 | # with this program. If not, see <http://www.gnu.org/licenses/>. | |
67 | # | |
68 | # As a special exception, the respective Autoconf Macro's copyright owner | |
69 | # gives unlimited permission to copy, distribute and modify the configure | |
70 | # scripts that are the output of Autoconf when processing the Macro. You | |
71 | # need not follow the terms of the GNU General Public License when using | |
72 | # or distributing such scripts, even though portions of the text of the | |
73 | # Macro appear in them. The GNU General Public License (GPL) does govern | |
74 | # all other use of the material that constitutes the Autoconf Macro. | |
75 | # | |
76 | # This special exception to the GPL applies to versions of the Autoconf | |
77 | # Macro released by the Autoconf Archive. When you make and distribute a | |
78 | # modified version of the Autoconf Macro, you may extend this special | |
79 | # exception to the GPL to apply to your modified version as well. | |
80 | ||
81 | #serial 25 | |
82 | ||
83 | AC_DEFUN([AX_ENABLE_BUILDDIR],[ | |
84 | AC_REQUIRE([AC_CANONICAL_HOST])[]dnl | |
85 | AC_REQUIRE([AC_CANONICAL_TARGET])[]dnl | |
86 | AC_REQUIRE([AX_CONFIGURE_ARGS])[]dnl | |
87 | AC_REQUIRE([AM_AUX_DIR_EXPAND])[]dnl | |
88 | AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl | |
89 | AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl | |
90 | AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl | |
91 | AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl | |
92 | SUB="." | |
93 | AC_ARG_ENABLE([builddir], AS_HELP_STRING( | |
94 | [--disable-builddir],[disable automatic build in subdir of sources]) | |
95 | ,[SUB="$enableval"], [SUB="auto"]) | |
96 | if test ".$ac_srcdir_defaulted" != ".no" ; then | |
97 | if test ".$srcdir" = ".." ; then | |
98 | if test -f config.status ; then | |
99 | AC_MSG_NOTICE(toplevel srcdir already configured... skipping subdir build) | |
100 | else | |
101 | test ".$SUB" = "." && SUB="." | |
102 | test ".$SUB" = ".no" && SUB="." | |
103 | test ".$TARGET" = "." && TARGET="$target" | |
104 | test ".$SUB" = ".auto" && SUB="m4_ifval([$1], [$1],[$TARGET])" | |
105 | if test ".$SUB" != ".." ; then # we know where to go and | |
106 | AS_MKDIR_P([$SUB]) | |
107 | echo __.$SUB.__ > $SUB/conftest.tmp | |
108 | cd $SUB | |
109 | if grep __.$SUB.__ conftest.tmp >/dev/null 2>/dev/null ; then | |
110 | rm conftest.tmp | |
111 | AC_MSG_RESULT([continue configure in default builddir "./$SUB"]) | |
112 | else | |
113 | AC_MSG_ERROR([could not change to default builddir "./$SUB"]) | |
114 | fi | |
115 | srcdir=`echo "$SUB" | | |
116 | sed -e 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g;s,[[/]]$,,;'` | |
117 | # going to restart from subdirectory location | |
118 | test -f $srcdir/config.log && mv $srcdir/config.log . | |
119 | test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h . | |
120 | test -f $srcdir/conftest.log && mv $srcdir/conftest.log . | |
121 | test -f $srcdir/$cache_file && mv $srcdir/$cache_file . | |
122 | AC_MSG_RESULT(....exec $SHELL $srcdir/[$]0 "--srcdir=$srcdir" "--enable-builddir=$SUB" ${1+"[$]@"}) | |
123 | case "[$]0" in # restart | |
124 | [[\\/]]* | ?:[[\\/]]*) # Asbolute name | |
125 | eval $SHELL "'[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;; | |
126 | *) eval $SHELL "'$srcdir/[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;; | |
127 | esac ; exit $? | |
128 | fi | |
129 | fi | |
130 | fi fi | |
131 | test ".$SUB" = ".auto" && SUB="." | |
132 | dnl ac_path_prog uses "set dummy" to override $@ which would defeat the "exec" | |
133 | AC_PATH_PROG(SED,gsed sed, sed) | |
134 | AUX="$am_aux_dir" | |
135 | AS_VAR_POPDEF([SED])dnl | |
136 | AS_VAR_POPDEF([AUX])dnl | |
137 | AS_VAR_POPDEF([SUB])dnl | |
138 | AC_CONFIG_COMMANDS([buildir],[dnl .............. config.status .............. | |
139 | AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl | |
140 | AS_VAR_PUSHDEF([TOP],[top_srcdir])dnl | |
141 | AS_VAR_PUSHDEF([SRC],[ac_top_srcdir])dnl | |
142 | AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl | |
143 | AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl | |
144 | pushdef([END],[Makefile.mk])dnl | |
145 | pushdef([_ALL],[ifelse([$3],,[-all],[$3])])dnl | |
146 | SRC="$ax_enable_builddir_srcdir" | |
147 | if test ".$SUB" = ".." ; then | |
148 | if test -f "$TOP/Makefile" ; then | |
149 | AC_MSG_NOTICE([skipping TOP/Makefile - left untouched]) | |
150 | else | |
151 | AC_MSG_NOTICE([skipping TOP/Makefile - not created]) | |
152 | fi | |
153 | else | |
154 | if test -f "$SRC/Makefile" ; then | |
155 | a=`grep "^VERSION " "$SRC/Makefile"` ; b=`grep "^VERSION " Makefile` | |
156 | test "$a" != "$b" && rm "$SRC/Makefile" | |
157 | fi | |
158 | if test -f "$SRC/Makefile" ; then | |
159 | echo "$SRC/Makefile : $SRC/Makefile.in" > $tmp/conftemp.mk | |
160 | echo " []@ echo 'REMOVED,,,' >\$[]@" >> $tmp/conftemp.mk | |
161 | eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null" | |
162 | if grep '^REMOVED,,,' "$SRC/Makefile" >/dev/null | |
163 | then rm $SRC/Makefile ; fi | |
164 | cp $tmp/conftemp.mk $SRC/makefiles.mk~ ## DEBUGGING | |
165 | fi | |
166 | if test ! -f "$SRC/Makefile" ; then | |
167 | AC_MSG_NOTICE([create TOP/Makefile guessed from local Makefile]) | |
168 | x='`' ; cat >$tmp/conftemp.sed <<_EOF | |
169 | /^\$/n | |
170 | x | |
171 | /^\$/bS | |
172 | x | |
173 | /\\\\\$/{H;d;} | |
174 | {H;s/.*//;x;} | |
175 | bM | |
176 | :S | |
177 | x | |
178 | /\\\\\$/{h;d;} | |
179 | {h;s/.*//;x;} | |
180 | :M | |
181 | s/\\(\\n\\) /\\1 /g | |
182 | /^ /d | |
183 | /^[[ ]]*[[\\#]]/d | |
184 | /^VPATH *=/d | |
185 | s/^srcdir *=.*/srcdir = ./ | |
186 | s/^top_srcdir *=.*/top_srcdir = ./ | |
187 | /[[:=]]/!d | |
188 | /^\\./d | |
189 | dnl Now handle rules (i.e. lines containing ":" but not " = "). | |
190 | / = /b | |
191 | / .= /b | |
192 | /:/!b | |
193 | s/:.*/:/ | |
194 | s/ / /g | |
195 | s/ \\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/ \\1 \\1[]_ALL\\2/g | |
196 | s/^\\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/\\1 \\1[]_ALL\\2/ | |
197 | s/ / /g | |
198 | /^all all[]_ALL[[ :]]/i\\ | |
199 | all-configured : all[]_ALL | |
200 | dnl dist-all exists... and would make for dist-all-all | |
201 | s/ [[a-zA-Z0-9-]]*[]_ALL [[a-zA-Z0-9-]]*[]_ALL[]_ALL//g | |
202 | /[]_ALL[]_ALL/d | |
203 | a\\ | |
204 | @ HOST="\$(HOST)\" \\\\\\ | |
205 | ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ | |
206 | ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ | |
207 | ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ | |
208 | ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" -eq "0" ; then : \\\\\\ | |
209 | ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\ | |
210 | ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ | |
211 | ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\ | |
212 | ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ | |
213 | ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done | |
214 | dnl special rule add-on: "dist" copies the tarball to $(PUB). (source tree) | |
215 | /dist[]_ALL *:/a\\ | |
216 | @ HOST="\$(HOST)\" \\\\\\ | |
217 | ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ | |
218 | ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ | |
219 | ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ | |
220 | ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\ | |
221 | ; if test "\$\$found" -eq "0" ; then : \\\\\\ | |
222 | ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ | |
223 | ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ | |
224 | ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).tar.* \\\\\\ | |
225 | ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done | |
226 | dnl special rule add-on: "dist-foo" copies all the archives to $(PUB). (source tree) | |
227 | /dist-[[a-zA-Z0-9]]*[]_ALL *:/a\\ | |
228 | @ HOST="\$(HOST)\" \\\\\\ | |
229 | ; test ".\$\$HOST" = "." && HOST=$x sh ./config.guess $x \\\\\\ | |
230 | ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ | |
231 | ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ | |
232 | ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).*" \\\\\\ | |
233 | ; if test "\$\$found" -eq "0" ; then : \\\\\\ | |
234 | ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ | |
235 | ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ | |
236 | ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).* \\\\\\ | |
237 | ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done | |
238 | dnl special rule add-on: "distclean" removes all local builddirs completely | |
239 | /distclean[]_ALL *:/a\\ | |
240 | @ HOST="\$(HOST)\" \\\\\\ | |
241 | ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ | |
242 | ; BUILD=$x grep "^#### .*|" Makefile | sed -e 's/.*|//' $x \\\\\\ | |
243 | ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ | |
244 | ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\ | |
245 | ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ | |
246 | ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ | |
247 | ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\ | |
248 | ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ | |
249 | ; echo "\$\$i" | grep "^/" > /dev/null && continue \\\\\\ | |
250 | ; echo "\$\$i" | grep "^../" > /dev/null && continue \\\\\\ | |
251 | ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile | |
252 | _EOF | |
253 | cp "$tmp/conftemp.sed" "$SRC/makefile.sed~" ## DEBUGGING | |
254 | $SED -f $tmp/conftemp.sed Makefile >$SRC/Makefile | |
255 | if test -f "$SRC/m4_ifval([$2],[$2],[END])" ; then | |
256 | AC_MSG_NOTICE([extend TOP/Makefile with TOP/m4_ifval([$2],[$2],[END])]) | |
257 | cat $SRC/END >>$SRC/Makefile | |
258 | fi ; xxxx="####" | |
259 | echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$SRC/Makefile | |
260 | # sanity check | |
261 | if grep '^; echo "MAKE ' $SRC/Makefile >/dev/null ; then | |
262 | AC_MSG_NOTICE([buggy sed found - it deletes tab in "a" text parts]) | |
263 | $SED -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/ /' $SRC/Makefile \ | |
264 | >$SRC/Makefile~ | |
265 | (test -s $SRC/Makefile~ && mv $SRC/Makefile~ $SRC/Makefile) 2>/dev/null | |
266 | fi | |
267 | else | |
268 | xxxx="\\#\\#\\#\\#" | |
269 | # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed | |
270 | echo "s!^$xxxx [[^|]]* | *$SUB *\$!$xxxx ...... $SUB!" >$tmp/conftemp.sed | |
271 | $SED -f "$tmp/conftemp.sed" "$SRC/Makefile" >$tmp/mkfile.tmp | |
272 | cp "$tmp/conftemp.sed" "$SRC/makefiles.sed~" ## DEBUGGING | |
273 | cp "$tmp/mkfile.tmp" "$SRC/makefiles.out~" ## DEBUGGING | |
274 | if cmp -s "$SRC/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then | |
275 | AC_MSG_NOTICE([keeping TOP/Makefile from earlier configure]) | |
276 | rm "$tmp/mkfile.tmp" | |
277 | else | |
278 | AC_MSG_NOTICE([reusing TOP/Makefile from earlier configure]) | |
279 | mv "$tmp/mkfile.tmp" "$SRC/Makefile" | |
280 | fi | |
281 | fi | |
282 | AC_MSG_NOTICE([build in $SUB (HOST=$ax_enable_builddir_host)]) | |
283 | xxxx="####" | |
284 | echo "$xxxx" "$ax_enable_builddir_host" "|$SUB" >>$SRC/Makefile | |
285 | fi | |
286 | popdef([END])dnl | |
287 | AS_VAR_POPDEF([SED])dnl | |
288 | AS_VAR_POPDEF([AUX])dnl | |
289 | AS_VAR_POPDEF([SRC])dnl | |
290 | AS_VAR_POPDEF([TOP])dnl | |
291 | AS_VAR_POPDEF([SUB])dnl | |
292 | ],[dnl | |
293 | ax_enable_builddir_srcdir="$srcdir" # $srcdir | |
294 | ax_enable_builddir_host="$HOST" # $HOST / $host | |
295 | ax_enable_builddir_version="$VERSION" # $VERSION | |
296 | ax_enable_builddir_package="$PACKAGE" # $PACKAGE | |
297 | ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX | |
298 | ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED | |
299 | ax_enable_builddir="$ax_enable_builddir" # $SUB | |
300 | ])dnl | |
301 | ]) |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_extend_srcdir.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_EXTEND_SRCDIR | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # The AX_EXTEND_SRCDIR macro extends $srcdir by one path component. | |
11 | # | |
12 | # As an example, when working in /home/michael/i3-4.12/build and calling | |
13 | # ../configure, your $srcdir is "..". After calling AX_EXTEND_SRCDIR, | |
14 | # $srcdir will be set to "../../i3-4.12". | |
15 | # | |
16 | # The result of extending $srcdir is that filenames (e.g. in the output of | |
17 | # the "backtrace" gdb command) will include one more path component of the | |
18 | # absolute source path. The additional path component makes it easy for | |
19 | # users to recognize which files belong to the PACKAGE, and -- provided a | |
20 | # dist tarball was unpacked -- which version of PACKAGE was used. | |
21 | # | |
22 | # As an example, in "backtrace", you will see: | |
23 | # | |
24 | # #0 main (argc=1, argv=0x7fffffff1fc8) at ../../i3-4.12/src/main.c:187 | |
25 | # | |
26 | # instead of: | |
27 | # | |
28 | # #0 main (argc=1, argv=0x7fffffff1fc8) at ../src/main.c:187 | |
29 | # | |
30 | # In case your code uses the __FILE__ preprocessor directive to refer to | |
31 | # the filename of the current source file (e.g. in debug messages), using | |
32 | # the extended path might be undesirable. For this purpose, | |
33 | # AX_EXTEND_SRCDIR defines the output variable AX_EXTEND_SRCDIR_CPPFLAGS, | |
34 | # which can be added to AM_CPPFLAGS in Makefile.am in order to define the | |
35 | # preprocessor directive STRIPPED__FILE__. As an example, when compiling | |
36 | # the file "../../i3-4.12/src/main.c", STRIPPED__FILE__ evaluates to | |
37 | # "main.c". | |
38 | # | |
39 | # There are some caveats: When $srcdir is "." (i.e. when ./configure was | |
40 | # called instead of ../configure in a separate build directory), | |
41 | # AX_EXTEND_SRCDIR will still extend $srcdir, but the intended effect will | |
42 | # not be achieved because of the way automake specifies file paths: | |
43 | # automake defines COMPILE to use "`test -f '$source' || echo | |
44 | # '\$(srcdir)/'`$source" in order to prefer files in the current directory | |
45 | # over specifying $srcdir explicitly. | |
46 | # | |
47 | # The AX_EXTEND_SRCDIR author is not aware of any way to influence this | |
48 | # automake behavior. Patches very welcome. | |
49 | # | |
50 | # To work around this issue, you can use AX_ENABLE_BUILDDIR i.e. by adding | |
51 | # the following code to configure.ac: | |
52 | # | |
53 | # AX_ENABLE_BUILDDIR | |
54 | # dnl ... | |
55 | # AX_EXTEND_SRCDIR | |
56 | # | |
57 | # Then also add this bit to Makefile.am (if you wish to use | |
58 | # STRIPPED__FILE__ in your code): | |
59 | # | |
60 | # AM_CPPFLAGS = @AX_EXTEND_SRCDIR_CPPFLAGS@ | |
61 | # | |
62 | # LICENSE | |
63 | # | |
64 | # Copyright (c) 2016 Michael Stapelberg <[email protected]> | |
65 | # | |
66 | # Copying and distribution of this file, with or without modification, are | |
67 | # permitted in any medium without royalty provided the copyright notice | |
68 | # and this notice are preserved. This file is offered as-is, without any | |
69 | # warranty. | |
70 | ||
71 | #serial 3 | |
72 | ||
73 | AC_DEFUN([AX_EXTEND_SRCDIR], | |
74 | [dnl | |
75 | AS_CASE([$srcdir], | |
76 | [.|.*|/*], | |
77 | [ | |
78 | # pwd -P is specified in IEEE 1003.1 from 2004 | |
79 | as_dir=`cd "$srcdir" && pwd -P` | |
80 | as_base=`AS_BASENAME([$as_dir])` | |
81 | srcdir=${srcdir}/../${as_base} | |
82 | ||
83 | AC_SUBST([AX_EXTEND_SRCDIR_CPPFLAGS], ["-DSTRIPPED__FILE__=AS_ESCAPE([\"$$(basename $<)\"])"]) | |
84 | ]) | |
85 | ])dnl AX_EXTEND_SRCDIR |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_pthread.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # This macro figures out how to build C programs using POSIX threads. It | |
11 | # sets the PTHREAD_LIBS output variable to the threads library and linker | |
12 | # flags, and the PTHREAD_CFLAGS output variable to any special C compiler | |
13 | # flags that are needed. (The user can also force certain compiler | |
14 | # flags/libs to be tested by setting these environment variables.) | |
15 | # | |
16 | # Also sets PTHREAD_CC to any special C compiler that is needed for | |
17 | # multi-threaded programs (defaults to the value of CC otherwise). (This | |
18 | # is necessary on AIX to use the special cc_r compiler alias.) | |
19 | # | |
20 | # NOTE: You are assumed to not only compile your program with these flags, | |
21 | # but also to link with them as well. For example, you might link with | |
22 | # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS | |
23 | # | |
24 | # If you are only building threaded programs, you may wish to use these | |
25 | # variables in your default LIBS, CFLAGS, and CC: | |
26 | # | |
27 | # LIBS="$PTHREAD_LIBS $LIBS" | |
28 | # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" | |
29 | # CC="$PTHREAD_CC" | |
30 | # | |
31 | # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant | |
32 | # has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to | |
33 | # that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). | |
34 | # | |
35 | # Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the | |
36 | # PTHREAD_PRIO_INHERIT symbol is defined when compiling with | |
37 | # PTHREAD_CFLAGS. | |
38 | # | |
39 | # ACTION-IF-FOUND is a list of shell commands to run if a threads library | |
40 | # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it | |
41 | # is not found. If ACTION-IF-FOUND is not specified, the default action | |
42 | # will define HAVE_PTHREAD. | |
43 | # | |
44 | # Please let the authors know if this macro fails on any platform, or if | |
45 | # you have any other suggestions or comments. This macro was based on work | |
46 | # by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help | |
47 | # from M. Frigo), as well as ac_pthread and hb_pthread macros posted by | |
48 | # Alejandro Forero Cuervo to the autoconf macro repository. We are also | |
49 | # grateful for the helpful feedback of numerous users. | |
50 | # | |
51 | # Updated for Autoconf 2.68 by Daniel Richard G. | |
52 | # | |
53 | # LICENSE | |
54 | # | |
55 | # Copyright (c) 2008 Steven G. Johnson <[email protected]> | |
56 | # Copyright (c) 2011 Daniel Richard G. <[email protected]> | |
57 | # | |
58 | # This program is free software: you can redistribute it and/or modify it | |
59 | # under the terms of the GNU General Public License as published by the | |
60 | # Free Software Foundation, either version 3 of the License, or (at your | |
61 | # option) any later version. | |
62 | # | |
63 | # This program is distributed in the hope that it will be useful, but | |
64 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
65 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |
66 | # Public License for more details. | |
67 | # | |
68 | # You should have received a copy of the GNU General Public License along | |
69 | # with this program. If not, see <http://www.gnu.org/licenses/>. | |
70 | # | |
71 | # As a special exception, the respective Autoconf Macro's copyright owner | |
72 | # gives unlimited permission to copy, distribute and modify the configure | |
73 | # scripts that are the output of Autoconf when processing the Macro. You | |
74 | # need not follow the terms of the GNU General Public License when using | |
75 | # or distributing such scripts, even though portions of the text of the | |
76 | # Macro appear in them. The GNU General Public License (GPL) does govern | |
77 | # all other use of the material that constitutes the Autoconf Macro. | |
78 | # | |
79 | # This special exception to the GPL applies to versions of the Autoconf | |
80 | # Macro released by the Autoconf Archive. When you make and distribute a | |
81 | # modified version of the Autoconf Macro, you may extend this special | |
82 | # exception to the GPL to apply to your modified version as well. | |
83 | ||
84 | #serial 23 | |
85 | ||
86 | AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) | |
87 | AC_DEFUN([AX_PTHREAD], [ | |
88 | AC_REQUIRE([AC_CANONICAL_HOST]) | |
89 | AC_REQUIRE([AC_PROG_CC]) | |
90 | AC_REQUIRE([AC_PROG_SED]) | |
91 | AC_LANG_PUSH([C]) | |
92 | ax_pthread_ok=no | |
93 | ||
94 | # We used to check for pthread.h first, but this fails if pthread.h | |
95 | # requires special compiler flags (e.g. on Tru64 or Sequent). | |
96 | # It gets checked for in the link test anyway. | |
97 | ||
98 | # First of all, check if the user has set any of the PTHREAD_LIBS, | |
99 | # etcetera environment variables, and if threads linking works using | |
100 | # them: | |
101 | if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then | |
102 | ax_pthread_save_CC="$CC" | |
103 | ax_pthread_save_CFLAGS="$CFLAGS" | |
104 | ax_pthread_save_LIBS="$LIBS" | |
105 | AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) | |
106 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" | |
107 | LIBS="$PTHREAD_LIBS $LIBS" | |
108 | AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) | |
109 | AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) | |
110 | AC_MSG_RESULT([$ax_pthread_ok]) | |
111 | if test "x$ax_pthread_ok" = "xno"; then | |
112 | PTHREAD_LIBS="" | |
113 | PTHREAD_CFLAGS="" | |
114 | fi | |
115 | CC="$ax_pthread_save_CC" | |
116 | CFLAGS="$ax_pthread_save_CFLAGS" | |
117 | LIBS="$ax_pthread_save_LIBS" | |
118 | fi | |
119 | ||
120 | # We must check for the threads library under a number of different | |
121 | # names; the ordering is very important because some systems | |
122 | # (e.g. DEC) have both -lpthread and -lpthreads, where one of the | |
123 | # libraries is broken (non-POSIX). | |
124 | ||
125 | # Create a list of thread flags to try. Items starting with a "-" are | |
126 | # C compiler flags, and other items are library names, except for "none" | |
127 | # which indicates that we try without any flags at all, and "pthread-config" | |
128 | # which is a program returning the flags for the Pth emulation library. | |
129 | ||
130 | ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" | |
131 | ||
132 | # The ordering *is* (sometimes) important. Some notes on the | |
133 | # individual items follow: | |
134 | ||
135 | # pthreads: AIX (must check this before -lpthread) | |
136 | # none: in case threads are in libc; should be tried before -Kthread and | |
137 | # other compiler flags to prevent continual compiler warnings | |
138 | # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) | |
139 | # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 | |
140 | # (Note: HP C rejects this with "bad form for `-t' option") | |
141 | # -pthreads: Solaris/gcc (Note: HP C also rejects) | |
142 | # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it | |
143 | # doesn't hurt to check since this sometimes defines pthreads and | |
144 | # -D_REENTRANT too), HP C (must be checked before -lpthread, which | |
145 | # is present but should not be used directly; and before -mthreads, | |
146 | # because the compiler interprets this as "-mt" + "-hreads") | |
147 | # -mthreads: Mingw32/gcc, Lynx/gcc | |
148 | # pthread: Linux, etcetera | |
149 | # --thread-safe: KAI C++ | |
150 | # pthread-config: use pthread-config program (for GNU Pth library) | |
151 | ||
152 | case $host_os in | |
153 | ||
154 | freebsd*) | |
155 | ||
156 | # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) | |
157 | # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) | |
158 | ||
159 | ax_pthread_flags="-kthread lthread $ax_pthread_flags" | |
160 | ;; | |
161 | ||
162 | hpux*) | |
163 | ||
164 | # From the cc(1) man page: "[-mt] Sets various -D flags to enable | |
165 | # multi-threading and also sets -lpthread." | |
166 | ||
167 | ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" | |
168 | ;; | |
169 | ||
170 | openedition*) | |
171 | ||
172 | # IBM z/OS requires a feature-test macro to be defined in order to | |
173 | # enable POSIX threads at all, so give the user a hint if this is | |
174 | # not set. (We don't define these ourselves, as they can affect | |
175 | # other portions of the system API in unpredictable ways.) | |
176 | ||
177 | AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], | |
178 | [ | |
179 | # if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) | |
180 | AX_PTHREAD_ZOS_MISSING | |
181 | # endif | |
182 | ], | |
183 | [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) | |
184 | ;; | |
185 | ||
186 | solaris*) | |
187 | ||
188 | # On Solaris (at least, for some versions), libc contains stubbed | |
189 | # (non-functional) versions of the pthreads routines, so link-based | |
190 | # tests will erroneously succeed. (N.B.: The stubs are missing | |
191 | # pthread_cleanup_push, or rather a function called by this macro, | |
192 | # so we could check for that, but who knows whether they'll stub | |
193 | # that too in a future libc.) So we'll check first for the | |
194 | # standard Solaris way of linking pthreads (-mt -lpthread). | |
195 | ||
196 | ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" | |
197 | ;; | |
198 | esac | |
199 | ||
200 | # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) | |
201 | ||
202 | AS_IF([test "x$GCC" = "xyes"], | |
203 | [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"]) | |
204 | ||
205 | # The presence of a feature test macro requesting re-entrant function | |
206 | # definitions is, on some systems, a strong hint that pthreads support is | |
207 | # correctly enabled | |
208 | ||
209 | case $host_os in | |
210 | darwin* | hpux* | linux* | osf* | solaris*) | |
211 | ax_pthread_check_macro="_REENTRANT" | |
212 | ;; | |
213 | ||
214 | aix*) | |
215 | ax_pthread_check_macro="_THREAD_SAFE" | |
216 | ;; | |
217 | ||
218 | *) | |
219 | ax_pthread_check_macro="--" | |
220 | ;; | |
221 | esac | |
222 | AS_IF([test "x$ax_pthread_check_macro" = "x--"], | |
223 | [ax_pthread_check_cond=0], | |
224 | [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) | |
225 | ||
226 | # Are we compiling with Clang? | |
227 | ||
228 | AC_CACHE_CHECK([whether $CC is Clang], | |
229 | [ax_cv_PTHREAD_CLANG], | |
230 | [ax_cv_PTHREAD_CLANG=no | |
231 | # Note that Autoconf sets GCC=yes for Clang as well as GCC | |
232 | if test "x$GCC" = "xyes"; then | |
233 | AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], | |
234 | [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ | |
235 | # if defined(__clang__) && defined(__llvm__) | |
236 | AX_PTHREAD_CC_IS_CLANG | |
237 | # endif | |
238 | ], | |
239 | [ax_cv_PTHREAD_CLANG=yes]) | |
240 | fi | |
241 | ]) | |
242 | ax_pthread_clang="$ax_cv_PTHREAD_CLANG" | |
243 | ||
244 | ax_pthread_clang_warning=no | |
245 | ||
246 | # Clang needs special handling, because older versions handle the -pthread | |
247 | # option in a rather... idiosyncratic way | |
248 | ||
249 | if test "x$ax_pthread_clang" = "xyes"; then | |
250 | ||
251 | # Clang takes -pthread; it has never supported any other flag | |
252 | ||
253 | # (Note 1: This will need to be revisited if a system that Clang | |
254 | # supports has POSIX threads in a separate library. This tends not | |
255 | # to be the way of modern systems, but it's conceivable.) | |
256 | ||
257 | # (Note 2: On some systems, notably Darwin, -pthread is not needed | |
258 | # to get POSIX threads support; the API is always present and | |
259 | # active. We could reasonably leave PTHREAD_CFLAGS empty. But | |
260 | # -pthread does define _REENTRANT, and while the Darwin headers | |
261 | # ignore this macro, third-party headers might not.) | |
262 | ||
263 | PTHREAD_CFLAGS="-pthread" | |
264 | PTHREAD_LIBS= | |
265 | ||
266 | ax_pthread_ok=yes | |
267 | ||
268 | # However, older versions of Clang make a point of warning the user | |
269 | # that, in an invocation where only linking and no compilation is | |
270 | # taking place, the -pthread option has no effect ("argument unused | |
271 | # during compilation"). They expect -pthread to be passed in only | |
272 | # when source code is being compiled. | |
273 | # | |
274 | # Problem is, this is at odds with the way Automake and most other | |
275 | # C build frameworks function, which is that the same flags used in | |
276 | # compilation (CFLAGS) are also used in linking. Many systems | |
277 | # supported by AX_PTHREAD require exactly this for POSIX threads | |
278 | # support, and in fact it is often not straightforward to specify a | |
279 | # flag that is used only in the compilation phase and not in | |
280 | # linking. Such a scenario is extremely rare in practice. | |
281 | # | |
282 | # Even though use of the -pthread flag in linking would only print | |
283 | # a warning, this can be a nuisance for well-run software projects | |
284 | # that build with -Werror. So if the active version of Clang has | |
285 | # this misfeature, we search for an option to squash it. | |
286 | ||
287 | AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], | |
288 | [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], | |
289 | [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown | |
290 | # Create an alternate version of $ac_link that compiles and | |
291 | # links in two steps (.c -> .o, .o -> exe) instead of one | |
292 | # (.c -> exe), because the warning occurs only in the second | |
293 | # step | |
294 | ax_pthread_save_ac_link="$ac_link" | |
295 | ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' | |
296 | ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` | |
297 | ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" | |
298 | ax_pthread_save_CFLAGS="$CFLAGS" | |
299 | for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do | |
300 | AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) | |
301 | CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" | |
302 | ac_link="$ax_pthread_save_ac_link" | |
303 | AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], | |
304 | [ac_link="$ax_pthread_2step_ac_link" | |
305 | AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], | |
306 | [break]) | |
307 | ]) | |
308 | done | |
309 | ac_link="$ax_pthread_save_ac_link" | |
310 | CFLAGS="$ax_pthread_save_CFLAGS" | |
311 | AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) | |
312 | ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" | |
313 | ]) | |
314 | ||
315 | case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in | |
316 | no | unknown) ;; | |
317 | *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; | |
318 | esac | |
319 | ||
320 | fi # $ax_pthread_clang = yes | |
321 | ||
322 | if test "x$ax_pthread_ok" = "xno"; then | |
323 | for ax_pthread_try_flag in $ax_pthread_flags; do | |
324 | ||
325 | case $ax_pthread_try_flag in | |
326 | none) | |
327 | AC_MSG_CHECKING([whether pthreads work without any flags]) | |
328 | ;; | |
329 | ||
330 | -mt,pthread) | |
331 | AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) | |
332 | PTHREAD_CFLAGS="-mt" | |
333 | PTHREAD_LIBS="-lpthread" | |
334 | ;; | |
335 | ||
336 | -*) | |
337 | AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) | |
338 | PTHREAD_CFLAGS="$ax_pthread_try_flag" | |
339 | ;; | |
340 | ||
341 | pthread-config) | |
342 | AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) | |
343 | AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) | |
344 | PTHREAD_CFLAGS="`pthread-config --cflags`" | |
345 | PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" | |
346 | ;; | |
347 | ||
348 | *) | |
349 | AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) | |
350 | PTHREAD_LIBS="-l$ax_pthread_try_flag" | |
351 | ;; | |
352 | esac | |
353 | ||
354 | ax_pthread_save_CFLAGS="$CFLAGS" | |
355 | ax_pthread_save_LIBS="$LIBS" | |
356 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" | |
357 | LIBS="$PTHREAD_LIBS $LIBS" | |
358 | ||
359 | # Check for various functions. We must include pthread.h, | |
360 | # since some functions may be macros. (On the Sequent, we | |
361 | # need a special flag -Kthread to make this header compile.) | |
362 | # We check for pthread_join because it is in -lpthread on IRIX | |
363 | # while pthread_create is in libc. We check for pthread_attr_init | |
364 | # due to DEC craziness with -lpthreads. We check for | |
365 | # pthread_cleanup_push because it is one of the few pthread | |
366 | # functions on Solaris that doesn't have a non-functional libc stub. | |
367 | # We try pthread_create on general principles. | |
368 | ||
369 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h> | |
370 | # if $ax_pthread_check_cond | |
371 | # error "$ax_pthread_check_macro must be defined" | |
372 | # endif | |
373 | static void routine(void *a) { a = 0; } | |
374 | static void *start_routine(void *a) { return a; }], | |
375 | [pthread_t th; pthread_attr_t attr; | |
376 | pthread_create(&th, 0, start_routine, 0); | |
377 | pthread_join(th, 0); | |
378 | pthread_attr_init(&attr); | |
379 | pthread_cleanup_push(routine, 0); | |
380 | pthread_cleanup_pop(0) /* ; */])], | |
381 | [ax_pthread_ok=yes], | |
382 | []) | |
383 | ||
384 | CFLAGS="$ax_pthread_save_CFLAGS" | |
385 | LIBS="$ax_pthread_save_LIBS" | |
386 | ||
387 | AC_MSG_RESULT([$ax_pthread_ok]) | |
388 | AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) | |
389 | ||
390 | PTHREAD_LIBS="" | |
391 | PTHREAD_CFLAGS="" | |
392 | done | |
393 | fi | |
394 | ||
395 | # Various other checks: | |
396 | if test "x$ax_pthread_ok" = "xyes"; then | |
397 | ax_pthread_save_CFLAGS="$CFLAGS" | |
398 | ax_pthread_save_LIBS="$LIBS" | |
399 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" | |
400 | LIBS="$PTHREAD_LIBS $LIBS" | |
401 | ||
402 | # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. | |
403 | AC_CACHE_CHECK([for joinable pthread attribute], | |
404 | [ax_cv_PTHREAD_JOINABLE_ATTR], | |
405 | [ax_cv_PTHREAD_JOINABLE_ATTR=unknown | |
406 | for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do | |
407 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>], | |
408 | [int attr = $ax_pthread_attr; return attr /* ; */])], | |
409 | [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], | |
410 | []) | |
411 | done | |
412 | ]) | |
413 | AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ | |
414 | test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ | |
415 | test "x$ax_pthread_joinable_attr_defined" != "xyes"], | |
416 | [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], | |
417 | [$ax_cv_PTHREAD_JOINABLE_ATTR], | |
418 | [Define to necessary symbol if this constant | |
419 | uses a non-standard name on your system.]) | |
420 | ax_pthread_joinable_attr_defined=yes | |
421 | ]) | |
422 | ||
423 | AC_CACHE_CHECK([whether more special flags are required for pthreads], | |
424 | [ax_cv_PTHREAD_SPECIAL_FLAGS], | |
425 | [ax_cv_PTHREAD_SPECIAL_FLAGS=no | |
426 | case $host_os in | |
427 | solaris*) | |
428 | ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" | |
429 | ;; | |
430 | esac | |
431 | ]) | |
432 | AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ | |
433 | test "x$ax_pthread_special_flags_added" != "xyes"], | |
434 | [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" | |
435 | ax_pthread_special_flags_added=yes]) | |
436 | ||
437 | AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], | |
438 | [ax_cv_PTHREAD_PRIO_INHERIT], | |
439 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], | |
440 | [[int i = PTHREAD_PRIO_INHERIT;]])], | |
441 | [ax_cv_PTHREAD_PRIO_INHERIT=yes], | |
442 | [ax_cv_PTHREAD_PRIO_INHERIT=no]) | |
443 | ]) | |
444 | AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ | |
445 | test "x$ax_pthread_prio_inherit_defined" != "xyes"], | |
446 | [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) | |
447 | ax_pthread_prio_inherit_defined=yes | |
448 | ]) | |
449 | ||
450 | CFLAGS="$ax_pthread_save_CFLAGS" | |
451 | LIBS="$ax_pthread_save_LIBS" | |
452 | ||
453 | # More AIX lossage: compile with *_r variant | |
454 | if test "x$GCC" != "xyes"; then | |
455 | case $host_os in | |
456 | aix*) | |
457 | AS_CASE(["x/$CC"], | |
458 | [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], | |
459 | [#handle absolute path differently from PATH based program lookup | |
460 | AS_CASE(["x$CC"], | |
461 | [x/*], | |
462 | [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], | |
463 | [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) | |
464 | ;; | |
465 | esac | |
466 | fi | |
467 | fi | |
468 | ||
469 | test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" | |
470 | ||
471 | AC_SUBST([PTHREAD_LIBS]) | |
472 | AC_SUBST([PTHREAD_CFLAGS]) | |
473 | AC_SUBST([PTHREAD_CC]) | |
474 | ||
475 | # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: | |
476 | if test "x$ax_pthread_ok" = "xyes"; then | |
477 | ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) | |
478 | : | |
479 | else | |
480 | ax_pthread_ok=no | |
481 | $2 | |
482 | fi | |
483 | AC_LANG_POP | |
484 | ])dnl AX_PTHREAD |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_require_defined.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_REQUIRE_DEFINED(MACRO) | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have | |
11 | # been defined and thus are available for use. This avoids random issues | |
12 | # where a macro isn't expanded. Instead the configure script emits a | |
13 | # non-fatal: | |
14 | # | |
15 | # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found | |
16 | # | |
17 | # It's like AC_REQUIRE except it doesn't expand the required macro. | |
18 | # | |
19 | # Here's an example: | |
20 | # | |
21 | # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) | |
22 | # | |
23 | # LICENSE | |
24 | # | |
25 | # Copyright (c) 2014 Mike Frysinger <[email protected]> | |
26 | # | |
27 | # Copying and distribution of this file, with or without modification, are | |
28 | # permitted in any medium without royalty provided the copyright notice | |
29 | # and this notice are preserved. This file is offered as-is, without any | |
30 | # warranty. | |
31 | ||
32 | #serial 1 | |
33 | ||
34 | AC_DEFUN([AX_REQUIRE_DEFINED], [dnl | |
35 | m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) | |
36 | ])dnl AX_REQUIRE_DEFINED |
0 | # =========================================================================== | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_sanitizers.html | |
2 | # =========================================================================== | |
3 | # | |
4 | # SYNOPSIS | |
5 | # | |
6 | # AX_SANITIZERS([SANITIZERS], [ENABLED-BY-DEFAULT], [ACTION-SUCCESS]) | |
7 | # | |
8 | # DESCRIPTION | |
9 | # | |
10 | # Offers users to enable one or more sanitizers (see | |
11 | # https://github.com/google/sanitizers) with the corresponding | |
12 | # --enable-<sanitizer>-sanitizer option. | |
13 | # | |
14 | # SANITIZERS is a whitespace-separated list of sanitizers to offer via | |
15 | # --enable-<sanitizer>-sanitizer options, e.g. "address memory" for the | |
16 | # address sanitizer and the memory sanitizer. If SANITIZERS is not specified, | |
17 | # all known sanitizers to AX_SANITIZERS will be offered, which at the time of | |
18 | # writing are "address memory undefined". | |
19 | # NOTE that SANITIZERS is expanded at autoconf time, not at configure time, | |
20 | # i.e. you cannot use shell variables in SANITIZERS. | |
21 | # | |
22 | # ENABLED-BY-DEFAULT is a whitespace-separated list of sanitizers which | |
23 | # should be enabled by default, e.g. "memory undefined". Note that not all | |
24 | # sanitizers can be combined, e.g. memory sanitizer cannot be enabled when | |
25 | # address sanitizer is already enabled. | |
26 | # Set ENABLED-BY-DEFAULT to a single whitespace in order to disable all | |
27 | # sanitizers by default. | |
28 | # ENABLED-BY-DEFAULT is expanded at configure time, so you can use shell | |
29 | # variables. | |
30 | # | |
31 | # ACTION-SUCCESS allows to specify shell commands to execute on success, i.e. | |
32 | # when one of the sanitizers was successfully enabled. This is a good place | |
33 | # to call AC_DEFINE for any precompiler constants you might need to make your | |
34 | # code play nice with sanitizers. | |
35 | # | |
36 | # The variable ax_enabled_sanitizers contains a whitespace-separated list of | |
37 | # all enabled sanitizers, so that you can print them at the end of configure, | |
38 | # if you wish. | |
39 | # | |
40 | # The additional --enable-sanitizers option allows users to enable/disable | |
41 | # all sanitizers, effectively overriding ENABLED-BY-DEFAULT. | |
42 | # | |
43 | # EXAMPLES | |
44 | # | |
45 | # AX_SANITIZERS([address]) | |
46 | # dnl offer users to enable address sanitizer via --enable-address-sanitizer | |
47 | # | |
48 | # is_debug_build=… | |
49 | # if test "x$is_debug_build" = "xyes"; then | |
50 | # default_sanitizers="address memory" | |
51 | # else | |
52 | # default_sanitizers= | |
53 | # fi | |
54 | # AX_SANITIZERS([address memory], [$default_sanitizers]) | |
55 | # dnl enable address sanitizer and memory sanitizer by default for debug | |
56 | # dnl builds, e.g. when building from git instead of a dist tarball. | |
57 | # | |
58 | # AX_SANITIZERS(, , [ | |
59 | # AC_DEFINE([SANITIZERS_ENABLED], | |
60 | # [], | |
61 | # [At least one sanitizer was enabled])]) | |
62 | # dnl enable all sanitizers known to AX_SANITIZERS by default and set the | |
63 | # dnl SANITIZERS_ENABLED precompiler constant. | |
64 | # | |
65 | # AX_SANITIZERS(, [ ]) | |
66 | # dnl provide all sanitizers, but enable none by default. | |
67 | # | |
68 | # LICENSE | |
69 | # | |
70 | # Copyright (c) 2016 Michael Stapelberg <[email protected]> | |
71 | # | |
72 | # Copying and distribution of this file, with or without modification, | |
73 | # are permitted in any medium without royalty provided the copyright | |
74 | # notice and this notice are preserved. This file is offered as-is, | |
75 | # without any warranty. | |
76 | ||
77 | AC_DEFUN([AX_SANITIZERS], | |
78 | [AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) | |
79 | AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) | |
80 | AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) | |
81 | AC_ARG_ENABLE(sanitizers, | |
82 | AS_HELP_STRING( | |
83 | [--enable-sanitizers], | |
84 | [enable all known sanitizers]), | |
85 | [ax_sanitizers_default=$enableval], | |
86 | [ax_sanitizers_default=]) | |
87 | ax_enabled_sanitizers= | |
88 | m4_foreach_w([mysan], m4_default($1, [address memory undefined]), [ | |
89 | dnl If ax_sanitizers_default is unset, i.e. the user neither explicitly | |
90 | dnl enabled nor explicitly disabled all sanitizers, we get the default value | |
91 | dnl for this sanitizer based on whether it is listed in ENABLED-BY-DEFAULT. | |
92 | AS_IF([test "x$ax_sanitizers_default" = "x"], [dnl | |
93 | ax_sanitizer_default= | |
94 | for mycheck in m4_default([$2], [address memory undefined]); do | |
95 | AS_IF([test "x$mycheck" = "x[]mysan"], [ax_sanitizer_default=yes]) | |
96 | done | |
97 | AS_IF([test "x$ax_sanitizer_default" = "x"], [ax_sanitizer_default=no]) | |
98 | ], | |
99 | [ax_sanitizer_default=$ax_sanitizers_default]) | |
100 | AC_ARG_ENABLE(mysan[]-sanitizer, | |
101 | AS_HELP_STRING( | |
102 | [--enable-[]mysan[]-sanitizer], | |
103 | [enable -fsanitize=mysan]), | |
104 | [ax_sanitizer_enabled=$enableval], | |
105 | [ax_sanitizer_enabled=$ax_sanitizer_default]) | |
106 | ||
107 | AS_IF([test "x$ax_sanitizer_enabled" = "xyes"], [ | |
108 | dnl Not using AX_APPEND_COMPILE_FLAGS and AX_APPEND_LINK_FLAGS because they | |
109 | dnl lack the ability to specify ACTION-SUCCESS. | |
110 | AX_CHECK_COMPILE_FLAG([-fsanitize=[]mysan], [ | |
111 | AX_CHECK_LINK_FLAG([-fsanitize=[]mysan], [ | |
112 | AX_APPEND_FLAG([-fsanitize=[]mysan], []) | |
113 | dnl If and only if libtool is being used, LDFLAGS needs to contain -Wc,-fsanitize=…. | |
114 | dnl See e.g. https://sources.debian.net/src/systemd/231-7/configure.ac/?hl=128#L135 | |
115 | dnl TODO: how can recognize that situation and add -Wc,? | |
116 | AX_APPEND_FLAG([-fsanitize=[]mysan], [LDFLAGS]) | |
117 | dnl TODO: add -fPIE -pie for memory | |
118 | # -fno-omit-frame-pointer results in nicer stack traces in error | |
119 | # messages, see http://clang.llvm.org/docs/AddressSanitizer.html#usage | |
120 | AX_CHECK_COMPILE_FLAG([-fno-omit-frame-pointer], [ | |
121 | AX_APPEND_FLAG([-fno-omit-frame-pointer], [])]) | |
122 | dnl TODO: at least for clang, we should specify exactly -O1, not -O2 or -O0, so that performance is reasonable but stacktraces are not tampered with (due to inlining), see http://clang.llvm.org/docs/AddressSanitizer.html#usage | |
123 | m4_default([$3], :) | |
124 | ax_enabled_sanitizers="[]mysan $ax_enabled_sanitizers" | |
125 | ]) | |
126 | ]) | |
127 | ]) | |
128 | ])dnl | |
129 | ])dnl AX_SANITIZERS |