Skip to contentSkip to conversation

build: generate libkmod.pc during autoconf

PATCH In review Jeff Waugh 2 participants 4 messages Mar 10, 2015 – Mar 11, 2015 Kbuild

lore
Share & tools
lore

Jeff Waugh

author
#0 lore raw

PATCH 1/1 build: generate libkmod.pc during autoconf

The pkgconfig file is generated at make-time, leading to absolute /usr/include & /usr/lib search paths. The patch lets autoconf handle pkgconfig file subst, like other packages do. (Patch from OpenWrt's contributed packages project.)

---
 Makefile.am  | 3 ---
 configure.ac | 1 +
 2 files changed, 1 insertion(+), 3 deletions(-)
Makefile.am +0 -3
index caf18b6..32aea73 100644
@@ -36,9 +36,6 @@ SED_PROCESS = \
 	-e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
 	< $< > $@ || rm $@
 
-%.pc: %.pc.in Makefile
-	$(SED_PROCESS)
-
 LIBKMOD_CURRENT=4
 LIBKMOD_REVISION=10
 LIBKMOD_AGE=2
configure.ac +1 -0
index be597b4..8500cad 100644
@@ -250,6 +250,7 @@ AC_SUBST([OUR_LDFLAGS], $with_ldflags)
 AC_CONFIG_FILES([
 	Makefile
 	man/Makefile
+	libkmod/libkmod.pc
 	libkmod/docs/Makefile
 	libkmod/docs/version.xml
 ])
Signature · 1 line
1.9.1
#1 lore raw

Hi Jeff,

Quoted 2 lines · Jeff Waugh

The pkgconfig file is generated at make-time, leading to absolute /usr/include & /usr/lib search paths. The patch lets autoconf handle pkgconfig file subst,

what exactly are you solving here? What's the problem with doing it during make not during configure?
We have it in Makefile.am exactly so it's processed by make, not configure. Make runs after configure so it will use whatever is configured to make the substitution.

$ ./configure --includedir=/tmp/bla
$ make
$ grep includedir= ./libkmod/libkmod.pc
$ includedir=/tmp/bla
Quoted 1 line

like other packages do. (Patch from OpenWrt's contributed packages project.)

others do like we do, too:
https://git.kernel.org/cgit/linux/kernel/git/kay/libabc.git/tree/Makefile.am
http://cgit.freedesktop.org/systemd/systemd/tree/Makefile.am

should they be changed, too?

Signature · 1 line
Lucas De Marchi
author
#2 lore raw

Hi Lucas,

Quoted 3 lines · Lucas De Marchi

what exactly are you solving here? What's the problem with doing it during make not during configure?

It certainly affects cross-compiling. Possibly other stuff.

Here's the relevant part of libkmod.pc when produced during make:

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include

And during configure:

prefix=/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Quoted 10 lines
Quoted 1 line

like other packages do. (Patch from OpenWrt's contributed packages

project.)

others do like we do, too:

https://git.kernel.org/cgit/linux/kernel/git/kay/libabc.git/tree/Makefile.am
http://cgit.freedesktop.org/systemd/systemd/tree/Makefile.am

should they be changed, too?

Yes! I was just about to send a fix for systemd, as that burned me too. :-)

(If you check any of the libraries on git.gnome.org, their pkg-config files are generated during configure.)

Thanks,
Jeff

author
#3 lore raw
In reply to Lucas De Marchi

Hi Lucas,

Quoted 2 lines · Lucas De Marchi

what exactly are you solving here? What's the problem with doing it during make not during configure?

It certainly affects cross-compiling. Possibly other stuff.

Here's the relevant part of libkmod.pc when produced during make:

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include

And during configure:

prefix=/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Quoted 7 lines
Quoted 1 line

like other packages do. (Patch from OpenWrt's contributed packages project.)

others do like we do, too:
https://git.kernel.org/cgit/linux/kernel/git/kay/libabc.git/tree/Makefile.am
http://cgit.freedesktop.org/systemd/systemd/tree/Makefile.am

should they be changed, too?

Yes! I was just about to send a fix for systemd, as that burned me too. :-)

(If you check any of the libraries on git.gnome.org, their pkg-config files are generated during configure.)

Thanks,
Jeff