Merge pull request #9 from lha/master
[heimdal.git] / cf / krb-func-getcwd-broken.m4
blob08b0793510a7e271b0e5c379b53f0c2a8d0fe2fa
1 dnl $Id$
2 dnl
3 dnl
4 dnl test for broken getcwd in (SunOS braindamage)
5 dnl
7 AC_DEFUN([AC_KRB_FUNC_GETCWD_BROKEN], [
8 if test "$ac_cv_func_getcwd" = yes; then
9 AC_MSG_CHECKING(if getcwd is broken)
10 AC_CACHE_VAL(ac_cv_func_getcwd_broken, [
11 ac_cv_func_getcwd_broken=no
13 AC_RUN_IFELSE([AC_LANG_SOURCE([[
14 #include <errno.h>
15 char *getcwd(char*, int);
17 void *popen(char *cmd, char *mode)
19         errno = ENOTTY;
20         return 0;
23 int main(int argc, char **argv)
25         char *ret;
26         ret = getcwd(0, 1024);
27         if(ret == 0 && errno == ENOTTY)
28                 return 0;
29         return 1;
31 ]])], [ac_cv_func_getcwd_broken=yes],[:],[:])
33 if test "$ac_cv_func_getcwd_broken" = yes; then
34         AC_DEFINE(BROKEN_GETCWD, 1, [Define if getcwd is broken (like in SunOS 4).])dnl
35         AC_LIBOBJ(getcwd)
36         AC_MSG_RESULT($ac_cv_func_getcwd_broken)
37 else
38         AC_MSG_RESULT([seems ok])