summaryrefslogtreecommitdiffstats
path: root/m4/st_tim.m4
blob: aa790b63e7eca12b7702ac08f7253d276d92c3a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
AC_DEFUN([DOVECOT_ST_TIM_TIMESPEC], [
  AC_CACHE_CHECK([if struct stat has st_?tim timespec fields],i_cv_have_st_tim_timespec,[
    AC_TRY_COMPILE([
      #include <sys/types.h>
      #include <sys/stat.h>
      #include <unistd.h>
    ], [
      struct stat st;
      unsigned long x = st.st_mtim.tv_nsec;
  
      return 0;
    ], [
      i_cv_have_st_tim_timespec=yes
    ], [
      i_cv_have_st_tim_timespec=no
    ])
  ])
  if test $i_cv_have_st_tim_timespec = yes; then
    AC_DEFINE(HAVE_STAT_XTIM,, [Define if you have st_?tim timespec fields in struct stat])
  fi

  AC_CACHE_CHECK([if struct stat has st_?timespec fields],i_cv_have_st_timespec,[
    AC_TRY_COMPILE([
      #include <sys/types.h>
      #include <sys/stat.h>
      #include <unistd.h>
    ], [
      struct stat st;
      unsigned long x = st.st_mtimespec.tv_nsec;
  
      return 0;
    ], [
      i_cv_have_st_timespec=yes
    ], [
      i_cv_have_st_timespec=no
    ])
  ])
  if test $i_cv_have_st_timespec = yes; then
    AC_DEFINE(HAVE_STAT_XTIMESPEC,, [Define if you have st_?timespec fields in struct stat])
  fi
])