diff options
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 31 |
1 files changed, 31 insertions, 0 deletions
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( |