configure: check for pragma init/fini for constructors/destructors
[socket_wrapper.git] / ConfigureChecks.cmake
index 4a2f55e95258f67ad310f0c9671a28ce0333fa61..3c8e61573a7a392738e89fcf4e427b38643d8615 100644 (file)
@@ -216,6 +216,32 @@ int main(void) {
     return 0;
 }" HAVE_DESTRUCTOR_ATTRIBUTE)
 
+check_c_source_compiles("
+#pragma init (test_constructor)
+void test_constructor(void);
+
+void test_constructor(void)
+{
+    return;
+}
+
+int main(void) {
+    return 0;
+}" HAVE_PRAGMA_INIT)
+
+check_c_source_compiles("
+#pragma fini (test_destructor)
+void test_destructor(void);
+
+void test_destructor(void)
+{
+    return;
+}
+
+int main(void) {
+    return 0;
+}" HAVE_PRAGMA_FINI)
+
 check_c_source_compiles("
 #define FALL_THROUGH __attribute__((fallthrough))