[!_LIBC] (__getcwd): Define to xgetcwd and declare xgetcwd.
# include <config.h>
#endif
+#if __GNUC__
+# define alloca __builtin_alloca
+#else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ # pragma alloca
+# else
+char *alloca ();
+# endif
+# endif
+#endif
+
#if defined _LIBC
# include <dirent.h>
# define NAMLEN(dirent) _D_EXACT_NAMLEN(dirent)
# define __closedir closedir
# undef __fchdir
# define __fchdir fchdir
-# undef __getcwd
-# define __getcwd getcwd
# undef __opendir
# define __opendir opendir
# undef __readdir64
# define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
+#ifndef _LIBC
+# undef __getcwd
+# define __getcwd(P, N) xgetcwd ()
+extern char *xgetcwd (void);
+#endif
+
#ifndef __set_errno
# define __set_errno(Val) errno = (Val)
#endif