# Helper macro for checking binutils available in OS
macro(sio_check_assembler)
   exec_program(${CMAKE_CXX_COMPILER} ARGS -print-prog-name=as OUTPUT_VARIABLE _as)
   mark_as_advanced(_as)
   if(NOT _as)
      message(WARNING "Could not find 'as', the assembler used by GCC.")
   else()
      exec_program(${_as} ARGS --version OUTPUT_VARIABLE _as_version)
      string(REGEX REPLACE "\\([^\\)]*\\)" "" _as_version "${_as_version}")
      string(REGEX MATCH "[1-9]\\.[0-9]+(\\.[0-9]+)?" _as_version "${_as_version}")
      if(_as_version VERSION_LESS "2.18.93")
         message(STATUS "OS binutils is too old (${_as_version}). Some ZLIB optimizations will be disabled.")
         set(SIO_DEFINITIONS ${SIO_DEFINITIONS} -DSIO_NO_AVX)
         set(ZLIB_AVX_INTRINSICS_BROKEN true)
      elseif(_as_version VERSION_LESS "2.21.0")
         message(STATUS "OS binutils is too old (${_as_version}) for AVX2 instructions.")
         set(SIO_DEFINITIONS ${SIO_DEFINITIONS} -DSIO_NO_AVX2)
         set(ZLIB_AVX2_INTRINSICS_BROKEN true)
      else()
         message(STATUS "Binutils as version: ${_as_version}")
      endif()
   endif()
endmacro()
