+
+AC_ARG_ENABLE([java-agent-jul], [
+ AS_HELP_STRING([--enable-java-agent-jul], [build the LTTng UST Java agent with JUL support [default=no]])
+], [
+ java_agent_jul=$enableval
+], [
+ java_agent_jul=no
+])
+
+AC_ARG_ENABLE([java-agent-log4j], [
+ AS_HELP_STRING([--enable-java-agent-log4j], [build the LTTng UST Java agent with Log4j support [default=no]])
+], [
+ java_agent_log4j=$enableval
+], [
+ java_agent_log4j=no
+])
+
+AC_ARG_ENABLE([java-agent-all], [
+ AS_HELP_STRING([--enable-java-agent-all], [build the LTTng UST Java agent with all supported backends [default=no]])
+], [
+ java_agent_jul=$enableval
+ java_agent_log4j=$enableval
+], [:])
+
+AM_CONDITIONAL([BUILD_JAVA_AGENT], [test "x$java_agent_jul" = "xyes" || test "x$java_agent_log4j" = "xyes"])
+AM_CONDITIONAL([BUILD_JAVA_AGENT_WITH_JUL], [test "x$java_agent_jul" = "xyes"])
+AM_CONDITIONAL([BUILD_JAVA_AGENT_WITH_LOG4J], [test "x$java_agent_log4j" = "xyes"])
+
+AS_IF([test "x$jni_interface" = "xyes" || test "x$java_agent_jul" = "xyes" || test "x$java_agent_log4j" = "xyes"], [
+ AX_JAVA_OPTIONS
+ AX_PROG_JAVAC
+ AX_PROG_JAVA
+ AX_PROG_JAR
+
+ AX_JNI_INCLUDE_DIR
+ for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
+ do
+ CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR"
+ done
+
+ AX_PROG_JAVAH
+])
+
+AS_IF([test "x$java_agent_log4j" = "xyes"], [
+ AX_CHECK_CLASSPATH
+ AX_CHECK_CLASS([org.apache.log4j.Logger])
+ AS_IF([test "x$ac_cv_class_org_apache_log4j_Logger" = "xno"], [
+ 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"])
+ ])
+])
+
+# Option to build the python agent
+AC_ARG_ENABLE([python-agent], [
+ AS_HELP_STRING([--enable-python-agent], [build the LTTng UST Python agent [default=no]])
+], [
+ python_agent=$enableval
+], [:])
+AM_CONDITIONAL([BUILD_PYTHON_AGENT], [test "x$python_agent" = "xyes"])
+AS_IF([test "x$python_agent" = "xyes"], [
+ AM_PATH_PYTHON([2.7])
+])
+