(wishlist) Allowing scheme48 to build on hurd-i386
| Newsgroups | gmane.lisp.scheme.scheme48 |
|---|---|
| Message-ID | <[email protected]> |
Hello again, I recently did some work to port scheme48 version 1.8 to build on Debian GNU/Hurd running the Mach 1.3.99 kernel, with Hurd 0.3. I'm sending you this email because I wanted to inform you of the approach I took. I don't believe my approach is good enough to merit consideration for inclusion in your upstream branch, if you were interested. This is because it required manually passing -pthread through the LDFLAGS to ./configure, since I'm not an autoconf wizard and couldn't figure out why -pthread wasn't being passed on hurd-i386. If I can figure this out, or if you need any information about how the system is picked up by ./configure such that you could fix this easily, then I think this simple, non-invasive patch might be worthwhile. So far as I can tell, no other Scheme interpreter current ly builds on hurd-i386. This patch involved fixing two problems. The first is that MAXHOSTNAMELEN is not defined on GNU Hurd. The second is that pthreads are part of a separate library and must be manually included. The patch I applied is inlined at the end of this email. In addition to this patch, ./configure was not properly picking up the need to add -pthread to LDFLAGS, so I had to build the package with the following string: LDFLAGS="-pthread" ./configure [...] I took a brief look at your current development branch. It looks like the MAXHOSTNAMELEN logic is no longer used in c/unix/socket.c. However, the pthreads problem still exists. I hope you find this interesting. Regards, Daniel Moerner --- This patch fixes two ways that scheme48 fails to build from source on hurd-i386. First, pthread.h must be manually included since it's part of hurd-dev, not libc6-dev. Second, MAXHOSTNAMELEN is not defined on hurd-i386, so we manually define it here. There are more elegant ways to fix MAXHOSTNAMELEN that involve checking the hostname length at runtime and dynamically reallocating memory, but since upstream's development branch has already deprecated this code I implemented the simple fix. -- Daniel Moerner <[email protected]> Thu, 04 Jun 2009 22:08:13 -0700 diff --git a/c/unix/socket.c b/c/unix/socket.c index a0a5e34..a994fc2 100644 --- a/c/unix/socket.c +++ b/c/unix/socket.c @@ -19,6 +19,7 @@ #include <string.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <pthread.h> /* manual inclusion needed on hurd-i386 */ #include "c-mods.h" #include "scheme48.h" @@ -29,6 +30,11 @@ /* Henry Cejtin says that 5 is the largest safe number for this. */ #define LISTEN_QUEUE_SIZE 5 +/* MAXHOSTNAMELEN is not defined on hurd-i386, so we manually define it now. */ +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 1024 +#endif + extern void s48_init_socket(void); static s48_value s48_socket(s48_value udp_p, s48_value input_p), s48_bind(s48_value socket_channel, s48_value number), -- Daniel Moerner <[email protected]>
signature.asc
(application/pgp-signature, 835 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQIcBAEBCAAGBQJKLaixAAoJEMs9AU7X8bMqz4gP/3LI86qvCZqkX0tVL7e73GOO ym60GCldKfvNadYYwlKc3EI5SOv8uZMVJaeySClpb57eUEZcnKUQL3P9RgiEnkss kzLuyFEZb6n4WIDNV8b9W/wtWZKABxZ7iZAmHnQfvKlpX4HRbKSQ+uTyFI7q4PL0 2A8Whwsg8Ud5rXzZexSWo8JWzWGASw8So29mUqGvIB7oJJTjkAPOM+VE597P0d9s jqQw0RD8ex6SVuHthK1iuWHkxdnMEl9JRYzJVjDCtSsXHiHo7hjmcFiqJaxuBf7v FR04K0X19V9WG9wov24Ovw9GCmvuwWtRl9q0vhONy+SQowdcbCaEN9vIwfjSM2h/ WyEeWmwKTkxpG3aBrbZRK7tGEZizGGYWiCfeQ3Cyc+lckbWXFPP+Q7v7oTT1Rw/9 OMpJK+QNvi1qARz2PWDfjY7lMaFJO7oSfhUTqlxa9/S++DlpHLK/fT1Kpz9FYoW4 sXOcvyPSpvbGHMIOwE1Es4RZMj3fventNuTDi52Y2635apP8GiZ61q/t22nljSRC NqHA8KfvYacHBo/oDce2RhOifMite9Z2El3uy9tvGY5Hg1EHRHrf80mdeJZqnrv4 zUCXMYacyNh9X37BNZEeCQ6WpHa6kulTCOh4Q/yK38koFbtUlMu/JxuJBQ4xYygF AC8IPyByaPaQeT3O2NwS =HooH -----END PGP SIGNATURE-----