comparison m4/fdatasync.m4 @ 40132:6bcaf5dcb02b

fdatasync: Fix compilation error on Android 4.3. * m4/fdatasync.m4 (gl_FUNC_FDATASYNC): On platforms other than Solaris, test whether fdatasync() exists.
author Bruno Haible <bruno@clisp.org>
date Fri, 25 Jan 2019 00:15:50 +0100
parents b06060465f09
children
comparison
equal deleted inserted replaced
40131:9c7eed94d112 40132:6bcaf5dcb02b
1 # fdatasync.m4 serial 4 1 # fdatasync.m4 serial 5
2 dnl Copyright (C) 2008-2019 Free Software Foundation, Inc. 2 dnl Copyright (C) 2008-2019 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation 3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it, 4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved. 5 dnl with or without modifications, as long as this notice is preserved.
6 6
7 AC_DEFUN([gl_FUNC_FDATASYNC], 7 AC_DEFUN([gl_FUNC_FDATASYNC],
8 [ 8 [
9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) 9 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
10 AC_REQUIRE([AC_CANONICAL_HOST])
10 11
11 dnl Using AC_CHECK_FUNCS_ONCE would break our subsequent AC_SEARCH_LIBS 12 dnl Using AC_CHECK_FUNCS_ONCE would break our subsequent AC_SEARCH_LIBS
12 AC_CHECK_DECLS_ONCE([fdatasync]) 13 AC_CHECK_DECLS_ONCE([fdatasync])
13 LIB_FDATASYNC= 14 LIB_FDATASYNC=
14 AC_SUBST([LIB_FDATASYNC]) 15 AC_SUBST([LIB_FDATASYNC])
19 AC_CHECK_FUNCS([fdatasync]) 20 AC_CHECK_FUNCS([fdatasync])
20 if test $ac_cv_func_fdatasync = no; then 21 if test $ac_cv_func_fdatasync = no; then
21 HAVE_FDATASYNC=0 22 HAVE_FDATASYNC=0
22 fi 23 fi
23 else 24 else
24 dnl Solaris <= 2.6 has fdatasync() in libposix4. 25 case "$host_os" in
25 dnl Solaris 7..10 has it in librt. 26 solaris*)
26 gl_saved_libs=$LIBS 27 dnl Solaris <= 2.6 has fdatasync() in libposix4.
27 AC_SEARCH_LIBS([fdatasync], [rt posix4], 28 dnl Solaris 7..10 has it in librt.
28 [test "$ac_cv_search_fdatasync" = "none required" || 29 gl_saved_libs=$LIBS
29 LIB_FDATASYNC=$ac_cv_search_fdatasync]) 30 AC_SEARCH_LIBS([fdatasync], [rt posix4],
30 LIBS=$gl_saved_libs 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
31 fi 43 fi
32 ]) 44 ])