Skip to content

Commit c150e77

Browse files
committed
build: Add a pkg-config file
The .pc are a better replacement for library detection and linking usage, than libtool .la files or hardcoding the flags in the using code.
1 parent 5406b33 commit c150e77

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*.la
22
*.lo
33
*.o
4+
*.pc
45
.deps
56
.libs
67
INSTALL

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ AC_CHECK_FUNCS([bzero isascii memset strchr strerror strrchr strstr strtol])
5656

5757
AC_CONFIG_FILES([Makefile
5858
lib/Makefile
59+
lib/libsysfs.pc
5960
cmd/Makefile
6061
test/Makefile])
6162
AC_CONFIG_HEADERS([config.h])

lib/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
EXTRA_DIST = libsysfs.pc.in
2+
3+
pkgconfigdir = $(libdir)/pkgconfig
4+
pkgconfig_DATA = libsysfs.pc
5+
16
lib_LTLIBRARIES = libsysfs.la
27
libsysfs_la_SOURCES = sysfs_utils.c sysfs_attr.c sysfs_class.c dlist.c \
38
sysfs_device.c sysfs_driver.c sysfs_bus.c sysfs_module.c sysfs.h

lib/libsysfs.pc.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
prefix=@prefix@
2+
exec_prefix=@exec_prefix@
3+
libdir=@libdir@
4+
includedir=@includedir@
5+
6+
Name: libsysfs
7+
Description: interface to Linux sysfs
8+
Version: @VERSION@
9+
URL: https://github.com/linux-ras/sysfsutils
10+
Libs: -L${libdir} -lsysfs
11+
Cflags: -I${includedir}

0 commit comments

Comments
 (0)