diff options
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | src/main.c | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index faaa134..cf84ef1 100644 --- a/configure.ac +++ b/configure.ac @@ -165,12 +165,13 @@ AS_IF([test "$with_electric_fence" = yes], dnl Checks for header files. AC_HEADER_STDC +AC_CHECK_HEADERS([pwd.h]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_TYPEOF dnl Checks for library functions. -AC_CHECK_FUNCS(getline getopt_long setenv setpgid setpgrp setsid) +AC_CHECK_FUNCS(getline getopt_long getpwuid setenv setpgid setpgrp setsid) AC_CHECK_FUNCS(unsetenv vsnprintf) AH_TEMPLATE([HAVE___BUILTIN_PREFETCH], @@ -35,7 +35,6 @@ #include <string.h> #include <sys/wait.h> #include <ctype.h> -#include <pwd.h> #include "ratpoison.h" @@ -43,6 +42,10 @@ # include <langinfo.h> #endif +#if defined (HAVE_PWD_H) && defined (HAVE_GETPWUID) +#include <pwd.h> +#endif + /* Several systems seem not to have WAIT_ANY defined, so define it if it isn't. */ #ifndef WAIT_ANY @@ -422,6 +425,7 @@ read_startup_files (char *alt_rcfile) $sysconfdir/ratpoisonrc */ homedir = getenv ("HOME"); +#if defined (HAVE_PWD_H) && defined (HAVE_GETPWUID) if (!homedir) { struct passwd *pw; @@ -430,6 +434,7 @@ read_startup_files (char *alt_rcfile) if (pw) homedir = pw->pw_dir; } +#endif if (!homedir) PRINT_ERROR (("ratpoison: no home directory!?\n")); |