Build Python bindings with distutils for consistent installs
[babeltrace.git] / configure.ac
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
27 AC_PREREQ([2.50])
28
29 m4_define([bt_version_major], [2])
30 m4_define([bt_version_minor], [0])
31 m4_define([bt_version_patch], [0])
32 m4_define([bt_version_extra], [-pre1])
33 m4_define([bt_version], bt_version_major[.]bt_version_minor[.]bt_version_patch[]bt_version_extra)
34
35 AC_INIT([babeltrace], bt_version, [jeremie dot galarneau at efficios dot com], [], [https://efficios.com/babeltrace/])
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
39 AC_SUBST([BABELTRACE_LIBRARY_VERSION], bt_version_major[:]bt_version_minor[:]bt_version_patch)
40
41 AC_CONFIG_HEADERS([include/config.h])
42 AC_CONFIG_AUX_DIR([config])
43 AC_CONFIG_MACRO_DIR([m4])
44 AC_REQUIRE_AUX_FILE([tap-driver.sh])
45
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
51 AC_CANONICAL_TARGET
52 AC_CANONICAL_HOST
53
54
55 ## ##
56 ## Automake base setup ##
57 ## ##
58
59 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip tar-ustar nostdinc])
60 AM_MAINTAINER_MODE([enable])
61
62 # Enable silent rules if available (Introduced in AM 1.11)
63 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
64
65
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
99 AC_USE_SYSTEM_EXTENSIONS
100 AC_SYS_LARGEFILE
101
102 # Choose the c compiler
103 AC_PROG_CC
104
105 # Make sure the c compiler supports C99
106 AC_PROG_CC_C99([], [AC_MSG_ERROR([The compiler does not support C99])])
107
108 # Make sure the c compiler supports __attributes__
109 AX_C___ATTRIBUTE__
110 AS_IF([test "x$ax_cv___attribute__" != "xyes"],
111 [AC_MSG_ERROR([The compiler does not support __attribute__ extensions])])
112
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])
132
133
134 ## ##
135 ## Header checks ##
136 ## ##
137
138 AC_HEADER_STDBOOL
139 AC_CHECK_HEADERS([ \
140 fcntl.h \
141 float.h \
142 ftw.h \
143 libintl.h \
144 limits.h \
145 malloc.h \
146 netdb.h \
147 netinet/in.h \
148 stddef.h \
149 sys/socket.h \
150 sys/time.h
151 ])
152
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 # Check if the linker supports whole-archive
163 AX_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
180 # Initialize and configure libtool
181 LT_INIT([win32-dll])
182
183
184 ## ##
185 ## Programs checks ##
186 ## ##
187
188 AC_PROG_MAKE_SET
189 AC_PROG_MKDIR_P
190 AC_PROG_LN_S
191
192 # set $IN_GIT_REPO if we're in the Git repository; the `bootstrap` file
193 # is not distributed in tarballs
194 AS_IF([test -f "$srcdir/bootstrap"], [in_git_repo=yes], [in_git_repo=no])
195 AM_CONDITIONAL([IN_GIT_REPO], [test "x$in_git_repo" = "xyes"])
196
197 # check for bison
198 AC_PROG_YACC
199 AX_PROG_BISON_VERSION([2.4], [have_bison=yes])
200
201 AS_IF([test "x$have_bison" != "xyes"], [
202 AS_IF([test "x$in_git_repo" = "xyes"], [
203 AC_MSG_FAILURE([dnl
204 Bison >= 2.4 is required when building from the Git repository. You can
205 set the YACC variable to override automatic detection.
206 ])
207 ], [
208 AC_MSG_WARN([dnl
209 Missing Bison >= 2.4. Note that the parser files are already built in
210 this distribution tarball, so Bison is only needed if you intend to
211 modify their sources. You can set the YACC variable to override automatic
212 detection.
213 ])
214 ])
215 ])
216 AM_CONDITIONAL([HAVE_BISON], [test "x$have_bison" = "xyes"])
217
218 # check for flex
219 AC_PROG_LEX
220 AX_PROG_FLEX_VERSION([2.5.35], [have_flex=yes])
221
222 AS_IF([test "x$have_flex" != "xyes"], [
223 AS_IF([test "x$in_git_repo" = "xyes"], [
224 AC_MSG_FAILURE([dnl
225 Flex >= 2.5.35 is required when building from the Git repository. You can
226 set the LEX variable to override automatic detection.
227 ])
228 ], [
229 AC_MSG_WARN([dnl
230 Missing Flex >= 2.5.35. Note that the lexer files are already built in
231 this distribution tarball, so Flex is only needed if you intend to
232 modify their sources. You can set the LEX variable to override automatic
233 detection.
234 ])
235 ])
236 ])
237 AM_CONDITIONAL([HAVE_FLEX], [test "x$have_flex" = "xyes"])
238
239
240 ## ##
241 ## Library checks ##
242 ## ##
243
244 # Check what libraries are required on this platform to link sockets programs.
245 AX_LIB_SOCKET_NSL
246
247 # Check for glib >= 2.22 with gmodule support
248 AM_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 )
252
253 # Checks for library functions.
254 AC_FUNC_ALLOCA
255 AC_FUNC_FORK
256 AC_FUNC_MKTIME
257 AC_FUNC_MMAP
258 AC_FUNC_STRERROR_R
259 AC_FUNC_STRNLEN
260 AC_CHECK_FUNCS([ \
261 atexit \
262 dup2 \
263 ftruncate \
264 gethostbyname \
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 \
281 strstr \
282 strtoul \
283 strtoull \
284 tzset \
285 ])
286
287 # AC_FUNC_MALLOC causes problems when cross-compiling.
288 #AC_FUNC_MALLOC
289 #AC_FUNC_REALLOC
290
291 # First, check for uuid in system libs
292 AH_TEMPLATE([BABELTRACE_HAVE_LIBUUID], [Define if you have libuuid support])
293 AC_CHECK_FUNCS([uuid_generate],
294 [
295 AC_DEFINE([BABELTRACE_HAVE_LIBUUID], [1])
296 UUID_LIBS=""
297 ],
298 [
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],
302 [
303 AC_DEFINE([BABELTRACE_HAVE_LIBUUID], [1])
304 dnl PKG_CHECK_MODULES defines UUID_LIBS
305 ],
306 [
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.
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 )
326 ]
327 )
328 ]
329 )
330 ]
331 )
332 ]
333 )
334 AC_SUBST(UUID_LIBS)
335
336 # Check for fmemopen
337 AC_CHECK_LIB([c], [fmemopen],
338 [AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_FMEMOPEN], 1, [Has fmemopen support.])]
339 )
340
341 # Check for open_memstream
342 AC_CHECK_LIB([c], [open_memstream],
343 [AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_OPEN_MEMSTREAM], 1, [Has open_memstream support.])]
344 )
345
346 # Check for posix_fallocate
347 AC_CHECK_LIB([c], [posix_fallocate],
348 [AC_DEFINE_UNQUOTED([BABELTRACE_HAVE_POSIX_FALLOCATE], 1, [Has posix_fallocate support.])]
349 )
350
351 # Check libpopt
352 PKG_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 ]
367 )
368 AC_SUBST(POPT_LIBS)
369
370
371 ## ##
372 ## User variables ##
373 ## ##
374
375 AC_ARG_VAR([PYTHON_INCLUDE], [Include flags for Python, bypassing python-config])
376 AC_ARG_VAR([PYTHON_LIBS], [Library flags for Python, bypassing python-config])
377 AC_ARG_VAR([PYTHON_CONFIG], [Path to python-config])
378
379 # PLUGINSDIR: Plugins directory
380 AC_ARG_VAR([PLUGINSDIR], [built-in plugins install directory [LIBDIR/babeltrace/plugins]])
381 AS_IF([test "x$PLUGINSDIR" = x], [PLUGINSDIR='$(libdir)/babeltrace/plugins'])
382
383 # BABELTRACE_MINIMAL_LOG_LEVEL:
384 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)])
385 AS_IF([test "x$BABELTRACE_MINIMAL_LOG_LEVEL" = x], [BABELTRACE_MINIMAL_LOG_LEVEL="VERBOSE"])
386 AS_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 )
395 AC_DEFINE_UNQUOTED([BT_LOG_LEVEL], [BT_LOG_$BABELTRACE_MINIMAL_LOG_LEVEL], [Minimal log level])
396
397
398 ## ##
399 ## Optionnal features selection ##
400 ## ##
401
402 # Python bindings
403 # Disabled by default
404 AC_ARG_ENABLE([python-bindings],
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
412 AC_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
418 # Python bindings tests
419 # Disabled by default
420 AC_ARG_ENABLE([python-bindings-tests],
421 [AC_HELP_STRING([--enable-python-bindings-tests], [run the Python bindings tests])],
422 [], dnl AC_ARG_ENABLE will fill enable_python_bindings_tests with the user choice
423 [enable_python_bindings_tests=no]
424 )
425
426 # Python plugins
427 # Disabled by default
428 AC_ARG_ENABLE([python-plugins],
429 [AC_HELP_STRING([--enable-python-plugins], [enable the Python plugins support for the library and converter])],
430 [], dnl AC_ARG_ENABLE will fill enable_python_plugins with the user choice
431 [enable_python_plugins=no]
432 )
433
434 # Debug info
435 # Enabled by default, except on some platforms
436 AC_ARG_ENABLE([debug-info],
437 [AC_HELP_STRING([--disable-debug-info], [disable the debug info support (default on macOS, Solaris and Windows)])],
438 [], dnl AC_ARG_ENABLE will fill enable_debug_info with the user choice
439 [enable_debug_info="$DEFAULT_ENABLE_DEBUG_INFO"]
440 )
441
442 # API documentation
443 # Disabled by default
444 AC_ARG_ENABLE([api-doc],
445 [AC_HELP_STRING([--enable-api-doc], [build the HTML API documentation])],
446 [enable_api_doc=$enableval],
447 [enable_api_doc=no]
448 )
449
450 # Built-in plugins
451 # Disabled by default
452 AC_ARG_ENABLE([built-in-plugins],
453 [AC_HELP_STRING([--enable-built-in-plugins], [Statically-link in-tree plug-ins into the babeltrace binary])],
454 [], dnl AC_ARG_ENABLE will fill enable_built_in_plugins with the user choice
455 [enable_built_in_plugins=no]
456 )
457
458 # Built-in python plugin support
459 # Disabled by default
460 AC_ARG_ENABLE([built-in-python-plugin-support],
461 [AC_HELP_STRING([--enable-built-in-python-plugin-support], [Statically-link Python plugin support into the babeltrace library])],
462 [], dnl AC_ARG_ENABLE will fill enable_built_in_python_plugin_support with the user choice
463 [enable_built_in_python_plugin_support=no]
464 )
465
466
467 # Set automake variables for optionnal feature conditionnals in Makefile.am
468 AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS], [test "x$enable_python_bindings" = xyes])
469 AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS_DOC], [test "x$enable_python_bindings_doc" = xyes])
470 AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS_TESTS], [test "x$enable_python_bindings_tests" = xyes])
471 AM_CONDITIONAL([ENABLE_PYTHON_PLUGINS], [test "x$enable_python_plugins" = xyes])
472 AM_CONDITIONAL([ENABLE_DEBUG_INFO], [test "x$enable_debug_info" = xyes])
473 AM_CONDITIONAL([ENABLE_API_DOC], [test "x$enable_api_doc" = xyes])
474 AM_CONDITIONAL([ENABLE_BUILT_IN_PLUGINS], [test "x$enable_built_in_plugins" = xyes])
475 AM_CONDITIONAL([ENABLE_BUILT_IN_PYTHON_PLUGIN_SUPPORT], [test "x$enable_built_in_python_plugin_support" = xyes])
476
477
478 # Set defines for optionnal features conditionnals in the source code
479
480 ## jgalar: still used?
481 AS_IF([test "x$enable_python_plugins" = xyes],
482 [AC_DEFINE([PYTHON_PLUGINS], [1], [Python plugin support.])]
483 )
484
485 AS_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
489 AS_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
493 AS_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
497
498 # Check for conflicting optional features user choices
499
500 AS_IF([test "x$enable_python_bindings" = xno],
501 [
502 AS_IF([test "x$enable_python_bindings_doc" = xyes], [AC_MSG_ERROR([--enable-python-bindings-doc was specified without --enable-python-bindings])])
503 AS_IF([test "x$enable_python_bindings_tests" = xyes], AC_MSG_ERROR([--enable-python-bindings-tests was specified without --enable-python-bindings]))
504 ]
505 )
506
507 AS_IF([test "x$enable_built_in_plugins" = xyes],
508 [
509 # Built-in plug-ins are only available when the --disable-shared --enable-static options are used.
510 AS_IF([test "x$enable_static" != xyes], [AC_MSG_ERROR(--enable-static must be used to bundle plug-ins in the babeltrace executable)])
511 AS_IF([test "x$enable_shared" = xyes], [AC_MSG_ERROR(--disable-shared must be used to bundle plug-ins in the babeltrace executable)])
512 ]
513 )
514
515 AS_IF([test "x$enable_built_in_python_plugin_support" = xyes],
516 [
517 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])])
518 # Built-in plug-ins are only available when the --disable-shared --enable-static options are used.
519 AS_IF([test "x$enable_static" != xyes], [AC_MSG_ERROR(--enable-static must be used to bundle Python plugin support in the babeltrace executable)])
520 AS_IF([test "x$enable_shared" = xyes], [AC_MSG_ERROR(--disable-shared must be used to bundle Python plugin support in the babeltrace executable)])
521 ]
522 )
523
524
525 # Check for optionnal features dependencies
526
527 AS_IF([test "x$enable_python_bindings" = xyes],
528 [AX_PKG_SWIG(2.0.0, [], [AC_MSG_ERROR([SWIG 2.0.0 or newer is required to build the python bindings])])]
529 )
530
531 AS_IF([test "x$enable_python_bindings" = xyes || test "x$enable_python_plugins" = xyes],
532 [
533 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.)])
534
535 AM_PATH_PYTHON_MODULES([PYTHON])
536 # pythondir is the path where extra modules are to be installed
537 pythondir=$PYTHON_PREFIX/$PYTHON_MODULES_PATH
538 # pyexecdir is the path that contains shared objects used by the extra modules
539 pyexecdir=$PYTHON_EXEC_PREFIX/$PYTHON_MODULES_PATH
540 AS_IF([test -z "$PYTHON_INCLUDE"], [
541 AS_IF([test -z "$PYTHON_CONFIG"], [
542 AC_PATH_PROGS([PYTHON_CONFIG],
543 [python$PYTHON_VERSION-config python-config],
544 [no],
545 [`dirname $PYTHON`])
546 AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Is python-dev installed?])])
547 ])
548 AC_MSG_CHECKING([Python include flags])
549 PYTHON_INCLUDE=`$PYTHON_CONFIG --includes`
550 AC_MSG_RESULT([$PYTHON_INCLUDE])
551 ])
552 AS_IF([test -z "$PYTHON_LIBS"], [
553 AS_IF([test -z "$PYTHON_CONFIG"], [
554 AC_PATH_PROGS([PYTHON_CONFIG],
555 [python$PYTHON_VERSION-config python-config],
556 [no],
557 [`dirname $PYTHON`])
558 AS_IF([test "$PYTHON_CONFIG" = no], [AC_MSG_ERROR([cannot find python-config for $PYTHON. Is python-dev installed?])])
559 ])
560 AC_MSG_CHECKING([Python library flags])
561 PYTHON_LIBS=`$PYTHON_CONFIG --libs`
562 AC_MSG_RESULT([$PYTHON_LIBS])
563 ])
564 ]
565 )
566
567 AS_IF([test "x$enable_python_bindings_doc" = xyes],
568 [
569 AM_CHECK_PYTHON_SPHINX([PYTHON])
570 AS_IF([test "x$PYTHON_SPHINX_EXISTS" = xno],
571 [AC_MSG_ERROR([The Sphinx package for Python 3 is required to build the Python bindings documentation])]
572 )
573 ]
574 )
575
576 AS_IF([test "x$enable_python_bindings_tests" = xyes],
577 [
578 AM_CHECK_PYTHON_TAPPY([PYTHON])
579 AS_IF([test "x$PYTHON_TAPPY_EXISTS" = xno],
580 [AC_MSG_ERROR([You need the tappy Python project to test the Python bindings (see <https://github.com/python-tap/tappy>)])]
581 )
582 ]
583 )
584
585 AS_IF([test "x$enable_debug_info" = xyes],
586 [
587 # Check if libelf and libdw are present
588 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.)])
589 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.)])
590 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.)])
591 ELFUTILS_LIBS="-lelf -ldw"
592 ]
593 )
594 AC_SUBST([ELFUTILS_LIBS])
595
596 AS_IF([test "x$enable_api_doc" = "xyes"],
597 [
598 DX_DOXYGEN_FEATURE(ON)
599 DX_DOT_FEATURE(OFF)
600 DX_HTML_FEATURE(ON)
601 DX_CHM_FEATURE(OFF)
602 DX_CHI_FEATURE(OFF)
603 DX_MAN_FEATURE(OFF)
604 DX_RTF_FEATURE(OFF)
605 DX_XML_FEATURE(OFF)
606 DX_PDF_FEATURE(OFF)
607 DX_PS_FEATURE(OFF)
608 DX_INIT_DOXYGEN([Babeltrace], [$(srcdir)/Doxyfile], [output])
609 AS_IF([test -z "$DX_DOXYGEN"],
610 [AC_MSG_ERROR([You need doxygen to enable the API documentation])]
611 )
612 ]
613 )
614
615
616 # Set global CFLAGS in AM_CFLAGS
617 AM_CFLAGS="-Wall -Wformat $PTHREAD_CFLAGS $GLIB_CFLAGS"
618 AC_SUBST(AM_CFLAGS)
619
620 # Set global CPPFLAGS in AM_CPPFLAGS
621 AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h"
622 AC_SUBST(AM_CPPFLAGS)
623
624 # Add glib to global link libs
625 LIBS="$LIBS $GLIB_LIBS"
626
627 # Check that the current size_t matches the size that glib thinks it should
628 # be. This catches problems on multi-arch where people try to do a 32-bit
629 # build while pointing at 64-bit glib headers. This is a common error because
630 # glib.h is not platform specific but it includes glibconfig.h which is and
631 # is usually installed in a non-standard path.
632
633 # Older versions of the pkg-config macros disallows PKG_* in the autoconf
634 # output. Specifically allow pkg_config_libdir to be able to print the
635 # error message.
636 m4_pattern_allow([PKG_CONFIG_LIBDIR])
637
638 save_CFLAGS=${CFLAGS}
639 CFLAGS="${CFLAGS} ${AM_CFLAGS}"
640 AC_COMPILE_IFELSE([
641 AC_LANG_PROGRAM([dnl
642 #include <glib.h>
643 #include <unistd.h>
644 ], [dnl
645 G_STATIC_ASSERT(sizeof(size_t) == GLIB_SIZEOF_SIZE_T);
646 ])
647 ],[:],[
648 AC_MSG_ERROR([dnl
649 sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T. You probably need to set
650 PKG_CONFIG_LIBDIR to point to the right pkg-config files for your build
651 target.
652 ])
653 ])
654 CFLAGS=${save_CFLAGS}
655
656 # Abuse autoconf's AC_ARG_PROGRAM output variable 'program_transform_name'
657 # to rename babeltrace.bin to babeltrace at install time.
658 program_transform_name="s&babeltrace\.bin&babeltrace&;s&babeltrace-log\.bin&babeltrace-log&;$program_transform_name"
659 AC_SUBST(program_transform_name)
660
661 AC_CONFIG_FILES([
662 Makefile
663 bindings/python/Makefile
664 bindings/python/bt2/Makefile
665 bindings/python/bt2/setup.py
666 bindings/python/bt2/bt2/__init__.py
667 common/Makefile
668 compat/Makefile
669 cli/Makefile
670 doc/Makefile
671 doc/api/Makefile
672 doc/api/Doxyfile
673 doc/bindings/Makefile
674 doc/bindings/python/Makefile
675 doc/images/Makefile
676 lib/Makefile
677 lib/prio_heap/Makefile
678 lib/plugin/Makefile
679 lib/graph/Makefile
680 lib/graph/notification/Makefile
681 lib/ctf-ir/Makefile
682 lib/ctf-writer/Makefile
683 include/Makefile
684 logging/Makefile
685 bindings/Makefile
686 tests/Makefile
687 tests/cli/Makefile
688 tests/cli/intersection/Makefile
689 tests/lib/Makefile
690 tests/lib/writer/Makefile
691 tests/lib/test-plugin-plugins/Makefile
692 tests/utils/common.sh
693 tests/utils/Makefile
694 tests/utils/tap/Makefile
695 tests/bindings/Makefile
696 tests/bindings/python/Makefile
697 tests/bindings/python/bt2/Makefile
698 tests/plugins/Makefile
699 tests/python-plugin-provider/Makefile
700 extras/Makefile
701 extras/valgrind/Makefile
702 plugins/Makefile
703 plugins/ctf/Makefile
704 plugins/ctf/common/Makefile
705 plugins/ctf/common/btr/Makefile
706 plugins/ctf/common/metadata/Makefile
707 plugins/ctf/common/notif-iter/Makefile
708 plugins/ctf/common/utils/Makefile
709 plugins/ctf/fs-src/Makefile
710 plugins/ctf/fs-sink/Makefile
711 plugins/ctf/lttng-live/Makefile
712 plugins/text/Makefile
713 plugins/text/dmesg/Makefile
714 plugins/text/pretty/Makefile
715 plugins/utils/Makefile
716 plugins/utils/dummy/Makefile
717 plugins/utils/counter/Makefile
718 plugins/utils/trimmer/Makefile
719 plugins/utils/muxer/Makefile
720 python-plugin-provider/Makefile
721 plugins/libctfcopytrace/Makefile
722 plugins/lttng-utils/Makefile
723 babeltrace.pc
724 babeltrace-ctf.pc
725 ])
726
727 AC_CONFIG_FILES([tests/cli/intersection/bt_python_helper.py])
728 AC_CONFIG_FILES([tests/cli/intersection/test_intersection], [chmod +x tests/cli/intersection/test_intersection])
729 AC_CONFIG_FILES([tests/cli/test_convert_args], [chmod +x tests/cli/test_convert_args])
730 AC_CONFIG_FILES([tests/cli/test_debug_info], [chmod +x tests/cli/test_debug_info])
731 AC_CONFIG_FILES([tests/cli/test_packet_seq_num], [chmod +x tests/cli/test_packet_seq_num])
732 AC_CONFIG_FILES([tests/cli/test_trace_copy], [chmod +x tests/cli/test_trace_copy])
733 AC_CONFIG_FILES([tests/cli/test_trace_read], [chmod +x tests/cli/test_trace_read])
734 AC_CONFIG_FILES([tests/cli/test_trimmer], [chmod +x tests/cli/test_trimmer])
735 AC_CONFIG_FILES([tests/lib/test_ctf_writer_complete], [chmod +x tests/lib/test_ctf_writer_complete])
736 AC_CONFIG_FILES([tests/lib/test_plugin_complete], [chmod +x tests/lib/test_plugin_complete])
737 AC_CONFIG_FILES([tests/lib/writer/bt_python_helper.py])
738 AC_CONFIG_FILES([tests/lib/writer/test_ctf_writer_empty_packet.py])
739 AC_CONFIG_FILES([tests/lib/writer/test_ctf_writer_no_packet_context.py])
740 AC_CONFIG_FILES([tests/plugins/test-utils-muxer-complete], [chmod +x tests/plugins/test-utils-muxer-complete])
741 AC_CONFIG_FILES([tests/plugins/test_dwarf_complete], [chmod +x tests/plugins/test_dwarf_complete])
742 AC_CONFIG_FILES([tests/plugins/test_bin_info_complete], [chmod +x tests/plugins/test_bin_info_complete])
743
744 AS_IF([test "x$enable_python_bindings_tests" = xyes],
745 [AC_CONFIG_FILES([tests/bindings/python/bt2/test_python_bt2], [chmod +x tests/bindings/python/bt2/test_python_bt2])]
746 )
747
748 AS_IF([test "x$enable_python_plugins" = "xyes"],
749 [AC_CONFIG_FILES([tests/python-plugin-provider/test.sh], [chmod +x tests/python-plugin-provider/test.sh])]
750 )
751
752 AC_OUTPUT
753
754 #
755 # Mini-report on what will be built.
756 #
757
758 PPRINT_INIT
759 PPRINT_SET_INDENT(1)
760 PPRINT_SET_TS(38)
761
762 AS_ECHO
763 AS_ECHO("${PPRINT_COLOR_BLDBLU}Babeltrace $PACKAGE_VERSION$PPRINT_COLOR_RST")
764 AS_ECHO
765
766 PPRINT_SUBTITLE([System])
767
768 # Target architecture we're building for.
769 target_arch=$host_cpu
770 [
771 for f in $CFLAGS; do
772 if test $f = "-m32"; then
773 target_arch="32-bit"
774 elif test $f = "-m64"; then
775 target_arch="64-bit"
776 fi
777 done
778 ]
779
780 PPRINT_PROP_STRING([Target architecture], $target_arch)
781
782 AS_ECHO
783 PPRINT_SUBTITLE([Python 3 language support])
784 test "x$enable_python_bindings" = "xyes" && value=1 || value=0
785 PPRINT_PROP_BOOL([Python bindings], $value)
786 test "x$enable_python_plugins" = "xyes" && value=1 || value=0
787 PPRINT_PROP_BOOL([Python plugin support], $value)
788 AS_IF([test "x$enable_python_bindings" = "xyes" || test "x$enable_python_plugins" = "xyes"], [
789 PPRINT_PROP_STRING([Python include paths], [$PYTHON_INCLUDE])
790 PPRINT_PROP_STRING([Python libraries], [$PYTHON_LIBS])
791 ])
792
793 AS_ECHO
794 PPRINT_SUBTITLE([Plugins])
795 PPRINT_PROP_BOOL(['ctf' plugin], 1)
796 test "x$enable_debug_info" = "xyes" && value=1 || value=0
797 PPRINT_PROP_BOOL(['lttng-utils' plugin], $value)
798 PPRINT_PROP_BOOL(['text' plugin], 1)
799 PPRINT_PROP_BOOL(['utils' plugin], 1)
800
801 AS_ECHO
802 PPRINT_SUBTITLE([Built-in features])
803 test "x$enable_built_in_plugins" = "xyes" && value=1 || value=0
804 PPRINT_PROP_BOOL([Built-in plugins], $value)
805 test "x$enable_built_in_python_plugin_support" = "xyes" && value=1 || value=0
806 PPRINT_PROP_BOOL([Built-in Python plugin support], $value)
807
808 AS_ECHO
809 PPRINT_SUBTITLE([Documentation])
810 test "x$enable_api_doc" = "xyes" && value=1 || value=0
811 PPRINT_PROP_BOOL([HTML API documentation], $value)
812 test "x$enable_python_bindings_doc" = "xyes" && value=1 || value=0
813 PPRINT_PROP_BOOL([Python bindings documentation], $value)
814
815 AS_ECHO
816 PPRINT_SUBTITLE([Logging])
817 PPRINT_PROP_STRING([Minimal log level], $BABELTRACE_MINIMAL_LOG_LEVEL)
818
819 AS_ECHO
820 PPRINT_SUBTITLE([Testing])
821 test "x$enable_python_bindings_tests" = "xyes" && value=1 || value=0
822 PPRINT_PROP_BOOL([Python bindings tests], $value)
823
824 report_bindir="`eval eval echo $bindir`"
825 report_libdir="`eval eval echo $libdir`"
826 report_sysconfdif="`eval eval echo $sysconfdir`"
827
828 # Print the bindir and libdir this `make install' will install into.
829 AS_ECHO
830 PPRINT_SUBTITLE([Install directories])
831 PPRINT_PROP_STRING([Binaries], [$report_bindir])
832 PPRINT_PROP_STRING([Libraries], [$report_libdir])
833 PPRINT_PROP_STRING([Plugins], [$report_libdir/babeltrace/plugins])
834 PPRINT_PROP_STRING([Configuration], [$report_sysconfdif])
This page took 0.045269 seconds and 4 git commands to generate.