krb-func-getcwd-broken.m4 revision 1.1 1 1.1 elric dnl $Id: krb-func-getcwd-broken.m4,v 1.1 2011/04/13 18:14:32 elric Exp $
2 1.1 elric dnl
3 1.1 elric dnl
4 1.1 elric dnl test for broken getcwd in (SunOS braindamage)
5 1.1 elric dnl
6 1.1 elric
7 1.1 elric AC_DEFUN([AC_KRB_FUNC_GETCWD_BROKEN], [
8 1.1 elric if test "$ac_cv_func_getcwd" = yes; then
9 1.1 elric AC_MSG_CHECKING(if getcwd is broken)
10 1.1 elric AC_CACHE_VAL(ac_cv_func_getcwd_broken, [
11 1.1 elric ac_cv_func_getcwd_broken=no
12 1.1 elric
13 1.1 elric AC_RUN_IFELSE([AC_LANG_SOURCE([[
14 1.1 elric #include <errno.h>
15 1.1 elric char *getcwd(char*, int);
16 1.1 elric
17 1.1 elric void *popen(char *cmd, char *mode)
18 1.1 elric {
19 1.1 elric errno = ENOTTY;
20 1.1 elric return 0;
21 1.1 elric }
22 1.1 elric
23 1.1 elric int main(int argc, char **argv)
24 1.1 elric {
25 1.1 elric char *ret;
26 1.1 elric ret = getcwd(0, 1024);
27 1.1 elric if(ret == 0 && errno == ENOTTY)
28 1.1 elric return 0;
29 1.1 elric return 1;
30 1.1 elric }
31 1.1 elric ]])], [ac_cv_func_getcwd_broken=yes],[:],[:])
32 1.1 elric ])
33 1.1 elric if test "$ac_cv_func_getcwd_broken" = yes; then
34 1.1 elric AC_DEFINE(BROKEN_GETCWD, 1, [Define if getcwd is broken (like in SunOS 4).])dnl
35 1.1 elric AC_LIBOBJ(getcwd)
36 1.1 elric AC_MSG_RESULT($ac_cv_func_getcwd_broken)
37 1.1 elric else
38 1.1 elric AC_MSG_RESULT([seems ok])
39 1.1 elric fi
40 1.1 elric fi
41 1.1 elric ])
42