]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix compile erorr on clang undefined reference to '__atomic_load_8'
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 8 Nov 2015 15:09:16 +0000 (07:09 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 8 Nov 2015 15:09:16 +0000 (07:09 -0800)
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.

configure.ac
src/Makefile.am

index e7cd34d90ae288be822e2989ac8b3c802712a68c..17fda485dac218c4fe326ab26f8edb2324098351 100644 (file)
@@ -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])
index 5d7e3453804e964989d62e3db96748fabae74ef4..9da154bf39fb840c59d8b10cd2caa388c31b8d54 100644 (file)
@@ -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) \