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