1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- AC_DEFUN([AC_FUNC_GETCWD_NULL],
- [AC_CHECK_HEADERS(stdlib.h unistd.h)
- AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
- [ac_cv_func_getcwd_null],
- [AC_TRY_RUN(
- [
- char *getcwd ();
- int
- main ()
- {
- if (chdir ("/") != 0)
- exit (1);
- else
- {
- char *f = getcwd (NULL, 0);
- exit (! (f && f[0] == '/' && !f[1]));
- }
- }],
- [ac_cv_func_getcwd_null=yes],
- [ac_cv_func_getcwd_null=no],
- [ac_cv_func_getcwd_null=no])])
- if test $ac_cv_func_getcwd_null = yes; then
- AC_DEFINE(HAVE_GETCWD_NULL, 1,
- [Define if getcwd (NULL, 0) allocates memory for result.])
- fi])
|