[Python-checkins] python/dist/src configure.in, 1.481, 1.482 configure, 1.468, 1.469

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Thu Feb 10 21:48:27 CET 2005


Update of /cvsroot/python/python/dist/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7187

Modified Files:
	configure.in configure 
Log Message:
Modified test for tzset to not rely on tm->tm_zone's existence.  Also added
sanity checks on tzname if HAVE_TZNAME defined.

Closes bug #1096244.  Thanks Gregory Bond.


Index: configure.in
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure.in,v
retrieving revision 1.481
retrieving revision 1.482
diff -u -d -r1.481 -r1.482
--- configure.in	23 Jan 2005 09:27:22 -0000	1.481
+++ configure.in	10 Feb 2005 20:45:37 -0000	1.482
@@ -2917,45 +2917,74 @@
       [Define if poll() sets errno on invalid file descriptors.])
 fi
 
+# Before we can test tzset, we need to check if struct tm has a tm_zone 
+# (which is not required by ISO C or UNIX spec) and/or if we support
+# tzname[]
+AC_STRUCT_TIMEZONE
 
-# tzset(3) exists and works like we expect it to
+# check tzset(3) exists and works like we expect it to
 AC_MSG_CHECKING(for working tzset())
 AC_CACHE_VAL(ac_cv_working_tzset, [
 AC_TRY_RUN([
 #include <stdlib.h>
 #include <time.h>
 #include <string.h>
+
+#if HAVE_TZNAME
+extern char *tzname[];
+#endif
+
 int main()
 {
 	/* Note that we need to ensure that not only does tzset(3)
 	   do 'something' with localtime, but it works as documented
 	   in the library reference and as expected by the test suite.
+	   This includes making sure that tzname is set properly if
+	   tm->tm_zone does not exist since it is the alternative way
+	   of getting timezone info.
 
 	   Red Hat 6.2 doesn't understand the southern hemisphere 
-	   after New Year's Day; it thinks swaps on that day.
+	   after New Year's Day.
 	*/
 
-	time_t groundhogday = 1044144000; /* GMT-based; well, it's a colony */
+	time_t groundhogday = 1044144000; /* GMT-based */
 	time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
 
 	putenv("TZ=UTC+0");
 	tzset();
 	if (localtime(&groundhogday)->tm_hour != 0)
 	    exit(1);
+#if HAVE_TZNAME
+	/* For UTC, tzname[1] is sometimes "", sometimes "   " */
+	if (strcmp(tzname[0], "UTC") || 
+		(tzname[1][0] != 0 && tzname[1][0] != ' '))
+	    exit(1);
+#endif
 
 	putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
 	tzset();
 	if (localtime(&groundhogday)->tm_hour != 19)
 	    exit(1);
+#if HAVE_TZNAME
+	if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
+	    exit(1);
+#endif
 
 	putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
 	tzset();
 	if (localtime(&groundhogday)->tm_hour != 11)
 	    exit(1);
+#if HAVE_TZNAME
+	if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
+	    exit(1);
+#endif
+
+#if HAVE_STRUCT_TM_TM_ZONE
 	if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
 	    exit(1);
 	if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
 	    exit(1);
+#endif
 
 	exit(0);
 }

Index: configure
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure,v
retrieving revision 1.468
retrieving revision 1.469
diff -u -d -r1.468 -r1.469
--- configure	23 Jan 2005 09:27:17 -0000	1.468
+++ configure	10 Feb 2005 20:45:41 -0000	1.469
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.480 .
+# From configure.in Revision: 1.481 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59 for python 2.5.
 #
@@ -976,7 +976,7 @@
     else
       echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
     fi
-    cd "$ac_popdir"
[...2278 lines suppressed...]
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
   # Let's still pretend it is `configure' which instantiates (i.e., don't
   # use $as_me), people would be surprised to read:
   #    /* config.h.  Generated by config.status.  */
@@ -20854,12 +21282,6 @@
 	 fi;;
       esac
     done` || { (exit 1); exit 1; }
-
-  if test x"$ac_file" != x-; then
-    { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    rm -f "$ac_file"
-  fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
   sed "$ac_vpsub



More information about the Python-checkins mailing list