From a050d76f8c71fbc8c3162be6fb5f36544cf50a35 Mon Sep 17 00:00:00 2001
From: Fabian Groffen <grobian@gentoo.org>
Date: Wed, 8 Jun 2022 20:42:00 +0200
Subject: [PATCH] [cctools] fix build on macOS monterey

Based on original path by Tee KOBAYASHI, which was based on work
from https://trac.macports.org/ticket/63221

Adapted to be conditional, that is, only defined when not
yet defined.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
---
 cctools/otool/print_objc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git cctools/otool/print_objc.c cctools/otool/print_objc.c
index e8253f4..3793c22 100644
--- cctools/otool/print_objc.c
+++ cctools/otool/print_objc.c
@@ -75,6 +75,14 @@ struct objc_class_t {
     uint32_t protocols;   /* struct objc_protocol_list * (32-bit pointer) */
 };
 
+#ifndef CLS_GETINFO
+# define CLS_GETINFO(cls, infomask) ((cls)->info & (infomask))
+// class is not a metaclass
+#define CLS_CLASS 0x1
+// class is a metaclass
+#define CLS_META 0x2
+#endif
+
 struct objc_category_t {
     uint32_t category_name;	/* char * (32-bit pointer) */
     uint32_t class_name;	/* char * (32-bit pointer) */
-- 
2.38.1

