Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > strftime on Cygwin

Reply
Thread Tools

strftime on Cygwin

 
 
Corinna Vinschen
Guest
Posts: n/a
 
      01-08-2008
[Please use the NG for replies. Thanks in advance.]

Hi,

with Cygwin 1.5.25 I removed the link time reference to the non-standard
timezone() function in Cygwin. Old applications are still able to use
it, but you don't get to it when building new applications. Rather
timezone is now always a variable for newly build apps, as required by
POSIX.

However, the drawback is that suddenly ruby 1.8.6 doesn't build anymore.

Ruby on Cygwin uses the replacement function of strftime defined in
missing/strftime.c. This function uses the timezone() function when
built on Cygwin.

While this seems to be fixed using finer grained configure checking in
the stable snapshots on the first glance, the created code is actually
doing nothing for the %Z format specifier. From `gcc -E strftime.c':

[...]
case 'Z':
# 469 "./missing/strftime.c"
break;

So the problem persists, just differently.

The question is this: Why is Ruby on Cygwin using its own strftime at
all, instead of using Cygwin's strftime?

While looking into this, I found that Configure.in makes a few
assumptions about Cygwin which are incorrect:

cygwin*) rb_cv_have_daylight=no
ac_cv_var_tzname=no
ac_cv_func__setjmp=no
ac_cv_func_setitimer=no
;;

and later:

cygwin*)
[...]
AC_LIBOBJ([strftime])
;;

All of the above should actually go away. Cygwin has the daylight
variable, tzname, _setjmp, setitimer, and, last but not least, strftime,
which has a POSIX compliant implementation of %Z.

Given that, I'd like to propose the below patch. It's against the
stable release 1.8.6-p111, but AFAICS, it applies cleanly to
configure.in from the stable snapshot as well, just with offsets.

--- configure.in.ORIG 2008-01-08 13:11:13.583867700 +0100
+++ configure.in 2008-01-08 13:11:21.944438700 +0100
@@ -372,11 +372,7 @@ human*) ac_cv_func_getpgrp_void=yes
ac_cv_func_setitimer=no
;;
beos*) ac_cv_func_link=no;;
-cygwin*) rb_cv_have_daylight=no
- ac_cv_var_tzname=no
- ac_cv_func__setjmp=no
- ac_cv_func_setitimer=no
- ;;
+cygwin*) ;;
mingw*) if test "$with_winsock2" = yes; then
LIBS="-lws2_32 $LIBS"
else
@@ -1461,7 +1457,6 @@ case "$target_os" in
LIBRUBY_SO='cyg$(RUBY_SO_NAME)'${MAJOR}${MINOR}.dl l
LIBRUBY='lib$(RUBY_SO_NAME).dll.a'
fi
- AC_LIBOBJ([strftime])
;;
mingw*)
RUBY_SO_NAME=${rb_cv_msvcrt}-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR}

If it's not ok to disable Ruby's own implementation of strftime on
Cygwin for some reason, then you should at least get rid of these two
lines in configure.in:

rb_cv_have_daylight=no
ac_cv_var_tzname=no

This results in a correct compilation of missing/strftime.c in the
stable snapshot. The old missing/strftime.c in 1.8.6-p111 will still
not build, though.


Thanks,
Corinna

--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
strftime not working as expected Bryan O'Malley C++ 8 02-17-2004 08:34 AM
confirm unsubscribe from cygwin@cygwin.com cygwin-help@cygwin.com Python 0 09-05-2003 04:42 PM
WELCOME to cygwin@cygwin.com cygwin-help@cygwin.com Python 1 09-05-2003 07:46 AM
confirm unsubscribe from cygwin-announce@cygwin.com cygwin-announce-help@cygwin.com Python 0 09-05-2003 01:29 AM
confirm unsubscribe from cygwin@cygwin.com cygwin-help@cygwin.com Python 0 09-04-2003 06:34 PM



Advertisments