-# Check for various supplementary host information (beyond the
-# triplet) which might affect the library format choices. E.g., we
-# can be building with `i686-unknown-linux-gnu-gcc -m64'
-
-case "${host}" in
-changequote(,)dnl
- i[34567]86-*-linux*)
-changequote([,])dnl
- AC_CACHE_CHECK([if building for x86-64], [ust_cv_i386_is_x86_64],
- [save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $CFLAGS"
- AC_EGREP_CPP([got it], [
-#if __x86_64__
-got it
-#endif
- ], [ust_cv_i386_is_x86_64=yes],
- [ust_cv_i386_is_x86_64=no])
- CPPFLAGS="$save_CPPFLAGS"])
- ;;
-esac
-
-AC_MSG_CHECKING([library format for the host system])
-case $host_cpu in
-changequote(,)dnl
- i[3456]86)
-changequote([,])dnl
- if test "$ust_cv_i386_is_x86_64" = yes ; then
- LIBFORMAT="elf64-x86-64"
- else
- LIBFORMAT="elf32-i386"
- fi
- ;;
- x86_64) LIBFORMAT="elf64-x86-64" ;;
- powerpc) LIBFORMAT="elf32-powerpc" ;;
- ppc64) LIBFORMAT="elf64-powerpc" ;;
- powerpc64) LIBFORMAT="elf64-powerpc" ;;
- s390) LIBFORMAT="elf32-s390"; NO_UNALIGNED_ACCESS=1 ;;
- s390x) LIBFORMAT="elf64-s390"; NO_UNALIGNED_ACCESS=1 ;;
- armv5) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;;
- arm) LIBFORMAT="elf32-littlearm"; NO_UNALIGNED_ACCESS=1 ;;
- mips*) LIBFORMAT=""; NO_UNALIGNED_ACCESS=1;;
- *) AC_MSG_ERROR([unable to detect library format (unsupported architecture ($host_cpu)?)]) ;;
-esac
-AC_SUBST(LIBFORMAT)
-AC_MSG_RESULT($LIBFORMAT)
-
-if test "x$host_cpu" = "xarm" ; then
-AC_MSG_CHECKING([checking for armv5])
-AC_TRY_COMPILE(
-[
-],
-[
-#ifndef __ARM_ARCH_5TEJ__
-#error "no arm5 here"
-#endif
-],
-[
+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
+ JNI_CPPFLAGS="$JNI_CPPFLAGS -I$JNI_INCLUDE_DIR"
+ done
+
+ saved_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $JNI_CPPFLAGS"
+ AX_PROG_JAVAH
+ CPPFLAGS="$saved_CPPFLAGS"
+])
+
+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_MSG_CHECKING([whether shared libraries are enabled])
+AS_IF([test "x$enable_shared" = "xyes"], [