From: Todd C. Miller Date: Tue, 7 Sep 2004 20:36:31 +0000 (+0000) Subject: Add a check for struct timespec and provide it for those without. X-Git-Tag: SUDO_1_6_8p1~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=54789c8fbdc9bb0585a9e9c6a39f2c1ad52b76c3;p=sudo Add a check for struct timespec and provide it for those without. --- diff --git a/compat.h b/compat.h index 8ce97a4f9..471feef2a 100644 --- a/compat.h +++ b/compat.h @@ -232,4 +232,11 @@ const char *getprogname __P((void)); #endif /* HAVE___PROGNAME */ #endif /* !HAVE_GETPROGNAME */ +#ifndef HAVE_TIMESPEC +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +#endif /* !HAVE_TIMESPEC */ + #endif /* _SUDO_COMPAT_H */ diff --git a/config.h.in b/config.h.in index 1f1b1fcae..6991cab30 100644 --- a/config.h.in +++ b/config.h.in @@ -261,7 +261,7 @@ /* Define to 1 if you have the `sigaction' function. */ #undef HAVE_SIGACTION -/* Define if has the sigaction_t typedef. */ +/* Define to 1 if has the sigaction_t typedef. */ #undef HAVE_SIGACTION_T /* Define to 1 if the system has the type `sig_atomic_t'. */ @@ -348,6 +348,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_TERMIO_H +/* Define to 1 if you have struct timespec in sys/time.h. */ +#undef HAVE_TIMESPEC + /* Define to 1 if you have the `tzset' function. */ #undef HAVE_TZSET diff --git a/configure b/configure index 72cef7c78..e57ed2681 100755 --- a/configure +++ b/configure @@ -24172,6 +24172,64 @@ _ACEOF fi +echo "$as_me:$LINENO: checking for struct timespec" >&5 +echo $ECHO_N "checking for struct timespec... $ECHO_C" >&6 +if test "${ac_cv_type_struct_timespec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include + +int +main () +{ +if ((struct timespec *) 0) + return 0; +if (sizeof (struct timespec)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_struct_timespec=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_timespec=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_struct_timespec" >&5 +echo "${ECHO_T}$ac_cv_type_struct_timespec" >&6 +if test $ac_cv_type_struct_timespec = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TIMESPEC 1 +_ACEOF + +fi + echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 if test "${sudo_cv_type_size_t+set}" = set; then diff --git a/configure.in b/configure.in index a37319717..d19dbe1bf 100644 --- a/configure.in +++ b/configure.in @@ -1662,8 +1662,11 @@ AC_TYPE_MODE_T AC_TYPE_UID_T AC_CHECK_TYPES([sig_atomic_t], , [AC_DEFINE(sig_atomic_t, int, [Define to `int' if does not define.])], [#include #include ]) -AC_CHECK_TYPES([sigaction_t], [AC_DEFINE(HAVE_SIGACTION_T, 1, [Define if has the sigaction_t typedef.])], ,[#include +AC_CHECK_TYPES([sigaction_t], [AC_DEFINE(HAVE_SIGACTION_T, 1, [Define to 1 if has the sigaction_t typedef.])], ,[#include #include ]) +AC_CHECK_TYPE([struct timespec], [AC_DEFINE(HAVE_TIMESPEC, 1, [Define to 1 if you have struct timespec in sys/time.h])], , [#include +#include +#include ]) SUDO_TYPE_SIZE_T SUDO_TYPE_SSIZE_T SUDO_TYPE_DEV_T