Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 238 | Rev 300 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

Description: Fixes to make Pike build on GNU/Hurd
 1. Let realpath() allocate memory itself.
 2. Include mach/message.h directly where mach_msg_type_number_t is used.
 3. Don't build shared objects any differently than on Linux.
Forwarded: yes

--- a/src/modules/system/system.c
+++ b/src/modules/system/system.c
@@ -412,6 +412,13 @@ void f_resolvepath(INT32 args)
 #endif /* ENAMETOOLONG */
          (len >= buflen - 1));
 #elif defined(HAVE_REALPATH)
+#ifdef __GNU__
+  if ((buf = realpath(path, NULL))) {
+    len = strlen(buf);
+  } else if (errno == ENOMEM) {
+    Pike_error("resolvepath(): Out of memory\n");
+  }
+#else
   buflen = PATH_MAX+1;
 
   if (!(buf = alloca(buflen))) {
@@ -421,6 +428,7 @@ void f_resolvepath(INT32 args)
   if ((buf = realpath(path, buf))) {
     len = strlen(buf);
   }
+#endif
 #else /* !HAVE_RESOLVEPATH && !HAVE_REALPATH */
 #error "f_resolvepath with neither resolvepath nor realpath."
 #endif /* HAVE_RESOLVEPATH */
@@ -430,6 +438,9 @@ void f_resolvepath(INT32 args)
   }
   pop_n_elems(args);
   push_string(make_shared_binary_string(buf, len));
+#ifdef __GNU__
+  free(buf);
+#endif
 }
 #endif /* HAVE_RESOLVEPATH || HAVE_REALPATH */
 
--- a/src/pike_threadlib.h
+++ b/src/pike_threadlib.h
@@ -88,6 +88,9 @@
 #ifdef HAVE_MACH_TASK_INFO_H
 #include <mach/task_info.h>
 #endif
+#ifdef HAVE_MACH_MESSAGE_H
+#include <mach/message.h>
+#endif
 #ifdef HAVE_MACH_TASK_H
 #include <mach/task.h>
 #endif
--- a/src/configure.in
+++ b/src/configure.in
@@ -3233,7 +3233,7 @@ AC_CHECK_HEADERS(winsock2.h sys/rusage.h
                 float.h sys/priocntl.h sys/sched.h winbase.h errno.h \
                 stddef.h sys/termio.h sys/termios.h \
                 ws2tcpip.h valgrind/memcheck.h memcheck.h valgrind.h \
-                sys/prctl.h sys/ioctl.h mach/task_info.h mach/task.h \
+                sys/prctl.h sys/ioctl.h mach/message.h mach/task_info.h mach/task.h \
                 mach/mach_init.h syscall.h sys/syscall.h devices/timer.h \
                 direct.h CoreServices/CoreServices.h execinfo.h \
                 mach/mach.h mach/thread_act.h mach/clock.h urcu.h,,,[
@@ -7557,7 +7557,7 @@ if test -z "$LDSHARED" ; then
     next*) LDSHARED="$REALCC $CFLAGS -nostdlib -r";;
     Linux*) LDSHARED="$REALCC -shared";;
     GNU/kFreeBSD*) LDSHARED="$REALCC -shared";;
-    GNU*) LDSHARED="$REALCC -Wl,-Bshareable";;
+    GNU*) LDSHARED="$REALCC -shared";;
     FreeBSD*) LDSHARED="$REALCC -Wl,-Bshareable";;
     NetBSD*) LDSHARED="$REALCC -Wl,-Bshareable";;
     OpenBSD*) LDSHARED="$REALCC -Wl,-Bshareable";;
--- a/src/machine.h.in
+++ b/src/machine.h.in
@@ -900,6 +900,9 @@
 /* Define to 1 if you have the <mach/mach_init.h> header file. */
 #undef HAVE_MACH_MACH_INIT_H
 
+/* Define to 1 if you have the <mach/message.h> header file. */
+#undef HAVE_MACH_MESSAGE_H
+
 /* Define to 1 if you have the <mach-o/dyld.h> header file. */
 #undef HAVE_MACH_O_DYLD_H