--- configure.ac.orig
+++ configure.ac
@@ -137,22 +137,29 @@ AC_FUNC_MMAP()
 dnl ***************************************
 dnl *** Check for strftime() extensions ***
 dnl ***************************************
-AC_TRY_RUN([
-  #include <string.h>
-  #include <time.h>
-  int
-  main (int argc, char **argv)
-  {
-    struct tm tm;
-    char      buffer[16];
-    tm.tm_year = 81;
-    if (strftime (buffer, 16, "%EY", &tm) == 4 && strcmp (buffer, "1981") == 0)
-      return 0;
-    return 1;
-  }
-], [
+AC_CACHE_CHECK([Define if strftime supports %E and %O modifiers], ac_cv_strftime_extensions,
+  [AC_TRY_RUN([
+    #include <string.h>
+    #include <time.h>
+    int
+    main (int argc, char **argv)
+    {
+      struct tm tm;
+      char      buffer[16];
+      tm.tm_year = 81;
+      if (strftime (buffer, 16, "%EY", &tm) == 4 && strcmp (buffer, "1981") == 0)
+        return 0;
+      return 1;
+    }
+  ],
+  ac_cv_strftime_extensions=yes,
+  ac_cv_strftime_extensions=no,
+  [AC_MSG_ERROR([cross-compiling, preset ac_cv_strftime_extensions=yes/no])]
+  )]
+)
+if test x"$ac_cv_strftime_extensions" = x"yes"; then
   AC_DEFINE([HAVE_STRFTIME_EXTENSION], 1, [Define if strftime supports %E and %O modifiers.])
-])
+fi
 
 dnl ******************************
 dnl *** Check for i18n support ***
