Skip to content

Commit

Permalink
Adding pkg-config support.
Browse files Browse the repository at this point in the history
Remove usnic special case. Fix erroneous indentation.

Also include provider LDFLAGS in case library dependencies
are in non-system paths.

Remove unused pkg-config Requires variables.

Signed-off-by: Ezra Kissel <[email protected]>
  • Loading branch information
disprosium8 committed Dec 17, 2015
1 parent 1b23ce1 commit aff4981
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ dummy_man_pages = \
man/man3/fi_writemsg.3 \
man/man3/fi_writev.3

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libfabric.pc

nroff:
@for file in $(real_man_pages); do \
source=`echo $$file | sed -e 's@/man[0-9]@@'`; \
Expand Down
43 changes: 43 additions & 0 deletions config/fi_provider.m4
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ AC_DEFUN([FI_PROVIDER_SETUP],[
AS_IF([test $$1_happy -eq 1],
[PROVIDERS_TO_BUILD="$PROVIDERS_TO_BUILD $1"
PROVIDERS_COUNT=$((PROVIDERS_COUNT+1))
_FI_PROVIDER_PC_ADD($1)
AS_IF([test $$1_dl -eq 1],
[PROVIDERS_DL="prov/$1/lib$1.la $PROVIDERS_DL"
AS_IF([test x"$enable_static" = x"yes" &&
Expand Down Expand Up @@ -202,3 +203,45 @@ AC_DEFUN([_FI_PROVIDER_INVOKE],[
[])]
)
])

dnl
dnl Internal; should not be called from provder .m4 scripts.
dnl Helper macro that appends each providers build flags for pkg-config
dnl
dnl Arguments:
dnl
dnl $1: name of the provider
dnl
AC_DEFUN([_FI_PROVIDER_PC_ADD],[
FI_PC_CFLAGS="$FI_PC_CFLAGS $$1_CFLAGS $$1_CPPFLAGS"
FI_PC_PRIVATE_LIBS="$FI_PC_PRIVATE_LIBS $$1_LDFLAGS $$1_LIBS"
])

dnl
dnl Substitute pkg-config variables after all providers have been initialized
dnl
AC_DEFUN([FI_PROVIDER_SETUP_PC],[
FI_PC_PRIVATE_LIBS="$FI_PC_PRIVATE_LIBS $LIBS"
dnl Try and avoid duplication of private library flags
dnl Inefficient but easier than tracking within each provider macro
seen=""
for arg in $FI_PC_PRIVATE_LIBS
do
found=no
for s in $seen
do
AS_IF([test "$s" = "$arg"], [found=yes])
done
AS_IF([test "$found" = "no"], [seen="$seen $arg"])
done
FI_PC_PRIVATE_LIBS=$seen
AS_IF([test "x$enable_shared" != xyes],
[FI_PC_PUBLIC_LIBS="$FI_PC_PUBLIC_LIBS $FI_PC_PRIVATE_LIBS"])
AC_SUBST(FI_PC_CFLAGS)
AC_SUBST(FI_PC_PUBLIC_LIBS)
AC_SUBST(FI_PC_PRIVATE_LIBS)
AC_CONFIG_FILES([libfabric.pc])
])
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ FI_PROVIDER_SETUP([usnic])
FI_PROVIDER_SETUP([mxm])
FI_PROVIDER_SETUP([gni])
FI_PROVIDER_FINI
dnl Configure the .pc file
FI_PROVIDER_SETUP_PC

# If the user requested to build in direct mode, but
# we have more than one provider, error.
Expand Down
14 changes: 14 additions & 0 deletions libfabric.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: libfabric
Description: OFI-WG libfabric
URL: https://github.com/ofiwg/libfabric.git
Version: @VERSION@
Requires:
Cflags: -I${includedir}
Libs: -L${libdir} -lfabric @FI_PC_PUBLIC_LIBS@
Libs.private: @FI_PC_PRIVATE_LIBS@
Requires.private:

0 comments on commit aff4981

Please sign in to comment.