<commit_before># Enable -fvisibility=hidden if using a gcc that supports it
OLD_CFLAGS="$CFLAGS"
AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
VISIBILITY_CFLAGS="-fvisibility=hidden"
CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
       [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);

AC_SUBST(VISIBILITY_CFLAGS)
# Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
CFLAGS=$OLD_CFLAGS

AC_MSG_CHECKING(for GCC atomic builtins)
AC_LINK_IFELSE(
    [AC_LANG_SOURCE(
      [[int main() {
        int v = 1;
        __atomic_fetch_add(&v, 1, __ATOMIC_RELAXED);
        __atomic_fetch_sub(&v, 1, __ATOMIC_RELAXED);
        __atomic_store_n(&v, 1, __ATOMIC_RELAXED);
        __atomic_load_n(&v, __ATOMIC_RELAXED);
        return 0;
        }
    ]])],
    AC_MSG_RESULT(yes),
    AC_MSG_RESULT(no)
    echo "GCC-style __atomic builtins not supported by the compiler."
    echo "Use newer version. For gcc > 4.7.0"
    exit -1)

dnl Check whether -latomic is needed
use_libatomic=no

AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
AC_LINK_IFELSE(
  [AC_LANG_SOURCE([[
    static int loc;
    int main(void)
    {
        int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
        return 0;
    }
    ]])],
  [AC_MSG_RESULT(no)],
  [AC_MSG_RESULT(yes)
   AC_CHECK_LIB(
     [atomic], [__atomic_exchange_8],
     [use_libatomic=yes],
     [AC_MSG_FAILURE([__atomic_exchange_8 is not available])])
  ])

AC_MSG_CHECKING(whether -latomic is needed for 128-bit atomic built-ins)
AC_LINK_IFELSE(
  [AC_LANG_SOURCE([[
    static __int128 loc;
    int main(void)
    {
        __int128 prev;
        prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
        return 0;
    }
    ]])],
  [AC_MSG_RESULT(no)],
  [AC_MSG_RESULT(yes)
   AC_CHECK_LIB(
     [atomic], [__atomic_exchange_16],
     [use_libatomic=yes],
     [AC_MSG_FAILURE([cannot detect support for 128-bit atomics])])<commit_msg>configure.ac: do not trap if libatomic is not found<commit_after># Enable -fvisibility=hidden if using a gcc that supports it
OLD_CFLAGS="$CFLAGS"
AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
VISIBILITY_CFLAGS="-fvisibility=hidden"
CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
       [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);

AC_SUBST(VISIBILITY_CFLAGS)
# Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
CFLAGS=$OLD_CFLAGS

AC_MSG_CHECKING(for GCC atomic builtins)
AC_LINK_IFELSE(
    [AC_LANG_SOURCE(
      [[int main() {
        int v = 1;
        __atomic_fetch_add(&v, 1, __ATOMIC_RELAXED);
        __atomic_fetch_sub(&v, 1, __ATOMIC_RELAXED);
        __atomic_store_n(&v, 1, __ATOMIC_RELAXED);
        __atomic_load_n(&v, __ATOMIC_RELAXED);
        return 0;
        }
    ]])],
    AC_MSG_RESULT(yes),
    AC_MSG_RESULT(no)
    echo "GCC-style __atomic builtins not supported by the compiler."
    echo "Use newer version. For gcc > 4.7.0"
    exit -1)

dnl Check whether -latomic is needed
use_libatomic=no

AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
AC_LINK_IFELSE(
  [AC_LANG_SOURCE([[
    static int loc;
    int main(void)
    {
        int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
        return 0;
    }
    ]])],
  [AC_MSG_RESULT(no)],
  [AC_MSG_RESULT(yes)
   AC_CHECK_LIB(
     [atomic], [__atomic_exchange_8],
     [use_libatomic=yes],
     [AC_MSG_FAILURE([__atomic_exchange_8 is not available])])
  ])

AC_MSG_CHECKING(whether -latomic is needed for 128-bit atomic built-ins)
AC_LINK_IFELSE(
  [AC_LANG_SOURCE([[
    static __int128 loc;
    int main(void)
    {
        __int128 prev;
        prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
        return 0;
    }
    ]])],
  [AC_MSG_RESULT(no)],
  [AC_MSG_RESULT(yes)
   AC_CHECK_LIB(
     [atomic], [__atomic_exchange_16],
     [use_libatomic=yes],
     [AC_MSG_CHECKING([cannot detect support for 128-bit atomics])])
{'fraction_non_alphanumeric': 0.11518324607329843, 'fraction_numerical': 0.015457491897282473, 'mean_word_length': 3.776190476190476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4109387', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1496, 'n_words': 309}