+# Set architecture specific options
+AS_CASE([$host_cpu],
+ [i[[3456]]86], [],
+ [x86_64], [],
+ [amd64], [],
+ [powerpc], [],
+ [ppc64], [],
+ [ppc64le], [],
+ [powerpc64], [],
+ [powerpc64le], [],
+ [s390], [NO_UNALIGNED_ACCESS=1],
+ [s390x], [NO_UNALIGNED_ACCESS=1],
+ [arm*], [
+ NO_UNALIGNED_ACCESS=1
+ NO_NUMA=1
+ ],
+ [aarch64*], [NO_UNALIGNED_ACCESS=1],
+ [mips*], [NO_UNALIGNED_ACCESS=1],
+ [tile*], [NO_UNALIGNED_ACCESS=1],
+ [
+ UNSUPPORTED_ARCH=1
+ NO_UNALIGNED_ACCESS=1
+ ])
+
+# Configuration options, which will be installed in the config.h
+AH_TEMPLATE([LTTNG_UST_HAVE_EFFICIENT_UNALIGNED_ACCESS], [Use efficient unaligned access.])
+AH_TEMPLATE([LTTNG_UST_HAVE_SDT_INTEGRATION], [SystemTap integration via sdt.h])
+AH_TEMPLATE([LTTNG_UST_HAVE_PERF_EVENT], [Perf event integration via perf_event.h])
+
+# Checks for libraries.
+AC_CHECK_LIB([dl], [dlopen], [
+ libdl_name=dl
+ DL_LIBS="-ldl"
+], [
+ #libdl not found, check for dlopen in libc.
+ AC_CHECK_LIB([c], [dlopen], [
+ libdl_name=c
+ DL_LIBS="-lc"
+ ], [
+ AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
+ ])
+])
+AC_SUBST(DL_LIBS)
+
+# Check if libdl has dlmopen support.
+AH_TEMPLATE([HAVE_DLMOPEN], ["Define to 1 if dlmopen is available."])
+AC_CHECK_LIB([$libdl_name], [dlmopen],
+ [AC_DEFINE([HAVE_DLMOPEN], [1])]
+)
+
+AC_CHECK_LIB([pthread], [pthread_create])
+AC_CHECK_LIB([pthread], [pthread_setname_np],
+ AC_DEFINE([HAVE_PTHREAD_SETNAME_NP], [1], [Define to 1 if pthread_setname_np is available.]),
+ AC_CHECK_LIB([pthread], [pthread_set_name_np],
+ AC_DEFINE([HAVE_PTHREAD_SET_NAME_NP], [1], [Define to 1 if pthread_set_name_np is available.]),
+ AC_MSG_RESULT([pthread setname/set_name not found.])))
+
+# Check for dlfcn.h
+AC_CHECK_HEADER([dlfcn.h])
+AS_IF([test "x${ac_cv_header_dlfcn_h}" = "xyes"], [
+ AC_CHECK_DECLS([RTLD_DI_LINKMAP], [], [], [
+ #define _GNU_SOURCE /* Required on Linux to get GNU extensions */
+ #include <dlfcn.h>
+ ])
+], [
+ ac_cv_have_decl_RTLD_DI_LINKMAP="no"
+])
+
+AM_CONDITIONAL([HAVE_DLINFO], [test "x${ac_cv_have_decl_RTLD_DI_LINKMAP}" = "xyes"])