On Mon, 2009-07-20 at 12:43 -0600, Jason Gunthorpe wrote:
> On Mon, Jul 20, 2009 at 11:17:29AM -0700, Steven Dake wrote:
> > The attached patch adds support for pkgconfig to the ibverbs library.
> >
> > Cloned from Roland's kernel.org git tree.
>
> Erm, am I missing something? Shouldn't your patches include some use
> of the .pc files for libraries downstream of libibverbs, like
> librdmacm?
>
yes librdmacm should use PKG_CHECK_MODULES to determine cflags and
ldflags and I will submit a patch for this capability.
I was uncertain of project policy, however. One problem with using
PKG_CHECK_MODULES is that it only works properly in recent pkgconfig m4
files. In projects I maintain, we don't expect our users to
run ./autogen.sh to parse the configure.ac/in file. Instead we
distribute a already-autogenned version in our tarball (similar to the
output from make dist). Using the PKG_CHECK_MODULES then requires up to
date upstream packages of autotools for developers, but not for users
(which simply run configure where the m4 macro has already been
processed). Such a patch then won't also won't build on older distros
(if you have concerns about autogenning your library against older
versions of autotools). This issue caused significant problems in our
developer community (downstream user of ibverbs) as everyone had to
upgrade to recent autotools.
There are mechanisms to use pkg-config directly in the configure script
to avoid this defect, but I don't know how to do this (C jockey here,
not too experienced with autotools).
> I often install all this stuff in a prefix and it sure would be nice
> if the compilations didn't need as much hand holding beyond --prefix
> to get it all setup.
>
agree
> > diff --git a/configure.in b/configure.in
> > index 374aae7..c54ca4b 100644
> > +++ b/configure.in
> > @@ -6,6 +6,7 @@ AC_CONFIG_SRCDIR([src/ibverbs.h])
> > AC_CONFIG_AUX_DIR(config)
> > AM_CONFIG_HEADER(config.h)
> > AM_INIT_AUTOMAKE(libibverbs, 1.1.2)
> > +AC_CHECK_PROGS([PKGCONFIG], [pkg-config])
>
> Is that necessary, pkg-config is never called?
>
good catch
new patch attached
> Jason
diff --git a/Makefile.am b/Makefile.am
index 9b05306..b5ccb32 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,6 +66,8 @@ EXTRA_DIST = include/infiniband/driver.h include/infiniband/kern-abi.h \
src/ibverbs.h examples/pingpong.h \
src/libibverbs.map libibverbs.spec.in $(man_MANS)
+SUBDIRS = pkgconfig
+
dist-hook: libibverbs.spec
cp libibverbs.spec $(distdir)
diff --git a/configure.in b/configure.in
index 374aae7..ce098ec 100644
--- a/configure.in
+++ b/configure.in
@@ -67,5 +67,5 @@ if test $ac_cv_asm_symver_support = yes; then
fi
SHAVE_INIT([], [enable])
-AC_CONFIG_FILES([Makefile libibverbs.spec shave shave-libtool])
+AC_CONFIG_FILES([Makefile pkgconfig/Makefile libibverbs.spec shave shave-libtool])
AC_OUTPUT
diff --git a/libibverbs.spec.in b/libibverbs.spec.in
index 6bd8c8e..91d487e 100644
--- a/libibverbs.spec.in
+++ b/libibverbs.spec.in
@@ -72,6 +72,7 @@ rm -rf $RPM_BUILD_ROOT
%files devel
%defattr(-,root,root,-)
%{_libdir}/lib*.so
+%{_libdir}/pkgconfig/*.pc
%{_includedir}/*
%{_mandir}/man3/*
@@ -85,6 +86,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/*
%changelog
+* Mon Jul 20 2008 Steven Dake <[email protected]> - 1.1.2-2
+- Add support for pkgconfig infrastructure.
+
* Wed Apr 16 2008 Roland Dreier <[email protected]> - 1.1.2-1
- New upstream release
- Update description to mention RDMA and iWARP, not just InfiniBand
diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am
new file mode 100644
index 0000000..de7e769
--- /dev/null
+++ b/pkgconfig/Makefile.am
@@ -0,0 +1,25 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST = ibverbs.pc.in
+
+target_LIBS = ibverbs.pc
+
+%.pc: ibverbs.pc.in Makefile
+ rm -f $...@-t $@
+ sed \
+ -e 's#@''pre...@#$(exec_prefix)#g' \
+ -e 's#@''lib...@#$(libdir)#g' \
+ -e 's#@''libvers...@#$(VERSION)#g' \
+ -e 's#@''l...@#'$(*:lib%=%)'#g' \
+ $< > $...@-t
+ chmod a-w $...@-t
+ mv $...@-t $@
+
+all-local: $(target_LIBS)
+
+install-exec-local: $(target_LIBS)
+ $(INSTALL) -d $(DESTDIR)/$(libdir)/pkgconfig
+ $(INSTALL) -m 644 $(target_LIBS) $(DESTDIR)/$(libdir)/pkgconfig
+
+clean-local:
+ rm -f *.pc
diff --git a/pkgconfig/ibverbs.pc.in b/pkgconfig/ibverbs.pc.in
new file mode 100644
index 0000000..4a8a7e0
--- /dev/null
+++ b/pkgconfig/ibverbs.pc.in
@@ -0,0 +1,11 @@
+pref...@prefix@
+exec_prefix=${prefix}
+libd...@libdir@
+includedir=${prefix}/include
+
+Name: @LIB@
+Version: @LIBVERSION@
+Description: @LIB@
+Requires:
+Libs: -L${libdir} -...@lib@
+Cflags: -I${includedir}
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general