dbghelp: fix compile on Hurd

Austin English austinenglish at gmail.com
Fri Oct 8 02:33:52 CDT 2010


Both OS X and Hurd define __MACH__, but on Hurd, /usr/include doesn't
have a mach-o directory.

I considered doing __MACH__ && __APPLE, but this seems more portable
(thanks to Ken Thomases for pointing that out).

-- 
-Austin
-------------- next part --------------
diff --git a/configure.ac b/configure.ac
index 1a502db..1c0ed46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -418,6 +418,7 @@ AC_CHECK_HEADERS(\
 	linux/types.h \
 	linux/ucdrom.h \
 	mach-o/nlist.h \
+	mach-o/loader.h \
 	mach/mach.h \
 	mach/machine.h \
 	machine/cpu.h \
diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c
index 44fa4f2..41426d5 100644
--- a/dlls/dbghelp/macho_module.c
+++ b/dlls/dbghelp/macho_module.c
@@ -26,7 +26,8 @@
 
 #include "dbghelp_private.h"
 
-#ifdef __MACH__
+/* Not all platforms that define Mach actually use Mach files, e.g., GNU Hurd */
+#if defined(__MACH__) && defined (HAVE_MACH_O_LOADER_H)
 
 #include <assert.h>
 #include <stdarg.h>
@@ -1441,4 +1442,4 @@ BOOL macho_load_debug_info(struct module* module, struct macho_file_map* fmap)
 {
     return FALSE;
 }
-#endif  /* __MACH__ */
+#endif  /* __MACH__ && HAVE_MACH_O_LOADER_H */
diff --git a/include/config.h.in b/include/config.h.in
index 98a951f..0bb6be2 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -466,6 +466,9 @@
 /* Define to 1 if you have the <mach-o/dyld_images.h> header file. */
 #undef HAVE_MACH_O_DYLD_IMAGES_H
 
+/* Define to 1 if you have the <mach-o/loader.h> header file. */
+#undef HAVE_MACH_O_LOADER_H
+
 /* Define to 1 if you have the <mach-o/nlist.h> header file. */
 #undef HAVE_MACH_O_NLIST_H
 


More information about the wine-patches mailing list