This patch from Peter Collingbourne adds a --without-libatomic configure option to libgo, to make it easier to build libgo outside of the GCC build system. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 9e7a28ffe425 libgo/Makefile.am --- a/libgo/Makefile.am Wed May 28 17:02:52 2014 -0700 +++ b/libgo/Makefile.am Thu May 29 13:05:27 2014 -0700 @@ -30,6 +30,8 @@ LIBFFI = @LIBFFI@ LIBFFIINCS = @LIBFFIINCS@ +LIBATOMIC = @LIBATOMIC@ + WARN_CFLAGS = $(WARN_FLAGS) $(WERROR) # -I/-D flags to pass when compiling. @@ -1949,8 +1951,7 @@ libgo_la_LIBADD = \ $(libgo_go_objs) ../libbacktrace/libbacktrace.la \ - ../libatomic/libatomic_convenience.la \ - $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) + $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) libgobegin_a_SOURCES = \ runtime/go-main.c diff -r 9e7a28ffe425 libgo/configure.ac --- a/libgo/configure.ac Wed May 28 17:02:52 2014 -0700 +++ b/libgo/configure.ac Thu May 29 13:05:27 2014 -0700 @@ -122,6 +122,21 @@ AC_SUBST(LIBFFI) AC_SUBST(LIBFFIINCS) +# See if the user wants to configure without libatomic. This is useful if we are +# on an architecture for which libgo does not need an atomic support library and +# libatomic does not support our C compiler. +AC_ARG_WITH(libatomic, + AS_HELP_STRING([--without-libatomic], + [don't use libatomic]), + [:], + [with_libatomic=${with_libatomic_default-yes}]) + +LIBATOMIC= +if test "$with_libatomic" != no; then + LIBATOMIC=../libatomic/libatomic_convenience.la +fi +AC_SUBST(LIBATOMIC) + # Used to tell GNU make to include a file without telling automake to # include it. go_include="-include"