[kaffe] CVS kaffe (dalibor): Updated check for struct tm.tm_zone

Kaffe CVS cvs-commits at kaffe.org
Sun Jul 18 12:47:39 PDT 2004


PatchSet 4984 
Date: 2004/07/18 17:46:03
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Updated check for struct tm.tm_zone

2004-07-18  Dalibor Topic  <robilad at kaffe.org>

        * configure.ac:
        Use AC_CHECK_MEMBERS to check for struct tm.tm_zone.

        * configure,
        config/config.h.in:
        Regenerated.

        * libraries/clib/native/TimeZone.c:
        (java_util_TimeZone_getDefaultTimeZoneId) Use
        HAVE_STRUCT_TM_TM_ZONE in guard condition.

Members: 
	ChangeLog:1.2548->1.2549 
	configure:1.357->1.358 
	configure.ac:1.55->1.56 
	config/config.h.in:1.119->1.120 
	libraries/clib/native/TimeZone.c:1.3->1.4 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2548 kaffe/ChangeLog:1.2549
--- kaffe/ChangeLog:1.2548	Sun Jul 18 17:03:30 2004
+++ kaffe/ChangeLog	Sun Jul 18 17:46:03 2004
@@ -1,3 +1,16 @@
+2004-07-18  Dalibor Topic  <robilad at kaffe.org>
+
+        * configure.ac:
+	Use AC_CHECK_MEMBERS to check for struct tm.tm_zone.
+
+        * configure,
+        config/config.h.in:
+	Regenerated.
+
+        * libraries/clib/native/TimeZone.c:
+	(java_util_TimeZone_getDefaultTimeZoneId) Use 
+	HAVE_STRUCT_TM_TM_ZONE in guard condition.
+
 2004-07-18  Jim Huang  <jserv at kaffe.org>
 
 	* po/zh_TW.po:
Index: kaffe/configure
diff -u kaffe/configure:1.357 kaffe/configure:1.358
--- kaffe/configure:1.357	Sun Jul 18 15:27:26 2004
+++ kaffe/configure	Sun Jul 18 17:46:06 2004
@@ -50395,6 +50395,127 @@
 fi
 
 
+echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5
+echo $ECHO_N "checking for struct tm.tm_zone... $ECHO_C" >&6
+if test "${ac_cv_member_struct_tm_tm_zone+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#if defined(HAVE_TIME_H)
+#include <time.h>
+#endif
+
+
+int
+main ()
+{
+static struct tm ac_aggr;
+if (ac_aggr.tm_zone)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_tm_tm_zone=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#if defined(HAVE_TIME_H)
+#include <time.h>
+#endif
+
+
+int
+main ()
+{
+static struct tm ac_aggr;
+if (sizeof ac_aggr.tm_zone)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_member_struct_tm_tm_zone=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_tm_tm_zone=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5
+echo "${ECHO_T}$ac_cv_member_struct_tm_tm_zone" >&6
+if test $ac_cv_member_struct_tm_tm_zone = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_TM_TM_ZONE 1
+_ACEOF
+
+
+fi
+
+
 KSAVE_LIBS="$LIBS"
 LIBS="$M_LIBS $LIBS"
 
@@ -52518,74 +52639,6 @@
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE__VA_COPY 1
-_ACEOF
-
-fi
-
-
-echo "$as_me:$LINENO: checking for declaration of tm_zone in struct tm" >&5
-echo $ECHO_N "checking for declaration of tm_zone in struct tm... $ECHO_C" >&6
-if test "${ac_cv_declared_tm_zone+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-
-int
-main ()
-{
- struct tm conftime; conftime.tm_zone = NULL;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_declared_tm_zone=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_declared_tm_zone=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_declared_tm_zone" >&5
-echo "${ECHO_T}$ac_cv_declared_tm_zone" >&6
-
-if test x"$ac_cv_declared_tm_zone" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DECLARED_TM_ZONE 1
 _ACEOF
 
 fi
Index: kaffe/configure.ac
diff -u kaffe/configure.ac:1.55 kaffe/configure.ac:1.56
--- kaffe/configure.ac:1.55	Sun Jul 18 15:27:35 2004
+++ kaffe/configure.ac	Sun Jul 18 17:46:11 2004
@@ -1351,6 +1351,13 @@
 #endif
 ])
 
+dnl some Solaris systems don't have a tm_zone member in struct tm.
+AC_CHECK_MEMBERS([struct tm.tm_zone],,,[
+#if defined(HAVE_TIME_H)
+#include <time.h>
+#endif
+])
+
 KSAVE_LIBS="$LIBS"
 LIBS="$M_LIBS $LIBS"
 AC_CHECK_FUNCS([remainder remainderf fmod fmodf drem])
@@ -1491,25 +1498,6 @@
 AC_FUNC__VA_COPY
 
 dnl -------------------------------------------------------------------------
-
-dnl =========================================================================
-dnl Work out if struct tm contains tm_zone
-dnl -------------------------------------------------------------------------
-AC_CACHE_CHECK([for declaration of tm_zone in struct tm],
-  ac_cv_declared_tm_zone,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-]], [[ struct tm conftime; conftime.tm_zone = NULL; ]])],
-    [ac_cv_declared_tm_zone=yes],
-    [ac_cv_declared_tm_zone=no])
-])
-
-if test x"$ac_cv_declared_tm_zone" = x"yes"; then
-   AC_DEFINE(HAVE_DECLARED_TM_ZONE, 1, [Is tm_zone declared in struct tm ?])
-fi
-
 
 dnl =========================================================================
 dnl Work out if select is declared
Index: kaffe/config/config.h.in
diff -u kaffe/config/config.h.in:1.119 kaffe/config/config.h.in:1.120
--- kaffe/config/config.h.in:1.119	Sun Jul 18 15:27:37 2004
+++ kaffe/config/config.h.in	Sun Jul 18 17:46:12 2004
@@ -77,9 +77,6 @@
 /* Is function swab declared */
 #undef HAVE_DECLARED_SWAB
 
-/* Is tm_zone declared in struct tm ? */
-#undef HAVE_DECLARED_TM_ZONE
-
 /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
    */
 #undef HAVE_DIRENT_H
Index: kaffe/libraries/clib/native/TimeZone.c
diff -u kaffe/libraries/clib/native/TimeZone.c:1.3 kaffe/libraries/clib/native/TimeZone.c:1.4
--- kaffe/libraries/clib/native/TimeZone.c:1.3	Sat Jul 17 15:33:37 2004
+++ kaffe/libraries/clib/native/TimeZone.c	Sun Jul 18 17:46:13 2004
@@ -24,17 +24,17 @@
 java_util_TimeZone_getDefaultTimeZoneId(void)
 {
 	        char *tempZoneName = NULL;
-#ifdef HAVE_DECLARED_TM_ZONE
+#if defined(HAVE_STRUCT_TM_TM_ZONE)
 	        struct tm *tempTimeStruct;
 	        time_t tempTimeArithm;
 
 	        tempTimeArithm = 0;
 	        tempTimeStruct = localtime (&tempTimeArithm);
 	        tempZoneName = tempTimeStruct->tm_zone;
-#else
+#else /* ! defined(HAVE_STRUCT_TM_TM_ZONE) */
 	        tzset();
 	        tempZoneName = tzname[0];  /* read above for this external symbol */
-#endif
+#endif /* defined(HAVE_STRUCT_TM_TM_ZONE) */
 	        assert(tempZoneName != NULL);
 	        return stringC2Java(tempZoneName);
 }




More information about the kaffe mailing list