diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | configure.in | 31 |
2 files changed, 36 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Fri Apr 18 08:50:18 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * configure.in (rb_cv_getcwd_malloc): check if getcwd allocates + buffer if NULL is given [ruby-core:62072] [Bug #9752] + Thu Apr 17 16:28:10 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com> * prelude.rb: [DOC] Update Thread::exclusive docs by @stevenharman. diff --git a/configure.in b/configure.in index 5fbdb93843..18d58d85ea 100644 --- a/configure.in +++ b/configure.in @@ -2008,6 +2008,37 @@ AC_CHECK_FUNCS(utimes) AC_CHECK_FUNCS(wait4) AC_CHECK_FUNCS(waitpid) +AS_IF([test "$ac_cv_func_getcwd" = yes], [ + AC_CACHE_CHECK(if getcwd allocates buffer if NULL is given, [rb_cv_getcwd_malloc], + [AC_TRY_RUN([ +@%:@include <stddef.h> +@%:@include <stdio.h> +@%:@ifdef HAVE_UNISTD_H +@%:@include <unistd.h> +@%:@endif +@%:@ifndef EXIT_SUCCESS +@%:@define EXIT_SUCCESS 0 +@%:@endif +@%:@ifndef EXIT_FAILURE +@%:@define EXIT_FAILURE 1 +@%:@endif + +int +main(int argc, char **argv) +{ + if (!getcwd(NULL, 0)) return EXIT_FAILURE; + return EXIT_SUCCESS; +} +], + rb_cv_getcwd_malloc=yes, + rb_cv_getcwd_malloc=no, + AS_CASE($target_os, + [linux*|darwin*|*bsd|cygwin*|mingw*|mswin*], + [rb_cv_getcwd_malloc=yes], + [rb_cv_getcwd_malloc=no]))]) + AS_IF([test "$rb_cv_getcwd_malloc" = no], [AC_DEFINE(NO_GETCWD_MALLOC, 1)]) +]) + AC_DEFUN([RUBY_CHECK_BUILTIN_FUNC], [dnl AC_CACHE_CHECK([for $1], AS_TR_SH(rb_cv_builtin_$1), [AC_LINK_IFELSE( |