--- boost1.35-1.35.0.orig/tools/jam/src/pwd.c +++ boost1.35-1.35.0/tools/jam/src/pwd.c @@ -2,6 +2,9 @@ /* Software License, Version 1.0. (See accompanying */ /* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +/* Define _GNU_SOURCE to expose get_current_dir_name() */ +#define _GNU_SOURCE + #include "jam.h" #include "lists.h" #include "newstr.h" @@ -24,7 +27,9 @@ /* The current directory can't change in bjam, so optimize this to cache ** the result. */ +#ifndef __GLIBC__ static char pwd_buffer[PATH_MAX]; +#endif static char * pwd_result = NULL; @@ -33,11 +38,16 @@ { if (!pwd_result) { +#ifdef __GLIBC__ + if ((pwd_result = get_current_dir_name()) == NULL) +#else if (getcwd(pwd_buffer, sizeof(pwd_buffer)) == NULL) +#endif { perror("can not get current directory"); return L0; } +#ifndef __GLIBC__ else { #ifdef NT @@ -46,6 +56,7 @@ pwd_result = newstr(pwd_buffer); #endif } +#endif } return list_new(L0, pwd_result); }