AC_CHECK_FUNCS(clock_getres clock_gettime clock_settime)
# Common libraries that we need to link against for all sanitizer libs.
-link_sanitizer_common='-lpthread -ldl -lm'
+link_sanitizer_common='-lpthread -lm'
# At least for glibc, shm_open is in librt. But don't pull that
# in if it still doesn't give us the function we want. This
AC_CHECK_LIB(rt, shm_open,
[link_sanitizer_common="-lrt $link_sanitizer_common"])
+# Do a configure time check for -ldl
+AC_CHECK_LIB(dl, dlsym,
+ [link_sanitizer_common="-ldl $link_sanitizer_common"])
+
# Set up the set of additional libraries that we need to link against for libasan.
link_libasan=$link_sanitizer_common
AC_SUBST(link_libasan)