From 0d2520dd3e1fdbe774a91c490b7d36e59ac08594 Mon Sep 17 00:00:00 2001
From: midipix <writeonce@midipix.org>
Date: Thu, 22 Feb 2024 04:39:46 +0000
Subject: build system: ccenv.sh: legacy PE targets: define __PE__ and friends
 as needed.

---
 sofort/ccenv/ccenv.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sofort/ccenv/ccenv.sh b/sofort/ccenv/ccenv.sh
index 0f7f486..30e28fd 100644
--- a/sofort/ccenv/ccenv.sh
+++ b/sofort/ccenv/ccenv.sh
@@ -1412,6 +1412,20 @@ ccenv_set_os_pe_switches()
 				;;
 		esac
 	fi
+
+	if [ "$ccenv_cc_binfmt" = 'PE' ]; then
+		if ! cfgtest_macro_definition '__PE__'; then
+			ccenv_cflags_os="${ccenv_cflags_os} -D__PE__"
+		fi
+
+		if ! cfgtest_macro_definition '__dllexport'; then
+			ccenv_cflags_os="${ccenv_cflags_os} -D__dllexport=__attribute__\(\(__dllexport__\)\)"
+		fi
+
+		if ! cfgtest_macro_definition '__dllimport'; then
+			ccenv_cflags_os="${ccenv_cflags_os} -D__dllimport=__attribute__\(\(__dllimport__\)\)"
+		fi
+	fi
 }
 
 ccenv_output_defs()
-- 
cgit v1.2.3