#!/bin/sh
# autopkgtest check: Build and run a program against mathicgb, to verify that
# the headers and pkg-config file are installed correctly.
# Author: Doug Torrance <dtorrance@piedmont.edu>

set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > mathicgbtest.cpp

#include <mathicgb.h>
int main (int argc, char *argv[])
{
  mgb::GroebnerConfiguration configuration(2, 0, 0);
}
EOF

g++ -o mathicgbtest mathicgbtest.cpp `pkg-config --cflags --libs mathicgb`
echo "build: OK"
[ -x mathicgbtest ]
./mathicgbtest
echo "run: OK"
