diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-17 23:50:20 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-17 23:50:20 +0000 |
commit | f8d6453704b9b6f45f77aba7a43fb59ead229368 (patch) | |
tree | abb7544b2bafe4286cf5cf420afb9cdf2bbacab7 | |
parent | 2254fc650b681c2582f25aa0d2be2cc8aba3cb8e (diff) | |
download | ruby-f8d6453704b9b6f45f77aba7a43fb59ead229368.tar.gz |
configure.in: rb_cv_getcwd_malloc
* configure.in (rb_cv_getcwd_malloc): check if getcwd allocates
buffer if NULL is given [ruby-core:62072] [Bug #9752]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-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( |