Browse Source

CMake: Handle BSD platforms with sig_t instead of sighandler_t

Somewhat annoying, but OK. Might want to switch to something more
clever to get rid of the typedef at all.

Gbp-Dch: ignore
Julian Andres Klode 10 years ago
parent
commit
0fa5d86204
1 changed files with 13 additions and 0 deletions
  1. 13 0
      CMakeLists.txt

+ 13 - 0
CMakeLists.txt

@@ -118,6 +118,19 @@ if (CMAKE_USE_PTHREADS_INIT)
   set(HAVE_PTHREAD 1)
 endif()
 
+include(CheckTypeSize)
+set(CMAKE_EXTRA_INCLUDE_FILES "signal.h")
+check_type_size("sig_t" SIG_T LANGUAGE "CXX")
+check_type_size("sighandler_t" SIGHANDLER_T LANGUAGE "CXX")
+set(CMAKE_EXTRA_INCLUDE_FILES)
+if (NOT HAVE_SIGHANDLER_T)
+  if (HAVE_SIG_T)
+    add_definitions(-Dsighandler_t=sig_t)
+  else()
+    message(FATAL_ERROR "Platform defines neither sig_t nor sighandler_t")
+  endif()
+endif()
+
 # Configure some variables like package, version and architecture.
 set(PACKAGE ${PROJECT_NAME})
 set(PACKAGE_MAIL "APT Development Team <deity@lists.debian.org>")