]> granicus.if.org Git - sudo/commitdiff
Add a check for struct timespec and provide it for those without.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 7 Sep 2004 20:36:31 +0000 (20:36 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 7 Sep 2004 20:36:31 +0000 (20:36 +0000)
compat.h
config.h.in
configure
configure.in

index 8ce97a4f9b621157bbaaa2ebb19c5fcf946971cf..471feef2a82d218ab65479ac7dbfa6ec93073894 100644 (file)
--- 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 */
index 1f1b1fcae15b0d8e0d6ddab23c6919864220692a..6991cab30a83203293f69c935335600ffd6605a0 100644 (file)
 /* Define to 1 if you have the `sigaction' function. */
 #undef HAVE_SIGACTION
 
-/* Define if <signal.h> has the sigaction_t typedef. */
+/* Define to 1 if <signal.h> has the sigaction_t typedef. */
 #undef HAVE_SIGACTION_T
 
 /* Define to 1 if the system has the type `sig_atomic_t'. */
 /* Define to 1 if you have the <termio.h> 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
 
index 72cef7c78537ae01747be0a4ee5820b2c802329c..e57ed2681a900f14ffce3f7b44094dea7617439d 100755 (executable)
--- 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 <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+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
index a373197174a33d631178106b69561f84d782e35c..d19dbe1bf436203a360a8ffb38d301887c6fcc26 100644 (file)
@@ -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 <signal.h> does not define.])], [#include <sys/types.h>
 #include <signal.h>])
-AC_CHECK_TYPES([sigaction_t], [AC_DEFINE(HAVE_SIGACTION_T, 1, [Define if <signal.h> has the sigaction_t typedef.])], ,[#include <sys/types.h>
+AC_CHECK_TYPES([sigaction_t], [AC_DEFINE(HAVE_SIGACTION_T, 1, [Define to 1 if <signal.h> has the sigaction_t typedef.])], ,[#include <sys/types.h>
 #include <signal.h>])
+AC_CHECK_TYPE([struct timespec], [AC_DEFINE(HAVE_TIMESPEC, 1, [Define to 1 if you have struct timespec in sys/time.h])], , [#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>])
 SUDO_TYPE_SIZE_T
 SUDO_TYPE_SSIZE_T
 SUDO_TYPE_DEV_T