language: cpp
sudo: required
dist: xenial

#compiler:
  #- gcc
  #- clang

addons_shortcuts:
  addons_gcc5: &gcc5
    apt:
      sources: ['ubuntu-toolchain-r-test']
      packages: [ 'g++-5', 'autoconf-archive', 'libgmp-dev' ]
  addons_gcc9: &gcc9
    apt:
      sources: ['ubuntu-toolchain-r-test']
      packages: [ 'g++-9', 'autoconf-archive', 'libgmp-dev' ]


install:
  - export CXX="$COMPILER"
  - $CXX --version
  - autoconf --version
  - wget https://github.com/malb/m4ri/archive/release-20140914.tar.gz
  - tar -xzf release-20140914.tar.gz
  - pushd m4ri-release-20140914/ && autoreconf --install && ./configure --disable-openmp && make && sudo make install && popd
  - export BOOST_VERSION=${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_MAINTENANCE_VERSION}
  - export BOOST_DIR=boost_${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_${BOOST_MAINTENANCE_VERSION}
  - wget -O ${BOOST_DIR}.tar.bz2 https://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/${BOOST_DIR}.tar.bz2/download
  - tar -xjf ${BOOST_DIR}.tar.bz2
  - pushd ${BOOST_DIR} && ./bootstrap.sh && sudo ./b2 --with-test --prefix=/usr/local install > /dev/null 2>&1 && popd
  - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
  - export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/lib

script:
  - autoreconf --install
  - ./configure
  - make
  - make check

matrix:
  include:
    - os: linux
      compiler: "gcc-5"
      env:
        - COMPILER=g++-5
        - BOOST_MAJOR_VERSION=1
        - BOOST_MINOR_VERSION=65
        - BOOST_MAINTENANCE_VERSION=1
      addons: *gcc5
    - os: linux
      compiler: "gcc-9"
      env:
        - COMPILER=g++-9
        - BOOST_MAJOR_VERSION=1
        - BOOST_MINOR_VERSION=65
        - BOOST_MAINTENANCE_VERSION=1
      addons: *gcc9
    - os: osx
      osx_image: xcode9.4
      env:
        - COMPILER=clang++
        - BOOST_MAJOR_VERSION=1
        - BOOST_MINOR_VERSION=65
        - BOOST_MAINTENANCE_VERSION=1
    - os: osx
      osx_image: xcode11.3
      env:
        - COMPILER=clang++
        - BOOST_MAJOR_VERSION=1
        - BOOST_MINOR_VERSION=65
        - BOOST_MAINTENANCE_VERSION=1
    - os: linux
      compiler: "gcc-5"
      env:
        - COMPILER=g++-5
        - BOOST_MAJOR_VERSION=1
        - BOOST_MINOR_VERSION=72
        - BOOST_MAINTENANCE_VERSION=0
      addons: *gcc5
    - os: linux
      compiler: "gcc-9"
      env:
        - COMPILER=g++-9
        - BOOST_MAJOR_VERSION=1
        - BOOST_MINOR_VERSION=72
        - BOOST_MAINTENANCE_VERSION=0
      addons: *gcc9
    - os: osx
      osx_image: xcode9.4
      env:
        - COMPILER=clang++
        - BOOST_MAJOR_VERSION=1
        - BOOST_MINOR_VERSION=72
        - BOOST_MAINTENANCE_VERSION=0
    - os: osx
      osx_image: xcode11.3
      env:
        - COMPILER=clang++
        - BOOST_MAJOR_VERSION=1
        - BOOST_MINOR_VERSION=72
        - BOOST_MAINTENANCE_VERSION=0
