| 1 | # fdatasync.m4 serial 4 |
| 2 | dnl Copyright (C) 2008-2014 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. |
| 6 | |
| 7 | AC_DEFUN([gl_FUNC_FDATASYNC], |
| 8 | [ |
| 9 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) |
| 10 | |
| 11 | dnl Using AC_CHECK_FUNCS_ONCE would break our subsequent AC_SEARCH_LIBS |
| 12 | AC_CHECK_DECLS_ONCE([fdatasync]) |
| 13 | LIB_FDATASYNC= |
| 14 | AC_SUBST([LIB_FDATASYNC]) |
| 15 | |
| 16 | if test $ac_cv_have_decl_fdatasync = no; then |
| 17 | HAVE_DECL_FDATASYNC=0 |
| 18 | dnl Mac OS X 10.7 has fdatasync but does not declare it. |
| 19 | AC_CHECK_FUNCS([fdatasync]) |
| 20 | if test $ac_cv_func_fdatasync = no; then |
| 21 | HAVE_FDATASYNC=0 |
| 22 | fi |
| 23 | else |
| 24 | dnl Solaris <= 2.6 has fdatasync() in libposix4. |
| 25 | dnl Solaris 7..10 has it in librt. |
| 26 | gl_saved_libs=$LIBS |
| 27 | AC_SEARCH_LIBS([fdatasync], [rt posix4], |
| 28 | [test "$ac_cv_search_fdatasync" = "none required" || |
| 29 | LIB_FDATASYNC=$ac_cv_search_fdatasync]) |
| 30 | LIBS=$gl_saved_libs |
| 31 | fi |
| 32 | ]) |