os:
  - linux
language: cpp
dist: trusty
sudo: required

matrix:
  include:
    - compiler: gcc
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-4.9
            - g++-4.9
        artifacts: true
      env:
        - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
    - compiler: gcc
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-5
            - g++-5
        artifacts: true
      env:
        - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
    - compiler: gcc
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-6
            - g++-6
        artifacts: true
      env:
        - MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
    - compiler: gcc
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-7
            - g++-7
        artifacts: true
      env:
        - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"

before_install:
  - eval "${MATRIX_EVAL}"
  - . scripts/travis-$TRAVIS_OS_NAME.sh

before_script:
  - export -f travis_fold

script:
  - ./bootstrap.sh -a
  - ./configure
  - make
  - make test

after_failure:
  - travis_fold start "after_failure"
  - cat test-suite.log
  - travis_fold end "after_failure"
