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_SYNC_ADD_AND_FETCH],[dnl
16	AC_MSG_CHECKING([for __sync_add_and_fetch])
17	AC_LINK_IFELSE([AC_LANG_SOURCE([
18int main(void) {
19	int i = 0;
20	return __sync_add_and_fetch(&i, 1);
21}])],[has_saac="yes"])
22
23if test "x$has_saac" = xyes; then
24	AC_DEFINE(HAVE_SYNC_ADD_AND_FETCH,1,[Define to 1 if you have __sync_add_and_fetch])
25	AC_MSG_RESULT(yes)
26else
27	AC_MSG_RESULT(no)
28fi
29])
30