diff --git a/configure.ac b/configure.ac index 51c0bcde..6b073c89 100644 --- a/configure.ac +++ b/configure.ac @@ -317,7 +317,8 @@ AC_CHECK_HEADERS([argz.h \ unistd.h \ utime.h \ wchar.h \ - ifaddrs.h]) + ifaddrs.h \ + pwd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL diff --git a/src/util.cc b/src/util.cc index 3e0e9493..58ca54b8 100644 --- a/src/util.cc +++ b/src/util.cc @@ -36,7 +36,9 @@ #include #include -#include +#ifdef HAVE_PWD_H +# include +#endif // HAVE_PWD_H #include #include @@ -1026,12 +1028,12 @@ std::string getHomeDir() } } } -#else // !__MINGW32__ +#elif HAVE_PWD_H passwd* pw = getpwuid(geteuid()); if(pw && pw->pw_dir) { return pw->pw_dir; } -#endif // !__MINGW32__ +#endif // HAVE_PWD_H return A2STR::NIL; } }