+## ##
+## 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])
+])
+
+
+## ##
+## Check for optional features dependencies ##
+## ##
+
+# The numa integration requires libnuma
+AE_IF_FEATURE_ENABLED([numa], [
+ AC_CHECK_LIB([numa], [numa_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])], [
+ 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 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 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.
+ ])
+ ])
+])