Fix compilation on GNU/Hurd
Patch from Pino Toscano
From his email:
currently[1] luatex does not build on GNU/Hurd.
The problem is the unconditional usage of PATH_MAX.
The attached patch solves the issue, malloc'ing the buffers as needed.
It also adds a small bit to "recognize" the GNU platform.
---
 source/texk/web2c/luatexdir/lua/loslibext.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Index: luatex-0.47.0/source/texk/web2c/luatexdir/lua/loslibext.c
===================================================================
--- luatex-0.47.0.orig/source/texk/web2c/luatexdir/lua/loslibext.c	2009-12-24 03:28:17.000000000 +0900
+++ luatex-0.47.0/source/texk/web2c/luatexdir/lua/loslibext.c	2009-12-24 03:28:30.000000000 +0900
@@ -81,6 +81,9 @@
 #  elif defined(__MACH__) && defined(__APPLE__)
 #    undef OS_PLATNAME
 #    define OS_PLATNAME "macosx"
+#  elif defined(__GNU__)
+#    undef OS_PLATNAME
+#    define OS_PLATNAME "gnu"
 #  endif
 #endif
 
@@ -117,7 +120,7 @@
 
 static int exec_command(const char *file, char *const *argv, char *const *envp)
 {
-    char path[PATH_MAX];
+    char *path;
     const char *searchpath, *esp;
     size_t prefixlen, filelen, totallen;
 
@@ -125,6 +128,7 @@
         return execve(file, argv, envp);
 
     filelen = strlen(file);
+    path = NULL;
 
     searchpath = getenv("PATH");
     if (!searchpath)
@@ -141,14 +145,20 @@
 
         if (prefixlen == 0 || searchpath[prefixlen - 1] == '/') {
             totallen = prefixlen + filelen;
+#ifdef PATH_MAX
             if (totallen >= PATH_MAX)
                 continue;
+#endif
+            path = malloc(totallen + 1);
             memcpy(path, searchpath, prefixlen);
             memcpy(path + prefixlen, file, filelen);
         } else {
             totallen = prefixlen + filelen + 1;
+#ifdef PATH_MAX
             if (totallen >= PATH_MAX)
                 continue;
+#endif
+            path = malloc(totallen + 1);
             memcpy(path, searchpath, prefixlen);
             path[prefixlen] = '/';
             memcpy(path + prefixlen + 1, file, filelen);
@@ -156,6 +166,8 @@
         path[totallen] = '\0';
 
         execve(path, argv, envp);
+        free(path);
+        path = NULL;
         if (errno == E2BIG || errno == ENOEXEC ||
             errno == ENOMEM || errno == ETXTBSY)
             break;              /* Report this as an error, no more search */
