"Fossies" - the Fresh Open Source Software Archive

Member "mariadb-connector-c-3.0.8-src/cmake/FindGSSAPI.cmake" (18 Dec 2018, 4185 Bytes) of package /linux/misc/mariadb-connector-c-3.0.8-src.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) CMake source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #
    2 #  Copyright (C) 2013-2016 MariaDB Corporation AB
    3 #
    4 #  Redistribution and use is allowed according to the terms of the New
    5 #  BSD license.
    6 #  For details see the COPYING-CMAKE-SCRIPTS file.
    7 #
    8 # - Try to detect the GSSAPI support
    9 # Once done this will define
   10 #
   11 #  GSSAPI_FOUND - system supports GSSAPI
   12 #  GSSAPI_INCS - the GSSAPI include directory
   13 #  GSSAPI_LIBS - the libraries needed to use GSSAPI
   14 #  GSSAPI_FLAVOR - the type of API - MIT or HEIMDAL
   15 
   16 # Copyright (c) 2006, Pino Toscano, <toscano.pino@tiscali.it>
   17 #
   18 # Redistribution and use in source and binary forms, with or without
   19 # modification, are permitted provided that the following conditions
   20 # are met:
   21 #
   22 # 1. Redistributions of source code must retain the copyright
   23 #    notice, this list of conditions and the following disclaimer.
   24 # 2. Redistributions in binary form must reproduce the copyright
   25 #    notice, this list of conditions and the following disclaimer in the
   26 #    documentation and/or other materials provided with the distribution.
   27 # 3. The name of the author may not be used to endorse or promote products 
   28 #    derived from this software without specific prior written permission.
   29 #
   30 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   31 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   32 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   33 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   34 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   35 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   36 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   37 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   38 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   39 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   40 
   41 
   42 if(GSSAPI_LIBS AND GSSAPI_FLAVOR)
   43 
   44   # in cache already
   45   set(GSSAPI_FOUND TRUE)
   46 
   47 else(GSSAPI_LIBS AND GSSAPI_FLAVOR)
   48 
   49   find_program(KRB5_CONFIG NAMES krb5-config PATHS
   50      /opt/local/bin
   51      /usr/lib/mit/bin/
   52      ONLY_CMAKE_FIND_ROOT_PATH               # this is required when cross compiling with cmake 2.6 and ignored with cmake 2.4, Alex
   53   )
   54   mark_as_advanced(KRB5_CONFIG)
   55 
   56   #reset vars
   57   set(GSSAPI_INCS)
   58   set(GSSAPI_LIBS)
   59   set(GSSAPI_FLAVOR)
   60 
   61   if(KRB5_CONFIG)
   62   
   63     set(HAVE_KRB5_GSSAPI TRUE)
   64     exec_program(${KRB5_CONFIG} ARGS --libs gssapi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GSSAPI_LIBS)
   65     if(_return_VALUE)
   66       message(STATUS "GSSAPI configure check failed.")
   67       set(HAVE_KRB5_GSSAPI FALSE)
   68     endif(_return_VALUE)
   69   
   70     exec_program(${KRB5_CONFIG} ARGS --cflags gssapi RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GSSAPI_INCS)
   71     string(REGEX REPLACE "(\r?\n)+$" "" GSSAPI_INCS "${GSSAPI_INCS}")
   72     string(REGEX REPLACE " *-I" ";" GSSAPI_INCS "${GSSAPI_INCS}")
   73 
   74     exec_program(${KRB5_CONFIG} ARGS --vendor RETURN_VALUE _return_VALUE OUTPUT_VARIABLE gssapi_flavor_tmp)
   75     set(GSSAPI_FLAVOR_MIT)
   76     if(gssapi_flavor_tmp MATCHES ".*Massachusetts.*")
   77       set(GSSAPI_FLAVOR "MIT")
   78     else(gssapi_flavor_tmp MATCHES ".*Massachusetts.*")
   79       set(GSSAPI_FLAVOR "HEIMDAL")
   80     endif(gssapi_flavor_tmp MATCHES ".*Massachusetts.*")
   81 
   82     if(NOT HAVE_KRB5_GSSAPI)
   83       if (gssapi_flavor_tmp MATCHES "Sun Microsystems.*")
   84          message(STATUS "Solaris Kerberos does not have GSSAPI; this is normal.")
   85          set(GSSAPI_LIBS)
   86          set(GSSAPI_INCS)
   87       else(gssapi_flavor_tmp MATCHES "Sun Microsystems.*")
   88          message(WARNING "${KRB5_CONFIG} failed unexpectedly.")
   89       endif(gssapi_flavor_tmp MATCHES "Sun Microsystems.*")
   90     endif(NOT HAVE_KRB5_GSSAPI)
   91 
   92     if(GSSAPI_LIBS) # GSSAPI_INCS can be also empty, so don't rely on that
   93       set(GSSAPI_FOUND TRUE CACHE STRING "")
   94       message(STATUS "Found GSSAPI: ${GSSAPI_LIBS}")
   95 
   96       set(GSSAPI_INCS ${GSSAPI_INCS} CACHE STRING "")
   97       set(GSSAPI_LIBS ${GSSAPI_LIBS} CACHE STRING "")
   98       set(GSSAPI_FLAVOR ${GSSAPI_FLAVOR} CACHE STRING "")
   99 
  100       mark_as_advanced(GSSAPI_INCS GSSAPI_LIBS GSSAPI_FLAVOR)
  101 
  102     endif(GSSAPI_LIBS)
  103   
  104   endif(KRB5_CONFIG)
  105 
  106 endif(GSSAPI_LIBS AND GSSAPI_FLAVOR)