+AC_MSG_RESULT([$host_cpu])
+
+if test x$NO_UNALIGNED_ACCESS = x ; then
+AC_DEFINE([LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS], [1])
+fi
+
+# Check for JNI header files if requested
+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"])
+
+if test "x$jni_interface" = "xyes" || test "x$java_agent_jul" = "xyes" || test "x$java_agent_log4j" = "xyes"; then
+ 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
+fi
+
+if test "x$java_agent_log4j" = "xyes"; then
+ AX_CHECK_CLASSPATH
+
+ AX_CHECK_CLASS(org.apache.log4j.Logger)
+
+ if test "x$ac_cv_class_org_apache_log4j_Logger" = "xno"; then
+ 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"])
+ fi
+fi
+
+# 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"])
+if test "x$python_agent" = "xyes"; then
+ AM_PATH_PYTHON([2.7])
+fi
+
+# 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_MSG_CHECKING([whether shared libraries are enabled])
+AS_IF([test "x$enable_shared" = "xyes"],
+ [
+ AC_MSG_RESULT([yes])
+ ],
+ [
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([LTTng-UST requires shared libraries to be enabled])
+ ])
+
+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 $BUILD_GEN_TP_EXAMPLES], [Build examples requiring lttng-gen-tp])