]> git.saurik.com Git - apt.git/commitdiff
CMake: Handle BSD platforms with sig_t instead of sighandler_t
authorJulian Andres Klode <jak@debian.org>
Mon, 22 Aug 2016 20:45:19 +0000 (22:45 +0200)
committerJulian Andres Klode <jak@debian.org>
Fri, 26 Aug 2016 13:49:14 +0000 (15:49 +0200)
Somewhat annoying, but OK. Might want to switch to something more
clever to get rid of the typedef at all.

Gbp-Dch: ignore

CMakeLists.txt

index fcb2005713cf39decd9a33aa95801e800bbef3d5..27d0dd5a358bb53873a0bc4dab873ca8bdbb3532 100644 (file)
@@ -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>")