* Fixed the check for "environ" on OS X and Solaris.

git-svn-id: svn://svn.zoy.org/elk/trunk@184 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2003-09-24 15:14:16 +00:00
parent 4bf7fc4caa
commit ce02b05888
2 changed files with 17 additions and 6 deletions

View File

@ -385,7 +385,12 @@ AC_DEFINE(ANSI_CPP, 1, [FIXME HARD])
# library functions, and include files are supported by the system.
AC_CHECK_HEADERS(utime.h sys/utime.h sys/wait.h sys/times.h dirent.h netdb.h)
AC_CHECK_FUNCS(waitpid wait3 wait4 vfork uname gethostname gettimeofday ftime)
AC_CHECK_FUNCS(mktemp tmpnam tempnam getcwd getwd rename regcomp)
AC_CHECK_FUNCS(mktemp tmpnam tempnam getcwd getwd rename regcomp environ)
AC_MSG_CHECKING(for environ in unistd.h)
AC_EGREP_HEADER(environ, unistd.h,
[AC_MSG_RESULT(yes)
AC_DEFINE(ENVIRON_IN_UNISTD_H, 1, Define if <unistd.h> defines environ)],
[AC_MSG_RESULT(no)])
# Element type of the gidset argument of getgroups(); typically int
# or gid_t. Only needed by the UNIX extension.

View File

@ -32,17 +32,20 @@
#include <string.h>
#include <stdio.h>
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
#endif
#ifndef WIN32
/* "extern" in front of the next declaration causes the Ultrix 4.2 linker
* to fail when dynamically loading unix.o (but omitting it does no longer
* work with modern C compilers):
*/
extern char **environ;
#ifdef ENVIRON_IN_UNISTD_H
/* "extern" in front of the next declaration causes the Ultrix 4.2 linker
* to fail, but omitting it no longer works with modern C compilers: */
extern char **environ;
#endif
#ifdef HAVE_ENVIRON
static Object P_Environ() {
Object ret, cell, str;
char *p, **ep;
@ -67,6 +70,7 @@ static Object P_Environ() {
GC_Unlink;
return P_Reverse(ret);
}
#endif
static Object General_Exec(int argc, Object *argv, int path) {
Object fn, args, p, e;
@ -357,7 +361,9 @@ err:
}
void elk_init_unix_process() {
#ifdef HAVE_UNISTD_H
Def_Prim(P_Environ, "unix-environ", 0, 0, EVAL);
#endif
Def_Prim(P_Exec, "unix-exec", 2, 3, VARARGS);
Def_Prim(P_Exec_Path, "unix-exec-path", 2, 3, VARARGS);
Def_Prim(P_Fork, "unix-fork", 0, 0, EVAL);