Index: trunk/config.auto.h.in =================================================================== --- trunk/config.auto.h.in (revision 2544) +++ trunk/config.auto.h.in (revision 2545) @@ -77,6 +77,12 @@ print {\n\n/* Define to 1 if you have the `getcwd' function. */\n} print_ternary libs/fs/getcwd/presents {#define HAVE_GETCWD 1} {/* #undef HAVE_GETCWD */} +print {\n\n/* Define to 1 if you have the `_getcwd' function. */\n} +print_ternary ?libs/fs/_getcwd/presents {#define HAVE__GETCWD 1} {/* #undef HAVE__GETCWD */} + +print {\n\n/* Define to 1 if you have the `getwd' function. */\n} +print_ternary ?libs/fs/_getwd/presents {#define HAVE_GETWD 1} {/* #undef HAVE_GETWD */} + print {\n\n/* Define to 1 if you have the header file. */\n} print_ternary libs/gui/gd/presents {#define HAVE_GD_H 1} {/* #undef HAVE_GD_H */} Index: trunk/scconfig/hooks.c =================================================================== --- trunk/scconfig/hooks.c (revision 2544) +++ trunk/scconfig/hooks.c (revision 2545) @@ -173,6 +173,13 @@ } } + if (require("libs/fs/getcwd/*", 0, 0) != 0) + if (require("libs/fs/_getcwd/*", 0, 0) != 0) + if (require("libs/fs/getwd/*", 0, 0) != 0) { + report_repeat("\nERROR: Can not find any getcwd() variant.\n\n"); + return 1; + } + if (want_intl) { require("libs/sul/gettext/presents", 0, 0); if (!istrue(get("libs/sul/gettext/presents"))) { Index: trunk/src/compat_fs.c =================================================================== --- trunk/src/compat_fs.c (revision 2544) +++ trunk/src/compat_fs.c (revision 2545) @@ -29,6 +29,8 @@ #include "config.h" +#include "compat_inc.h" + #include #include #include @@ -64,8 +66,10 @@ */ char *GetWorkingDirectory(char *path) { -#ifdef HAVE_GETCWD +#if defined(HAVE_GETCWD) return getcwd(path, MAXPATHLEN); +#elif defined(HAVE__GETCWD) + return _getcwd(path, MAXPATHLEN); #else /* seems that some BSD releases lack of a prototype for getwd() */ return getwd(path); Index: trunk/src/compat_inc.h.in =================================================================== --- trunk/src/compat_inc.h.in (revision 2544) +++ trunk/src/compat_inc.h.in (revision 2545) @@ -1,8 +1,18 @@ -uniq /local/pcb/compat_inc [@ +put /local/pcb/compat_inc [@ + @?libs/ldl/includes@ @?libs/LoadLibrary/includes@ +@?libs/fs/getcwd/includes@ +@?libs/fs/_getcwd/includes@ +@?libs/fs/getwd/includes@ + @] +put /tmpasm/IFS {\n} +uniq /local/pcb/compat_inc +gsub /local/pcb/compat_inc {\\\\n *} {\n} + + print [@ /*** DO NOT EDIT - automatically generated by scconfig ***/