Fix: invalid alignment of enumeration fields
[babeltrace.git] / configure.ac
CommitLineData
de8bce8a
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])
de8bce8a 28
a2edfc7d
PP
29m4_define([bt_version_major], [2])
30m4_define([bt_version_minor], [0])
31m4_define([bt_version_patch], [0])
58159b52 32m4_define([bt_version_extra], [-pre4])
a2edfc7d 33m4_define([bt_version], bt_version_major[.]bt_version_minor[.]bt_version_patch[]bt_version_extra)
de8bce8a
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
989e97b6 41AC_CONFIG_HEADERS([include/config.h])
ac65e355 42AC_CONFIG_AUX_DIR([config])
80e2fb15 43AC_CONFIG_MACRO_DIR([m4])
de8bce8a 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
de8bce8a
MJ
54
55## ##
56## Automake base setup ##
57## ##
58
989e97b6 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
de8bce8a
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
de8bce8a
MJ
101
102# Choose the c compiler
80e2fb15 103AC_PROG_CC
217108a9 104
de8bce8a
MJ
105# Make sure the c compiler supports C99
106AC_PROG_CC_C99([], [AC_MSG_ERROR([The compiler does not support C99])])
ac65e355 107
de8bce8a 108# Make sure the c compiler supports __attributes__
ec8add54 109AX_C___ATTRIBUTE__
de8bce8a
MJ
110AS_IF([test "x$ax_cv___attribute__" != "xyes"],
111 [AC_MSG_ERROR([The compiler does not support __attribute__ extensions])])
ec8add54 112
de8bce8a
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
de8bce8a
MJ
133
134## ##
135## Header checks ##
136## ##
f0d8d709 137
f847f3ae
MJ
138AC_HEADER_STDBOOL
139AC_CHECK_HEADERS([ \
140 fcntl.h \
141 float.h \
1307d39e 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 \
de8bce8a 150 sys/time.h
f847f3ae 151])
80e2fb15 152
de8bce8a
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
11cc4f3d
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
de8bce8a
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
8a121625
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"], [
de8bce8a 203 AC_MSG_FAILURE([dnl
8a121625
MJ
204Bison >= 2.4 is required when building from the Git repository. You can
205set the YACC variable to override automatic detection.
206 ])
207 ], [
de8bce8a 208 AC_MSG_WARN([dnl
8a121625
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"], [
de8bce8a 224 AC_MSG_FAILURE([dnl
8a121625
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 ], [
de8bce8a 229 AC_MSG_WARN([dnl
8a121625
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
de8bce8a
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
de8bce8a
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
de8bce8a 259AC_FUNC_STRNLEN
2f8c0e47 260AC_CHECK_FUNCS([ \
f847f3ae 261 atexit \
f847f3ae
MJ
262 dup2 \
263 ftruncate \
264 gethostbyname \
f847f3ae
MJ
265 gettimeofday \
266 localtime_r \
267 memchr \
268 memset \
269 mkdir \
270 mkdtemp \
271 munmap \
272 rmdir \
273 setenv \
274 socket \
275 strchr \
276 strdup \
277 strerror \
278 strndup \
279 strnlen \
280 strrchr \
de8bce8a 281 strstr \
f847f3ae
MJ
282 strtoul \
283 strtoull \
284 tzset \
2f8c0e47 285])
ac65e355 286
34064482
MJ
287# AC_FUNC_MALLOC causes problems when cross-compiling.
288#AC_FUNC_MALLOC
289#AC_FUNC_REALLOC
290
8a995d73
MJ
291# First, check for uuid in system libs
292AH_TEMPLATE([BABELTRACE_HAVE_LIBUUID], [Define if you have libuuid support])
4120f662 293AC_CHECK_FUNCS([uuid_generate],
4120f662 294 [
8a995d73
MJ
295 AC_DEFINE([BABELTRACE_HAVE_LIBUUID], [1])
296 UUID_LIBS=""
4120f662
MJ
297 ],
298 [
8a995d73
MJ
299 # Then, check if the pkg-config module is available, otherwise explicitly check
300 # for libuuid, or uuid support in the C-library.
301 PKG_CHECK_MODULES([UUID], [uuid],
2741f55b 302 [
8a995d73
MJ
303 AC_DEFINE([BABELTRACE_HAVE_LIBUUID], [1])
304 dnl PKG_CHECK_MODULES defines UUID_LIBS
2741f55b
SM
305 ],
306 [
8a995d73
MJ
307 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])
308 AC_MSG_WARN([Finding libuuid without pkg-config.])
309 AC_CHECK_LIB([uuid], [uuid_generate],
310 [
311 AC_DEFINE([BABELTRACE_HAVE_LIBUUID], [1])
312 UUID_LIBS="-luuid"
313 ],
314 [
315 # libuuid not found, check for uuid_create in libc.
316 AC_CHECK_LIB([c], [uuid_create],
317 [
318 AC_DEFINE([BABELTRACE_HAVE_LIBUUID], [1])
319 UUID_LIBS="-lc"
320 ],
321 [
322 # for MinGW32 we have our own internal implementation of uuid using Windows functions.
de8bce8a
MJ
323 AS_IF([test "x$MINGW32" = xno],
324 [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])]
325 )
8a995d73
MJ
326 ]
327 )
328 ]
329 )
330 ]
331 )
332 ]
333)
334AC_SUBST(UUID_LIBS)
fd55fc57 335
f8370579
MD
336# Check for fmemopen
337AC_CHECK_LIB([c], [fmemopen],
de8bce8a 338 [AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_FMEMOPEN], 1, [Has fmemopen support.])]
f8370579
MD
339)
340
341# Check for open_memstream
342AC_CHECK_LIB([c], [open_memstream],
de8bce8a 343 [AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_OPEN_MEMSTREAM], 1, [Has open_memstream support.])]
f8370579
MD
344)
345
a323afb2
JG
346# Check for posix_fallocate
347AC_CHECK_LIB([c], [posix_fallocate],
de8bce8a 348 [AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_POSIX_FALLOCATE], 1, [Has posix_fallocate support.])]
a323afb2
JG
349)
350
5cddb897
MJ
351# Check libpopt
352PKG_CHECK_MODULES([POPT], [popt],
353 [
354 dnl PKG_CHECK_MODULES defines POPT_LIBS
355 ],
356 [
357 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])
358 AC_MSG_WARN([Finding libpopt without pkg-config.])
359 AC_CHECK_LIB([popt],
360 [poptGetContext],
361 [POPT_LIBS="-lpopt"],
362 [
363 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])
364 ]
365 )
366 ]
0f536a74 367)
5cddb897 368AC_SUBST(POPT_LIBS)
0f536a74 369
de8bce8a
MJ
370
371## ##
372## User variables ##
373## ##
374
375AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for Python, bypassing python-config])
376AC_ARG_VAR([PYTHON_LIBS], [Library flags for Python, bypassing python-config])
377AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
378
379# PLUGINSDIR: Plugins directory
a094f13b
PP
380AC_ARG_VAR([PLUGINSDIR], [built-in plugins install directory [LIBDIR/babeltrace/plugins]])
381AS_IF([test "x$PLUGINSDIR" = x], [PLUGINSDIR='$(libdir)/babeltrace/plugins'])
382
de8bce8a
MJ
383# BABELTRACE_MINIMAL_LOG_LEVEL:
384AC_ARG_VAR([BABELTRACE_MINIMAL_LOG_LEVEL], [Minimal log level for Babeltrace program, library, and plugins (VERBOSE, DEBUG, INFO, WARN, ERROR (default), FATAL, or NONE)])
385AS_IF([test "x$BABELTRACE_MINIMAL_LOG_LEVEL" = x], [BABELTRACE_MINIMAL_LOG_LEVEL="VERBOSE"])
386AS_IF([test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "VERBOSE" && \
387 test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "DEBUG" && \
388 test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "INFO" && \
389 test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "WARN" && \
390 test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "ERROR" && \
391 test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "FATAL" && \
392 test "$BABELTRACE_MINIMAL_LOG_LEVEL" != "NONE"],
393 [AC_MSG_ERROR([Invalid BABELTRACE_MINIMAL_LOG_LEVEL value ($BABELTRACE_MINIMAL_LOG_LEVEL): use VERBOSE, DEBUG, INFO, WARN, ERROR, FATAL, or NONE.])]
394)
395AC_DEFINE_UNQUOTED([BT_LOG_LEVEL], [BT_LOG_$BABELTRACE_MINIMAL_LOG_LEVEL], [Minimal log level])
396
397
398## ##
399## Optionnal features selection ##
400## ##
24a3136a 401
de8bce8a
MJ
402# Python bindings
403# Disabled by default
94a6cea3 404AC_ARG_ENABLE([python-bindings],
de8bce8a
MJ
405 [AC_HELP_STRING([--enable-python-bindings], [build the Python bindings])],
406 [], dnl AC_ARG_ENABLE will fill enable_python_bindings with the user choice
407 [enable_python_bindings=no]
408)
409
410# Python bindings documentation
411# Disabled by default
412AC_ARG_ENABLE([python-bindings-doc],
413 [AC_HELP_STRING([--enable-python-bindings-doc], [build the Python bindings documentation])],
414 [], dnl AC_ARG_ENABLE will fill enable_python_bindings_doc with the user choice
415 [enable_python_bindings_doc=no]
416)
417
de8bce8a
MJ
418# Python plugins
419# Disabled by default
420AC_ARG_ENABLE([python-plugins],
421 [AC_HELP_STRING([--enable-python-plugins], [enable the Python plugins support for the library and converter])],
422 [], dnl AC_ARG_ENABLE will fill enable_python_plugins with the user choice
423 [enable_python_plugins=no]
424)
425
426# Debug info
427# Enabled by default, except on some platforms
428AC_ARG_ENABLE([debug-info],
429 [AC_HELP_STRING([--disable-debug-info], [disable the debug info support (default on macOS, Solaris and Windows)])],
430 [], dnl AC_ARG_ENABLE will fill enable_debug_info with the user choice
431 [enable_debug_info="$DEFAULT_ENABLE_DEBUG_INFO"]
432)
433
434# API documentation
435# Disabled by default
436AC_ARG_ENABLE([api-doc],
437 [AC_HELP_STRING([--enable-api-doc], [build the HTML API documentation])],
438 [enable_api_doc=$enableval],
439 [enable_api_doc=no]
440)
441
442# Built-in plugins
443# Disabled by default
444AC_ARG_ENABLE([built-in-plugins],
445 [AC_HELP_STRING([--enable-built-in-plugins], [Statically-link in-tree plug-ins into the babeltrace binary])],
446 [], dnl AC_ARG_ENABLE will fill enable_built_in_plugins with the user choice
447 [enable_built_in_plugins=no]
448)
449
450# Built-in python plugin support
451# Disabled by default
452AC_ARG_ENABLE([built-in-python-plugin-support],
453 [AC_HELP_STRING([--enable-built-in-python-plugin-support], [Statically-link Python plugin support into the babeltrace library])],
454 [], dnl AC_ARG_ENABLE will fill enable_built_in_python_plugin_support with the user choice
455 [enable_built_in_python_plugin_support=no]
456)
457
838dd456
PP
458# Man pages
459# Enabled by default
460AC_ARG_ENABLE([man-pages],
461 [AS_HELP_STRING([--disable-man-pages], [Do not build and install man pages (already built in a distributed tarball])],
462 [], dnl AC_ARG_ENABLE will fill enable_built_in_plugins with the user choice
463 [enable_man_pages=yes]
464)
465
de8bce8a
MJ
466
467# Set automake variables for optionnal feature conditionnals in Makefile.am
468AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS], [test "x$enable_python_bindings" = xyes])
469AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS_DOC], [test "x$enable_python_bindings_doc" = xyes])
de8bce8a
MJ
470AM_CONDITIONAL([ENABLE_PYTHON_PLUGINS], [test "x$enable_python_plugins" = xyes])
471AM_CONDITIONAL([ENABLE_DEBUG_INFO], [test "x$enable_debug_info" = xyes])
472AM_CONDITIONAL([ENABLE_API_DOC], [test "x$enable_api_doc" = xyes])
473AM_CONDITIONAL([ENABLE_BUILT_IN_PLUGINS], [test "x$enable_built_in_plugins" = xyes])
474AM_CONDITIONAL([ENABLE_BUILT_IN_PYTHON_PLUGIN_SUPPORT], [test "x$enable_built_in_python_plugin_support" = xyes])
838dd456 475AM_CONDITIONAL([ENABLE_MAN_PAGES], [test "x$enable_man_pages" = xyes])
de8bce8a
MJ
476
477
478# Set defines for optionnal features conditionnals in the source code
479
480## jgalar: still used?
481AS_IF([test "x$enable_python_plugins" = xyes],
482 [AC_DEFINE([PYTHON_PLUGINS], [1], [Python plugin support.])]
483)
484
485AS_IF([test "x$enable_debug_info" = xyes],
486 [AC_DEFINE([ENABLE_DEBUG_INFO], [1], [Define to 1 if you enable the 'debug info' feature])]
487)
488
489AS_IF([test "x$enable_built_in_plugins" = xyes],
490 [AC_DEFINE([BT_BUILT_IN_PLUGINS], [1], [Define to 1 to register plug-in attributes in static executable sections])]
491)
492
493AS_IF([test "x$enable_built_in_python_plugin_support" = xyes],
494 [AC_DEFINE([BT_BUILT_IN_PYTHON_PLUGIN_SUPPORT], [1], [Define to 1 to register plug-in attributes in static executable sections])]
495)
496
838dd456
PP
497AS_IF([test "x$enable_debug_info" = xyes],
498 [ENABLE_DEBUG_INFO_VAL=1],
499 [ENABLE_DEBUG_INFO_VAL=0]
500)
501
502AC_SUBST([ENABLE_DEBUG_INFO_VAL])
503
de8bce8a 504
f6a5e476 505# Check for conflicting optional features user choices
de8bce8a
MJ
506
507AS_IF([test "x$enable_python_bindings" = xno],
508 [
509 AS_IF([test "x$enable_python_bindings_doc" = xyes], [AC_MSG_ERROR([--enable-python-bindings-doc was specified without --enable-python-bindings])])
de8bce8a
MJ
510 ]
511)
512
513AS_IF([test "x$enable_built_in_plugins" = xyes],
514 [
515 # Built-in plug-ins are only available when the --disable-shared --enable-static options are used.
516 AS_IF([test "x$enable_static" != xyes], [AC_MSG_ERROR(--enable-static must be used to bundle plug-ins in the babeltrace executable)])
517 AS_IF([test "x$enable_shared" = xyes], [AC_MSG_ERROR(--disable-shared must be used to bundle plug-ins in the babeltrace executable)])
518 ]
519)
520
521AS_IF([test "x$enable_built_in_python_plugin_support" = xyes],
522 [
523 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])])
524 # Built-in plug-ins are only available when the --disable-shared --enable-static options are used.
525 AS_IF([test "x$enable_static" != xyes], [AC_MSG_ERROR(--enable-static must be used to bundle Python plugin support in the babeltrace executable)])
526 AS_IF([test "x$enable_shared" = xyes], [AC_MSG_ERROR(--disable-shared must be used to bundle Python plugin support in the babeltrace executable)])
527 ]
55bb57e0 528)
9cf643d1 529
4f5f37d9 530
de8bce8a
MJ
531# Check for optionnal features dependencies
532
533AS_IF([test "x$enable_python_bindings" = xyes],
534 [AX_PKG_SWIG(2.0.0, [], [AC_MSG_ERROR([SWIG 2.0.0 or newer is required to build the python bindings])])]
535)
536
537AS_IF([test "x$enable_python_bindings" = xyes || test "x$enable_python_plugins" = xyes],
538 [
539 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 540
1b39e2de
JG
541 AM_PATH_PYTHON_MODULES([PYTHON])
542 # pythondir is the path where extra modules are to be installed
543 pythondir=$PYTHON_PREFIX/$PYTHON_MODULES_PATH
544 # pyexecdir is the path that contains shared objects used by the extra modules
545 pyexecdir=$PYTHON_EXEC_PREFIX/$PYTHON_MODULES_PATH
24a3136a
DS
546 AS_IF([test -z "$PYTHON_INCLUDE"], [
547 AS_IF([test -z "$PYTHON_CONFIG"], [
548 AC_PATH_PROGS([PYTHON_CONFIG],
549 [python$PYTHON_VERSION-config python-config],
550 [no],
551 [`dirname $PYTHON`])
de8bce8a 552 AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Is python-dev installed?])])
24a3136a 553 ])
55bb57e0 554 AC_MSG_CHECKING([Python include flags])
24a3136a
DS
555 PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
556 AC_MSG_RESULT([$PYTHON_INCLUDE])
557 ])
55bb57e0
PP
558 AS_IF([test -z "$PYTHON_LIBS"], [
559 AS_IF([test -z "$PYTHON_CONFIG"], [
560 AC_PATH_PROGS([PYTHON_CONFIG],
561 [python$PYTHON_VERSION-config python-config],
562 [no],
563 [`dirname $PYTHON`])
de8bce8a 564 AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Is python-dev installed?])])
55bb57e0
PP
565 ])
566 AC_MSG_CHECKING([Python library flags])
567 PYTHON_LIBS=`$PYTHON_CONFIG --libs`
568 AC_MSG_RESULT([$PYTHON_LIBS])
569 ])
de8bce8a 570 ]
55bb57e0
PP
571)
572
de8bce8a
MJ
573AS_IF([test "x$enable_python_bindings_doc" = xyes],
574 [
17137804
PP
575 AM_CHECK_PYTHON_SPHINX([PYTHON])
576 AS_IF([test "x$PYTHON_SPHINX_EXISTS" = xno],
de8bce8a 577 [AC_MSG_ERROR([The Sphinx package for Python 3 is required to build the Python bindings documentation])]
4f5f37d9 578 )
de8bce8a
MJ
579 ]
580)
4f5f37d9 581
de8bce8a
MJ
582AS_IF([test "x$enable_debug_info" = xyes],
583 [
584 # Check if libelf and libdw are present
d9796e27
MJ
585 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.)])
586 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.)])
de8bce8a 587 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.)])
d9796e27 588 ELFUTILS_LIBS="-lelf -ldw"
de8bce8a
MJ
589 ]
590)
d9796e27 591AC_SUBST([ELFUTILS_LIBS])
6fbd4105 592
de8bce8a
MJ
593AS_IF([test "x$enable_api_doc" = "xyes"],
594 [
595 DX_DOXYGEN_FEATURE(ON)
596 DX_DOT_FEATURE(OFF)
597 DX_HTML_FEATURE(ON)
598 DX_CHM_FEATURE(OFF)
599 DX_CHI_FEATURE(OFF)
600 DX_MAN_FEATURE(OFF)
601 DX_RTF_FEATURE(OFF)
602 DX_XML_FEATURE(OFF)
603 DX_PDF_FEATURE(OFF)
604 DX_PS_FEATURE(OFF)
605 DX_INIT_DOXYGEN([Babeltrace], [$(srcdir)/Doxyfile], [output])
606 AS_IF([test -z "$DX_DOXYGEN"],
607 [AC_MSG_ERROR([You need doxygen to enable the API documentation])]
608 )
609 ]
610)
ac65e355 611
838dd456
PP
612have_asciidoc_xmlto=no
613warn_prebuilt_man_pages=no
614
615AS_IF([test "x$enable_man_pages" = "xyes"], [
616 AC_PATH_PROG([ASCIIDOC], [asciidoc], [no])
617 AC_PATH_PROG([XMLTO], [xmlto], [no])
618
619 AS_IF([test "x$ASCIIDOC" = "xno" || test "x$XMLTO" = "xno"], [
620 AS_IF([test "x$in_git_repo" = "xyes"], [
621 # this is an error because we're in the Git repo, which
622 # means the man pages are not already generated for us,
623 # thus asciixmlto are required because we were asked
624 # to build the man pages
625 AC_MSG_ERROR([
626You need asciidoc and xmlto to build the Babeltrace man pages. Use
627--disable-man-pages to disable building the man pages, in which case
628they will not be installed.
629 ])
630 ], [
631 # only warn here: since we're in the tarball, the man
632 # pages should already be generated at this point, thus
633 # asciidoc/xmlto are not strictly required
634 warn_prebuilt_man_pages=yes
635 ])
636 ], [
637 have_asciidoc_xmlto=yes
638 ])
639])
640
641# export AsciiDoc and xmlto existence
642AM_CONDITIONAL([HAVE_ASCIIDOC_XMLTO], [test "x$have_asciidoc_xmlto" = "xyes"])
643
644# a wonderful hack that seems necessary because $libdir is
645# literally `${exec_prefix}/lib`, and $exec_prefix is set to `NONE`
646# by autoconf when it's not specified by the user
647AS_IF([test "x$exec_prefix" = xNONE], [
648 AS_IF([test "x$prefix" = xNONE], [
649 PREFIX="$ac_default_prefix"
650 ], [
651 PREFIX="$prefix"
652 ])
653
654 LIBDIR="$PREFIX/lib"
655], [
656 LIBDIR="$libdir"
657])
658
659AC_SUBST(LIBDIR)
660
beb0fb75 661
de8bce8a 662# Set global CFLAGS in AM_CFLAGS
989e97b6
MJ
663AM_CFLAGS="-Wall -Wformat $PTHREAD_CFLAGS $GLIB_CFLAGS"
664AC_SUBST(AM_CFLAGS)
ac65e355 665
de8bce8a 666# Set global CPPFLAGS in AM_CPPFLAGS
989e97b6
MJ
667AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h"
668AC_SUBST(AM_CPPFLAGS)
669
de8bce8a 670# Add glib to global link libs
836b5b39 671LIBS="$LIBS $GLIB_LIBS"
38424656 672
0ede31e8
MJ
673# Check that the current size_t matches the size that glib thinks it should
674# be. This catches problems on multi-arch where people try to do a 32-bit
675# build while pointing at 64-bit glib headers. This is a common error because
676# glib.h is not platform specific but it includes glibconfig.h which is and
677# is usually installed in a non-standard path.
678
ecca2f36
MJ
679# Older versions of the pkg-config macros disallows PKG_* in the autoconf
680# output. Specifically allow pkg_config_libdir to be able to print the
681# error message.
682m4_pattern_allow([PKG_CONFIG_LIBDIR])
683
0ede31e8
MJ
684save_CFLAGS=${CFLAGS}
685CFLAGS="${CFLAGS} ${AM_CFLAGS}"
686AC_COMPILE_IFELSE([
687 AC_LANG_PROGRAM([dnl
688#include <glib.h>
689#include <unistd.h>
690 ], [dnl
691G_STATIC_ASSERT(sizeof(size_t) == GLIB_SIZEOF_SIZE_T);
692 ])
693],[:],[
694 AC_MSG_ERROR([dnl
695sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T. You probably need to set
696PKG_CONFIG_LIBDIR to point to the right pkg-config files for your build
697target.
698 ])
699])
700CFLAGS=${save_CFLAGS}
701
de8bce8a
MJ
702# Abuse autoconf's AC_ARG_PROGRAM output variable 'program_transform_name'
703# to rename babeltrace.bin to babeltrace at install time.
5781a924 704program_transform_name="s&babeltrace\.bin&babeltrace&;s&babeltrace-log\.bin&babeltrace-log&;$program_transform_name"
33b34c43 705AC_SUBST(program_transform_name)
591999ca 706
ac65e355
MD
707AC_CONFIG_FILES([
708 Makefile
f6a5e476 709 bindings/python/Makefile
00f7eedc
JG
710 bindings/python/babeltrace/Makefile
711 bindings/python/babeltrace/setup.py
712 bindings/python/babeltrace/babeltrace/__init__.py
f6a5e476 713 bindings/python/bt2/Makefile
09ef660c
MJ
714 bindings/python/bt2/setup.py
715 bindings/python/bt2/bt2/__init__.py
1670bffd 716 common/Makefile
9d1e7de0 717 compat/Makefile
8d77550c 718 cli/Makefile
d2c0553c 719 doc/Makefile
dc3fffef
PP
720 doc/api/Makefile
721 doc/api/Doxyfile
4f5f37d9
PP
722 doc/bindings/Makefile
723 doc/bindings/python/Makefile
12e02f34 724 doc/contributing-images/Makefile
838dd456
PP
725 doc/man/Makefile
726 doc/man/asciidoc-attrs.conf
1eb0c69c 727 lib/Makefile
74f21e2d 728 lib/prio_heap/Makefile
33b34c43 729 lib/plugin/Makefile
c5504f73
PP
730 lib/graph/Makefile
731 lib/graph/notification/Makefile
dc3fffef
PP
732 lib/ctf-ir/Makefile
733 lib/ctf-writer/Makefile
e92927d1 734 include/Makefile
beb0fb75 735 logging/Makefile
24a3136a 736 bindings/Makefile
ac65e355 737 tests/Makefile
a8101b91
PP
738 tests/cli/Makefile
739 tests/cli/intersection/Makefile
aa968dde 740 tests/lib/Makefile
cbb9e0b1 741 tests/lib/test-plugin-plugins/Makefile
de3fb4cd 742 tests/utils/common.sh
1833a3d1
CB
743 tests/utils/Makefile
744 tests/utils/tap/Makefile
9cf643d1
PP
745 tests/bindings/Makefile
746 tests/bindings/python/Makefile
747 tests/bindings/python/bt2/Makefile
d6ca48e5 748 tests/bindings/python/babeltrace/Makefile
8deeabc6 749 tests/plugins/Makefile
a26f524a 750 tests/python-plugin-provider/Makefile
6aa249b5
MD
751 extras/Makefile
752 extras/valgrind/Makefile
8ca04164 753 plugins/Makefile
38d02a17 754 plugins/ctf/Makefile
06a626b8
JG
755 plugins/ctf/common/Makefile
756 plugins/ctf/common/btr/Makefile
757 plugins/ctf/common/metadata/Makefile
758 plugins/ctf/common/notif-iter/Makefile
8f7b565c 759 plugins/ctf/common/utils/Makefile
d8866baa
PP
760 plugins/ctf/fs-src/Makefile
761 plugins/ctf/fs-sink/Makefile
f3bc2010
JG
762 plugins/ctf/lttng-live/Makefile
763 plugins/text/Makefile
de8bce8a 764 plugins/text/dmesg/Makefile
3228cc1d 765 plugins/text/pretty/Makefile
e0dfa761
PP
766 plugins/utils/Makefile
767 plugins/utils/dummy/Makefile
14b7ef9e 768 plugins/utils/counter/Makefile
e0dfa761 769 plugins/utils/trimmer/Makefile
958f7d11 770 plugins/utils/muxer/Makefile
6fbd4105 771 python-plugin-provider/Makefile
91b73004 772 plugins/libctfcopytrace/Makefile
456a4476 773 plugins/lttng-utils/Makefile
d0acc96d 774 babeltrace.pc
e7a7efdb 775 babeltrace-ctf.pc
ac65e355 776])
c41a7502 777
a8101b91 778AC_CONFIG_FILES([tests/cli/intersection/test_intersection], [chmod +x tests/cli/intersection/test_intersection])
73d7fabb 779AC_CONFIG_FILES([tests/cli/test_convert_args], [chmod +x tests/cli/test_convert_args])
de8bce8a
MJ
780AC_CONFIG_FILES([tests/cli/test_packet_seq_num], [chmod +x tests/cli/test_packet_seq_num])
781AC_CONFIG_FILES([tests/cli/test_trace_copy], [chmod +x tests/cli/test_trace_copy])
782AC_CONFIG_FILES([tests/cli/test_trace_read], [chmod +x tests/cli/test_trace_read])
783AC_CONFIG_FILES([tests/cli/test_trimmer], [chmod +x tests/cli/test_trimmer])
de8bce8a 784AC_CONFIG_FILES([tests/lib/test_ctf_writer_complete], [chmod +x tests/lib/test_ctf_writer_complete])
de8bce8a 785AC_CONFIG_FILES([tests/lib/test_plugin_complete], [chmod +x tests/lib/test_plugin_complete])
de8bce8a 786AC_CONFIG_FILES([tests/plugins/test-utils-muxer-complete], [chmod +x tests/plugins/test-utils-muxer-complete])
36abff2a 787AC_CONFIG_FILES([tests/plugins/test_lttng_utils_debug_info], [chmod +x tests/plugins/test_lttng_utils_debug_info])
05088752
JD
788AC_CONFIG_FILES([tests/plugins/test_dwarf_complete], [chmod +x tests/plugins/test_dwarf_complete])
789AC_CONFIG_FILES([tests/plugins/test_bin_info_complete], [chmod +x tests/plugins/test_bin_info_complete])
c41a7502 790
0d9b8380 791AS_IF([test "x$enable_python_bindings" = xyes],
d6ca48e5
JG
792 [
793 AC_CONFIG_FILES([tests/bindings/python/bt2/test_python_bt2], [chmod +x tests/bindings/python/bt2/test_python_bt2])
794 AC_CONFIG_FILES([tests/bindings/python/babeltrace/test_python_babeltrace], [chmod +x tests/bindings/python/babeltrace/test_python_babeltrace])
795 ]
de8bce8a 796)
9cf643d1 797
a26f524a 798AS_IF([test "x$enable_python_plugins" = "xyes"],
2faa355b 799 [AC_CONFIG_FILES([tests/python-plugin-provider/test_python_plugin_provider], [chmod +x tests/python-plugin-provider/test_python_plugin_provider])]
a26f524a
PP
800)
801
ac65e355 802AC_OUTPUT
1a0399f9
MJ
803
804#
805# Mini-report on what will be built.
806#
807
808PPRINT_INIT
809PPRINT_SET_INDENT(1)
810PPRINT_SET_TS(38)
811
812AS_ECHO
813AS_ECHO("${PPRINT_COLOR_BLDBLU}Babeltrace $PACKAGE_VERSION$PPRINT_COLOR_RST")
814AS_ECHO
815
4266f2ad 816PPRINT_SUBTITLE([System])
1a0399f9
MJ
817
818# Target architecture we're building for.
819target_arch=$host_cpu
820[
821for f in $CFLAGS; do
822 if test $f = "-m32"; then
823 target_arch="32-bit"
824 elif test $f = "-m64"; then
825 target_arch="64-bit"
826 fi
827done
828]
beb0fb75 829
4266f2ad 830PPRINT_PROP_STRING([Target architecture], $target_arch)
d1dab1d2 831
4266f2ad
PP
832AS_ECHO
833PPRINT_SUBTITLE([Python 3 language support])
55bb57e0 834test "x$enable_python_bindings" = "xyes" && value=1 || value=0
1a0399f9 835PPRINT_PROP_BOOL([Python bindings], $value)
55bb57e0
PP
836test "x$enable_python_plugins" = "xyes" && value=1 || value=0
837PPRINT_PROP_BOOL([Python plugin support], $value)
4266f2ad
PP
838AS_IF([test "x$enable_python_bindings" = "xyes" || test "x$enable_python_plugins" = "xyes"], [
839 PPRINT_PROP_STRING([Python include paths], [$PYTHON_INCLUDE])
840 PPRINT_PROP_STRING([Python libraries], [$PYTHON_LIBS])
841])
55bb57e0 842
4266f2ad
PP
843AS_ECHO
844PPRINT_SUBTITLE([Plugins])
845PPRINT_PROP_BOOL(['ctf' plugin], 1)
de8bce8a 846test "x$enable_debug_info" = "xyes" && value=1 || value=0
4266f2ad
PP
847PPRINT_PROP_BOOL(['lttng-utils' plugin], $value)
848PPRINT_PROP_BOOL(['text' plugin], 1)
849PPRINT_PROP_BOOL(['utils' plugin], 1)
850
851AS_ECHO
852PPRINT_SUBTITLE([Built-in features])
de8bce8a 853test "x$enable_built_in_plugins" = "xyes" && value=1 || value=0
4266f2ad 854PPRINT_PROP_BOOL([Built-in plugins], $value)
de8bce8a 855test "x$enable_built_in_python_plugin_support" = "xyes" && value=1 || value=0
6fbd4105
PP
856PPRINT_PROP_BOOL([Built-in Python plugin support], $value)
857
4266f2ad
PP
858AS_ECHO
859PPRINT_SUBTITLE([Documentation])
838dd456
PP
860
861# man pages build enabled/disabled
862m4_pushdef([build_man_pages_msg], [Build and install man pages])
863
864AS_IF([test "x$enable_man_pages" != "xno"], [
865 AS_IF([test "x$in_git_repo" = "xyes"], [
866 PPRINT_PROP_BOOL([build_man_pages_msg], 1)
867 ], [
868 AS_IF([test "x$have_asciidoc_xmlto" = "xyes"], [
869 PPRINT_PROP_BOOL([build_man_pages_msg], 1)
870 ], [
871 PPRINT_PROP_STRING([build_man_pages_msg],
872 [${PPRINT_COLOR_BLDGRN}yes (already built)],
873 $PPRINT_COLOR_SUBTITLE)
874 ])
875 ])
876], [
877 PPRINT_PROP_BOOL([build_man_pages_msg], 0)
878])
879
880m4_popdef([build_man_pages_msg])
881
4266f2ad
PP
882test "x$enable_api_doc" = "xyes" && value=1 || value=0
883PPRINT_PROP_BOOL([HTML API documentation], $value)
884test "x$enable_python_bindings_doc" = "xyes" && value=1 || value=0
885PPRINT_PROP_BOOL([Python bindings documentation], $value)
1a0399f9 886
4266f2ad
PP
887AS_ECHO
888PPRINT_SUBTITLE([Logging])
889PPRINT_PROP_STRING([Minimal log level], $BABELTRACE_MINIMAL_LOG_LEVEL)
890
1a0399f9
MJ
891report_bindir="`eval eval echo $bindir`"
892report_libdir="`eval eval echo $libdir`"
4266f2ad 893report_sysconfdif="`eval eval echo $sysconfdir`"
1a0399f9
MJ
894
895# Print the bindir and libdir this `make install' will install into.
896AS_ECHO
897PPRINT_SUBTITLE([Install directories])
898PPRINT_PROP_STRING([Binaries], [$report_bindir])
899PPRINT_PROP_STRING([Libraries], [$report_libdir])
4266f2ad
PP
900PPRINT_PROP_STRING([Plugins], [$report_libdir/babeltrace/plugins])
901PPRINT_PROP_STRING([Configuration], [$report_sysconfdif])
This page took 0.089705 seconds and 4 git commands to generate.