-AS_IF([test "x$with_sdt" = "xyes"],[
- AC_MSG_CHECKING([STAP_PROBEV()])
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
- #define SDT_USE_VARIADIC
- #include <sys/sdt.h>
- void fct(void)
- {
- STAP_PROBEV(provider,name,1,2,3,4,5,6,7,8,9,10);
- }
- ]])],[
- AC_MSG_RESULT([yes])
- AC_DEFINE([LTTNG_UST_HAVE_SDT_INTEGRATION], [1])
- ],[
- AC_MSG_RESULT([no])
- 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])
- ])
+# Override the default runtime directory
+AC_ARG_WITH([lttng-system-rundir], [
+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".]),
+], [
+ lttng_system_rundir="$withval"
+], [
+ lttng_system_rundir="/var/run/lttng"
+])
+
+# Add the java command line arguments like '--wit-java-prefix'
+AX_JAVA_OPTIONS
+
+
+## ##
+## Check for conflicting features selection ##
+## ##
+
+AE_IF_FEATURE_DISABLED([shared], [
+ AC_MSG_ERROR(LTTng-UST requires shared libraries to be enabled)
+])
+
+AE_IF_FEATURE_ENABLED([java-agent-all], [
+ AE_FEATURE_ENABLE([java-agent-jul])
+ AE_FEATURE_ENABLE([java-agent-log4j])
+ # This backport to a stable branch requires the explicit use of
+ # '--enable-java-agent-log4j2' to avoid introducing a new dependency in
+ # an existing configuration.
+ dnl AE_FEATURE_ENABLE([java-agent-lkog4j2])
+])
+
+
+## ##
+## Check for optional features dependencies ##
+## ##
+
+# The numa integration requires libnuma
+AE_IF_FEATURE_ENABLED([numa], [
+ AC_CHECK_LIB([numa], [numa_available], [
+ AC_DEFINE([HAVE_LIBNUMA], [1], [Define to 1 if libnuma is available.])
+ ], [
+ AC_MSG_ERROR([dnl
+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.
+ ])
+ ])
+])
+
+# The JNI interface and Java Agents require a working Java JDK
+AS_IF([AE_IS_FEATURE_ENABLED([jni-interface]) || AE_IS_FEATURE_ENABLED([java-agent-jul]) || \
+ AE_IS_FEATURE_ENABLED([java-agent-log4j]) || AE_IS_FEATURE_ENABLED([java-agent-log4j2])], [
+ AX_PROG_JAVAC
+ AX_PROG_JAVA
+ AX_PROG_JAR
+
+ # Get the CPPFLAGS required to build jni libaries
+ AX_JNI_INCLUDE_DIR
+ for jni_include_dir in $JNI_INCLUDE_DIRS; do
+ JNI_CPPFLAGS="$JNI_CPPFLAGS -I$jni_include_dir"
+ done
+
+ # Check for javah and jni.h
+ saved_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $JNI_CPPFLAGS"
+ AX_PROG_JAVAH
+ CPPFLAGS="$saved_CPPFLAGS"
+])
+
+# The log4j 1.x agent requires the log4j jar in the classpath
+AE_IF_FEATURE_ENABLED([java-agent-log4j], [
+ AX_CHECK_CLASS([org.apache.log4j.Logger])
+ AS_IF([test "x$ac_cv_class_org_apache_log4j_Logger" = "xno"], [
+ AC_MSG_ERROR([dnl
+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
+environment variable, e.g. ./configure CLASSPATH="/path/to/log4j.jar"
+
+Current CLASSPATH: "$CLASSPATH"
+ ])
+ ])
+])
+
+# The log4j 2.x agent requires the log4j core and api jars in the classpath
+AE_IF_FEATURE_ENABLED([java-agent-log4j2], [
+ AX_CHECK_CLASS([org.apache.logging.log4j.Logger])
+ AX_CHECK_CLASS([org.apache.logging.log4j.core.Core])
+ AS_IF([test "x$ac_cv_class_org_apache_logging_log4j_Logger" = "xno" || test "x$ac_cv_class_org_apache_logging_log4j_core_Core" = "xno"], [
+ AC_MSG_ERROR([dnl
+The UST Java agent support for log4j was requested but the Log4j classes were
+not found. Please specify the location of the Log4j API and core 2.x jars via the Java CLASSPATH
+environment variable, e.g. ./configure CLASSPATH="/path/to/log4j-core.jar:/path/to/log4j-api.jar"
+
+Current CLASSPATH: "$CLASSPATH"
+ ])
+ ])
+])
+
+# The python agent requires a python interpreter
+AE_IF_FEATURE_ENABLED([python-agent], [
+ AS_IF([test "x$PYTHON" = "x"], [
+ AC_MSG_ERROR([dnl
+Cannot find a suitable python interpreter. You can override it with the PYTHON
+environment variable.
+ ])
+ ])
+
+ AX_COMPARE_VERSION(["$PYTHON_VERSION"], [ge], ["3.12"], [
+ AC_MSG_CHECKING([for python setuptools])
+ AS_IF(["$PYTHON" -c "import setuptools" 2>/dev/null], [
+ AC_MSG_RESULT([yes])
+ ], [
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Python >= 3.12 removed 'distutils', the 'setuptools' module needs to be installed for the selected interpreter.])
+ ])
+ ])