1 dnl SPDX-License-Identifier: LGPL-2.1-only
3 dnl Copyright (C) 2021 EfficiOS, Inc.
5 dnl Process this file with autoconf to produce a configure script.
8 # Project version information
9 m4_define([ust_version_major], [2])
10 m4_define([ust_version_minor], [13])
11 m4_define([ust_version_patch], [0])
12 m4_define([ust_version_dev_stage], [-pre])
13 m4_define([ust_version], ust_version_major[.]ust_version_minor[.]ust_version_patch[]ust_version_dev_stage)
14 m4_define([ust_version_name], [[Codename TBD]])
15 m4_define([ust_version_description], [[Description TBD]])
17 # Library version information of "liblttng-ust"
18 # Following the numbering scheme proposed by libtool for the library version
19 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
20 m4_define([ust_lib_version_current], [1])
21 m4_define([ust_lib_version_revision], [0])
22 m4_define([ust_lib_version_age], [0])
23 m4_define([ust_lib_version], ust_lib_version_current[:]ust_lib_version_revision[:]ust_lib_version_age)
25 # Library version information of "liblttng-ust-ctl"
26 # Following the numbering scheme proposed by libtool for the library version
27 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
28 m4_define([ust_ctl_lib_version_current], [5])
29 m4_define([ust_ctl_lib_version_revision], [0])
30 m4_define([ust_ctl_lib_version_age], [0])
31 m4_define([ust_ctl_lib_version], ust_ctl_lib_version_current[:]ust_ctl_lib_version_revision[:]ust_ctl_lib_version_age)
35 ## Autoconf base setup ##
39 AC_INIT([lttng-ust],[ust_version],[mathieu dot desnoyers at efficios dot com],[],[https://lttng.org])
41 AC_CONFIG_HEADERS([include/config.h include/lttng/ust-config.h include/lttng/ust-version.h])
42 AC_CONFIG_AUX_DIR([config])
43 AC_CONFIG_MACRO_DIR([m4])
50 ## Automake base setup ##
53 AM_INIT_AUTOMAKE([1.12 foreign dist-bzip2 no-dist-gzip tar-ustar nostdinc -Wall -Wno-portability -Werror])
54 AM_MAINTAINER_MODE([enable])
56 # Enable silent rules by default
57 AM_SILENT_RULES([yes])
61 ## OS and Arch specific defaults ##
64 # Set os specific options
66 [freebsd*], [AE_FEATURE_DISABLE([numa])]
69 # Set architecture specific options
81 [arm*], [AE_FEATURE_DISABLE([numa])],
86 unsupported_arch="yes"
91 ## C compiler checks ##
94 # Choose the C compiler
96 # AC_PROG_CC_STDC was merged in AC_PROG_CC in autoconf 2.70
97 m4_version_prereq([2.70], [], [AC_PROG_CC_STDC])
99 # Make sure the C compiler supports C99
100 AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not support C99])])
102 # Enable available system extensions and LFS support
103 AC_USE_SYSTEM_EXTENSIONS
106 # Make sure the C compiler supports __attribute__
108 AS_IF([test "x$ax_cv___attribute__" != "xyes"],
109 [AC_MSG_ERROR([The compiler does not support __attribute__ extensions])])
111 # Make sure we have pthread support
112 AX_PTHREAD([], [AC_MSG_ERROR([Could not configure pthread support])])
114 # Make sure the C compiler supports weak symbols
116 AS_IF([test "x$ax_cv_sys_weak_alias" = "xno"],
117 [AC_MSG_ERROR([Your platform doesn't support weak symbols.])])
119 # Checks for typedefs, structures, and compiler characteristics.
136 AC_CHECK_TYPES([ptrdiff_t])
140 ## C++ compiler checks ##
143 # Find an optional C++11 compiler without GNU extensions (-std=c++11)
144 AX_CXX_COMPILE_STDCXX([11], [noext], [optional])
166 # Check for dlinfo() by testing for RTLD_DI_LINKMAP in dlfcn.h
167 AS_IF([test "x$ac_cv_header_dlfcn_h" = "xyes"], [
168 AC_CHECK_DECL([RTLD_DI_LINKMAP], [], [], [[#include <dlfcn.h>]])
173 ## Programs checks ##
182 AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
183 AC_CHECK_PROGS([CMAKE], [cmake])
184 AC_CHECK_PROGS([FOLD], [fold])
185 AC_CHECK_PROGS([XMLTO], [xmlto])
187 AM_PATH_PYTHON([2.7], [], [PYTHON=""])
193 # Initialize and configure libtool
194 LT_INIT([disable-static])
229 # AC_FUNC_MALLOC causes problems when cross-compiling.
233 # Check for pthread_setname_np and its signature
234 LTTNG_PTHREAD_SETNAME_NP
235 LTTNG_PTHREAD_GETNAME_NP
237 # Check dor dlopen() in -ldl or -lc
238 AC_CHECK_LIB([dl], [dlopen], [
242 # dlopen not found in libdl, check in libc
243 AC_CHECK_LIB([c], [dlopen], [
247 AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
252 # Check if libdl has dlmopen()
253 AC_CHECK_LIB([$libdl_name], [dlmopen], [
254 AC_DEFINE([HAVE_DLMOPEN], [1], [Define to 1 if dlmopen is available.])
257 # Require URCU >= 0.12 for DEFINE_URCU_TLS_INIT
258 PKG_CHECK_MODULES([URCU], [liburcu >= 0.12])
265 # Additional variables captured during ./configure
267 AC_ARG_VAR([CLASSPATH], [Java class path])
271 ## Optionnal features selection ##
275 # Enabled by default, except on some platforms
276 AE_FEATURE_DEFAULT_ENABLE
277 AE_FEATURE([numa],[disable NUMA support])
279 # Java JNI interface library
280 # Disabled by default
281 AE_FEATURE_DEFAULT_DISABLE
282 AE_FEATURE([jni-interface], [build JNI interface between C and Java])
284 # Build the Java Logging API agent
285 # Disabled by default
286 AE_FEATURE_DEFAULT_DISABLE
287 AE_FEATURE([java-agent-jul],[build the LTTng UST Java agent with JUL support])
289 # Build the Java Log4j agent
290 # Disabled by default
291 AE_FEATURE_DEFAULT_DISABLE
292 AE_FEATURE([java-agent-log4j],[build the LTTng UST Java agent with Log4j support])
294 # Build both Java agents
295 # Disabled by default
296 AE_FEATURE_DEFAULT_DISABLE
297 AE_FEATURE([java-agent-all],[build the LTTng UST Java agent with all supported backends])
299 # Build the Python agent
300 # Disabled by default
301 AE_FEATURE_DEFAULT_DISABLE
302 AE_FEATURE([python-agent],[build the LTTng UST Python agent])
305 # Disabled by default
306 AE_FEATURE_DEFAULT_ENABLE
307 AE_FEATURE([examples],[Do not build and install examples])
311 AE_FEATURE_DEFAULT_ENABLE
312 AE_FEATURE([man-pages],[Do not build and install man pages (already built in a distributed tarball)])
314 # Systemtap sdt.h integration
315 # Disabled by default
317 [AS_HELP_STRING([--with-sdt], [provide SystemTap integration via sdt.h [default=no]])]
320 # Override the default runtime directory
321 AC_ARG_WITH([lttng-system-rundir], [
322 AS_HELP_STRING([--with-lttng-system-rundir], [Location of the system directory where LTTng-UST expects the system-wide lttng-sessiond runtime files. The default is "/var/run/lttng".]),
324 lttng_system_rundir="$withval"
326 lttng_system_rundir="/var/run/lttng"
329 # Add the java command line arguments like '--wit-java-prefix'
334 ## Check for conflicting features selection ##
337 AE_IF_FEATURE_DISABLED([shared], [
338 AC_MSG_ERROR(LTTng-UST requires shared libraries to be enabled)
341 AE_IF_FEATURE_ENABLED([java-agent-all], [
342 AE_FEATURE_ENABLE([java-agent-jul])
343 AE_FEATURE_ENABLE([java-agent-log4j])
348 ## Check for optional features dependencies ##
351 # The numa integration requires libnuma
352 AE_IF_FEATURE_ENABLED([numa], [
353 AC_CHECK_LIB([numa], [numa_available], [], [
355 libnuma is not available. Please either install it (e.g. libnuma-dev) or use
356 [LDFLAGS]=-Ldir to specify the right location, or use --disable-numa configure
357 argument to disable NUMA support.
362 # The JNI interface and Java Agents require a working Java JDK
363 AS_IF([AE_IS_FEATURE_ENABLED([jni-interface]) || AE_IS_FEATURE_ENABLED([java-agent-jul]) || AE_IS_FEATURE_ENABLED([java-agent-log4j])], [
364 # We detected a java compiler earlier, make sure it works
367 # Get the CPPFLAGS required to build jni libaries
369 for jni_include_dir in $JNI_INCLUDE_DIRS; do
370 JNI_CPPFLAGS="$JNI_CPPFLAGS -I$jni_include_dir"
373 # Check for javah and jni.h
374 saved_CPPFLAGS="$CPPFLAGS"
375 CPPFLAGS="$CPPFLAGS $JNI_CPPFLAGS"
377 CPPFLAGS="$saved_CPPFLAGS"
380 # The log4j agent requires the log4j jar in the classpath
381 AE_IF_FEATURE_ENABLED([java-agent-log4j], [
382 AX_CHECK_CLASS([org.apache.log4j.Logger])
383 AS_IF([test "x$ac_cv_class_org_apache_log4j_Logger" = "xno"], [
385 The UST Java agent support for log4j was requested but the Log4j classes were
386 not found. Please specify the location of the Log4j jar via the Java CLASSPATH
387 environment variable, e.g. ./configure CLASSPATH="/path/to/log4j.jar"
389 Current CLASSPATH: "$CLASSPATH"
394 # The python agent requires a python interpreter
395 AE_IF_FEATURE_ENABLED([python-agent], [
396 AS_IF([test "x$PYTHON" = "x"], [
398 Cannot find a suitable python interpreter. You can override it with the PYTHON
399 environment variable.
404 # Check for asciidoc and xmlto if we enabled building the man pages.
405 AE_IF_FEATURE_ENABLED([man-pages], [
406 AS_IF([test "x$ASCIIDOC" = "x" || test "x$XMLTO" = "x"], [
408 # This is an error because we're in the Git repo, which
409 # means the man pages are not already generated for us,
410 # thus asciidoc/xmlto are required because we were asked
411 # to build the man pages.
413 Both asciidoc and xmlto are needed to build the LTTng-UST man pages. Use
414 --disable-man-pages to disable building the man pages, in which case
415 they will not be installed.
418 # Only warn here: since we're in the tarball, the man
419 # pages should already be generated at this point, thus
420 # asciidoc/xmlto are not strictly required.
421 warn_prebuilt_man_pages=yes
424 have_asciidoc_xmlto=yes
428 AS_IF([test "x$with_sdt" = "xyes"], [
429 AC_MSG_CHECKING([STAP_PROBEV()])
430 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
431 #define SDT_USE_VARIADIC
435 STAP_PROBEV(provider,name,1,2,3,4,5,6,7,8,9,10);
439 AC_DEFINE([LTTNG_UST_HAVE_SDT_INTEGRATION], [1], [SystemTap integration via sdt.h])
443 The sdt.h integration was requested but the STAP_PROBEV define cannot be used.
444 Make sure it is installed, and up to date, or use CPPFLAGS=-I/path/ to specify
445 a non-standard path to sys/sdt.h
452 ## Set defines for optional features conditionnals in the source code ##
455 AC_DEFINE_UNQUOTED([LTTNG_SYSTEM_RUNDIR], ["$lttng_system_rundir"], [LTTng system runtime directory])
457 # Defined in include/lttng/ust-version.h
458 AC_DEFINE([LTTNG_UST_MAJOR_VERSION], ust_version_major, [LTTng UST major version])
459 AC_DEFINE([LTTNG_UST_MINOR_VERSION], ust_version_minor, [LTTng UST minor version])
460 AC_DEFINE([LTTNG_UST_PATCHLEVEL_VERSION], ust_version_patch, [LTTng UST patch version])
461 AC_DEFINE([LTTNG_UST_VERSION], ["]ust_version["], [LTTng UST version string])
462 AC_DEFINE([LTTNG_UST_LIB_SONAME_MAJOR], [ust_lib_version_current], [Major SONAME number of liblttng-ust])
463 AC_DEFINE([LTTNG_UST_CTL_LIB_SONAME_MAJOR], [ust_ctl_lib_version_current], [Major SONAME number of liblttng-ust-ctl])
467 ## Set automake variables for optional feature conditionnals in Makefile.am ##
470 AM_CONDITIONAL([ENABLE_EXAMPLES], AE_IS_FEATURE_ENABLED([examples]))
471 AM_CONDITIONAL([ENABLE_GEN_TP_EXAMPLES], [test "x$PYTHON" != "x"])
472 AM_CONDITIONAL([ENABLE_JAVA_AGENT], AE_IS_FEATURE_ENABLED([java-agent-jul]) || AE_IS_FEATURE_ENABLED([java-agent-log4j]))
473 AM_CONDITIONAL([ENABLE_JAVA_AGENT_WITH_JUL], AE_IS_FEATURE_ENABLED([java-agent-jul]))
474 AM_CONDITIONAL([ENABLE_JAVA_AGENT_WITH_LOG4J], AE_IS_FEATURE_ENABLED([java-agent-log4j]))
475 AM_CONDITIONAL([ENABLE_JNI_INTERFACE], AE_IS_FEATURE_ENABLED([jni-interface]))
476 AM_CONDITIONAL([ENABLE_MAN_PAGES], AE_IS_FEATURE_ENABLED([man-pages]))
477 AM_CONDITIONAL([ENABLE_NUMA], AE_IS_FEATURE_ENABLED([numa]))
478 AM_CONDITIONAL([ENABLE_PYTHON_AGENT], AE_IS_FEATURE_ENABLED([python-agent]))
479 AM_CONDITIONAL([ENABLE_UST_DL], [test "x$ac_cv_have_decl_RTLD_DI_LINKMAP" = "xyes"])
480 AM_CONDITIONAL([HAVE_ASCIIDOC_XMLTO], [test "x$have_asciidoc_xmlto" = "xyes"])
481 AM_CONDITIONAL([HAVE_CMAKE], [test "x$CMAKE" != "x"])
482 AM_CONDITIONAL([HAVE_CXX], [test "$HAVE_CXX11" = "1"])
483 AM_CONDITIONAL([HAVE_JAVAH], [test "x$JAVAH" != "x"])
484 AM_CONDITIONAL([HAVE_PERF_EVENT], [test "x$ac_cv_header_linux_perf_event_h" = "xyes"])
488 ## Substitute variables for use in Makefile.am ##
491 # Library versions for libtool
492 AC_SUBST([LTTNG_UST_LIBRARY_VERSION], ust_lib_version)
493 AC_SUBST([LTTNG_UST_CTL_LIBRARY_VERSION], ust_ctl_lib_version)
495 AM_CFLAGS="-Wall $URCU_CFLAGS $PTHREAD_CFLAGS"
498 AM_CXXFLAGS="$AM_CFLAGS"
499 AC_SUBST(AM_CXXFLAGS)
501 # The order in which the include folders are searched is important.
502 # The top_builddir should always be searched first in the event that a build
503 # time generated file is included.
504 AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h"
505 AC_SUBST(AM_CPPFLAGS)
507 AC_SUBST(JNI_CPPFLAGS)
511 ## Output files generated by configure ##
514 # List of files to be generated from '.in' templates by AC_OUTPUT
518 doc/examples/Makefile
524 libringbuffer/Makefile
525 liblttng-ust-comm/Makefile
526 liblttng-ust/Makefile
527 liblttng-ust-ctl/Makefile
528 liblttng-ust-fork/Makefile
529 liblttng-ust-dl/Makefile
530 liblttng-ust-fd/Makefile
531 liblttng-ust-java/Makefile
532 liblttng-ust-java-agent/Makefile
533 liblttng-ust-java-agent/java/Makefile
534 liblttng-ust-java-agent/java/lttng-ust-agent-all/Makefile
535 liblttng-ust-java-agent/java/lttng-ust-agent-common/Makefile
536 liblttng-ust-java-agent/java/lttng-ust-agent-jul/Makefile
537 liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Makefile
538 liblttng-ust-java-agent/jni/Makefile
539 liblttng-ust-java-agent/jni/common/Makefile
540 liblttng-ust-java-agent/jni/jul/Makefile
541 liblttng-ust-java-agent/jni/log4j/Makefile
542 liblttng-ust-libc-wrapper/Makefile
543 liblttng-ust-cyg-profile/Makefile
544 liblttng-ust-python-agent/Makefile
545 python-lttngust/Makefile
546 python-lttngust/setup.py
547 python-lttngust/lttngust/__init__.py
550 tests/compile/Makefile
551 tests/compile/ctf-types/Makefile
552 tests/compile/hello.cxx/Makefile
553 tests/compile/hello/Makefile
554 tests/compile/hello-many/Makefile
555 tests/compile/same_line_tracepoint/Makefile
556 tests/compile/test-app-ctx/Makefile
557 tests/benchmark/Makefile
558 tests/unit/gcc-weak-hidden/Makefile
559 tests/unit/libmsgpack/Makefile
561 tests/unit/libringbuffer/Makefile
562 tests/unit/pthread_name/Makefile
563 tests/unit/snprintf/Makefile
564 tests/unit/ust-elf/Makefile
574 ## Mini-report on what will be built. ##
582 AS_IF([test -n "ust_version_name"], [
583 AS_ECHO("${PPRINT_COLOR_BLDBLU}LTTng-ust $PACKAGE_VERSION \"ust_version_name\"$PPRINT_COLOR_RST")
585 AS_ECHO("${PPRINT_COLOR_BLDBLU}LTTng-ust $PACKAGE_VERSION")
590 AS_IF([test -n "ust_version_description"], [
591 AS_IF([test -n "$FOLD"], [
592 AS_ECHO("`AS_ECHO("ust_version_description") | $FOLD -s`")
594 AS_ECHO("ust_version_description")
599 PPRINT_SUBTITLE([System])
601 PPRINT_PROP_STRING([Target architecture], $host_cpu)
603 AS_IF([test "x$unsupported_arch" = "xyes"],[
604 PPRINT_WARN([Your architecture ($host_cpu) is unsupported, using safe default of no unaligned access.])
608 PPRINT_SUBTITLE([Features])
611 test "x$with_sdt" = "xyes" && value=1 || value=0
612 PPRINT_PROP_BOOL_CUSTOM([sdt.h integration], $value, [use --with-sdt])
614 AE_IS_FEATURE_ENABLED([java-agent-jul]) && value=1 || value=0
615 PPRINT_PROP_BOOL_CUSTOM([Java agent (JUL support)], $value, [use --enable-java-agent-jul])
617 AE_IS_FEATURE_ENABLED([java-agent-log4j]) && value=1 || value=0
618 PPRINT_PROP_BOOL_CUSTOM([Java agent (Log4j support)], $value, [use --enable-java-agent-log4j])
620 AE_IS_FEATURE_ENABLED([jni-interface]) && value=1 || value=0
621 PPRINT_PROP_BOOL_CUSTOM([JNI interface (JNI)], $value, [use --enable-jni-interface])
623 AE_IS_FEATURE_ENABLED([python-agent]) && value=1 || value=0
624 PPRINT_PROP_BOOL_CUSTOM([Python agent], $value, [use --enable-python-agent])
626 test "x$ac_cv_header_linux_perf_event_h" = "xyes" && value=1 || value=0
627 PPRINT_PROP_BOOL_CUSTOM([Perf event integration], $value)
629 AE_IS_FEATURE_ENABLED([numa]) && value=1 || value=0
630 PPRINT_PROP_BOOL([NUMA], $value)
635 AE_IS_FEATURE_ENABLED([examples]) && value=1 || value=0
636 PPRINT_PROP_BOOL([Build and install examples], $value, $PPRINT_COLOR_SUBTITLE)
638 # man pages build enabled/disabled
639 m4_pushdef([build_man_pages_msg], [Build and install man pages])
641 AE_IF_FEATURE_ENABLED([man-pages], [
643 PPRINT_PROP_BOOL([build_man_pages_msg], 1, $PPRINT_COLOR_SUBTITLE)
645 AS_IF([test "x$have_asciidoc_xmlto" = "xyes"], [
646 PPRINT_PROP_BOOL([build_man_pages_msg], 1, $PPRINT_COLOR_SUBTITLE)
648 PPRINT_PROP_STRING([build_man_pages_msg],
649 [${PPRINT_COLOR_BLDGRN}yes (already built)],
650 $PPRINT_COLOR_SUBTITLE)
654 PPRINT_PROP_BOOL([build_man_pages_msg], 0, $PPRINT_COLOR_SUBTITLE)
657 m4_popdef([build_man_pages_msg])
661 report_bindir="`eval eval echo $bindir`"
662 report_libdir="`eval eval echo $libdir`"
664 # Print the bindir and libdir this `make install' will install into.
666 PPRINT_SUBTITLE([Install directories])
667 PPRINT_PROP_STRING([Binaries], [$report_bindir])
668 PPRINT_PROP_STRING([Libraries], [$report_libdir])
671 PPRINT_SUBTITLE([System directories])
673 PPRINT_PROP_STRING([lttng-sessiond rundir], [$lttng_system_rundir])
677 AS_IF([test "x$warn_prebuilt_man_pages" = "xyes" ], [
680 Both asciidoc and xmlto are needed to build the LTTng-UST man pages.
682 Note that the man pages are already built in this distribution tarball,
683 therefore asciidoc and xmlto are only needed if you intend to modify
686 Use --disable-man-pages to completely disable building and installing
690 # vim: shiftwidth=2 softtabstop=2 expandtab