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])
44 AC_CONFIG_SRCDIR([include/lttng/tracepoint.h])
51 ## Automake base setup ##
54 AM_INIT_AUTOMAKE([1.12 foreign dist-bzip2 no-dist-gzip tar-ustar nostdinc -Wall -Wno-portability -Werror])
55 AM_MAINTAINER_MODE([enable])
57 # Enable silent rules by default
58 AM_SILENT_RULES([yes])
62 ## C compiler checks ##
65 # Choose the C compiler
67 # AC_PROG_CC_STDC was merged in AC_PROG_CC in autoconf 2.70
68 m4_version_prereq([2.70], [], [AC_PROG_CC_STDC])
70 # Make sure the C compiler supports C99
71 AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not support C99])])
73 # Enable available system extensions and LFS support
74 AC_USE_SYSTEM_EXTENSIONS
77 # Make sure the C compiler supports __attribute__
79 AS_IF([test "x$ax_cv___attribute__" != "xyes"],
80 [AC_MSG_ERROR([The compiler does not support __attribute__ extensions])])
82 # Make sure we have pthread support
83 AX_PTHREAD([], [AC_MSG_ERROR([Could not configure pthread support])])
85 # Make sure the C compiler supports weak symbols
87 AS_IF([test "x$ax_cv_sys_weak_alias" = "xno"],
88 [AC_MSG_ERROR([Your platform doesn't support weak symbols.])])
90 # Checks for typedefs, structures, and compiler characteristics.
107 AC_CHECK_TYPES([ptrdiff_t])
111 ## C++ compiler checks ##
114 # Find an optional C++11 compiler without GNU extensions (-std=c++11)
115 AX_CXX_COMPILE_STDCXX([11], [noext], [optional])
116 AM_CONDITIONAL([HAVE_CXX], [test "$HAVE_CXX11" = "1"])
119 # Checks for programs.
126 AC_CHECK_PROG([CMAKE], [cmake])
127 AM_CONDITIONAL([HAVE_CMAKE], [test "x$CMAKE" != "x"])
129 # libtool link_all_deplibs fixup. See http://bugs.lttng.org/issues/321.
130 AC_ARG_ENABLE([libtool-linkdep-fixup], [
131 AS_HELP_STRING([--disable-libtool-linkdep-fixup], [disable the libtool fixup for linking all dependent libraries (link_all_deplibs)])
133 libtool_fixup=$enableval
138 AS_IF([test "x$libtool_fixup" = "xyes"], [
139 libtool_m4="$srcdir/m4/libtool.m4"
140 libtool_flag_pattern=".*link_all_deplibs\s*,\s*\$1\s*)"
141 AC_MSG_CHECKING([for occurence(s) of link_all_deplibs = no in $libtool_m4])
142 libtool_flag_pattern_count=$(grep -c "$libtool_flag_pattern\s*=\s*no" $libtool_m4)
144 AS_IF([test $libtool_flag_pattern_count -ne 0], [
145 AC_MSG_RESULT([$libtool_flag_pattern_count])
146 AC_MSG_WARN([the detected libtool will not link all dependencies, forcing link_all_deplibs = unknown])
147 $SED -i "s/\($libtool_flag_pattern\)\s*=\s*no/\1=unknown/g" $libtool_m4
149 AC_MSG_RESULT([none])
152 LT_INIT([disable-static])
154 AC_MSG_CHECKING([whether shared libraries are enabled])
155 AS_IF([test "x$enable_shared" = "xyes"], [
159 AC_MSG_ERROR([LTTng-UST requires shared libraries to be enabled])
162 # Checks for library functions.
192 # Check for pthread_setname_np and its signature
193 LTTNG_PTHREAD_SETNAME_NP
194 LTTNG_PTHREAD_GETNAME_NP
196 # AC_FUNC_MALLOC causes problems when cross-compiling.
199 # Checks for header files.
213 # Set architecture specific options
235 # Set os specific options
237 [freebsd*], [NO_NUMA=1]
240 # Configuration options, which will be installed in the config.h
241 AH_TEMPLATE([LTTNG_UST_HAVE_SDT_INTEGRATION], [SystemTap integration via sdt.h])
243 # Checks for libraries.
244 AC_CHECK_LIB([dl], [dlopen], [
248 #libdl not found, check for dlopen in libc.
249 AC_CHECK_LIB([c], [dlopen], [
253 AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
258 # Check if libdl has dlmopen support.
259 AH_TEMPLATE([HAVE_DLMOPEN], ["Define to 1 if dlmopen is available."])
260 AC_CHECK_LIB([$libdl_name], [dlmopen],
261 [AC_DEFINE([HAVE_DLMOPEN], [1])]
265 AC_CHECK_HEADER([dlfcn.h])
266 AS_IF([test "x${ac_cv_header_dlfcn_h}" = "xyes"], [
267 AC_CHECK_DECLS([RTLD_DI_LINKMAP], [], [], [
271 ac_cv_have_decl_RTLD_DI_LINKMAP="no"
274 AM_CONDITIONAL([ENABLE_UST_DL], [test "x${ac_cv_have_decl_RTLD_DI_LINKMAP}" = "xyes"])
276 # Require URCU >= 0.12 for DEFINE_URCU_TLS_INIT
277 PKG_CHECK_MODULES([URCU], [liburcu >= 0.12])
280 AS_IF([test "x$NO_NUMA" = "x1"],[
281 AS_IF([test "x$enable_numa" = "x" ], [enable_numa=no])
284 AC_ARG_ENABLE([numa], [
285 AS_HELP_STRING([--disable-numa], [disable NUMA support])
287 enable_numa=$enableval
292 AS_IF([test "x$enable_numa" = "xyes"], [
293 # numa - check that numa lib is available
294 AC_CHECK_LIB([numa], [numa_available], [],
295 [AC_MSG_ERROR([libnuma is not available. Please either install it (e.g. libnuma-dev) or use [LDFLAGS]=-Ldir to specify the right location, or use --disable-numa configure argument to disable NUMA support.])])
298 AM_CONDITIONAL([ENABLE_NUMA], [test "x$have_libnuma" = "xyes"])
300 # optional linux/perf_event.h
301 AC_CHECK_HEADERS([linux/perf_event.h], [have_perf_event=yes], [])
303 # Perf event counters are supported on all architectures supported by
304 # perf, using the read system call as fallback.
305 AM_CONDITIONAL([HAVE_PERF_EVENT], [test "x$have_perf_event" = "xyes"])
307 AH_TEMPLATE([HAVE_PERF_EVENT], ["Perf event integration via perf_event.h"])
308 AS_IF([test "x$have_perf_event" = "xyes"], [
309 AC_DEFINE([HAVE_PERF_EVENT], [1])
312 # Check for JNI header files if requested
313 AC_ARG_ENABLE([jni-interface], [
314 AS_HELP_STRING([--enable-jni-interface], [build JNI interface between C and Java. Needs Java include files [default=no]])
316 jni_interface=$enableval
321 AM_CONDITIONAL([ENABLE_JNI_INTERFACE], [test "x$jni_interface" = "xyes"])
324 AC_ARG_ENABLE([java-agent-jul], [
325 AS_HELP_STRING([--enable-java-agent-jul], [build the LTTng UST Java agent with JUL support [default=no]])
327 java_agent_jul=$enableval
332 AC_ARG_ENABLE([java-agent-log4j], [
333 AS_HELP_STRING([--enable-java-agent-log4j], [build the LTTng UST Java agent with Log4j support [default=no]])
335 java_agent_log4j=$enableval
340 AC_ARG_ENABLE([java-agent-all], [
341 AS_HELP_STRING([--enable-java-agent-all], [build the LTTng UST Java agent with all supported backends [default=no]])
343 java_agent_jul=$enableval
344 java_agent_log4j=$enableval
347 AM_CONDITIONAL([ENABLE_JAVA_AGENT], [test "x$java_agent_jul" = "xyes" || test "x$java_agent_log4j" = "xyes"])
348 AM_CONDITIONAL([ENABLE_JAVA_AGENT_WITH_JUL], [test "x$java_agent_jul" = "xyes"])
349 AM_CONDITIONAL([ENABLE_JAVA_AGENT_WITH_LOG4J], [test "x$java_agent_log4j" = "xyes"])
351 AS_IF([test "x$jni_interface" = "xyes" || test "x$java_agent_jul" = "xyes" || test "x$java_agent_log4j" = "xyes"], [
356 AC_ARG_VAR([CLASSPATH], [Java class path])
359 for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
361 JNI_CPPFLAGS="$JNI_CPPFLAGS -I$JNI_INCLUDE_DIR"
364 saved_CPPFLAGS="$CPPFLAGS"
365 CPPFLAGS="$CPPFLAGS $JNI_CPPFLAGS"
367 CPPFLAGS="$saved_CPPFLAGS"
370 AM_CONDITIONAL([HAVE_JAVAH], [test "x$JAVAH" != "x"])
372 AS_IF([test "x$java_agent_log4j" = "xyes"], [
374 AX_CHECK_CLASS([org.apache.log4j.Logger])
375 AS_IF([test "x$ac_cv_class_org_apache_log4j_Logger" = "xno"], [
376 AC_MSG_ERROR([The UST Java agent support for log4j was requested but the Log4j classes were not found. Please specify the location of the Log4j jar via the Java CLASSPATH e.g: export CLASSPATH="/path/to/log4j.jar"])
380 # Option to build the python agent
381 AC_ARG_ENABLE([python-agent], [
382 AS_HELP_STRING([--enable-python-agent], [build the LTTng UST Python agent [default=no]])
384 python_agent=$enableval
386 AM_CONDITIONAL([ENABLE_PYTHON_AGENT], [test "x$python_agent" = "xyes"])
387 AS_IF([test "x$python_agent" = "xyes"], [
388 AM_PATH_PYTHON([2.7])
393 AS_HELP_STRING([--with-sdt], [provide SystemTap integration via sdt.h [default=no]])
400 AS_IF([test "x$with_sdt" = "xyes"], [
401 AC_MSG_CHECKING([STAP_PROBEV()])
402 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
403 #define SDT_USE_VARIADIC
407 STAP_PROBEV(provider,name,1,2,3,4,5,6,7,8,9,10);
411 AC_DEFINE([LTTNG_UST_HAVE_SDT_INTEGRATION], [1])
414 AC_MSG_ERROR([The sdt.h integration was requested but the STAP_PROBEV define cannot be used. Make sure it is installed, and up to date, or use CPPFLAGS=-I/path/ to specify a non-standard path to sys/sdt.h])
418 AC_ARG_WITH([lttng-system-rundir], [
419 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".]),
421 lttng_system_rundir="$withval"
423 lttng_system_rundir="/var/run/lttng"
425 AC_DEFINE_UNQUOTED([LTTNG_SYSTEM_RUNDIR], ["$lttng_system_rundir"],
426 [LTTng system runtime directory])
428 AC_CHECK_PROG([ENABLE_GEN_TP_EXAMPLES], [python], ["yes"])
429 AM_CONDITIONAL([ENABLE_GEN_TP_EXAMPLES], [test "x$ENABLE_GEN_TP_EXAMPLES" = "xyes"])
431 # Enable building examples
435 [--disable-examples],
436 [Do not build and install examples]
438 [enable_examples=$enableval],
439 [enable_examples=yes]
442 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" != "xno"])
444 # Enable building man pages (user's intention).
448 [--disable-man-pages],
449 [Do not build and install man pages (already built in a distributed tarball)]
451 [man_pages_opt=$enableval],
455 # Check for asciidoc and xmlto if we enabled building the man pages.
456 have_asciidoc_xmlto=no
457 warn_prebuilt_man_pages=no
459 AS_IF([test "x$man_pages_opt" = "xyes"], [
460 AC_PATH_PROG([ASCIIDOC], [asciidoc], [no])
461 AC_PATH_PROG([XMLTO], [xmlto], [no])
463 AS_IF([test "x$ASCIIDOC" = "xno" || test "x$XMLTO" = "xno"], [
465 # This is an error because we're in the Git repo, which
466 # means the man pages are not already generated for us,
467 # thus asciidoc/xmlto are required because we were asked
468 # to build the man pages.
470 Both asciidoc and xmlto are needed to build the LTTng-UST man pages. Use
471 --disable-man-pages to disable building the man pages, in which case
472 they will not be installed.
475 # Only warn here: since we're in the tarball, the man
476 # pages should already be generated at this point, thus
477 # asciidoc/xmlto are not strictly required.
478 warn_prebuilt_man_pages=yes
481 have_asciidoc_xmlto=yes
485 # Export man page build condition: build the man pages if the user
486 # asked for it, and if the tools are available.
487 AM_CONDITIONAL([ENABLE_MAN_PAGES], [test "x$man_pages_opt" != "xno"])
488 AM_CONDITIONAL([HAVE_ASCIIDOC_XMLTO], [test "x$have_asciidoc_xmlto" = "xyes"])
491 # Defined in include/lttng/ust-version.h
492 AC_DEFINE([LTTNG_UST_MAJOR_VERSION], ust_version_major, [LTTng UST major version])
493 AC_DEFINE([LTTNG_UST_MINOR_VERSION], ust_version_minor, [LTTng UST minor version])
494 AC_DEFINE([LTTNG_UST_PATCHLEVEL_VERSION], ust_version_patch, [LTTng UST patch version])
495 AC_DEFINE([LTTNG_UST_VERSION], ["]ust_version["], [LTTng UST version string])
496 AC_DEFINE([LTTNG_UST_LIB_SONAME_MAJOR], [ust_lib_version_current], [Major SONAME number of liblttng-ust])
497 AC_DEFINE([LTTNG_UST_CTL_LIB_SONAME_MAJOR], [ust_ctl_lib_version_current], [Major SONAME number of liblttng-ust-ctl])
500 AM_CFLAGS="-Wall $URCU_CFLAGS $PTHREAD_CFLAGS"
503 AM_CXXFLAGS="$AM_CFLAGS"
504 AC_SUBST(AM_CXXFLAGS)
506 # The order in which the include folders are searched is important.
507 # The top_builddir should always be searched first in the event that a build
508 # time generated file is included.
509 AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h"
510 AC_SUBST(AM_CPPFLAGS)
512 AC_SUBST(JNI_CPPFLAGS)
516 ## Output files generated by configure ##
519 # List of files to be generated from '.in' templates by AC_OUTPUT
523 doc/examples/Makefile
529 libringbuffer/Makefile
530 liblttng-ust-comm/Makefile
531 liblttng-ust/Makefile
532 liblttng-ust-ctl/Makefile
533 liblttng-ust-fork/Makefile
534 liblttng-ust-dl/Makefile
535 liblttng-ust-fd/Makefile
536 liblttng-ust-java/Makefile
537 liblttng-ust-java-agent/Makefile
538 liblttng-ust-java-agent/java/Makefile
539 liblttng-ust-java-agent/java/lttng-ust-agent-all/Makefile
540 liblttng-ust-java-agent/java/lttng-ust-agent-common/Makefile
541 liblttng-ust-java-agent/java/lttng-ust-agent-jul/Makefile
542 liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Makefile
543 liblttng-ust-java-agent/jni/Makefile
544 liblttng-ust-java-agent/jni/common/Makefile
545 liblttng-ust-java-agent/jni/jul/Makefile
546 liblttng-ust-java-agent/jni/log4j/Makefile
547 liblttng-ust-libc-wrapper/Makefile
548 liblttng-ust-cyg-profile/Makefile
549 liblttng-ust-python-agent/Makefile
550 python-lttngust/Makefile
551 python-lttngust/setup.py
552 python-lttngust/lttngust/__init__.py
555 tests/compile/Makefile
556 tests/compile/ctf-types/Makefile
557 tests/compile/hello.cxx/Makefile
558 tests/compile/hello/Makefile
559 tests/compile/hello-many/Makefile
560 tests/compile/same_line_tracepoint/Makefile
561 tests/compile/test-app-ctx/Makefile
562 tests/benchmark/Makefile
563 tests/unit/gcc-weak-hidden/Makefile
564 tests/unit/libmsgpack/Makefile
566 tests/unit/libringbuffer/Makefile
567 tests/unit/pthread_name/Makefile
568 tests/unit/snprintf/Makefile
569 tests/unit/ust-elf/Makefile
579 ## Mini-report on what will be built. ##
587 AS_IF([test -n "ust_version_name"], [
588 AS_ECHO("${PPRINT_COLOR_BLDBLU}LTTng-ust $PACKAGE_VERSION \"ust_version_name\"$PPRINT_COLOR_RST")
590 AS_ECHO("${PPRINT_COLOR_BLDBLU}LTTng-ust $PACKAGE_VERSION")
595 AS_IF([test -n "ust_version_description"], [
596 AS_IF([test -n "$FOLD"], [
597 AS_ECHO("`AS_ECHO("ust_version_description") | $FOLD -s`")
599 AS_ECHO("ust_version_description")
604 PPRINT_SUBTITLE([System])
606 PPRINT_PROP_STRING([Target architecture], $host_cpu)
608 AS_IF([test "x$UNSUPPORTED_ARCH" = "x1"],[
609 PPRINT_WARN([Your architecture ($host_cpu) is unsupported, using safe default of no unaligned access.])
613 PPRINT_SUBTITLE([Features])
616 test "x$with_sdt" = "xyes" && value=1 || value=0
617 PPRINT_PROP_BOOL_CUSTOM([sdt.h integration], $value, [use --with-sdt])
619 test "x$java_agent_jul" = xyes && value=1 || value=0
620 PPRINT_PROP_BOOL_CUSTOM([Java agent (JUL support)], $value, [use --enable-java-agent-jul])
622 test "x$java_agent_log4j" = xyes && value=1 || value=0
623 PPRINT_PROP_BOOL_CUSTOM([Java agent (Log4j support)], $value, [use --enable-java-agent-log4j])
625 test "x$jni_interface" = xyes && value=1 || value=0
626 PPRINT_PROP_BOOL_CUSTOM([JNI interface (JNI)], $value, [use --enable-jni-interface])
628 test "x$python_agent" = xyes && value=1 || value=0
629 PPRINT_PROP_BOOL_CUSTOM([Python agent], $value, [use --enable-python-agent])
631 test "x$have_perf_event" = "xyes" && value=1 || value=0
632 PPRINT_PROP_BOOL_CUSTOM([Perf event integration], $value)
634 test "x$enable_numa" = xyes && value=1 || value=0
635 PPRINT_PROP_BOOL([NUMA], $value)
640 test "x$enable_examples" = xyes && value=1 || value=0
641 PPRINT_PROP_BOOL([Build and install examples], $value, $PPRINT_COLOR_SUBTITLE)
643 # man pages build enabled/disabled
644 m4_pushdef([build_man_pages_msg], [Build and install man pages])
646 AS_IF([test "x$man_pages_opt" != "xno"], [
648 PPRINT_PROP_BOOL([build_man_pages_msg], 1, $PPRINT_COLOR_SUBTITLE)
650 AS_IF([test "x$have_asciidoc_xmlto" = "xyes"], [
651 PPRINT_PROP_BOOL([build_man_pages_msg], 1, $PPRINT_COLOR_SUBTITLE)
653 PPRINT_PROP_STRING([build_man_pages_msg],
654 [${PPRINT_COLOR_BLDGRN}yes (already built)],
655 $PPRINT_COLOR_SUBTITLE)
659 PPRINT_PROP_BOOL([build_man_pages_msg], 0, $PPRINT_COLOR_SUBTITLE)
662 m4_popdef([build_man_pages_msg])
666 report_bindir="`eval eval echo $bindir`"
667 report_libdir="`eval eval echo $libdir`"
669 # Print the bindir and libdir this `make install' will install into.
671 PPRINT_SUBTITLE([Install directories])
672 PPRINT_PROP_STRING([Binaries], [$report_bindir])
673 PPRINT_PROP_STRING([Libraries], [$report_libdir])
676 PPRINT_SUBTITLE([System directories])
678 PPRINT_PROP_STRING([lttng-sessiond rundir], [$lttng_system_rundir])
682 AS_IF([test "x$warn_prebuilt_man_pages" = "xyes" ], [
684 PPRINT_WARN([Both asciidoc and xmlto are needed to build the LTTng-UST man pages.
686 Note that the man pages are already built in this distribution tarball,
687 therefore asciidoc and xmlto are only needed if you intend to modify
690 Use --disable-man-pages to completely disable building and installing