[PATCH] Add pkg-config support

Michael Catanzaro mcatanzaro at gnome.org
Mon Aug 29 20:41:34 UTC 2016


# HG changeset patch
# User Michael Catanzaro <mcatanzaro at gnome.org>
# Date 1472477638 18000
#      Mon Aug 29 08:33:58 2016 -0500
# Node ID 95850e2b3e2e24c3a84496a3289ec783c96bae15
# Parent  31d28753a4e167fa571268408d7ba16890f2cb9e
Add pkg-config file

It would be desirable for gmp to install a pkg-config file. This makes
it much easier for other projects to link to gmp, especially projects
that use Autotools build systems.

diff -r 31d28753a4e1 -r 95850e2b3e2e Makefile.am
--- a/Makefile.am	Thu Jun 02 15:34:47 2016 +0200
+++ b/Makefile.am	Mon Aug 29 08:33:58 2016 -0500
@@ -113,6 +113,8 @@
 EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf \
 	     COPYING.LESSERv3 COPYINGv2 COPYINGv3
 
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gmp-6.pc
 
 if WANT_CXX
 GMPXX_HEADERS_OPTION = gmpxx.h
diff -r 31d28753a4e1 -r 95850e2b3e2e configure.ac
--- a/configure.ac	Thu Jun 02 15:34:47 2016 +0200
+++ b/configure.ac	Mon Aug 29 08:33:58 2016 -0500
@@ -62,6 +62,10 @@
 
 GMP_INIT(config.m4)
 
+dnl It's not ideal to have two different values for version, but it's
+dnl not possible to export GMP_VERSION via AC_SUBST.
+AC_SUBST([VERSION], [GMP_VERSION])
+
 AC_CANONICAL_HOST
 
 dnl  Automake "no-dependencies" is used because include file dependencies
@@ -3881,6 +3885,7 @@
   tests/cxx/Makefile							\
   doc/Makefile tune/Makefile						\
   demos/Makefile demos/calc/Makefile demos/expr/Makefile		\
+  gmp-6.pc								\
   gmp.h:gmp-h.in)
 
 AC_MSG_NOTICE([summary of build options:
diff -r 31d28753a4e1 -r 95850e2b3e2e gmp-6.pc.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gmp-6.pc.in	Mon Aug 29 08:33:58 2016 -0500
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gmp
+Description: A free library for arbitrary precision arithmetic
+URL: https://gmplib.org/
+Version: @VERSION@
+Libs: -L${libdir} -lgmp
+Cflags: -I${includedir}


More information about the gmp-devel mailing list