1dnl 2dnl Copyright (c) Linux Test Project, 2016 3dnl 4dnl This program is free software; you can redistribute it and/or modify 5dnl it under the terms of the GNU General Public License as published by 6dnl the Free Software Foundation; either version 2 of the License, or 7dnl (at your option) any later version. 8dnl 9dnl This program is distributed in the hope that it will be useful, 10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 12dnl the GNU General Public License for more details. 13dnl 14 15AC_DEFUN([LTP_CHECK_ATOMIC_MEMORY_MODEL],[dnl 16 AC_MSG_CHECKING([for __atomic_* compiler builtins]) 17 AC_LINK_IFELSE([AC_LANG_SOURCE([ 18int main(void) { 19 int i = 0, j = 0; 20 __atomic_add_fetch(&i, 1, __ATOMIC_ACQ_REL); 21 __atomic_load_n(&i, __ATOMIC_SEQ_CST); 22 __atomic_store_n(&i, 0, __ATOMIC_RELAXED); 23 return i; 24}])],[has_atomic_mm="yes"]) 25 26if test "x$has_atomic_mm" = xyes; then 27 AC_DEFINE(HAVE_ATOMIC_MEMORY_MODEL,1, 28 [Define to 1 if you have the __atomic_* compiler builtins]) 29 AC_MSG_RESULT(yes) 30else 31 AC_MSG_RESULT(no) 32fi 33]) 34