#!/bin/sh
# script for testing the installation
# this has been added to check the post instal hook on osx (Darwin)

set -ev

mkdir -p tmp
cd tmp

cat > test.c <<EOL
#include "antic/nf.h"
#include "antic/nf_elem.h"

int main(void)
{
    nf_t nf;
    nf_elem_t a;
    flint_rand_t state;

    flint_randinit(state);
    nf_init_randtest(nf, state, 5, 20);

    nf_elem_init(a, nf);

    nf_elem_clear(a, nf);
    nf_clear(nf);
    flint_randclear(state);
    flint_cleanup();

    return 0;
}
EOL

$CC test.c -o test -I${PREFIX}/include -L${PREFIX}/lib -Wl,-rpath,${PREFIX}/lib -lantic -lflint -lgmp
if [ $? -ne 0 ];
then
    exit 1;
fi

./test
if [ $? -ne 0 ];
then
    exit 1;
fi
