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