language: c
os: linux
dist: xenial
addons:
  apt:
    packages:
      - xmlto
      - libxml2-dev
      - libnss3-tools
      - libproxy-dev
      - gnutls-bin
      - libgnutls28-dev
env:
  global:
    - MARGS="-j2 check"
matrix:
  include:
    - name: Static
      compiler: gcc
      env: CONF="--enable-static"
    - name: Shared
      compiler: gcc
      env: CONF="--enable-shared"
    - name: Disable-all
      compiler: gcc
      env: CONF="--without-libproxy --without-gssapi --without-zlib --disable-nls --disable-debug --disable-webdav"
    - name: Memleak
      compiler: gcc
      env: CONF="--enable-memleak"
    - name: Libxml2
      compiler: gcc
      env: CONF="--with-libxml2"
    - name: Static UBSan w/OpenSSL
      env: CONF="--enable-static --with-ssl=openssl" CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined" LIBS=-lubsan NEON_LIBS=-lubsan
    - name: Static 32-bit w/OpenSSL
      compiler: gcc
      env: CONF="--enable-static --with-ssl=openssl" CC='gcc -m32'
      addons:
        apt:
          packages:
            - libc6-dev-i386
            - gcc-multilib
            - libexpat1-dev:i386
            - libssl-dev:i386
            - lib32z1-dev
    - name: OpenSSL
      compiler: gcc
      env: CONF="--with-ssl=openssl"
    - name: OpenSSL on arm64
      arch: arm64
      env: CONF="--with-ssl=openssl"
    - name: OpenSSL on s390x
      arch: s390x
      env: CONF="--with-ssl=openssl"
    - name: OpenSSL on trusty
      dist: trusty
      env: CONF="--with-ssl=openssl"
    - name: OpenSSL on trusty, shared w/thread-safety
      dist: trusty
      env: CONF="--with-ssl=openssl --enable-shared --disable-static --enable-threadsafe-ssl=posix"
           CC="gcc -pthread"
    - name: OpenSSL on bionic
      compiler: gcc
      dist: bionic
      env: CONF="--with-ssl=openssl"
    - name: OpenSSL memleak
      compiler: gcc
      env: CONF="--with-ssl=openssl --enable-memleak"
    - name: GnuTLS
      env: CONF="--with-ssl=gnutls"
    - name: GnuTLS on bionic
      dist: bionic
      env: CONF="--with-ssl=gnutls"
    - name: GnuTLS on trusty
      dist: trusty
      env: CONF="--with-ssl=gnutls"
    - name: GnuTLS memleak
      env: CONF="--with-ssl=gnutls --enable-memleak"
    - name: Copyright check
      compiler: gcc
      env: CONF="--without-libproxy --without-gssapi --without-zlib --disable-nls --disable-debug --disable-webdav" MARGS="update-copyright"
  allow_failures:
    # s390x builds currently flaky
    - name: OpenSSL on s390x
      arch: s390x
      env: CONF="--with-ssl=openssl"

script: ./autogen.sh && ./configure --enable-warnings $CONF && make $MARGS
