ruby-changes:2890
From: ko1@a...
Date: 21 Dec 2007 12:03:45 +0900
Subject: [ruby-changes:2890] akr - Ruby:r14382 (trunk): * configure.in: check langinfo.h and locale.h.
akr 2007-12-21 12:03:29 +0900 (Fri, 21 Dec 2007)
New Revision: 14382
Modified files:
trunk/ChangeLog
trunk/configure.in
trunk/encoding.c
trunk/main.c
Log:
* configure.in: check langinfo.h and locale.h.
* encoding.c: use langinfo.h only if available.
* main.c: use locale.h only if available.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14382&r2=14381
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/encoding.c?r1=14382&r2=14381
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/configure.in?r1=14382&r2=14381
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/main.c?r1=14382&r2=14381
Index: encoding.c
===================================================================
--- encoding.c (revision 14381)
+++ encoding.c (revision 14382)
@@ -14,7 +14,9 @@
#include "ruby/encoding.h"
#include "regenc.h"
#include <ctype.h>
+#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
+#endif
static ID id_encoding, id_based_encoding;
static VALUE rb_cEncoding;
@@ -707,9 +709,13 @@
VALUE
rb_locale_charmap(VALUE klass)
{
+#ifdef HAVE_LANGINFO_H
char *codeset;
codeset = nl_langinfo(CODESET);
return rb_str_new2(codeset);
+#else
+ return rb_str_new2("ASCII-8BIT");
+#endif
}
static void
Index: configure.in
===================================================================
--- configure.in (revision 14381)
+++ configure.in (revision 14382)
@@ -530,7 +530,7 @@
fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
syscall.h pwd.h grp.h a.out.h utime.h memory.h direct.h sys/resource.h \
sys/mkdev.h sys/utime.h netinet/in_systm.h float.h ieeefp.h pthread.h \
- ucontext.h intrinsics.h)
+ ucontext.h intrinsics.h langinfo.h locale.h)
dnl Check additional types.
AC_CHECK_SIZEOF(rlim_t, 0, [
Index: ChangeLog
===================================================================
--- ChangeLog (revision 14381)
+++ ChangeLog (revision 14382)
@@ -1,3 +1,11 @@
+Fri Dec 21 12:00:34 2007 Tanaka Akira <akr@f...>
+
+ * configure.in: check langinfo.h and locale.h.
+
+ * encoding.c: use langinfo.h only if available.
+
+ * main.c: use locale.h only if available.
+
Fri Dec 21 11:47:56 2007 Tanaka Akira <akr@f...>
* encoding.c: include locale.h
Index: main.c
===================================================================
--- main.c (revision 14381)
+++ main.c (revision 14382)
@@ -12,7 +12,9 @@
#undef RUBY_EXPORT
#include "ruby/ruby.h"
+#ifdef LOCALE_H
#include <locale.h>
+#endif
RUBY_GLOBAL_SETUP
@@ -23,7 +25,9 @@
extern void ruby_set_debug_option(const char *);
ruby_set_debug_option(getenv("RUBY_DEBUG"));
#endif
+#ifdef LOCALE_H
setlocale(LC_CTYPE, "");
+#endif
ruby_sysinit(&argc, &argv);
{
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml