# KCGI (kcgi)
option(FUN_WITH_KCGI "Enable kcgi support (CGI/FastCGI via kcgi)" OFF)
set(KCGI_INCLUDE_DIRS "")
set(KCGI_LINK_LIBS "")

if(FUN_WITH_KCGI)
  add_definitions(-DFUN_WITH_KCGI)
  find_package(PkgConfig QUIET)
  if(PKG_CONFIG_FOUND)
    pkg_check_modules(KCGI QUIET kcgi)
  endif()
  if(KCGI_FOUND)
    list(APPEND KCGI_INCLUDE_DIRS ${KCGI_INCLUDE_DIRS} ${KCGI_INCLUDE_DIRS})
    list(APPEND KCGI_LINK_LIBS ${KCGI_LINK_LIBS} ${KCGI_LIBRARIES})
  else()
    # Fallback libs commonly required for kcgi on Linux
    list(APPEND KCGI_LINK_LIBS kcgi z)
  endif()
endif()
