$NetBSD$

--- src/Native/System.Net.Security.Native/CMakeLists.txt.orig	2016-05-03 12:05:51.000000000 +0000
+++ src/Native/System.Net.Security.Native/CMakeLists.txt
@@ -9,6 +9,13 @@ if (HAVE_GSSFW_HEADERS)
    if(LIBGSS STREQUAL LIBGSS-NOTFOUND)
       message(FATAL_ERROR "Cannot find GSS.Framework and System.Net.Security.Native cannot build without it. Try installing GSS.Framework (or the appropriate package for your platform)")
    endif()
+elseif(HAVE_HEIMDAL_HEADERS)
+   find_library(LIBGSS NAMES gssapi)
+   if(LIBGSS STREQUAL LIBGSS-NOTFOUND)
+      message(FATAL_ERROR "Cannot find libgssapi and System.Net.Security.Native cannot build without it. Try installing heimdal (or the appropriate package for your platform)")
+   endif()
+elseif(HeimdalGssApi)
+     message(FATAL_ERROR "HeimdalGssApi option was set but gssapi headers could not be found and System.Net.Security.Native cannot build without the headers. Try installing heimdal (or the appropriate package for your platform)")
 else()
    find_library(LIBGSS NAMES gssapi_krb5)
    if(LIBGSS STREQUAL LIBGSS-NOTFOUND)
