fix atomic ops detection

AC_TRY_LINK should be used instead of AC_TRY_COMPILE because the code
will compile everywhere, either producing ``atomic'' code, or an
external reference to __sync_bool_compare_and_swap.

https://bugzilla.gnome.org/show_bug.cgi?id=706958