uwrap: Always enable logging
[uid_wrapper.git] / ConfigureChecks.cmake
index bfd1919dbc9c03add39f4b0c95dc15f9930f98f1..150d89b4dbe0ba0223ca8d0e90ca8f4f29679f14 100644 (file)
@@ -60,11 +60,13 @@ check_function_exists(snprintf HAVE_SNPRINTF)
 
 check_function_exists(seteuid HAVE_SETEUID)
 check_function_exists(setreuid HAVE_SETREUID)
-check_function_exists(setreuid HAVE_SETRESUID)
+check_function_exists(setresuid HAVE_SETRESUID)
+check_function_exists(getresuid HAVE_GETRESUID)
+check_function_exists(getresgid HAVE_GETRESGID)
 
 check_function_exists(setegid HAVE_SETEGID)
 check_function_exists(setregid HAVE_SETREGID)
-check_function_exists(setregid HAVE_SETRESGID)
+check_function_exists(setresgid HAVE_SETRESGID)
 
 check_function_exists(getgroups HAVE_GETGROUPS)
 check_function_exists(setgroups HAVE_SETGROUPS)
@@ -124,6 +126,15 @@ int main(void) {
     set(CMAKE_REQUIRED_DEFINITIONS)
 endif (LINUX)
 
+check_c_source_compiles("
+#include <stdbool.h>
+int main(void) {
+    bool x;
+    bool *p_x = &x;
+    __atomic_load(p_x, &x, __ATOMIC_RELAXED);
+    return 0;
+}" HAVE_GCC_ATOMIC_BUILTINS)
+
 check_c_source_compiles("
 __thread int tls;
 
@@ -131,6 +142,51 @@ int main(void) {
     return 0;
 }" HAVE_GCC_THREAD_LOCAL_STORAGE)
 
+check_c_source_compiles("
+void test_constructor_attribute(void) __attribute__ ((constructor));
+
+void test_constructor_attribute(void)
+{
+     return;
+}
+
+int main(void) {
+     return 0;
+}" HAVE_CONSTRUCTOR_ATTRIBUTE)
+
+check_c_source_compiles("
+void test_destructor_attribute(void) __attribute__ ((destructor));
+
+void test_destructor_attribute(void)
+{
+    return;
+}
+
+int main(void) {
+    return 0;
+}" HAVE_DESTRUCTOR_ATTRIBUTE)
+
+# If this produces a warning treat it as error!
+set(CMAKE_REQUIRED_FLAGS "-Werror")
+check_c_source_compiles("
+void test_address_sanitizer_attribute(void) __attribute__((no_sanitize_address));
+
+void test_address_sanitizer_attribute(void)
+{
+    return;
+}
+
+int main(void) {
+    return 0;
+}" HAVE_ADDRESS_SANITIZER_ATTRIBUTE)
+set(CMAKE_REQUIRED_FLAGS)
+
+check_c_source_compiles("
+void log_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
+
+int main(void) {
+    return 0;
+}" HAVE_FUNCTION_ATTRIBUTE_FORMAT)
 
 # SYSTEM LIBRARIES
 
@@ -140,6 +196,10 @@ if (HAVE_LIBDL)
     set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${DLFCN_LIBRARY})
 endif (HAVE_LIBDL)
 
+if (OSX)
+    set(HAVE_APPLE 1)
+endif (OSX)
+
 # ENDIAN
 if (NOT WIN32)
     test_big_endian(WORDS_BIGENDIAN)