1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

configure: detect st_ctim

Check stat has nanosecond precision for ctim.
This commit is contained in:
Zdenek Kabelac 2015-03-18 10:52:40 +01:00
parent a10a11bd54
commit 17583f1b59
4 changed files with 53 additions and 0 deletions

View File

@ -37,6 +37,10 @@ AC_DEFUN([AC_TRY_CCFLAG],
fi
])
dnl AC_IF_YES([TEST-FOR-YES], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
dnl AS_IF() abstraction, checks shell variable for 'yes'
AC_DEFUN([AC_IF_YES], [AS_IF([test $$1 = yes], [$2], [$3])])
dnl AC_TRY_LDFLAGS([LDFLAGS], [VAR], [ACTION-IF-WORKS], [ACTION-IF-FAILS])
dnl check if $CC supports given ld flags

34
configure vendored
View File

@ -11958,6 +11958,40 @@ $as_echo "$as_me: WARNING: Disabling realtime clock" >&2;}
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat has st_ctim." >&5
$as_echo_n "checking for struct stat has st_ctim.... " >&6; }
if ${ac_cv_stat_st_ctim+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/stat.h>
long bar(void) { struct stat s; return (long)(s.st_ctim.tv_sec + s.st_ctim.tv_nsec);}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_stat_st_ctim=yes
else
ac_cv_stat_st_ctim=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_stat_st_ctim" >&5
$as_echo "$ac_cv_stat_st_ctim" >&6; }
if test $ac_cv_stat_st_ctim = yes; then :
$as_echo "#define HAVE_STAT_ST_CTIM 1" >>confdefs.h
fi
################################################################################
for ac_header in getopt.h
do :

View File

@ -1379,6 +1379,18 @@ if test "$REALTIME" = yes; then
fi
fi
dnl Check if the system has struct stat st_ctim.
AC_CACHE_CHECK([for struct stat has st_ctim.],
[ac_cv_stat_st_ctim],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[#include <sys/stat.h>
long bar(void) { struct stat s; return (long)(s.st_ctim.tv_sec + s.st_ctim.tv_nsec);}]
)], [ac_cv_stat_st_ctim=yes], [ac_cv_stat_st_ctim=no])])
AC_IF_YES(ac_cv_stat_st_ctim,
AC_DEFINE(HAVE_STAT_ST_CTIM, 1,
[Define if struct stat has a field st_ctim with timespec for ctime]))
################################################################################
dnl -- Check for getopt
AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getopt_long is available.]))

View File

@ -322,6 +322,9 @@
zero-length file name argument. */
#undef HAVE_STAT_EMPTY_STRING_BUG
/* Define if struct stat has a field st_ctim with timespec for ctime */
#undef HAVE_STAT_ST_CTIM
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H