Validate the presence of dlmopen at configure time
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 21 Feb 2017 21:00:27 +0000 (16:00 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 21 Feb 2017 21:22:07 +0000 (16:22 -0500)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure.ac
liblttng-ust-dl/lttng-ust-dl.c
liblttng-ust-dl/ust_dl.h

index 450b43b23ce6af31047fde462918878dc91423c7..023cfd4e3811ac52b020bec794a948d2bbf681e3 100644 (file)
@@ -125,15 +125,23 @@ AS_IF([test "x${ax_cv_sys_weak_alias}" = "xno"], [
 # Checks for libraries.
 AC_CHECK_LIB([dl], [dlopen], [
        have_libdl=yes
+       libdl_name=dl
 ], [
        #libdl not found, check for dlopen in libc.
        AC_CHECK_LIB([c], [dlopen], [
                have_libc_dl=yes
+               libdl_name=c
        ], [
                AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
        ])
 ])
 
+# 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])]
+)
+
 AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBDL], [test "x$have_libdl" = "xyes"])
 AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"])
 
index b0737b65f9f4222d6beef931b7ce3a07eef0ea1c..ce2ae0e7028036a0b6e61ed4520bbba9b341a384 100644 (file)
 #include "ust_dl.h"
 
 static void *(*__lttng_ust_plibc_dlopen)(const char *filename, int flags);
+#ifdef HAVE_DLMOPEN
 static void *(*__lttng_ust_plibc_dlmopen)(Lmid_t nsid, const char *filename,
                int flags);
+#endif
 static int (*__lttng_ust_plibc_dlclose)(void *handle);
 
 static
@@ -55,6 +57,7 @@ void *_lttng_ust_dl_libc_dlopen(const char *filename, int flags)
        return __lttng_ust_plibc_dlopen(filename, flags);
 }
 
+#ifdef HAVE_DLMOPEN
 static
 void *_lttng_ust_dl_libc_dlmopen(Lmid_t nsid, const char *filename,
                int flags)
@@ -68,6 +71,7 @@ void *_lttng_ust_dl_libc_dlmopen(Lmid_t nsid, const char *filename,
        }
        return __lttng_ust_plibc_dlmopen(nsid, filename, flags);
 }
+#endif
 
 static
 int _lttng_ust_dl_libc_dlclose(void *handle)
@@ -143,6 +147,7 @@ end:
        return;
 }
 
+#ifdef HAVE_DLMOPEN
 static
 void lttng_ust_dl_dlmopen(void *so_base, Lmid_t nsid, const char *so_name,
                int flags, void *ip)
@@ -203,6 +208,7 @@ end:
        lttng_ust_elf_destroy(elf);
        return;
 }
+#endif
 
 void *dlopen(const char *filename, int flags)
 {
@@ -223,6 +229,7 @@ void *dlopen(const char *filename, int flags)
        return handle;
 }
 
+#ifdef HAVE_DLMOPEN
 void *dlmopen(Lmid_t nsid, const char *filename, int flags)
 {
        void *handle;
@@ -243,6 +250,7 @@ void *dlmopen(Lmid_t nsid, const char *filename, int flags)
        return handle;
 
 }
+#endif
 
 int dlclose(void *handle)
 {
index b8cfe822b5c48bf3eaa2b2b3fd87981690322445..afa8e842ac587b0f55fd1be779bc5f98ea09432b 100644 (file)
@@ -51,6 +51,7 @@ TRACEPOINT_EVENT(lttng_ust_dl, dlopen,
        )
 )
 
+#ifdef HAVE_DLMOPEN
 TRACEPOINT_EVENT(lttng_ust_dl, dlmopen,
        TP_ARGS(void *, ip, void *, baddr, Lmid_t, nsid,
                const char *, path, int, flags,
@@ -66,6 +67,7 @@ TRACEPOINT_EVENT(lttng_ust_dl, dlmopen,
                ctf_integer(uint8_t, has_debug_link, has_debug_link)
        )
 )
+#endif
 
 TRACEPOINT_EVENT(lttng_ust_dl, build_id,
        TP_ARGS(
This page took 0.026557 seconds and 4 git commands to generate.