summaryrefslogtreecommitdiff
path: root/debian/tests/pkg-config-test
blob: e074b16038665ef35fff9be6234cd54dcc9c8757 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
set -e

if [ -z "$AUTOPKGTEST_TMP" ]; then
   WORKDIR=''
   cleanup() {
      if [ -n "$WORKDIR" ]; then cd /; rm -rf -- "$WORKDIR"; fi
      WORKDIR=''
   }
   trap 'cleanup' 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
   WORKDIR="$(mktemp -d)"
   cd "$WORKDIR"
else
   cd "$AUTOPKGTEST_TMP"
fi

cat >pkgconfigtest.cc <<EOF
#include <apt-pkg/init.h>
#include <cstdio>

int main()
{
    printf("APT Version: %s\n", pkgVersion);
    return 0;
}
EOF

g++ -Wall -Wextra -o pkgconfigtest pkgconfigtest.cc `pkg-config --cflags --libs apt-pkg`
echo 'build: OK'
test -x pkgconfigtest
./pkgconfigtest
echo 'run: OK'