summaryrefslogtreecommitdiffstats
path: root/0101-Cygwin-enable-libgccjit-not-just-for-MingW.patch
blob: 62cf0f78861134de1f61bea0b8ceb574d4edacb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
From 38fae7faa3405611b2cce41de639aa3351dbc048 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Achim.Gratz@Stromeko.DE>
Date: Sun, 25 Apr 2021 11:33:55 +0200
Subject: [PATCH 1/2] Cygwin: enable libgccjit not just for MingW

---
 configure            | 17 +++++++++++++++--
 configure.ac         |  3 ++-
 gcc/cp/Make-lang.in  |  2 +-
 gcc/jit/Make-lang.in | 15 ++++++++++-----
 gcc/system.h         |  5 +++--
 5 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 504f6410274..fc0dd15f3e9 100755
--- a/configure
+++ b/configure
@@ -756,6 +756,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -922,6 +923,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE}'
@@ -1174,6 +1176,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1311,7 +1322,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1471,6 +1482,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -8492,6 +8504,7 @@ $as_echo "$as_me: WARNING: GNAT is required to build $language" >&2;}
         # is position independent code (PIC).
         case $target in
           *mingw*) ;;
+          *cygwin*) ;;
           *)
           case ${add_this_lang}:${language}:${host_shared} in
             yes:jit:no)
@@ -8516,7 +8529,7 @@ $as_echo "$as_me: WARNING: --enable-host-shared required to build $language" >&2
               # Silently disable.
               add_this_lang=unsupported
               ;;
-	        esac
+	  esac
           ;;
         esac
 
diff --git a/configure.ac b/configure.ac
index 088e735c5db..7f452989b82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2089,6 +2089,7 @@ if test -d ${srcdir}/gcc; then
         # is position independent code (PIC).
         case $target in
           *mingw*) ;;
+          *cygwin*) ;;
           *)
           case ${add_this_lang}:${language}:${host_shared} in
             yes:jit:no)
@@ -2112,7 +2113,7 @@ directories, to avoid imposing the performance cost of
               # Silently disable.
               add_this_lang=unsupported
               ;;
-	        esac
+	  esac
           ;;
         esac
 
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 155be74efdb..b750114185c 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -285,7 +285,7 @@ c++.install-plugin: installdirs
 # Install import library.
 ifeq ($(plugin_implib),yes)
 	$(mkinstalldirs) $(DESTDIR)$(plugin_resourcesdir)
-	$(INSTALL_DATA) cc1plus$(exeext).a $(DESTDIR)/$(plugin_resourcesdir)/cc1plus$(exeext).a
+	$(INSTALL_DATA) cc1plus$(exeext).a $(DESTDIR)$(plugin_resourcesdir)/cc1plus$(exeext).a
 endif
 
 c++.uninstall:
diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
index 663772aba63..98c4d521b1c 100644
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -44,8 +44,13 @@ LIBGCCJIT_VERSION_NUM = 0
 LIBGCCJIT_MINOR_NUM = 0
 LIBGCCJIT_RELEASE_NUM = 1
 
-ifneq (,$(findstring mingw,$(target)))
-LIBGCCJIT_FILENAME = libgccjit-$(LIBGCCJIT_VERSION_NUM).dll
+SHARED_PFX=lib
+ifneq (,$(filter %cygwin,$(target)))
+SHARED_PFX=cyg
+endif
+
+ifneq (,$(filter %-mingw% %-cygwin,$(target)))
+LIBGCCJIT_FILENAME = $(SHARED_PFX)gccjit-$(LIBGCCJIT_VERSION_NUM).dll
 LIBGCCJIT_IMPORT_LIB = libgccjit.dll.a
 
 jit: $(LIBGCCJIT_FILENAME) \
@@ -105,7 +110,7 @@ endif
 # Use strict warnings for this front end.
 jit-warn = $(STRICT_WARN)
 
-ifneq (,$(findstring mingw,$(target)))
+ifneq (,$(filter %-mingw% %-cygwin,$(target)))
 # Create import library
 LIBGCCJIT_EXTRA_OPTS = -Wl,--out-implib,$(LIBGCCJIT_IMPORT_LIB)
 else
@@ -129,7 +134,7 @@ $(LIBGCCJIT_FILENAME): $(jit_OBJS) \
 	@$(call LINK_PROGRESS,$(INDEX.jit),end)
 
 # Create symlinks when not building for Windows
-ifeq (,$(findstring mingw,$(target)))
+ifeq (,$(filter %-mingw% %-cygwin,$(target)))
 $(LIBGCCJIT_SONAME_SYMLINK): $(LIBGCCJIT_FILENAME)
 	ln -sf $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SONAME_SYMLINK)
 
@@ -311,7 +316,7 @@ jit.install-headers: installdirs
 	$(INSTALL_DATA) $(srcdir)/jit/libgccjit++.h \
 	  $(DESTDIR)$(includedir)/libgccjit++.h
 
-ifneq (,$(findstring mingw,$(target)))
+ifneq (,$(filter %-mingw% %-cygwin,$(target)))
 jit.install-common: installdirs jit.install-headers
 # Install import library
 	$(INSTALL_PROGRAM) $(LIBGCCJIT_IMPORT_LIB) \
diff --git a/gcc/system.h b/gcc/system.h
index a3f5948aaee..97b91b33afa 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -688,8 +688,9 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
 # endif
 #endif
 
-#if defined (ENABLE_PLUGIN) && defined (HAVE_DLFCN_H)
-/* If plugin support is enabled, we could use libdl.  */
+#if defined (HAVE_DLFCN_H) && (defined (ENABLE_PLUGIN) || defined (__CYGWIN__))
+/* If plugin support is enabled, we could use libdl.
+   On Cygwin libdl is needed for libgccjit but no plugin support is available.  */
 #include <dlfcn.h>
 #endif
 
-- 
2.31.1