language: cpp
sudo: false

cache:
  directories:
    - ${TRAVIS_BUILD_DIR}/boost_1_64_0

matrix:
  include:
    #
    #---------------------------------------------------------------------------
    # Linux / g++-6
    #---------------------------------------------------------------------------
    #
    # Linux / g++-6 / -O2 / standalone
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-6
      env:
        - CXXFLAGS="-Wall -Wextra -O2"
        - CONFIGFLAGS="--with-boost=no"
        - MATRIX_EVAL="CC=gcc-6 CXX=g++-6"
      compiler: gcc
    #
    # Linux / g++-6 / -O0 / standalone / handler tracking
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-6
      env:
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline -DASIO_ENABLE_HANDLER_TRACKING"
        - CONFIGFLAGS="--with-boost=no"
        - MATRIX_EVAL="CC=gcc-6 CXX=g++-6"
      compiler: gcc
    #
    # Linux / g++-6 / -O0 / standalone / epoll disabled
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-6
      env:
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline -DASIO_DISABLE_EPOLL"
        - CONFIGFLAGS="--with-boost=no"
        - MATRIX_EVAL="CC=gcc-6 CXX=g++-6"
      compiler: gcc
    #
    # Linux / g++-6 / -O0 / standalone / separate compilation
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-6
      env:
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline"
        - CONFIGFLAGS="--with-boost=no --enable-separate-compilation"
        - MATRIX_EVAL="CC=gcc-6 CXX=g++-6"
      compiler: gcc
    #
    # Linux / g++-6 / -O0 / standalone / separate compilation / handler tracking
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-6
      env:
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline -DASIO_ENABLE_HANDLER_TRACKING"
        - CONFIGFLAGS="--with-boost=no --enable-separate-compilation"
        - MATRIX_EVAL="CC=gcc-6 CXX=g++-6"
      compiler: gcc
    #
    # Linux / g++-6 / -O0 / standalone / separate compilation / epoll disabled
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-6
      env:
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline -DASIO_DISABLE_EPOLL"
        - CONFIGFLAGS="--with-boost=no --enable-separate-compilation"
        - MATRIX_EVAL="CC=gcc-6 CXX=g++-6"
      compiler: gcc
    #
    # Linux / g++-6 / -O2 / boost 1.64
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-6
      env:
        - BOOST_DIR="boost_1_64_0"
        - BOOST_URL="https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2"
        - CXXFLAGS="-Wall -Wextra -O2"
        - CONFIGFLAGS=""
        - MATRIX_EVAL="CC=gcc-6 CXX=g++-6"
      compiler: gcc
    #
    # Linux / g++-6 / -O0 / boost 1.64 / epoll disabled
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-6
      env:
        - BOOST_DIR="boost_1_64_0"
        - BOOST_URL="https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2"
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline -DASIO_DISABLE_EPOLL"
        - CONFIGFLAGS=""
        - MATRIX_EVAL="CC=gcc-6 CXX=g++-6"
      compiler: gcc
    #
    # Linux / g++-6 / -O0 / boost 1.64 / separate compilation
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-6
      env:
        - BOOST_DIR="boost_1_64_0"
        - BOOST_URL="https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2"
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline"
        - CONFIGFLAGS="--enable-separate-compilation"
        - MATRIX_EVAL="CC=gcc-6 CXX=g++-6"
      compiler: gcc
    #
    #---------------------------------------------------------------------------
    # Linux / g++-4.8
    #---------------------------------------------------------------------------
    #
    # Linux / g++-4.8 / -O2 / standalone
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-4.8
      env:
        - CXXFLAGS="-Wall -Wextra -O2"
        - CONFIGFLAGS="--with-boost=no"
        - MATRIX_EVAL="CC=gcc-4.8 CXX=g++-4.8"
      compiler: gcc
    #
    # Linux / g++-4.8 / -O0 / standalone / separate compilation
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-4.8
      env:
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline"
        - CONFIGFLAGS="--with-boost=no --enable-separate-compilation"
        - MATRIX_EVAL="CC=gcc-4.8 CXX=g++-4.8"
      compiler: gcc
    #
    # Linux / g++-4.8 / -O2 / boost 1.64
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-4.8
      env:
        - BOOST_DIR="boost_1_64_0"
        - BOOST_URL="https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2"
        - CXXFLAGS="-Wall -Wextra -O2"
        - CONFIGFLAGS=""
        - MATRIX_EVAL="CC=gcc-4.8 CXX=g++-4.8"
      compiler: gcc
    #
    # Linux / g++-4.8 -std=c++11 / -O2 / boost 1.64
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-4.8
      env:
        - BOOST_DIR="boost_1_64_0"
        - BOOST_URL="https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2"
        - CXXFLAGS="-std=c++11 -Wall -Wextra -O2"
        - CONFIGFLAGS=""
        - MATRIX_EVAL="CC=gcc-4.8 CXX=g++-4.8"
      compiler: gcc
    #
    #---------------------------------------------------------------------------
    # Linux / clang-3.8
    #---------------------------------------------------------------------------
    #
    # Linux / clang-3.8 / -O2 / standalone"
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
            - llvm-toolchain-precise-3.8
          packages:
            - clang-3.8
      env:
        - CXXFLAGS="-Wall -Wextra -O2"
        - CONFIGFLAGS="--with-boost=no"
        - MATRIX_EVAL="CC=clang-3.8 CXX=clang++-3.8"
      compiler: clang
    #
    # Linux / clang-3.8 / -O0 / standalone / separate compilation
    #
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
            - llvm-toolchain-precise-3.8
          packages:
            - clang-3.8
      env:
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline"
        - CONFIGFLAGS="--with-boost=no --enable-separate-compilation"
        - MATRIX_EVAL="CC=clang-3.8 CXX=clang++-3.8"
      compiler: clang
    #
    #---------------------------------------------------------------------------
    # macOS / xcode8
    #---------------------------------------------------------------------------
    #
    # macOS / xcode8 / -O2 / standalone
    #
    - os: osx
      env:
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline"
        - CONFIGFLAGS="--with-boost=no"
      osx_image: xcode8
    #
    # macOS / xcode8 / -O0 / standalone / kqueue disabled
    #
    - os: osx
      env:
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline -DASIO_DISABLE_KQUEUE"
        - CONFIGFLAGS="--with-boost=no"
      osx_image: xcode8
    #
    # macOS / xcode8 / -O0 / standalone / separate compilation
    #
    - os: osx
      env:
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline"
        - CONFIGFLAGS="--with-boost=no --enable-separate-compilation"
      osx_image: xcode8
    #
    # macOS / xcode8 / -O2 / boost 1.64
    #
    - os: osx
      env:
        - BOOST_DIR="boost_1_64_0"
        - BOOST_URL="https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2"
        - CXXFLAGS="-Wall -Wextra -O2"
        - CONFIGFLAGS=""
      osx_image: xcode8
    #
    # macOS / xcode8 / -O0 / boost 1.64 / separate compilation
    #
    - os: osx
      env:
        - BOOST_DIR="boost_1_64_0"
        - BOOST_URL="https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2"
        - CXXFLAGS="-Wall -Wextra -O0 -fno-inline"
        - CONFIGFLAGS="--enable-separate-compilation"
      osx_image: xcode8

before_install:
  - eval "${MATRIX_EVAL}"

install:
  - |
    if [[ "${BOOST_URL}" != "" ]]; then
      if [[ -z "$(ls -A ${BOOST_DIR})" ]]; then
        { travis_retry wget --quiet -O - ${BOOST_URL} | tar -xj; } || exit 1
      fi
    fi

script:
  - cd asio && ./autogen.sh && ./configure $CONFIGFLAGS && make && make check

notifications:
  email: false
