#!/bin/sh
# autopkgtest check: Builds a small application against libdconf-dev, checking
# if it compiles, links and runs successfully.
# Author: Rafał Cieślak <rafalcieslak256@ubuntu.com> 

set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > build_test.c
#include <dconf.h>
int main(int argc, char** argv) {
	if(dconf_is_path("No, this is not actually a path!",NULL)) return 1;
    	return 0;
}
EOF

gcc -o build_test build_test.c `pkg-config --cflags --libs dconf`
echo "build: OK"
[ -x build_test ]
./build_test
echo "run: OK"

