Commit | Line | Data |
---|---|---|
9ffc0257 MJ |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | dnl | |
3 | dnl Copyright (c) 2017 EfficiOS, Inc. | |
4 | dnl | |
5 | dnl Permission is hereby granted, free of charge, to any person obtaining a copy | |
6 | dnl of this software and associated documentation files (the "Software"), to deal | |
7 | dnl in the Software without restriction, including without limitation the rights | |
8 | dnl to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
9 | dnl copies of the Software, and to permit persons to whom the Software is | |
10 | dnl furnished to do so, subject to the following conditions: | |
11 | dnl | |
12 | dnl The above copyright notice and this permission notice shall be included in | |
13 | dnl all copies or substantial portions of the Software. | |
14 | dnl | |
15 | dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
16 | dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
17 | dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
18 | dnl AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
19 | dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
20 | dnl OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
21 | dnl SOFTWARE. | |
22 | ||
23 | ## ## | |
24 | ## Autoconf base setup ## | |
25 | ## ## | |
26 | ||
9d594903 | 27 | AC_PREREQ([2.50]) |
9ffc0257 | 28 | |
a2edfc7d PP |
29 | m4_define([bt_version_major], [2]) |
30 | m4_define([bt_version_minor], [0]) | |
31 | m4_define([bt_version_patch], [0]) | |
48d1e6e0 | 32 | m4_define([bt_version_extra], [-pre1]) |
a2edfc7d | 33 | m4_define([bt_version], bt_version_major[.]bt_version_minor[.]bt_version_patch[]bt_version_extra) |
9ffc0257 MJ |
34 | |
35 | AC_INIT([babeltrace], bt_version, [jeremie dot galarneau at efficios dot com], [], [https://efficios.com/babeltrace/]) | |
3fbccce7 MD |
36 | |
37 | # Following the numbering scheme proposed by libtool for the library version | |
38 | # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html | |
a2edfc7d | 39 | AC_SUBST([BABELTRACE_LIBRARY_VERSION], bt_version_major[:]bt_version_minor[:]bt_version_patch) |
3fbccce7 | 40 | |
05c03100 | 41 | AC_CONFIG_HEADERS([include/config.h]) |
ac65e355 | 42 | AC_CONFIG_AUX_DIR([config]) |
80e2fb15 | 43 | AC_CONFIG_MACRO_DIR([m4]) |
9ffc0257 | 44 | AC_REQUIRE_AUX_FILE([tap-driver.sh]) |
80e2fb15 | 45 | |
a2edfc7d PP |
46 | AC_DEFINE([BT_VERSION_MAJOR], bt_version_major, [Babeltrace library major version]) |
47 | AC_DEFINE([BT_VERSION_MINOR], bt_version_minor, [Babeltrace library minor version]) | |
48 | AC_DEFINE([BT_VERSION_PATCH], bt_version_patch, [Babeltrace library patch version]) | |
49 | AC_DEFINE([BT_VERSION_EXTRA], ["]bt_version_extra["], [Babeltrace library extra version]) | |
50 | ||
ac65e355 MD |
51 | AC_CANONICAL_TARGET |
52 | AC_CANONICAL_HOST | |
80e2fb15 | 53 | |
9ffc0257 MJ |
54 | |
55 | ## ## | |
56 | ## Automake base setup ## | |
57 | ## ## | |
58 | ||
05c03100 | 59 | AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip tar-ustar nostdinc]) |
99e3ba41 | 60 | AM_MAINTAINER_MODE([enable]) |
ac65e355 | 61 | |
80e2fb15 MJ |
62 | # Enable silent rules if available (Introduced in AM 1.11) |
63 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) | |
0671bd13 | 64 | |
3d5e9596 | 65 | |
9ffc0257 MJ |
66 | ## ## |
67 | ## OS specific defaults ## | |
68 | ## ## | |
69 | ||
70 | MINGW32=no | |
71 | DEFAULT_ENABLE_DEBUG_INFO=yes | |
72 | LT_NO_UNDEFINED="" | |
73 | AS_CASE([$host_os], | |
74 | [solaris*|darwin*], | |
75 | [ | |
76 | DEFAULT_ENABLE_DEBUG_INFO=no | |
77 | ], | |
78 | [cygwin*], | |
79 | [ | |
80 | DEFAULT_ENABLE_DEBUG_INFO=no | |
81 | LT_NO_UNDEFINED="-no-undefined" | |
82 | ], | |
83 | [mingw*], | |
84 | [ | |
85 | MINGW32=yes | |
86 | DEFAULT_ENABLE_DEBUG_INFO=no | |
87 | LT_NO_UNDEFINED="-no-undefined" | |
88 | ] | |
89 | ) | |
90 | ||
91 | AM_CONDITIONAL([BABELTRACE_BUILD_WITH_MINGW], [test "x$MINGW32" = "xyes"]) | |
92 | AC_SUBST(LT_NO_UNDEFINED) | |
93 | ||
94 | ||
95 | ## ## | |
96 | ## C compiler checks ## | |
97 | ## ## | |
98 | ||
80e2fb15 | 99 | AC_USE_SYSTEM_EXTENSIONS |
217108a9 | 100 | AC_SYS_LARGEFILE |
9ffc0257 MJ |
101 | |
102 | # Choose the c compiler | |
80e2fb15 | 103 | AC_PROG_CC |
217108a9 | 104 | |
9ffc0257 MJ |
105 | # Make sure the c compiler supports C99 |
106 | AC_PROG_CC_C99([], [AC_MSG_ERROR([The compiler does not support C99])]) | |
ac65e355 | 107 | |
9ffc0257 | 108 | # Make sure the c compiler supports __attributes__ |
ec8add54 | 109 | AX_C___ATTRIBUTE__ |
9ffc0257 MJ |
110 | AS_IF([test "x$ax_cv___attribute__" != "xyes"], |
111 | [AC_MSG_ERROR([The compiler does not support __attribute__ extensions])]) | |
ec8add54 | 112 | |
9ffc0257 MJ |
113 | # Make sur we have pthread support |
114 | AX_PTHREAD([], [AC_MSG_ERROR([Could not configure pthread support])]) | |
115 | ||
116 | # Checks for typedefs, structures, and compiler characteristics. | |
117 | AC_C_INLINE | |
118 | AC_C_TYPEOF | |
119 | AC_TYPE_PID_T | |
120 | AC_TYPE_SIZE_T | |
121 | AC_TYPE_INT16_T | |
122 | AC_TYPE_INT32_T | |
123 | AC_TYPE_INT64_T | |
124 | AC_TYPE_INT8_T | |
125 | AC_TYPE_OFF_T | |
126 | AC_TYPE_SSIZE_T | |
127 | AC_TYPE_UINT16_T | |
128 | AC_TYPE_UINT32_T | |
129 | AC_TYPE_UINT64_T | |
130 | AC_TYPE_UINT8_T | |
131 | AC_CHECK_TYPES([ptrdiff_t]) | |
a2bc83d4 | 132 | |
9ffc0257 MJ |
133 | |
134 | ## ## | |
135 | ## Header checks ## | |
136 | ## ## | |
f0d8d709 | 137 | |
f847f3ae MJ |
138 | AC_HEADER_STDBOOL |
139 | AC_CHECK_HEADERS([ \ | |
140 | fcntl.h \ | |
141 | float.h \ | |
e1f4c4f7 | 142 | ftw.h \ |
f847f3ae MJ |
143 | libintl.h \ |
144 | limits.h \ | |
145 | malloc.h \ | |
146 | netdb.h \ | |
147 | netinet/in.h \ | |
148 | stddef.h \ | |
149 | sys/socket.h \ | |
9ffc0257 | 150 | sys/time.h |
f847f3ae | 151 | ]) |
80e2fb15 | 152 | |
9ffc0257 MJ |
153 | |
154 | ## ## | |
155 | ## Linker checks ## | |
156 | ## ## | |
157 | ||
158 | # Check if the linker supports no-as-needed | |
159 | AX_APPEND_LINK_FLAGS([-Wl,--no-as-needed], [LD_NO_AS_NEEDED]) | |
160 | AC_SUBST([LD_NO_AS_NEEDED]) | |
161 | ||
162 | # Initialize and configure libtool | |
163 | LT_INIT([win32-dll]) | |
164 | ||
165 | ||
166 | ## ## | |
167 | ## Programs checks ## | |
168 | ## ## | |
169 | ||
170 | AC_PROG_MAKE_SET | |
171 | AC_PROG_MKDIR_P | |
172 | AC_PROG_LN_S | |
173 | ||
540d833d MJ |
174 | # set $IN_GIT_REPO if we're in the Git repository; the `bootstrap` file |
175 | # is not distributed in tarballs | |
176 | AS_IF([test -f "$srcdir/bootstrap"], [in_git_repo=yes], [in_git_repo=no]) | |
177 | AM_CONDITIONAL([IN_GIT_REPO], [test "x$in_git_repo" = "xyes"]) | |
178 | ||
179 | # check for bison | |
180 | AC_PROG_YACC | |
181 | AX_PROG_BISON_VERSION([2.4], [have_bison=yes]) | |
182 | ||
183 | AS_IF([test "x$have_bison" != "xyes"], [ | |
184 | AS_IF([test "x$in_git_repo" = "xyes"], [ | |
9ffc0257 | 185 | AC_MSG_FAILURE([dnl |
540d833d MJ |
186 | Bison >= 2.4 is required when building from the Git repository. You can |
187 | set the YACC variable to override automatic detection. | |
188 | ]) | |
189 | ], [ | |
9ffc0257 | 190 | AC_MSG_WARN([dnl |
540d833d MJ |
191 | Missing Bison >= 2.4. Note that the parser files are already built in |
192 | this distribution tarball, so Bison is only needed if you intend to | |
193 | modify their sources. You can set the YACC variable to override automatic | |
194 | detection. | |
195 | ]) | |
196 | ]) | |
197 | ]) | |
198 | AM_CONDITIONAL([HAVE_BISON], [test "x$have_bison" = "xyes"]) | |
199 | ||
200 | # check for flex | |
201 | AC_PROG_LEX | |
202 | AX_PROG_FLEX_VERSION([2.5.35], [have_flex=yes]) | |
203 | ||
204 | AS_IF([test "x$have_flex" != "xyes"], [ | |
205 | AS_IF([test "x$in_git_repo" = "xyes"], [ | |
9ffc0257 | 206 | AC_MSG_FAILURE([dnl |
540d833d MJ |
207 | Flex >= 2.5.35 is required when building from the Git repository. You can |
208 | set the LEX variable to override automatic detection. | |
209 | ]) | |
210 | ], [ | |
9ffc0257 | 211 | AC_MSG_WARN([dnl |
540d833d MJ |
212 | Missing Flex >= 2.5.35. Note that the lexer files are already built in |
213 | this distribution tarball, so Flex is only needed if you intend to | |
214 | modify their sources. You can set the LEX variable to override automatic | |
215 | detection. | |
216 | ]) | |
217 | ]) | |
218 | ]) | |
219 | AM_CONDITIONAL([HAVE_FLEX], [test "x$have_flex" = "xyes"]) | |
331d78f5 | 220 | |
e5f5317f | 221 | |
9ffc0257 MJ |
222 | ## ## |
223 | ## Library checks ## | |
224 | ## ## | |
ac65e355 | 225 | |
39fa4402 MJ |
226 | # Check what libraries are required on this platform to link sockets programs. |
227 | AX_LIB_SOCKET_NSL | |
228 | ||
9ffc0257 MJ |
229 | # Check for glib >= 2.22 with gmodule support |
230 | AM_PATH_GLIB_2_0([2.22.0], [], | |
231 | AC_MSG_ERROR([glib >= 2.22 is required - download it from ftp://ftp.gtk.org/pub/gtk]), | |
232 | [gmodule-no-export] | |
233 | ) | |
ac65e355 MD |
234 | |
235 | # Checks for library functions. | |
f847f3ae MJ |
236 | AC_FUNC_ALLOCA |
237 | AC_FUNC_FORK | |
f847f3ae | 238 | AC_FUNC_MKTIME |
ac65e355 | 239 | AC_FUNC_MMAP |
f847f3ae | 240 | AC_FUNC_STRERROR_R |
9ffc0257 | 241 | AC_FUNC_STRNLEN |
2f8c0e47 | 242 | AC_CHECK_FUNCS([ \ |
f847f3ae | 243 | atexit \ |
f847f3ae MJ |
244 | dup2 \ |
245 | ftruncate \ | |
246 | gethostbyname \ | |
247 | gethostname \ | |
248 | gettimeofday \ | |
249 | localtime_r \ | |
250 | memchr \ | |
251 | memset \ | |
252 | mkdir \ | |
253 | mkdtemp \ | |
254 | munmap \ | |
255 | rmdir \ | |
256 | setenv \ | |
257 | socket \ | |
258 | strchr \ | |
259 | strdup \ | |
260 | strerror \ | |
261 | strndup \ | |
262 | strnlen \ | |
263 | strrchr \ | |
9ffc0257 | 264 | strstr \ |
f847f3ae MJ |
265 | strtoul \ |
266 | strtoull \ | |
267 | tzset \ | |
268 | uname \ | |
2f8c0e47 | 269 | ]) |
ac65e355 | 270 | |
dc4cb410 MJ |
271 | # AC_FUNC_MALLOC causes problems when cross-compiling. |
272 | #AC_FUNC_MALLOC | |
273 | #AC_FUNC_REALLOC | |
274 | ||
60725cf9 MJ |
275 | # First, check for uuid in system libs |
276 | AH_TEMPLATE([BABELTRACE_HAVE_LIBUUID], [Define if you have libuuid support]) | |
4120f662 | 277 | AC_CHECK_FUNCS([uuid_generate], |
4120f662 | 278 | [ |
60725cf9 MJ |
279 | AC_DEFINE([BABELTRACE_HAVE_LIBUUID], [1]) |
280 | UUID_LIBS="" | |
4120f662 MJ |
281 | ], |
282 | [ | |
60725cf9 MJ |
283 | # Then, check if the pkg-config module is available, otherwise explicitly check |
284 | # for libuuid, or uuid support in the C-library. | |
285 | PKG_CHECK_MODULES([UUID], [uuid], | |
2741f55b | 286 | [ |
60725cf9 MJ |
287 | AC_DEFINE([BABELTRACE_HAVE_LIBUUID], [1]) |
288 | dnl PKG_CHECK_MODULES defines UUID_LIBS | |
2741f55b SM |
289 | ], |
290 | [ | |
60725cf9 MJ |
291 | AC_MSG_WARN([pkg-config was unable to find a valid .pc for libuuid. Set PKG_CONFIG_PATH to specify the pkgconfig configuration file location]) |
292 | AC_MSG_WARN([Finding libuuid without pkg-config.]) | |
293 | AC_CHECK_LIB([uuid], [uuid_generate], | |
294 | [ | |
295 | AC_DEFINE([BABELTRACE_HAVE_LIBUUID], [1]) | |
296 | UUID_LIBS="-luuid" | |
297 | ], | |
298 | [ | |
299 | # libuuid not found, check for uuid_create in libc. | |
300 | AC_CHECK_LIB([c], [uuid_create], | |
301 | [ | |
302 | AC_DEFINE([BABELTRACE_HAVE_LIBUUID], [1]) | |
303 | UUID_LIBS="-lc" | |
304 | ], | |
305 | [ | |
306 | # for MinGW32 we have our own internal implementation of uuid using Windows functions. | |
9ffc0257 MJ |
307 | AS_IF([test "x$MINGW32" = xno], |
308 | [AC_MSG_FAILURE([Cannot find libuuid uuid_generate nor libc uuid_create. Either set PKG_CONFIG_PATH to the configuration file location or use LDFLAGS=-Ldir to specify the library location])] | |
309 | ) | |
60725cf9 MJ |
310 | ] |
311 | ) | |
312 | ] | |
313 | ) | |
314 | ] | |
315 | ) | |
316 | ] | |
317 | ) | |
318 | AC_SUBST(UUID_LIBS) | |
fd55fc57 | 319 | |
f8370579 MD |
320 | # Check for fmemopen |
321 | AC_CHECK_LIB([c], [fmemopen], | |
9ffc0257 | 322 | [AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_FMEMOPEN], 1, [Has fmemopen support.])] |
f8370579 MD |
323 | ) |
324 | ||
325 | # Check for open_memstream | |
326 | AC_CHECK_LIB([c], [open_memstream], | |
9ffc0257 | 327 | [AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_OPEN_MEMSTREAM], 1, [Has open_memstream support.])] |
f8370579 MD |
328 | ) |
329 | ||
a323afb2 JG |
330 | # Check for posix_fallocate |
331 | AC_CHECK_LIB([c], [posix_fallocate], | |
9ffc0257 | 332 | [AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_POSIX_FALLOCATE], 1, [Has posix_fallocate support.])] |
a323afb2 JG |
333 | ) |
334 | ||
4817cd5b MJ |
335 | # Check libpopt |
336 | PKG_CHECK_MODULES([POPT], [popt], | |
337 | [ | |
338 | dnl PKG_CHECK_MODULES defines POPT_LIBS | |
339 | ], | |
340 | [ | |
341 | AC_MSG_WARN([pkg-config was unable to find a valid .pc for libpopt. Set PKG_CONFIG_PATH to specify the pkgconfig configuration file location]) | |
342 | AC_MSG_WARN([Finding libpopt without pkg-config.]) | |
343 | AC_CHECK_LIB([popt], | |
344 | [poptGetContext], | |
345 | [POPT_LIBS="-lpopt"], | |
346 | [ | |
347 | AC_MSG_FAILURE([Cannot find libpopt. Either set PKG_CONFIG_PATH to the configuration file location or use LDFLAGS=-Ldir to specify the library location]) | |
348 | ] | |
349 | ) | |
350 | ] | |
0f536a74 | 351 | ) |
4817cd5b | 352 | AC_SUBST(POPT_LIBS) |
0f536a74 | 353 | |
9ffc0257 MJ |
354 | |
355 | ## ## | |
356 | ## User variables ## | |
357 | ## ## | |
358 | ||
359 | AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for Python, bypassing python-config]) | |
360 | AC_ARG_VAR([PYTHON_LIBS], [Library flags for Python, bypassing python-config]) | |
361 | AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config]) | |
362 | ||
363 | # PLUGINSDIR: Plugins directory | |
a094f13b PP |
364 | AC_ARG_VAR([PLUGINSDIR], [built-in plugins install directory [LIBDIR/babeltrace/plugins]]) |
365 | AS_IF([test "x$PLUGINSDIR" = x], [PLUGINSDIR='$(libdir)/babeltrace/plugins']) | |
366 | ||
9ffc0257 MJ |
367 | # BABELTRACE_MINIMAL_LOG_LEVEL: |
368 | AC_ARG_VAR([BABELTRACE_MINIMAL_LOG_LEVEL], [Minimal log level for Babeltrace program, library, and plugins (VERBOSE, DEBUG, INFO, WARN, ERROR (default), FATAL, or NONE)]) | |
369 | AS_IF([test "x$BABELTRACE_MINIMAL_LOG_LEVEL" = x], [BABELTRACE_MINIMAL_LOG_LEVEL="VERBOSE"]) | |
370 | AS_IF([test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "VERBOSE" && \ | |
371 | test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "DEBUG" && \ | |
372 | test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "INFO" && \ | |
373 | test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "WARN" && \ | |
374 | test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "ERROR" && \ | |
375 | test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "FATAL" && \ | |
376 | test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "NONE"], | |
377 | [AC_MSG_ERROR([Invalid BABELTRACE_MINIMAL_LOG_LEVEL value ($BABELTRACE_MINIMAL_LOG_LEVEL): use VERBOSE, DEBUG, INFO, WARN, ERROR, FATAL, or NONE.])] | |
378 | ) | |
379 | AC_DEFINE_UNQUOTED([BT_LOG_LEVEL], [BT_LOG_$BABELTRACE_MINIMAL_LOG_LEVEL], [Minimal log level]) | |
380 | ||
381 | ||
382 | ## ## | |
383 | ## Optionnal features selection ## | |
384 | ## ## | |
24a3136a | 385 | |
9ffc0257 MJ |
386 | # Python bindings |
387 | # Disabled by default | |
94a6cea3 | 388 | AC_ARG_ENABLE([python-bindings], |
9ffc0257 MJ |
389 | [AC_HELP_STRING([--enable-python-bindings], [build the Python bindings])], |
390 | [], dnl AC_ARG_ENABLE will fill enable_python_bindings with the user choice | |
391 | [enable_python_bindings=no] | |
392 | ) | |
393 | ||
394 | # Python bindings documentation | |
395 | # Disabled by default | |
396 | AC_ARG_ENABLE([python-bindings-doc], | |
397 | [AC_HELP_STRING([--enable-python-bindings-doc], [build the Python bindings documentation])], | |
398 | [], dnl AC_ARG_ENABLE will fill enable_python_bindings_doc with the user choice | |
399 | [enable_python_bindings_doc=no] | |
400 | ) | |
401 | ||
402 | # Python bindings tests | |
403 | # Disabled by default | |
404 | AC_ARG_ENABLE([python-bindings-tests], | |
405 | [AC_HELP_STRING([--enable-python-bindings-tests], [run the Python bindings tests])], | |
406 | [], dnl AC_ARG_ENABLE will fill enable_python_bindings_tests with the user choice | |
407 | [enable_python_bindings_tests=no] | |
408 | ) | |
409 | ||
410 | # Python plugins | |
411 | # Disabled by default | |
412 | AC_ARG_ENABLE([python-plugins], | |
413 | [AC_HELP_STRING([--enable-python-plugins], [enable the Python plugins support for the library and converter])], | |
414 | [], dnl AC_ARG_ENABLE will fill enable_python_plugins with the user choice | |
415 | [enable_python_plugins=no] | |
416 | ) | |
417 | ||
418 | # Debug info | |
419 | # Enabled by default, except on some platforms | |
420 | AC_ARG_ENABLE([debug-info], | |
421 | [AC_HELP_STRING([--disable-debug-info], [disable the debug info support (default on macOS, Solaris and Windows)])], | |
422 | [], dnl AC_ARG_ENABLE will fill enable_debug_info with the user choice | |
423 | [enable_debug_info="$DEFAULT_ENABLE_DEBUG_INFO"] | |
424 | ) | |
425 | ||
426 | # API documentation | |
427 | # Disabled by default | |
428 | AC_ARG_ENABLE([api-doc], | |
429 | [AC_HELP_STRING([--enable-api-doc], [build the HTML API documentation])], | |
430 | [enable_api_doc=$enableval], | |
431 | [enable_api_doc=no] | |
432 | ) | |
433 | ||
434 | # Built-in plugins | |
435 | # Disabled by default | |
436 | AC_ARG_ENABLE([built-in-plugins], | |
437 | [AC_HELP_STRING([--enable-built-in-plugins], [Statically-link in-tree plug-ins into the babeltrace binary])], | |
438 | [], dnl AC_ARG_ENABLE will fill enable_built_in_plugins with the user choice | |
439 | [enable_built_in_plugins=no] | |
440 | ) | |
441 | ||
442 | # Built-in python plugin support | |
443 | # Disabled by default | |
444 | AC_ARG_ENABLE([built-in-python-plugin-support], | |
445 | [AC_HELP_STRING([--enable-built-in-python-plugin-support], [Statically-link Python plugin support into the babeltrace library])], | |
446 | [], dnl AC_ARG_ENABLE will fill enable_built_in_python_plugin_support with the user choice | |
447 | [enable_built_in_python_plugin_support=no] | |
448 | ) | |
449 | ||
450 | ||
451 | # Set automake variables for optionnal feature conditionnals in Makefile.am | |
452 | AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS], [test "x$enable_python_bindings" = xyes]) | |
453 | AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS_DOC], [test "x$enable_python_bindings_doc" = xyes]) | |
454 | AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS_TESTS], [test "x$enable_python_bindings_tests" = xyes]) | |
455 | AM_CONDITIONAL([ENABLE_PYTHON_PLUGINS], [test "x$enable_python_plugins" = xyes]) | |
456 | AM_CONDITIONAL([ENABLE_DEBUG_INFO], [test "x$enable_debug_info" = xyes]) | |
457 | AM_CONDITIONAL([ENABLE_API_DOC], [test "x$enable_api_doc" = xyes]) | |
458 | AM_CONDITIONAL([ENABLE_BUILT_IN_PLUGINS], [test "x$enable_built_in_plugins" = xyes]) | |
459 | AM_CONDITIONAL([ENABLE_BUILT_IN_PYTHON_PLUGIN_SUPPORT], [test "x$enable_built_in_python_plugin_support" = xyes]) | |
460 | ||
461 | ||
462 | # Set defines for optionnal features conditionnals in the source code | |
463 | ||
464 | ## jgalar: still used? | |
465 | AS_IF([test "x$enable_python_plugins" = xyes], | |
466 | [AC_DEFINE([PYTHON_PLUGINS], [1], [Python plugin support.])] | |
467 | ) | |
468 | ||
469 | AS_IF([test "x$enable_debug_info" = xyes], | |
470 | [AC_DEFINE([ENABLE_DEBUG_INFO], [1], [Define to 1 if you enable the 'debug info' feature])] | |
471 | ) | |
472 | ||
473 | AS_IF([test "x$enable_built_in_plugins" = xyes], | |
474 | [AC_DEFINE([BT_BUILT_IN_PLUGINS], [1], [Define to 1 to register plug-in attributes in static executable sections])] | |
475 | ) | |
476 | ||
477 | AS_IF([test "x$enable_built_in_python_plugin_support" = xyes], | |
478 | [AC_DEFINE([BT_BUILT_IN_PYTHON_PLUGIN_SUPPORT], [1], [Define to 1 to register plug-in attributes in static executable sections])] | |
479 | ) | |
480 | ||
481 | ||
482 | # Check for conflicting optionnal features user choices | |
483 | ||
484 | AS_IF([test "x$enable_python_bindings" = xno], | |
485 | [ | |
486 | AS_IF([test "x$enable_python_bindings_doc" = xyes], [AC_MSG_ERROR([--enable-python-bindings-doc was specified without --enable-python-bindings])]) | |
487 | AS_IF([test "x$enable_python_bindings_tests" = xyes], AC_MSG_ERROR([--enable-python-bindings-tests was specified without --enable-python-bindings])) | |
488 | ] | |
489 | ) | |
490 | ||
491 | AS_IF([test "x$enable_built_in_plugins" = xyes], | |
492 | [ | |
493 | # Built-in plug-ins are only available when the --disable-shared --enable-static options are used. | |
494 | AS_IF([test "x$enable_static" != xyes], [AC_MSG_ERROR(--enable-static must be used to bundle plug-ins in the babeltrace executable)]) | |
495 | AS_IF([test "x$enable_shared" = xyes], [AC_MSG_ERROR(--disable-shared must be used to bundle plug-ins in the babeltrace executable)]) | |
496 | ] | |
497 | ) | |
498 | ||
499 | AS_IF([test "x$enable_built_in_python_plugin_support" = xyes], | |
500 | [ | |
501 | AS_IF([test "x$enable_python_plugins" = xno], [AC_MSG_ERROR([--enable-python-plugins must be used to bundle Python plugin support in the babeltrace executable])]) | |
502 | # Built-in plug-ins are only available when the --disable-shared --enable-static options are used. | |
503 | AS_IF([test "x$enable_static" != xyes], [AC_MSG_ERROR(--enable-static must be used to bundle Python plugin support in the babeltrace executable)]) | |
504 | AS_IF([test "x$enable_shared" = xyes], [AC_MSG_ERROR(--disable-shared must be used to bundle Python plugin support in the babeltrace executable)]) | |
505 | ] | |
55bb57e0 | 506 | ) |
9cf643d1 | 507 | |
4f5f37d9 | 508 | |
9ffc0257 MJ |
509 | # Check for optionnal features dependencies |
510 | ||
511 | AS_IF([test "x$enable_python_bindings" = xyes], | |
512 | [AX_PKG_SWIG(2.0.0, [], [AC_MSG_ERROR([SWIG 2.0.0 or newer is required to build the python bindings])])] | |
513 | ) | |
514 | ||
515 | AS_IF([test "x$enable_python_bindings" = xyes || test "x$enable_python_plugins" = xyes], | |
516 | [ | |
517 | AM_PATH_PYTHON([3.0], [], [AC_MSG_ERROR(Python 3 is not available or is not the default Python interpreter on your system. See the README file to learn how to override your distribution's default Python interpreter.)]) | |
24a3136a | 518 | |
1b39e2de JG |
519 | AM_PATH_PYTHON_MODULES([PYTHON]) |
520 | # pythondir is the path where extra modules are to be installed | |
521 | pythondir=$PYTHON_PREFIX/$PYTHON_MODULES_PATH | |
522 | # pyexecdir is the path that contains shared objects used by the extra modules | |
523 | pyexecdir=$PYTHON_EXEC_PREFIX/$PYTHON_MODULES_PATH | |
24a3136a DS |
524 | AS_IF([test -z "$PYTHON_INCLUDE"], [ |
525 | AS_IF([test -z "$PYTHON_CONFIG"], [ | |
526 | AC_PATH_PROGS([PYTHON_CONFIG], | |
527 | [python$PYTHON_VERSION-config python-config], | |
528 | [no], | |
529 | [`dirname $PYTHON`]) | |
9ffc0257 | 530 | AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Is python-dev installed?])]) |
24a3136a | 531 | ]) |
55bb57e0 | 532 | AC_MSG_CHECKING([Python include flags]) |
24a3136a DS |
533 | PYTHON_INCLUDE=`$PYTHON_CONFIG --includes` |
534 | AC_MSG_RESULT([$PYTHON_INCLUDE]) | |
535 | ]) | |
55bb57e0 PP |
536 | AS_IF([test -z "$PYTHON_LIBS"], [ |
537 | AS_IF([test -z "$PYTHON_CONFIG"], [ | |
538 | AC_PATH_PROGS([PYTHON_CONFIG], | |
539 | [python$PYTHON_VERSION-config python-config], | |
540 | [no], | |
541 | [`dirname $PYTHON`]) | |
9ffc0257 | 542 | AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Is python-dev installed?])]) |
55bb57e0 PP |
543 | ]) |
544 | AC_MSG_CHECKING([Python library flags]) | |
545 | PYTHON_LIBS=`$PYTHON_CONFIG --libs` | |
546 | AC_MSG_RESULT([$PYTHON_LIBS]) | |
547 | ]) | |
9ffc0257 | 548 | ] |
55bb57e0 PP |
549 | ) |
550 | ||
9ffc0257 MJ |
551 | AS_IF([test "x$enable_python_bindings_doc" = xyes], |
552 | [ | |
17137804 PP |
553 | AM_CHECK_PYTHON_SPHINX([PYTHON]) |
554 | AS_IF([test "x$PYTHON_SPHINX_EXISTS" = xno], | |
9ffc0257 | 555 | [AC_MSG_ERROR([The Sphinx package for Python 3 is required to build the Python bindings documentation])] |
4f5f37d9 | 556 | ) |
9ffc0257 MJ |
557 | ] |
558 | ) | |
4f5f37d9 | 559 | |
9ffc0257 MJ |
560 | AS_IF([test "x$enable_python_bindings_tests" = xyes], |
561 | [ | |
9cf643d1 PP |
562 | AM_CHECK_PYTHON_TAPPY([PYTHON]) |
563 | AS_IF([test "x$PYTHON_TAPPY_EXISTS" = xno], | |
9ffc0257 | 564 | [AC_MSG_ERROR([You need the tappy Python project to test the Python bindings (see <https://github.com/python-tap/tappy>)])] |
9cf643d1 | 565 | ) |
9ffc0257 MJ |
566 | ] |
567 | ) | |
4fe06062 | 568 | |
9ffc0257 MJ |
569 | AS_IF([test "x$enable_debug_info" = xyes], |
570 | [ | |
571 | # Check if libelf and libdw are present | |
572 | AC_CHECK_LIB([elf], [elf_version], [], [AC_MSG_ERROR(Missing libelf (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)]) | |
573 | AC_CHECK_LIB([dw], [dwarf_begin], [], [AC_MSG_ERROR(Missing libdw (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)]) | |
574 | BT_LIB_ELFUTILS([0], [154], [:], [AC_MSG_ERROR(elfutils >= 0.154 is required to use the debug info feature. You can disable this feature using --disable-debug-info.)]) | |
575 | ] | |
576 | ) | |
6fbd4105 | 577 | |
9ffc0257 MJ |
578 | AS_IF([test "x$enable_api_doc" = "xyes"], |
579 | [ | |
580 | DX_DOXYGEN_FEATURE(ON) | |
581 | DX_DOT_FEATURE(OFF) | |
582 | DX_HTML_FEATURE(ON) | |
583 | DX_CHM_FEATURE(OFF) | |
584 | DX_CHI_FEATURE(OFF) | |
585 | DX_MAN_FEATURE(OFF) | |
586 | DX_RTF_FEATURE(OFF) | |
587 | DX_XML_FEATURE(OFF) | |
588 | DX_PDF_FEATURE(OFF) | |
589 | DX_PS_FEATURE(OFF) | |
590 | DX_INIT_DOXYGEN([Babeltrace], [$(srcdir)/Doxyfile], [output]) | |
591 | AS_IF([test -z "$DX_DOXYGEN"], | |
592 | [AC_MSG_ERROR([You need doxygen to enable the API documentation])] | |
593 | ) | |
594 | ] | |
595 | ) | |
ac65e355 | 596 | |
beb0fb75 | 597 | |
9ffc0257 | 598 | # Set global CFLAGS in AM_CFLAGS |
05c03100 MJ |
599 | AM_CFLAGS="-Wall -Wformat $PTHREAD_CFLAGS $GLIB_CFLAGS" |
600 | AC_SUBST(AM_CFLAGS) | |
ac65e355 | 601 | |
9ffc0257 | 602 | # Set global CPPFLAGS in AM_CPPFLAGS |
05c03100 MJ |
603 | AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h" |
604 | AC_SUBST(AM_CPPFLAGS) | |
605 | ||
9ffc0257 | 606 | # Add glib to global link libs |
05c03100 | 607 | LIBS="$GLIB_LIBS" |
38424656 | 608 | |
9ffc0257 MJ |
609 | # Abuse autoconf's AC_ARG_PROGRAM output variable 'program_transform_name' |
610 | # to rename babeltrace.bin to babeltrace at install time. | |
899a1d74 | 611 | program_transform_name="s&babeltrace\.bin&babeltrace&;s&babeltrace-log\.bin&babeltrace-log&;$program_transform_name" |
33b34c43 | 612 | AC_SUBST(program_transform_name) |
591999ca | 613 | |
d1dab1d2 | 614 | |
45ff8fe4 MD |
615 | #TODO: removed, work in progress |
616 | #bindings/python/Makefile | |
617 | #bindings/python/babeltrace/Makefile | |
618 | #bindings/python/bt2/Makefile | |
619 | #bindings/python/bt2/__init__.py | |
ac65e355 MD |
620 | AC_CONFIG_FILES([ |
621 | Makefile | |
1670bffd | 622 | common/Makefile |
9d1e7de0 | 623 | compat/Makefile |
8d77550c | 624 | cli/Makefile |
d2c0553c | 625 | doc/Makefile |
dc3fffef PP |
626 | doc/api/Makefile |
627 | doc/api/Doxyfile | |
4f5f37d9 PP |
628 | doc/bindings/Makefile |
629 | doc/bindings/python/Makefile | |
e7b68776 | 630 | doc/images/Makefile |
1eb0c69c | 631 | lib/Makefile |
74f21e2d | 632 | lib/prio_heap/Makefile |
33b34c43 | 633 | lib/plugin/Makefile |
c5504f73 PP |
634 | lib/graph/Makefile |
635 | lib/graph/notification/Makefile | |
dc3fffef PP |
636 | lib/ctf-ir/Makefile |
637 | lib/ctf-writer/Makefile | |
e92927d1 | 638 | include/Makefile |
beb0fb75 | 639 | logging/Makefile |
24a3136a | 640 | bindings/Makefile |
ac65e355 | 641 | tests/Makefile |
a8101b91 PP |
642 | tests/cli/Makefile |
643 | tests/cli/intersection/Makefile | |
aa968dde | 644 | tests/lib/Makefile |
4c3453a1 | 645 | tests/lib/writer/Makefile |
cbb9e0b1 | 646 | tests/lib/test-plugin-plugins/Makefile |
1833a3d1 CB |
647 | tests/utils/Makefile |
648 | tests/utils/tap/Makefile | |
9cf643d1 PP |
649 | tests/bindings/Makefile |
650 | tests/bindings/python/Makefile | |
651 | tests/bindings/python/bt2/Makefile | |
8deeabc6 | 652 | tests/plugins/Makefile |
6aa249b5 MD |
653 | extras/Makefile |
654 | extras/valgrind/Makefile | |
8ca04164 | 655 | plugins/Makefile |
38d02a17 | 656 | plugins/ctf/Makefile |
06a626b8 JG |
657 | plugins/ctf/common/Makefile |
658 | plugins/ctf/common/btr/Makefile | |
659 | plugins/ctf/common/metadata/Makefile | |
660 | plugins/ctf/common/notif-iter/Makefile | |
d8866baa PP |
661 | plugins/ctf/fs-src/Makefile |
662 | plugins/ctf/fs-sink/Makefile | |
f3bc2010 JG |
663 | plugins/ctf/lttng-live/Makefile |
664 | plugins/text/Makefile | |
9ffc0257 | 665 | plugins/text/dmesg/Makefile |
3228cc1d | 666 | plugins/text/pretty/Makefile |
e0dfa761 PP |
667 | plugins/utils/Makefile |
668 | plugins/utils/dummy/Makefile | |
358340ec | 669 | plugins/utils/counter/Makefile |
e0dfa761 | 670 | plugins/utils/trimmer/Makefile |
958f7d11 | 671 | plugins/utils/muxer/Makefile |
6fbd4105 | 672 | python-plugin-provider/Makefile |
91b73004 | 673 | plugins/libctfcopytrace/Makefile |
456a4476 | 674 | plugins/lttng-utils/Makefile |
d0acc96d | 675 | babeltrace.pc |
e7a7efdb | 676 | babeltrace-ctf.pc |
ac65e355 | 677 | ]) |
c41a7502 | 678 | |
9ffc0257 | 679 | AC_CONFIG_FILES([tests/cli/intersection/bt_python_helper.py]) |
a8101b91 | 680 | AC_CONFIG_FILES([tests/cli/intersection/test_intersection], [chmod +x tests/cli/intersection/test_intersection]) |
73d7fabb | 681 | AC_CONFIG_FILES([tests/cli/test_convert_args], [chmod +x tests/cli/test_convert_args]) |
9ffc0257 MJ |
682 | AC_CONFIG_FILES([tests/cli/test_debug_info], [chmod +x tests/cli/test_debug_info]) |
683 | AC_CONFIG_FILES([tests/cli/test_packet_seq_num], [chmod +x tests/cli/test_packet_seq_num]) | |
684 | AC_CONFIG_FILES([tests/cli/test_trace_copy], [chmod +x tests/cli/test_trace_copy]) | |
685 | AC_CONFIG_FILES([tests/cli/test_trace_read], [chmod +x tests/cli/test_trace_read]) | |
686 | AC_CONFIG_FILES([tests/cli/test_trimmer], [chmod +x tests/cli/test_trimmer]) | |
687 | AC_CONFIG_FILES([tests/lib/test_bin_info_complete], [chmod +x tests/lib/test_bin_info_complete]) | |
688 | AC_CONFIG_FILES([tests/lib/test_ctf_writer_complete], [chmod +x tests/lib/test_ctf_writer_complete]) | |
689 | AC_CONFIG_FILES([tests/lib/test_dwarf_complete], [chmod +x tests/lib/test_dwarf_complete]) | |
690 | AC_CONFIG_FILES([tests/lib/test_plugin_complete], [chmod +x tests/lib/test_plugin_complete]) | |
4c3453a1 | 691 | AC_CONFIG_FILES([tests/lib/writer/bt_python_helper.py]) |
cd36b2f1 MD |
692 | AC_CONFIG_FILES([tests/lib/writer/test_ctf_writer_empty_packet.py]) |
693 | AC_CONFIG_FILES([tests/lib/writer/test_ctf_writer_no_packet_context.py]) | |
9ffc0257 | 694 | AC_CONFIG_FILES([tests/plugins/test-utils-muxer-complete], [chmod +x tests/plugins/test-utils-muxer-complete]) |
c41a7502 | 695 | |
9ffc0257 MJ |
696 | AS_IF([test "x$enable_python" = xyes], |
697 | [AC_CONFIG_FILES([tests/bindings/python/bt2/testall.sh], [chmod +x tests/bindings/python/bt2/testall.sh])] | |
698 | ) | |
9cf643d1 | 699 | |
ac65e355 | 700 | AC_OUTPUT |
1a0399f9 MJ |
701 | |
702 | # | |
703 | # Mini-report on what will be built. | |
704 | # | |
705 | ||
706 | PPRINT_INIT | |
707 | PPRINT_SET_INDENT(1) | |
708 | PPRINT_SET_TS(38) | |
709 | ||
710 | AS_ECHO | |
711 | AS_ECHO("${PPRINT_COLOR_BLDBLU}Babeltrace $PACKAGE_VERSION$PPRINT_COLOR_RST") | |
712 | AS_ECHO | |
713 | ||
4266f2ad | 714 | PPRINT_SUBTITLE([System]) |
1a0399f9 MJ |
715 | |
716 | # Target architecture we're building for. | |
717 | target_arch=$host_cpu | |
718 | [ | |
719 | for f in $CFLAGS; do | |
720 | if test $f = "-m32"; then | |
721 | target_arch="32-bit" | |
722 | elif test $f = "-m64"; then | |
723 | target_arch="64-bit" | |
724 | fi | |
725 | done | |
726 | ] | |
beb0fb75 | 727 | |
4266f2ad | 728 | PPRINT_PROP_STRING([Target architecture], $target_arch) |
d1dab1d2 | 729 | |
4266f2ad PP |
730 | AS_ECHO |
731 | PPRINT_SUBTITLE([Python 3 language support]) | |
55bb57e0 | 732 | test "x$enable_python_bindings" = "xyes" && value=1 || value=0 |
1a0399f9 | 733 | PPRINT_PROP_BOOL([Python bindings], $value) |
55bb57e0 PP |
734 | test "x$enable_python_plugins" = "xyes" && value=1 || value=0 |
735 | PPRINT_PROP_BOOL([Python plugin support], $value) | |
4266f2ad PP |
736 | AS_IF([test "x$enable_python_bindings" = "xyes" || test "x$enable_python_plugins" = "xyes"], [ |
737 | PPRINT_PROP_STRING([Python include paths], [$PYTHON_INCLUDE]) | |
738 | PPRINT_PROP_STRING([Python libraries], [$PYTHON_LIBS]) | |
739 | ]) | |
55bb57e0 | 740 | |
4266f2ad PP |
741 | AS_ECHO |
742 | PPRINT_SUBTITLE([Plugins]) | |
743 | PPRINT_PROP_BOOL(['ctf' plugin], 1) | |
9ffc0257 | 744 | test "x$enable_debug_info" = "xyes" && value=1 || value=0 |
4266f2ad PP |
745 | PPRINT_PROP_BOOL(['lttng-utils' plugin], $value) |
746 | PPRINT_PROP_BOOL(['text' plugin], 1) | |
747 | PPRINT_PROP_BOOL(['utils' plugin], 1) | |
748 | ||
749 | AS_ECHO | |
750 | PPRINT_SUBTITLE([Built-in features]) | |
9ffc0257 | 751 | test "x$enable_built_in_plugins" = "xyes" && value=1 || value=0 |
4266f2ad | 752 | PPRINT_PROP_BOOL([Built-in plugins], $value) |
9ffc0257 | 753 | test "x$enable_built_in_python_plugin_support" = "xyes" && value=1 || value=0 |
6fbd4105 PP |
754 | PPRINT_PROP_BOOL([Built-in Python plugin support], $value) |
755 | ||
4266f2ad PP |
756 | AS_ECHO |
757 | PPRINT_SUBTITLE([Documentation]) | |
758 | test "x$enable_api_doc" = "xyes" && value=1 || value=0 | |
759 | PPRINT_PROP_BOOL([HTML API documentation], $value) | |
760 | test "x$enable_python_bindings_doc" = "xyes" && value=1 || value=0 | |
761 | PPRINT_PROP_BOOL([Python bindings documentation], $value) | |
1a0399f9 | 762 | |
4266f2ad PP |
763 | AS_ECHO |
764 | PPRINT_SUBTITLE([Logging]) | |
765 | PPRINT_PROP_STRING([Minimal log level], $BABELTRACE_MINIMAL_LOG_LEVEL) | |
766 | ||
767 | AS_ECHO | |
768 | PPRINT_SUBTITLE([Testing]) | |
769 | test "x$enable_python_bindings_tests" = "xyes" && value=1 || value=0 | |
770 | PPRINT_PROP_BOOL([Python bindings tests], $value) | |
1a0399f9 MJ |
771 | |
772 | report_bindir="`eval eval echo $bindir`" | |
773 | report_libdir="`eval eval echo $libdir`" | |
4266f2ad | 774 | report_sysconfdif="`eval eval echo $sysconfdir`" |
1a0399f9 MJ |
775 | |
776 | # Print the bindir and libdir this `make install' will install into. | |
777 | AS_ECHO | |
778 | PPRINT_SUBTITLE([Install directories]) | |
779 | PPRINT_PROP_STRING([Binaries], [$report_bindir]) | |
780 | PPRINT_PROP_STRING([Libraries], [$report_libdir]) | |
4266f2ad PP |
781 | PPRINT_PROP_STRING([Plugins], [$report_libdir/babeltrace/plugins]) |
782 | PPRINT_PROP_STRING([Configuration], [$report_sysconfdif]) |