summaryrefslogtreecommitdiffstats
path: root/src/openal-2-gcc-destructor-win32.patch
blob: d2a51a296bd222586539cf082aae7c22fc8a9d62 (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
This file is part of mingw-cross-env.
See doc/index.html for further information.

This patch has been taken from:
http://opensource.creative.com/pipermail/openal-devel/2010-November/005759.html

diff -r 37cec05f2c93 Alc/ALc.c
--- a/Alc/ALc.c	Sun Nov 28 20:53:45 2010 +0100
+++ b/Alc/ALc.c	Sun Nov 28 21:19:52 2010 +0100
@@ -239,7 +239,10 @@
 
 ///////////////////////////////////////////////////////
 // ALC Related helper functions
-#ifdef _WIN32
+#if defined(HAVE_GCC_DESTRUCTOR)
+static void alc_init(void) __attribute__((constructor));
+static void alc_deinit(void) __attribute__((destructor));
+#elif defined(_WIN32)
 static void alc_init(void);
 static void alc_deinit(void);
 
@@ -261,11 +264,6 @@
     }
     return TRUE;
 }
-#else
-#ifdef HAVE_GCC_DESTRUCTOR
-static void alc_init(void) __attribute__((constructor));
-static void alc_deinit(void) __attribute__((destructor));
-#endif
 #endif
 
 static void alc_init(void)
diff -r 37cec05f2c93 CMakeLists.txt
--- a/CMakeLists.txt	Sun Nov 28 20:53:45 2010 +0100
+++ b/CMakeLists.txt	Sun Nov 28 21:19:52 2010 +0100
@@ -123,11 +123,11 @@
         "Flags used by the compiler during debug builds."
         FORCE)
 
+    CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
+                             int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
+
     # Set visibility options if available
     IF(NOT WIN32)
-        CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
-                                 int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
-
         CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_SWITCH)
         IF(HAVE_VISIBILITY_SWITCH)
             CHECK_C_SOURCE_COMPILES("int foo() __attribute__((visibility(\"default\")));