#################################################
#
#  (C) 2017 Slávek Banko
#  slavek (DOT) banko (AT) axis.cz
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

tde_save_and_set( CMAKE_REQUIRED_FLAGS "-include X11/Xlib.h" )
tde_save_and_set( CMAKE_REQUIRED_LIBRARIES "${XEXT_LIBRARIES}" )
check_symbol_exists( XShmGetEventBase "X11/extensions/XShm.h" HAVE_XSHMGETEVENTBASE )
tde_restore( CMAKE_REQUIRED_FLAGS )
tde_restore( CMAKE_REQUIRED_LIBRARIES )

if( ${XINE_VERSION} VERSION_LESS "1.2" )
  tde_save_and_set( CMAKE_REQUIRED_LIBRARIES "xine" )
  check_function_exists( _x_ao_new_port HAVE_XINE_X_AO_NEW_PORT )
  if( HAVE_XINE_X_AO_NEW_PORT )
    set( ao_new_port "_x_ao_new_port" CACHE INTERNAL "" FORCE)
  else()
    check_function_exists( ao_new_port HAVE_XINE_AO_NEW_PORT )
  endif()
  tde_restore( CMAKE_REQUIRED_LIBRARIES )
endif( ${XINE_VERSION} VERSION_LESS "1.2" )
