From b681e308a281559e4489cf5ad3d2a31f1494683a Mon Sep 17 00:00:00 2001
From: rathnor <rathnor>
Date: Sun, 15 Jun 2003 12:28:37 +0000
Subject: workaround for gcc 3.3. bug - alternate strftime test

---
 ChangeLog    |  3 +++
 configure.in | 25 ++++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 7545b81..d456b3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 (Format: Year/Month/Day)
 Changes for 0.9.4:
 *03/06/15:
+   * Apply workaround for strftime test - fails with gcc 3.3 due to 
+     compiler bug? - thanks Joshua Kwan (Simon)
+     configure.in
    * Fix group cycling, also adding new "NextGroup/PrevGroup" keys (Simon)
      Screen.hh/cc Keys.hh/cc fluxbox.cc
 *03/06/13:
diff --git a/configure.in b/configure.in
index a521abd..df9e325 100644
--- a/configure.in
+++ b/configure.in
@@ -31,7 +31,30 @@ AC_HEADER_TIME
 
 dnl Check for existance of basename(), setlocale() and strftime()
 AC_CHECK_FUNCS(basename, , AC_CHECK_LIB(gen, basename, LIBS="$LIBS -lgen"))
-AC_CHECK_FUNCS(getpid setlocale sigaction strftime strcasestr snprintf vsnprintf catopen catgets catclose)
+AC_CHECK_FUNCS(getpid setlocale sigaction strcasestr snprintf vsnprintf catopen catgets catclose)
+dnl The autoconf test for strftime is broken now (due to gcc 3.3 bug?):
+dnl Gcc 3.3 testprog = ``extern "C" char strftime;'', build with g++ test.cc
+dnl breaks with:
+dnl   test.cc:1: error: nonnull argument with out-of-range operand number 
+dnl   (arg 1, operand 3)
+
+
+AC_MSG_CHECKING(for strftime)
+
+AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([#include <time.h>],
+[[
+char * s;
+time_t t = time(NULL);
+size_t x = strftime(s, 5, "%a", localtime(&t));
+]]
+)],
+[
+	AC_DEFINE(HAVE_STRFTIME, 1, [Define to 1 if you have the 'strftime' function.])
+	AC_MSG_RESULT(yes)
+],
+[AC_MSG_RESULT(no)])
+
 AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl")
 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
 
-- 
cgit v0.11.2