+AC_ARG_ENABLE([jni-interface], [
+AS_HELP_STRING([--enable-jni-interface], [build JNI interface between C and Java. Needs Java include files [default=no]])
+], [
+ jni_interface=$enableval
+], [
+ jni_interface=no
+])
+
+AM_CONDITIONAL([BUILD_JNI_INTERFACE], [test "x$jni_interface" = "xyes"])
+
+
+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
+ AC_ARG_VAR([CLASSPATH], [Java class path])
+
+ AX_JNI_INCLUDE_DIR
+ for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
+ do
+ JNI_CPPFLAGS="$JNI_CPPFLAGS -I$JNI_INCLUDE_DIR"
+ done
+
+ saved_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $JNI_CPPFLAGS"
+ AX_PROG_JAVAH
+ CPPFLAGS="$saved_CPPFLAGS"
+])
+
+AM_CONDITIONAL([HAVE_JAVAH], [test "x$JAVAH" != "x"])
+
+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])
+])
+
+# sdt.h integration
+AC_ARG_WITH([sdt], [
+AS_HELP_STRING([--with-sdt], [provide SystemTap integration via sdt.h [default=no]])
+], [
+ with_sdt=$withval
+], [
+ with_sdt="no"
+])
+
+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])
+ ])
+])
+
+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"
+])
+AC_DEFINE_UNQUOTED([LTTNG_SYSTEM_RUNDIR], ["$lttng_system_rundir"],
+ [LTTng system runtime directory])
+
+AC_CHECK_PROG([BUILD_GEN_TP_EXAMPLES], [python], ["yes"])
+AM_CONDITIONAL([BUILD_GEN_TP_EXAMPLES], [test "x$BUILD_GEN_TP_EXAMPLES" = "xyes"])
+
+# Enable building examples
+AC_ARG_ENABLE(
+ examples,
+ AS_HELP_STRING(
+ [--disable-examples],
+ [Do not build and install examples]
+ ),
+ [enable_examples=$enableval],
+ [enable_examples=yes]