| 1 |
#!/bin/sh |
| 2 |
# Copyright © 2020 Collabora Ltd. |
| 3 |
# Copyright © 2020 Guillem Jover <[email protected]> |
| 4 |
# SPDX-License-Identifier: GPL-2.0-or-later |
| 5 |
|
| 6 |
set -e |
| 7 |
set -u |
| 8 |
set -x |
| 9 |
|
| 10 |
if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then |
| 11 |
CC="$DEB_HOST_GNU_TYPE-gcc" |
| 12 |
PKG_CONFIG="$DEB_HOST_GNU_TYPE-pkg-config" |
| 13 |
else |
| 14 |
CC=gcc |
| 15 |
PKG_CONFIG=pkg-config |
| 16 |
fi |
| 17 |
|
| 18 |
CFLAGS="-Wall -g -O2 -D_GNU_SOURCE" |
| 19 |
LIBS=$($PKG_CONFIG --cflags --libs libpci) |
| 20 |
|
| 21 |
cd "$AUTOPKGTEST_TMP" |
| 22 |
|
| 23 |
cat <<EOF >test-libpci.c |
| 24 |
#include <pci/pci.h> |
| 25 |
|
| 26 |
int main(void) |
| 27 |
{ |
| 28 |
struct pci_access *a; |
| 29 |
a = pci_alloc(); |
| 30 |
pci_init(a); |
| 31 |
pci_cleanup(a); |
| 32 |
return 0; |
| 33 |
} |
| 34 |
EOF |
| 35 |
|
| 36 |
# Test building minimal code against the installed library. |
| 37 |
$CC $CFLAGS -o test-dynamic test-libpci.c $LIBS |
| 38 |
test -x ./test-dynamic |
| 39 |
./test-dynamic |