From: Amos Jeffries Date: Sun, 8 Nov 2015 15:09:16 +0000 (-0800) Subject: Fix compile erorr on clang undefined reference to '__atomic_load_8' X-Git-Tag: SQUID_4_0_3~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b0f89121135aae68fbaf2aa33b5fb2e0da66d3e;p=thirdparty%2Fsquid.git Fix compile erorr on clang undefined reference to '__atomic_load_8' 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. --- diff --git a/configure.ac b/configure.ac index e7cd34d90a..17fda485da 100644 --- a/configure.ac +++ b/configure.ac @@ -457,6 +457,10 @@ if test "x$with_dl" = "xyes"; then 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]) diff --git a/src/Makefile.am b/src/Makefile.am index 5d7e345380..9da154bf39 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -586,6 +586,7 @@ squid_LDADD = \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ + $(ATOMICLIB) \ $(SSLLIB) \ $(EPOLL_LIBS) \ $(MINGW_LIBS) \