Skip to content

Commit a7cf5f8

Browse files
committed
Use pkg-config macro to check for libgpiod
This also restricts supported version of libgpiod to < 2.0.0.
1 parent e2b4427 commit a7cf5f8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/configure.ac

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,12 @@ install with "sudo apt-get install libusb-1.0-0-dev" or disable with
533533
#
534534
# check for libgpiod
535535
#
536-
AC_MSG_CHECKING([for libgpiod])
537-
AC_CHECK_LIB(gpiod, main,
536+
PKG_CHECK_MODULES([LIBGPIOD], [libgpiod < 2.0.0],
538537
[AC_DEFINE_UNQUOTED([LIBGPIOD_VER], `pkg-config libgpiod --modversion | awk -F. '{print ($1 * 100)+($2) }'`,
539538
[libgpiod version, undefined if not present])
540-
LDFLAGS="$LDFLAGS -lgpiod"
539+
LDFLAGS="$LDFLAGS $LIBGPIOD_LIBS"
540+
LIBGPIOD_VERSION=`pkg-config libgpiod --modversion`
541+
AC_MSG_NOTICE([libgpiod version $LIBGPIOD_VERSION found])
541542
AC_SUBST([LIBGPIOD_VER], `pkg-config libgpiod --modversion | awk -F. '{print ($1 * 100)+($2) }'`)],
542543
[AC_MSG_WARN([Could not find libgpiod, not building hal_gpio])])
543544

0 commit comments

Comments
 (0)