Changes to compile under gnu-win32, from Marcus Daniels:
authorJim Blandy <jimb@red-bean.com>
Tue, 24 Jun 1997 01:45:30 +0000 (01:45 +0000)
committerJim Blandy <jimb@red-bean.com>
Tue, 24 Jun 1997 01:45:30 +0000 (01:45 +0000)
* stime.c (tzset): If tzset isn't provided, make it a NOP.
(scm_localtime): Change SCM_EOF to SCM_EOL.
(scm_mktime): Likewise.
* socket.c: Don't include sys/un.h unless autoconf tells
us Unix domain sockets are available.
(scm_fill_sockaddr): Ignore Unix domain code.
(scm_addr_vector): Likewise.
(scm_init_addr_buffer): Likewise.
(scm_socketpair): Don't include unless socketpair was
found during autoconf.
* simpos.c (SYSTNAME): Treat cygwin like Unix.
* scmsigs.c (scm_pause): Don't include unless pause was found
during autoconf.
* posix.c (scm_getgroups): Don't include unless support function
was found during autoconf (in this case, getgroups).
(scm_setpwent): For setpwent.
(scm_setegid): For setegid.
* net_db.c (scm_inet_netof): Don't include unless support
function was found during autoconf (in this case, inet_netof).
(scm_lnaof): For inet_lnaof.
(scm_inet_makeaddr): For inet_makeaddr.
(scm_getnet): For getnetent, getnetbyname, getnetbyaddr.
(scm_getproto): For getprotoent.
(scm_getserv): For getservent.
(scm_sethost): For sethostent, endhostent.
(scm_setnet): For setnetent, endnetent.
(scm_setproto): For setprotoent, endprotoent.
(scm_setserv): For setservent, endservent.

libguile/net_db.c
libguile/posix.c
libguile/scmconfig.h.in
libguile/scmsigs.c
libguile/simpos.c
libguile/socket.c
libguile/stime.c

index 198b95f..3bf47cd 100644 (file)
@@ -109,6 +109,7 @@ scm_inet_ntoa (inetid)
   return answer;
 }
 
+#ifdef HAVE_INET_NETOF
 SCM_PROC (s_inet_netof, "inet-netof", 1, 0, 0, scm_inet_netof);
 
 SCM 
@@ -119,7 +120,9 @@ scm_inet_netof (address)
   addr.s_addr = htonl (scm_num2ulong (address, (char *) SCM_ARG1, s_inet_netof));
   return scm_ulong2num ((unsigned long) inet_netof (addr));
 }
+#endif
 
+#ifdef HAVE_INET_LNAOF
 SCM_PROC (s_lnaof, "inet-lnaof", 1, 0, 0, scm_lnaof);
 
 SCM 
@@ -130,8 +133,9 @@ scm_lnaof (address)
   addr.s_addr = htonl (scm_num2ulong (address, (char *) SCM_ARG1, s_lnaof));
   return scm_ulong2num ((unsigned long) inet_lnaof (addr));
 }
+#endif
 
-
+#ifdef HAVE_INET_MAKEADDR
 SCM_PROC (s_inet_makeaddr, "inet-makeaddr", 2, 0, 0, scm_inet_makeaddr);
 
 SCM 
@@ -148,6 +152,7 @@ scm_inet_makeaddr (net, lna)
   addr = inet_makeaddr (netnum, lnanum);
   return scm_ulong2num (ntohl (addr.s_addr));
 }
+#endif
 
 
 /* !!! Doesn't take address format.
@@ -244,6 +249,7 @@ scm_gethost (name)
    doesn't seem quite right (what if errno gets set as part of healthy
    operation?), but it seems to work okay.  We'll see.  */
 
+#if defined(HAVE_GETNETENT) && defined(HAVE_GETNETBYNAME) && defined(HAVE_GETNETBYADDR)
 SCM_PROC (s_getnet, "getnet", 0, 1, 0, scm_getnet);
 
 SCM 
@@ -293,7 +299,9 @@ scm_getnet (name)
   ve[3] = scm_ulong2num (entry->n_net + 0L);
   return ans;
 }
+#endif
 
+#ifdef HAVE_GETPROTOENT
 SCM_PROC (s_getproto, "getproto", 0, 1, 0, scm_getproto);
 
 SCM 
@@ -342,7 +350,7 @@ scm_getproto (name)
   ve[2] = SCM_MAKINUM (entry->p_proto + 0L);
   return ans;
 }
-
+#endif
 
 static SCM scm_return_entry SCM_P ((struct servent *entry));
 
@@ -363,6 +371,7 @@ scm_return_entry (entry)
   return ans;
 }
 
+#ifdef HAVE_GETSERVENT
 SCM_PROC (s_getserv, "getserv", 0, 2, 0, scm_getserv);
 
 SCM 
@@ -406,7 +415,9 @@ scm_getserv (name, proto)
   SCM_ALLOW_INTS;
   return scm_return_entry (entry);
 }
+#endif
 
+#if defined(HAVE_SETHOSTENT) && defined(HAVE_ENDHOSTENT)
 SCM_PROC (s_sethost, "sethost", 0, 1, 0, scm_sethost);
 
 SCM 
@@ -419,7 +430,9 @@ scm_sethost (arg)
     sethostent (SCM_NFALSEP (arg));
   return SCM_UNSPECIFIED;
 }
+#endif
 
+#if defined(HAVE_SETNETENT) && defined(HAVE_ENDNETENT) 
 SCM_PROC (s_setnet, "setnet", 0, 1, 0, scm_setnet);
 
 SCM 
@@ -432,7 +445,9 @@ scm_setnet (arg)
     setnetent (SCM_NFALSEP (arg));
   return SCM_UNSPECIFIED;
 }
+#endif
 
+#if defined(HAVE_SETPROTOENT) && defined(HAVE_ENDPROTOENT)
 SCM_PROC (s_setproto, "setproto", 0, 1, 0, scm_setproto);
 
 SCM 
@@ -445,7 +460,9 @@ scm_setproto (arg)
     setprotoent (SCM_NFALSEP (arg));
   return SCM_UNSPECIFIED;
 }
+#endif
 
+#if defined(HAVE_SETSERVENT) && defined(HAVE_ENDSERVENT)
 SCM_PROC (s_setserv, "setserv", 0, 1, 0, scm_setserv);
 
 SCM 
@@ -458,6 +475,7 @@ scm_setserv (arg)
     setservent (SCM_NFALSEP (arg));
   return SCM_UNSPECIFIED;
 }
+#endif
 
 
 void 
index c763f4d..048ac55 100644 (file)
@@ -207,7 +207,7 @@ scm_pipe ()
 }
 
 
-
+#ifdef HAVE_GETGROUPS
 SCM_PROC (s_getgroups, "getgroups", 0, 0, 0, scm_getgroups);
 
 SCM
@@ -240,7 +240,7 @@ scm_getgroups()
     return ans;
   }
 }  
-
+#endif
 
 
 SCM_PROC (s_getpwuid, "getpw", 0, 1, 0, scm_getpwuid);
@@ -299,7 +299,7 @@ scm_getpwuid (user)
 }
 
 
-
+#ifdef HAVE_SETPWENT
 SCM_PROC (s_setpwent, "setpw", 0, 1, 0, scm_setpwent);
 
 SCM 
@@ -312,6 +312,7 @@ scm_setpwent (arg)
     setpwent ();
   return SCM_UNSPECIFIED;
 }
+#endif
 
 
 
@@ -572,6 +573,7 @@ scm_seteuid (id)
   return SCM_UNSPECIFIED;
 }
 
+#ifdef HAVE_SETEGID
 SCM_PROC (s_setegid, "setegid", 1, 0, 0, scm_setegid);
 
 SCM 
@@ -591,6 +593,7 @@ scm_setegid (id)
   return SCM_UNSPECIFIED;
     
 }
+#endif
 
 SCM_PROC (s_getpgrp, "getpgrp", 0, 0, 0, scm_getpgrp);
 SCM 
index 38e1080..8789f78 100644 (file)
 /* Define if the operating system can restart system calls.  */
 #undef HAVE_RESTARTS
 
+/* Define if the system supports Unix-domain (file-domain) sockets.  */
+#undef HAVE_UNIX_DOMAIN_SOCKETS
+
 /* Define if you have the ctermid function.  */
 #undef HAVE_CTERMID
 
 /* Define if you have the geteuid function.  */
 #undef HAVE_GETEUID
 
+/* Define if you have the getgroups function.  */
+#undef HAVE_GETGROUPS
+
 /* Define if you have the gethostent function.  */
 #undef HAVE_GETHOSTENT
 
 /* Define if you have the nice function.  */
 #undef HAVE_NICE
 
+/* Define if you have the pause function.  */
+#undef HAVE_PAUSE
+
 /* Define if you have the putenv function.  */
 #undef HAVE_PUTENV
 
 /* Define if you have the setpgid function.  */
 #undef HAVE_SETPGID
 
+/* Define if you have the setpwent function.  */
+#undef HAVE_SETPWENT
+
 /* Define if you have the setsid function.  */
 #undef HAVE_SETSID
 
 /* Define if you have the sigaction function.  */
 #undef HAVE_SIGACTION
 
+/* Define if you have the socketpair function.  */
+#undef HAVE_SOCKETPAIR
+
 /* Define if you have the strerror function.  */
 #undef HAVE_STRERROR
 
 /* Define if you have the times function.  */
 #undef HAVE_TIMES
 
+/* Define if you have the tzset function.  */
+#undef HAVE_TZSET
+
 /* Define if you have the uname function.  */
 #undef HAVE_UNAME
 
 /* Define if you have the <ndir.h> header file.  */
 #undef HAVE_NDIR_H
 
+/* Define if you have the <regex.h> header file.  */
+#undef HAVE_REGEX_H
+
 /* Define if you have the <string.h> header file.  */
 #undef HAVE_STRING_H
 
index 57456e0..6440419 100644 (file)
@@ -329,6 +329,7 @@ scm_alarm (i)
   return SCM_MAKINUM (j);
 }
 
+#ifdef HAVE_PAUSE
 SCM_PROC(s_pause, "pause", 0, 0, 0, scm_pause);
 
 SCM 
@@ -337,6 +338,7 @@ scm_pause ()
   pause ();
   return SCM_UNSPECIFIED;
 }
+#endif
 
 SCM_PROC(s_sleep, "sleep", 1, 0, 0, scm_sleep);
 
index 69117ec..9973e5f 100644 (file)
@@ -104,7 +104,7 @@ scm_getenv(nam)
 #ifdef vms
 # define SYSTNAME "VMS"
 #endif
-#if defined (unix) || defined (__unix)
+#if defined (unix) || defined (__unix) || defined(__CYGWIN32__)
 # define SYSTNAME "UNIX"
 #endif
 #ifdef MWC
index 64eb02d..935f315 100644 (file)
@@ -57,7 +57,9 @@
 #endif
 #include <sys/types.h>
 #include <sys/socket.h>
+#ifdef UNIX_DOMAIN_SOCKETS
 #include <sys/un.h>
+#endif
 #include <netinet/in.h>
 #include <netdb.h>
 #include <arpa/inet.h>
@@ -117,6 +119,7 @@ scm_socket (family, style, proto)
 
 
 
+#ifdef HAVE_SOCKETPAIR
 SCM_PROC (s_socketpair, "socketpair", 3, 0, 0, scm_socketpair);
 
 SCM 
@@ -145,7 +148,7 @@ scm_socketpair (family, style, proto)
   SCM_ALLOW_INTS;
   return scm_cons (a, b);
 }
-
+#endif
 
 SCM_PROC (s_getsockopt, "getsockopt", 3, 0, 0, scm_getsockopt);
 
@@ -349,6 +352,7 @@ scm_fill_sockaddr (fam, address, args, which_arg, proc, size)
        *size = sizeof (struct sockaddr_in);
        return (struct sockaddr *) soka;
       }
+#ifdef UNIX_DOMAIN_SOCKETS
     case AF_UNIX:
       {
        struct sockaddr_un *soka;
@@ -363,6 +367,7 @@ scm_fill_sockaddr (fam, address, args, which_arg, proc, size)
        *size = sizeof (struct sockaddr_un);
        return (struct sockaddr *) soka;
       }
+#endif
     default:
       scm_out_of_range (proc, SCM_MAKINUM (fam));
     }
@@ -446,6 +451,7 @@ scm_addr_vector (address, proc)
   short int fam = address->sa_family;
   SCM result;
   SCM *ve;
+#ifdef UNIX_DOMAIN_SOCKETS
   if (fam == AF_UNIX)
     {
       struct sockaddr_un *nad = (struct sockaddr_un *) address;
@@ -455,7 +461,9 @@ scm_addr_vector (address, proc)
       ve[1] = scm_makfromstr (nad->sun_path,
                              (scm_sizet) strlen (nad->sun_path), 0);
     }
-  else if (fam == AF_INET)
+  else 
+#endif
+  if (fam == AF_INET)
     {
       struct sockaddr_in *nad = (struct sockaddr_in *) address;
       result = scm_make_vector (SCM_MAKINUM (3), SCM_UNSPECIFIED, SCM_BOOL_F);
@@ -480,7 +488,13 @@ static void scm_init_addr_buffer SCM_P ((void));
 static void
 scm_init_addr_buffer ()
 {
-  scm_addr_buffer_size = (int) sizeof (struct sockaddr_un);
+  scm_addr_buffer_size =
+#ifdef UNIX_DOMAIN_SOCKETS
+  (int) sizeof (struct sockaddr_un)
+#else
+  0
+#endif
+  ;
   if (sizeof (struct sockaddr_in) > scm_addr_buffer_size)
     scm_addr_buffer_size = (int) sizeof (struct sockaddr_in);
   scm_addr_buffer = scm_must_malloc (scm_addr_buffer_size, "address buffer");
index 37042f8..eee6271 100644 (file)
@@ -160,6 +160,10 @@ scm_get_internal_real_time()
 }
 #endif
 
+#ifndef HAVE_TZSET
+/* GNU-WIN32's cygwin.dll doesn't have this. */
+#define tzset()
+#endif
 
 
 static long scm_my_base = 0;
@@ -315,7 +319,7 @@ scm_localtime (SCM time, SCM zone)
       strcpy (zname, ptr);
 # else
       scm_misc_error (s_localtime, "Not fully implemented on this platform",
-                     SCM_EOF);
+                     SCM_EOL);
 # endif
 #endif
     }
@@ -426,7 +430,7 @@ scm_mktime (SCM sbd_time, SCM zone)
       strcpy (zname, ptr);
 # else
       scm_misc_error (s_localtime, "Not fully implemented on this platform",
-                     SCM_EOF);
+                     SCM_EOL);
 # endif
 #endif
     }