From 6e9ebc2a9f013ea5ae5b87fd73787c9b9b3646d6 Mon Sep 17 00:00:00 2001
From: unknown <df@pippilotta.erinye.com>
Date: Fri, 9 Mar 2007 10:17:21 +0100
Subject: [PATCH] BUG#25601 Missing m4 macro MYSQL_CHECK_TIME_T

config/ac-macros/misc.m4:
  BUG#25601 MYSQL_CHECK_TIME_T macro is missing in 5.0 and upward, likely incorrectly merged up from 4.1. This patch is a verbatim copy from 4.1's acinclude.m4 (except for typos in comment).
---
 config/ac-macros/misc.m4 | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4
index d8199f5970e..09081fb3eac 100644
--- a/config/ac-macros/misc.m4
+++ b/config/ac-macros/misc.m4
@@ -790,3 +790,27 @@ esac
 AC_SUBST(AR)
 AC_SUBST(ARFLAGS)
 ])
+
+dnl
+dnl  Macro to check time_t range: according to C standard
+dnl  array index must be greater than 0 => if time_t is signed,
+dnl  the code in the macros below won't compile.
+dnl
+
+AC_DEFUN([MYSQL_CHECK_TIME_T],[
+    AC_MSG_CHECKING(if time_t is unsigned)
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+        [[
+#include <time.h>
+        ]],
+        [[
+        int array[(((time_t)-1) > 0) ? 1 : -1];
+        ]] )
+    ], [
+    AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
+    AC_MSG_RESULT(yes)
+    ],
+    [AC_MSG_RESULT(no)]
+    )
+])
+