Description: a very nice patch which does a lot more checking for functions that actually exist. Author: Christian Lynbech Applying: snip out the stuff between the part1 markers, and the part2 markers, saving them into files. cd to your guile directory, and do a patch -p1 < part1. Then cd to libguile, and do a patch -p0 < part2 (note that this will cause a few complaints). This will require a rebuild of configure (so either be configured with --enable-maintainer-mode, or do all the fun stuff yerself). =======PART 1========= Index: guile-core/configure.in =================================================================== RCS file: /nmc/Repository/tools/guile/guile-core/configure.in,v retrieving revision 1.1.1.7 diff -u -r1.1.1.7 configure.in --- guile-core/configure.in 1998/10/25 13:00:54 1.1.1.7 +++ guile-core/configure.in 1998/12/14 08:15:09 @@ -131,7 +131,7 @@ GUILE_DLSYM_USCORE -AC_CHECK_FUNCS(ctermid ftime getcwd geteuid gethostent gettimeofday lstat mkdir mknod nice readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction strftime strptime symlink sync tcgetpgrp tcsetpgrp times uname waitpid bzero strdup system usleep) +AC_CHECK_FUNCS(ctermid ftime getcwd geteuid gethostent gettimeofday lstat mkdir mknod nice readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction strftime strptime symlink sync tcgetpgrp tcsetpgrp times uname waitpid bzero strdup system usleep dup2 fchmod fchown freopen fsync getpeername getsockname getsockopt setsockopt shutdown ttyname umask ftruncate) ### Some systems don't declare some functions. On such systems, we ### need to at least provide our own K&R-style declarations. ========END PART 1========= ========PART 2============= Index: filesys.c =================================================================== RCS file: /nmc/Repository/tools/guile/guile-core/libguile/filesys.c,v retrieving revision 1.1.1.5 diff -u -r1.1.1.5 filesys.c --- filesys.c 1998/10/20 03:27:08 1.1.1.5 +++ filesys.c 1998/12/14 08:15:57 @@ -120,6 +120,7 @@ SCM owner; SCM group; { +#ifdef HAVE_FCHOWN int rv; int fdes; @@ -152,6 +153,11 @@ scm_syserror (s_chown); SCM_ALLOW_INTS; return SCM_UNSPECIFIED; +#else + scm_sysmissing (s_chown); + /* not reached */ + return SCM_BOOL_F; +#endif } @@ -162,6 +168,7 @@ SCM object; SCM mode; { +#ifdef HAVE_FCHMOD int rv; int fdes; @@ -192,6 +199,11 @@ scm_syserror (s_chmod); SCM_ALLOW_INTS; return SCM_UNSPECIFIED; +#else + scm_sysmissing (s_chmod); + /* not reached */ + return SCM_BOOL_F; +#endif } SCM_PROC (s_umask, "umask", 0, 1, 0, scm_umask); @@ -200,6 +212,7 @@ scm_umask (mode) SCM mode; { +#ifdef HAVE_UMASK mode_t mask; if (SCM_UNBNDP (mode)) { @@ -212,6 +225,11 @@ mask = umask (SCM_INUM (mode)); } return SCM_MAKINUM (mask); +#else + scm_sysmissing (s_umask); + /* not reached */ + return SCM_BOOL_F; +#endif } @@ -539,6 +557,7 @@ SCM scm_truncate_file (SCM object, SCM size) { +#ifdef HAVE_FTRUNCATE int rv; scm_sizet csize; int fdes; @@ -570,6 +589,11 @@ scm_syserror (s_truncate_file); SCM_ALLOW_INTS; return SCM_UNSPECIFIED; +#else + scm_sysmissing (s_truncate_file); + /* not reached. */ + return SCM_BOOL_F; +#endif } SCM_PROC (s_mkdir, "mkdir", 1, 1, 0, scm_mkdir); @@ -1027,8 +1051,10 @@ # else # ifndef THINK_C # ifndef ARM_ULIB +# ifdef HAVE_SYS_IOCTL_H # include # endif +# endif # endif # endif # endif @@ -1147,6 +1173,7 @@ SCM scm_fsync (SCM object) { +#ifdef HAVE_FSYNC int fdes; object = SCM_COERCE_OUTPORT (object); @@ -1168,6 +1195,11 @@ scm_syserror (s_fsync); SCM_ALLOW_INTS; return SCM_UNSPECIFIED; +#else + scm_sysmissing (s_fsync); + /* not reached */ + return SCM_BOOL_F; +#endif } SCM_PROC (s_symlink, "symlink", 2, 0, 0, scm_symlink); Index: fports.c =================================================================== RCS file: /nmc/Repository/tools/guile/guile-core/libguile/fports.c,v retrieving revision 1.1.1.5 diff -u -r1.1.1.5 fports.c --- fports.c 1998/11/02 13:00:53 1.1.1.5 +++ fports.c 1998/12/13 21:02:57 @@ -281,6 +287,7 @@ SCM modes; SCM port; { +#ifdef HAVE_FREOPEN FILE *f; SCM_ASSERT (SCM_NIMP (filename) && SCM_ROSTRINGP (filename), filename, SCM_ARG1, s_freopen); @@ -313,6 +320,11 @@ } SCM_ALLOW_INTS; return port; +#else + scm_sysmissing (s_freopen); + /* not reached */ + return SCM_BOOL_F; +#endif } Index: ioext.c =================================================================== RCS file: /nmc/Repository/tools/guile/guile-core/libguile/ioext.c,v retrieving revision 1.1.1.5 diff -u -r1.1.1.5 ioext.c --- ioext.c 1998/10/31 13:01:01 1.1.1.5 +++ ioext.c 1998/12/20 14:55:32 @@ -267,6 +267,7 @@ SCM old; SCM new; { +#ifdef HAVE_DUP2 int ans, oldfd, newfd; old = SCM_COERCE_OUTPORT (old); @@ -286,12 +287,18 @@ scm_syserror (s_redirect_port); SCM_ALLOW_INTS; return SCM_UNSPECIFIED; +#else + scm_sysmissing (s_redirect_port); + /* not reached */ + return SCM_BOOL_F; +#endif } SCM_PROC (s_dup_to_fdes, "dup->fdes", 1, 1, 0, scm_dup_to_fdes); SCM scm_dup_to_fdes (SCM fd_or_port, SCM fd) { +#ifdef HAVE_DUP2 int oldfd, newfd, rv; fd_or_port = SCM_COERCE_OUTPORT (fd_or_port); @@ -329,6 +336,11 @@ } SCM_ALLOW_INTS; return fd; +#else + scm_sysmissing (s_dup_to_fdes); + /* not reached */ + return SCM_BOOL_F; +#endif } SCM_PROC (s_fileno, "fileno", 1, 0, 0, scm_fileno); @@ -406,6 +418,7 @@ SCM port; SCM fd; { +#ifdef HAVE_DUP2 FILE *stream; int old_fd; int new_fd; @@ -432,6 +445,11 @@ SCM_SYSCALL (close (old_fd)); SCM_ALLOW_INTS; return SCM_BOOL_T; +#else + scm_sysmissing (s_primitive_move_to_fdes); + /* not reached */ + return SCM_BOOL_F; +#endif } /* Return a list of ports using a given file descriptor. */ Index: ports.c =================================================================== RCS file: /nmc/Repository/tools/guile/guile-core/libguile/ports.c,v retrieving revision 1.1.1.8 diff -u -r1.1.1.8 ports.c --- ports.c 1998/11/07 13:00:50 1.1.1.8 +++ ports.c 1999/01/04 13:36:07 @@ -840,9 +840,11 @@ #ifndef _DCC #ifndef AMIGA #ifndef THINK_C +#ifdef HAVE_TTYNAME if (SCM_OPENP (exp) && scm_tc16_fport == SCM_TYP16 (exp) && isatty (fileno ((FILE *)SCM_STREAM (exp)))) scm_puts (ttyname (fileno ((FILE *)SCM_STREAM (exp))), port); else +#endif #endif #endif #endif Index: posix.c =================================================================== RCS file: /nmc/Repository/tools/guile/guile-core/libguile/posix.c,v retrieving revision 1.1.1.4 diff -u -r1.1.1.4 posix.c --- posix.c 1998/10/20 03:36:44 1.1.1.4 +++ posix.c 1998/12/13 21:02:58 @@ -637,6 +637,7 @@ scm_ttyname (port) SCM port; { +#ifdef HAVE_TTYNAME char *ans; int fd; @@ -652,6 +653,11 @@ scm_syserror (s_ttyname); /* ans could be overwritten by another call to ttyname */ return (scm_makfrom0str (ans)); +#else + scm_sysmissing (s_ttyname); + /* not reached */ + return SCM_BOOL_F; +#endif } Index: socket.c =================================================================== RCS file: /nmc/Repository/tools/guile/guile-core/libguile/socket.c,v retrieving revision 1.1.1.5 diff -u -r1.1.1.5 socket.c --- socket.c 1998/10/20 03:42:22 1.1.1.5 +++ socket.c 1998/12/13 21:02:58 @@ -153,6 +153,7 @@ SCM level; SCM optname; { +#ifdef HAVE_GETSOCKOPT int fd; int optlen; #ifdef HAVE_STRUCT_LINGER @@ -210,6 +211,11 @@ } #endif return SCM_MAKINUM (*(int *) optval); +#else + scm_sysmissing (s_getsockopt); + /* not reached */ + return SCM_BOOL_F; +#endif } SCM_PROC (s_setsockopt, "setsockopt", 4, 0, 0, scm_setsockopt); @@ -221,6 +227,7 @@ SCM optname; SCM value; { +#ifdef HAVE_SETSOCKOPT int fd; int optlen; #ifdef HAVE_STRUCT_LINGER @@ -289,6 +296,11 @@ if (setsockopt (fd, ilevel, ioptname, (void *) optval, optlen) == -1) scm_syserror (s_setsockopt); return SCM_UNSPECIFIED; +#else + scm_sysmissing (s_setsockopt); + /* not reached */ + return SCM_BOOL_F; +#endif } SCM_PROC (s_shutdown, "shutdown", 2, 0, 0, scm_shutdown); @@ -298,6 +310,7 @@ SCM sock; SCM how; { +#ifdef HAVE_SHUTDOWN int fd; sock = SCM_COERCE_OUTPORT (sock); SCM_ASSERT (SCM_NIMP (sock) && SCM_FPORTP (sock), sock, SCM_ARG1, @@ -308,6 +321,11 @@ if (shutdown (fd, SCM_INUM (how)) == -1) scm_syserror (s_shutdown); return SCM_UNSPECIFIED; +#else + scm_sysmissing (s_shutdown); + /* not reached */ + return SCM_BOOL_F; +#endif } /* convert fam/address/args into a sockaddr of the appropriate type. @@ -536,6 +554,7 @@ scm_getsockname (sock) SCM sock; { +#ifdef HAVE_GETSOCKNAME int tmp_size; int fd; SCM result; @@ -552,6 +571,11 @@ result = SCM_BOOL_F; SCM_ALLOW_INTS; return result; +#else + scm_sysmissing (s_getsockname); + /* not reached */ + return SCM_BOOL_F; +#endif } SCM_PROC (s_getpeername, "getpeername", 1, 0, 0, scm_getpeername); @@ -560,6 +584,7 @@ scm_getpeername (sock) SCM sock; { +#ifdef HAVE_GETPEERNAME int tmp_size; int fd; SCM result; @@ -576,6 +601,11 @@ result = SCM_BOOL_F; SCM_ALLOW_INTS; return result; +#else + scm_sysmissing (s_getpeername); + /* not reached */ + return SCM_BOOL_F; +#endif } SCM_PROC (s_recv, "recv!", 2, 1, 0, scm_recv); ====END PART 2=====