diff options
Diffstat (limited to 'libgfortran/acinclude.m4')
-rw-r--r-- | libgfortran/acinclude.m4 | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4 index 857733a2e35..9d06a8b84d4 100644 --- a/libgfortran/acinclude.m4 +++ b/libgfortran/acinclude.m4 @@ -149,6 +149,44 @@ extern void bar(void) __attribute__((alias(ULP "foo")));], [Define to 1 if the target supports __attribute__((alias(...))).]) fi]) +dnl Check whether the target supports __sync_fetch_and_add. +AC_DEFUN([LIBGFOR_CHECK_SYNC_FETCH_AND_ADD], [ + AC_CACHE_CHECK([whether the target supports __sync_fetch_and_add], + have_sync_fetch_and_add, [ + AC_TRY_LINK([int foovar = 0;], [ +if (foovar <= 0) return __sync_fetch_and_add (&foovar, 1); +if (foovar > 10) return __sync_add_and_fetch (&foovar, -1);], + have_sync_fetch_and_add=yes, have_sync_fetch_and_add=no)]) + if test $have_sync_fetch_and_add = yes; then + AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD, 1, + [Define to 1 if the target supports __sync_fetch_and_add]) + fi]) + +dnl Check if threads are supported. +AC_DEFUN([LIBGFOR_CHECK_GTHR_DEFAULT], [ + AC_CACHE_CHECK([configured target thread model], + target_thread_file, [ +target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`]) + + if test $target_thread_file != single; then + AC_DEFINE(HAVE_GTHR_DEFAULT, 1, + [Define if the compiler has a thread header that is non single.]) + fi]) + +dnl Check for pragma weak. +AC_DEFUN([LIBGFOR_CHECK_PRAGMA_WEAK], [ + AC_CACHE_CHECK([whether pragma weak works], + have_pragma_weak, [ + gfor_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wunknown-pragmas" + AC_TRY_COMPILE([void foo (void); +#pragma weak foo], [if (foo) foo ();], + have_pragma_weak=yes, have_pragma_weak=no)]) + if test $have_pragma_weak = yes; then + AC_DEFINE(HAVE_PRAGMA_WEAK, 1, + [Define to 1 if the target supports #pragma weak]) + fi]) + dnl Check whether target can unlink a file still open. AC_DEFUN([LIBGFOR_CHECK_UNLINK_OPEN_FILE], [ AC_CACHE_CHECK([whether the target can unlink an open file], |