option(WITH_testbed "Enable Kopete testbed protocol" ON)
option(WITH_oscar "Enable Kopete Oscar (ICQ and AIM) protocol" ON)
option(WITH_yahoo "Enable Kopete Yahoo protocol" ON)
option(WITH_qq "Enable Kopete QQ protocol" ON)
option(WITH_sms "Enable Kopete SMS protocol" ON)
option(WITH_groupwise "Enable Novell GroupWise Messenger protocol" ON)
option(WITH_winpopup "Enable Kopete winpopup protocol" ON)
option(WITH_gadu "Enable Kopete Gadu-Gadu protocol" ON)
option(WITH_jabber "Enable Kopete Jabber protocol" ON)
option(WITH_GOOGLETALK "Enable Kopete Jabber Google Talk support" ON)
option(WITH_bonjour "Enable Kopete Bonjour protocol" ON)
option(WITH_irc "Enable Kopete IRC protocol" OFF)
option(WITH_wlm "Enable Window Live Messenger support" ON)
option(WITH_WLM_MEDIASTREAMER "Enable Windows Live Messenger voice clip support" ON)
option(WITH_meanwhile "Enable Kopete meanwhile protocol" ON)
option(WITH_skype "Enable Kopete Skype protocol" ON)

# Disable jingle support because it is not working and libiris does not support it
#if(LIBORTP_FOUND AND SPEEX_FOUND AND ALSA_FOUND AND WITH_JINGLE)
#  message(STATUS "Building jingle support")
#  set(BUILD_JINGLE TRUE)
#else(LIBORTP_FOUND AND SPEEX_FOUND AND ALSA_FOUND AND WITH_JINGLE)
#  message(STATUS "Not building jingle support (recommended)")
#  set(BUILD_JINGLE FALSE)
#endif(LIBORTP_FOUND AND SPEEX_FOUND AND ALSA_FOUND AND WITH_JINGLE)
set(BUILD_JINGLE FALSE)

if(OPENSSL_FOUND OR WIN32)
  if(EXPAT_FOUND AND LIBORTP_FOUND AND SRTP_FOUND AND JSONCPP_FOUND AND ALSA_FOUND AND MEDIASTREAMER_FOUND AND WITH_GOOGLETALK)
    message(STATUS "Building Google Talk libjingle support")
    set(BUILD_GOOGLETALK TRUE)
  else(EXPAT_FOUND AND LIBORTP_FOUND AND SRTP_FOUND AND JSONCPP_FOUND AND ALSA_FOUND AND MEDIASTREAMER_FOUND AND WITH_GOOGLETALK)
    message(STATUS "Not building Google Talk libjingle support")
    set(BUILD_GOOGLETALK FALSE)
  endif(EXPAT_FOUND AND LIBORTP_FOUND AND SRTP_FOUND AND JSONCPP_FOUND AND ALSA_FOUND AND MEDIASTREAMER_FOUND AND WITH_GOOGLETALK)
else(OPENSSL_FOUND OR WIN32)
  message(STATUS "Not building Google Talk libjingle support")
  set(BUILD_GOOGLETALK FALSE)
endif(OPENSSL_FOUND OR WIN32)

if(MEDIASTREAMER_FOUND AND LIBORTP_FOUND AND WITH_WLM_MEDIASTREAMER)
  message(STATUS "Building Windows Live Messenger voice clip support")
  set(BUILD_WLM_MEDIASTREAMER TRUE)
else(MEDIASTREAMER_FOUND AND LIBORTP_FOUND AND WITH_WLM_MEDIASTREAMER)
  message(STATUS "Not building Windows Live Messenger voice clip support")
  set(BUILD_WLM_MEDIASTREAMER FALSE)
endif(MEDIASTREAMER_FOUND AND LIBORTP_FOUND AND WITH_WLM_MEDIASTREAMER)

include_directories(${KOPETE_INCLUDES})

if(WITH_wlm AND LIBMSN_FOUND AND Boost_FOUND)
  add_subdirectory( wlm )
endif(WITH_wlm AND LIBMSN_FOUND AND Boost_FOUND)

if(WITH_oscar)
  add_subdirectory( oscar )
endif(WITH_oscar)
if(WITH_yahoo AND JASPER_FOUND)
  add_subdirectory( yahoo ) 
endif(WITH_yahoo AND JASPER_FOUND)
if(WITH_qq)
  add_subdirectory( qq )
endif(WITH_qq)
if(WITH_irc)
  message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: WARNING: Building the irc plugin, even if  it hasn't been completely ported yet")
  add_subdirectory( irc )
endif(WITH_irc)
if(NOT WIN32)
  if(WITH_winpopup)
    add_subdirectory( winpopup )
  endif(WITH_winpopup)
  if(WITH_gadu AND LIBGADU_FOUND)
    add_subdirectory( gadu )
  endif(WITH_gadu AND LIBGADU_FOUND)
  if(WITH_sms)
    add_subdirectory( sms )
  endif(WITH_sms)
  if(NOT APPLE AND WITH_skype)
    add_subdirectory( skype )
  endif(NOT APPLE AND WITH_skype)
endif(NOT WIN32)

if(QCA2_FOUND AND ZLIB_FOUND)
  if(IDN_FOUND)
    if(WITH_jabber)
      add_subdirectory( jabber )
    endif(WITH_jabber)
  else(IDN_FOUND)
    message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: Disabled Jabber because libidn-devel was not found")
  endif(IDN_FOUND)
  if(WITH_groupwise)
    add_subdirectory( groupwise )
  endif(WITH_groupwise)
else(QCA2_FOUND AND ZLIB_FOUND)
  message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: Disabled GroupWise and Jabber because QCA2 was not found")
endif(QCA2_FOUND AND ZLIB_FOUND)

if(WITH_testbed)
  add_subdirectory( testbed )
endif(WITH_testbed)

if(WITH_bonjour)
  add_subdirectory( bonjour )
endif(WITH_bonjour)

if(WITH_meanwhile)
  if(LIBMEANWHILE_FOUND)
    add_subdirectory( meanwhile )
  else(LIBMEANWHILE_FOUND)
    message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: Disabled Meanwhile beause libmeanwhile was not found")
  endif(LIBMEANWHILE_FOUND)
endif(WITH_meanwhile)

