From 2f64b991b6d83bbf88d01ff892e461050980a48d Mon Sep 17 00:00:00 2001 From: Christian Wiese Date: Mon, 12 Aug 2013 23:53:09 +0200 Subject: [PATCH] build: changed to only generate/install .pc file if pkg-config is found This change improves the pkg-config support to only generate/install a .pc file if pkg-config is found, assuming it is part of the build toolchain. Note: The minimal version set for pkg-config is 0.25, because this is the oldest version I am able to test at the moment. --- Makefile.am | 2 ++ configure.ac | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index ee7aabaf..1202c4ec 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,5 +10,7 @@ SUBDIRS = \ src \ test +if HAVE_PKG_CONFIG pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = @PACKAGE_NAME@.pc +endif diff --git a/configure.ac b/configure.ac index 2222d9c3..1540ce4b 100644 --- a/configure.ac +++ b/configure.ac @@ -110,6 +110,10 @@ AC_SUBST([MAINT]) dnl Checks +PKG_PROG_PKG_CONFIG([0.25]) +AM_CONDITIONAL([HAVE_PKG_CONFIG], [test "x$PKG_CONFIG" != "x"]) +AC_SUBST(HAVE_PKG_CONFIG) + AC_PROG_CC_C99 AM_PROG_AS AC_USE_SYSTEM_EXTENSIONS @@ -362,7 +366,9 @@ AH_VERBATIM([NDEBUG], [/* Never ever ignore assertions */ #/**/undef/**/ NDEBUG #endif]) -AC_CONFIG_FILES([libsodium.pc]) +AS_IF([test "x$PKG_CONFIG" != "x"], [ + AC_CONFIG_FILES([libsodium.pc]) +]) AC_CONFIG_FILES([Makefile src/Makefile src/libsodium/Makefile