From 74db070b78c58369e0ec6cb1392048bedc165a9a Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Fri, 2 Jul 2010 10:51:24 +0200 Subject: [PATCH 6/7] [autotools] Check for declaration of gettimeofday() The function gettimeofday() is not declared in ansi mode with the mingw compiler, even though the function exists. Therefore, configure must not only check with AC_CHECK_FUNC, but also with AC_CHECK_DECL. Also, the checks must run in a C++ context because that is where gettimeofday() is used. --- configure.ac | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index bcf0ddc..6b2e86d 100644 --- a/configure.ac +++ b/configure.ac @@ -29,9 +29,6 @@ if test "x$GXX" = "xyes"; then CXXFLAGS="$CXXFLAGS -ansi" fi AC_PROG_INSTALL -AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defines if gettimeofday is available on your system])) -AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R, 1, [Defines if localtime_r is available on your system])) -AC_CHECK_FUNC(gmtime_r, AC_DEFINE(HAVE_GMTIME_R, 1, [Defines if gmtime_r is available on your system])) dnl ##### Check for pkgconfig PKG_PROG_PKG_CONFIG @@ -120,6 +117,10 @@ dnl ##### bit stricter (requiring function prototypes in include files). dnl ##### (99% of xpdf is written in C++.) AC_LANG_CPLUSPLUS +AC_CHECK_DECL(gettimeofday, [AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defines if gettimeofday is available on your system]))],[],[#include ]) +AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R, 1, [Defines if localtime_r is available on your system])) +AC_CHECK_FUNC(gmtime_r, AC_DEFINE(HAVE_GMTIME_R, 1, [Defines if gmtime_r is available on your system])) + dnl ##### Check for extra libraries needed by X. (LynxOS needs this.) AC_CHECK_FUNC(gethostbyname) if test $ac_cv_func_gethostbyname = no; then -- 1.6.4.2