diff --git a/configure.in b/configure.in index 2176b998b..797cc3b19 100644 --- a/configure.in +++ b/configure.in @@ -730,10 +730,14 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime # the DECL is checked because Solaris 10 doens't have in any header # strncasecmp - on NetBSD 1.6 the symbol is available in libc but the # declaration cannot be found +# unsetenv - on Tru64 5.1b the symbol is available in libc but the +# declaration is only found if `_BSD' is defined; it's marked as +# discouraged in and has type `void' instead of `int' +# anyway. # AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h) AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname) -AC_CHECK_DECLS([sethostname, strncasecmp]) +AC_CHECK_DECLS([sethostname, strncasecmp, unsetenv]) # crypt() may or may not be available, for instance in some countries there # are restrictions on cryptography. diff --git a/libguile/posix.c b/libguile/posix.c index 9ab593ad8..25d37d244 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,6 +21,7 @@ # include #endif +#include #include #include @@ -1335,7 +1336,7 @@ SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0, /* We want no "=" in the argument to mean remove the variable from the environment, but not all putenv()s understand this, for example FreeBSD 4.8 doesn't. Getting it happening everywhere is a bit - painful. What unsetenv() exists, we use that, of course. + painful. When unsetenv() exists, we use that, of course. Traditionally putenv("NAME") removes a variable, for example that's what we have to do on Solaris 9 (it doesn't have an unsetenv). @@ -1359,7 +1360,7 @@ SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0, build would be to try "NAME" then "NAME=" at runtime, if that's not too much like overkill. */ -#if HAVE_UNSETENV +#if defined HAVE_UNSETENV && HAVE_DECL_UNSETENV /* when unsetenv() exists then we use it */ unsetenv (c_str); free (c_str);