From: oetiker Date: Thu, 23 Jun 2011 05:45:36 +0000 (+0000) Subject: Fix for #304: checking for time_t is done with AC_RUN_IFELSE which fails when cross... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6ed43d1871dec39e4538d3698e3a350b2f8358d8;p=rrdtool-all.git Fix for #304: checking for time_t is done with AC_RUN_IFELSE which fails when cross-compiling. The size of time_t can be detected with AC_CHECK_SIZEOF. -- Michael Olbrich git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@2186 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/configure.ac b/program/configure.ac index a5c9eaa3..10603bdb 100644 --- a/program/configure.ac +++ b/program/configure.ac @@ -499,27 +499,16 @@ dnl is time_t 32 of 64 bit ? AC_DEFINE([TIME_T_IS_32BIT], [], [time_t is 32bit]) AC_DEFINE([TIME_T_IS_64BIT], [], [time_t is 64bit]) AC_MSG_CHECKING([the type of time_t]) -AC_RUN_IFELSE( - AC_LANG_PROGRAM( - [[#include ]], - [[if (sizeof(time_t) != 4) return 1; ]] - ), - [ AC_MSG_RESULT([time_t is 32 bit]) - AC_DEFINE([TIME_T_IS_32BIT]) - ], - [ AC_RUN_IFELSE( - AC_LANG_PROGRAM( - [[#include ]], - [[if (sizeof(time_t) != 8) return 1; ]] - ), - [ - AC_MSG_RESULT([time_t is 64 bit]) - AC_DEFINE([TIME_T_IS_64BIT]) - ], - [AC_MSG_ERROR([can not figure type of time_t])] - ) - ] -) +AC_CHECK_SIZEOF([time_t]) +if test "x$ac_cv_sizeof_time_t" = "x4"; then + AC_MSG_RESULT([time_t is 32 bit]) + AC_DEFINE([TIME_T_IS_32BIT]) +elif test "x$ac_cv_sizeof_time_t" = "x8"; then + AC_MSG_RESULT([time_t is 64 bit]) + AC_DEFINE([TIME_T_IS_64BIT]) +else + AC_MSG_ERROR([can not figure type of time_t]) +fi AC_LANG_POP(C)