Later versions of GCC on some architectures push atomic functions
out into a separate atomic library. Older versions of clang do not
handle that automatically and require the library to be linked
explicitly.
Add a check for when this is required and set ATOMICLIB if needed.
AC_MSG_NOTICE([With dl])
fi
+## check for atomics library before anything that might need it
+AC_SEARCH_LIBS([__atomic_load_8],[atomic],[ATOMICLIB="-latomic"],[])
+AC_SUBST(ATOMICLIB)
+
AC_SEARCH_LIBS([shm_open], [rt])
if test "x$ac_cv_search_shm_open" != "xno" ; then
AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
+ $(ATOMICLIB) \
$(SSLLIB) \
$(EPOLL_LIBS) \
$(MINGW_LIBS) \