ruby-changes:21125
From: nobu <ko1@a...>
Date: Sat, 3 Sep 2011 23:56:45 +0900 (JST)
Subject: [ruby-changes:21125] nobu:r33174 (trunk): * configure.in (sizeof_struct_dirent_too_small): check if struct
nobu 2011-09-03 23:56:26 +0900 (Sat, 03 Sep 2011) New Revision: 33174 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33174 Log: * configure.in (sizeof_struct_dirent_too_small): check if struct dirent.d_name is too small. Modified files: trunk/ChangeLog trunk/configure.in Index: configure.in =================================================================== --- configure.in (revision 33173) +++ configure.in (revision 33174) @@ -933,15 +933,6 @@ AS_CASE(["$target_os"],[*bsd*|dragonfly*],[],[ac_cv_func_daemon=no]) AS_CASE(["$target_os"], -[solaris*], [ - AC_DEFINE(SIZEOF_STRUCT_DIRENT_TOO_SMALL, 1) - LIBS="-lm $LIBS" - ], -# GNU Hurd -[gnu*], [ - AC_DEFINE(SIZEOF_STRUCT_DIRENT_TOO_SMALL, 1) - LIBS="-lm $LIBS" - ], [nextstep*], [ ], [openstep*], [ ], [rhapsody*], [ ], @@ -1734,6 +1725,38 @@ RUBY_CHECK_SIZEOF([struct stat.st_ino], [long "long long"], [], [@%:@include <sys/stat.h>]) +AC_CACHE_CHECK([whether struct dirent.d_name is too small], rb_cv_sizeof_struct_dirent_too_small, + [AC_COMPILE_IFELSE( + [AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([ +@%:@if defined _WIN32 +@%:@ error <<<struct direct in win32/dir.h has variable length d_name>>> +@%:@elif defined HAVE_DIRENT_H +@%:@ include <dirent.h> +@%:@elif defined HAVE_DIRECT_H +@%:@ include <direct.h> +@%:@else +@%:@ define dirent direct +@%:@ if HAVE_SYS_NDIR_H +@%:@ include <sys/ndir.h> +@%:@ endif +@%:@ if HAVE_SYS_DIR_H +@%:@ include <sys/dir.h> +@%:@ endif +@%:@ if HAVE_NDIR_H +@%:@ include <ndir.h> +@%:@ endif +@%:@endif +@%:@include <stddef.h> +@%:@define numberof(array) [(int)(sizeof(array) / sizeof((array)[0]))] +struct dirent d; +])], + [offsetof(struct dirent, [d_name[numberof(d.d_name)]]) - offsetof(struct dirent, d_name) < 256])], + [rb_cv_sizeof_struct_dirent_too_small=yes], + [rb_cv_sizeof_struct_dirent_too_small=no])]) +if test "$rb_cv_sizeof_struct_dirent_too_small" = yes; then + AC_DEFINE(SIZEOF_STRUCT_DIRENT_TOO_SMALL, 1) +fi + if test "$ac_cv_func_sysconf" = yes; then AC_DEFUN([RUBY_CHECK_SYSCONF], [dnl AC_CACHE_CHECK([whether _SC_$1 is supported], rb_cv_have_sc_[]m4_tolower($1), Index: ChangeLog =================================================================== --- ChangeLog (revision 33173) +++ ChangeLog (revision 33174) @@ -1,5 +1,8 @@ -Sat Sep 3 23:55:17 2011 Nobuyoshi Nakada <nobu@r...> +Sat Sep 3 23:56:24 2011 Nobuyoshi Nakada <nobu@r...> + * configure.in (sizeof_struct_dirent_too_small): check if struct + dirent.d_name is too small. + * configure.in (RUBY_MINGW32): take tool prefix from CC. Sat Sep 3 23:52:08 2011 Nobuyoshi Nakada <nobu@r...> -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/