shithub: sox

Download patch

ref: 902c9fc8930d81d4a81e110f82ffba657b73d87d
parent: 42db1b4a5ac01b702f8cb399a48f10e483d5c432
author: cbagwell <cbagwell>
date: Sat Mar 1 13:12:34 EST 2008

Make pkg-config optional and allow specifying .pc install directory.

--- a/Makefile.am
+++ b/Makefile.am
@@ -12,8 +12,10 @@
 dist_man_MANS = sox.1 soxi.1 soxeffect.7 soxformat.7 soxexam.7 libsox.3
 EXTRA_DIST = sox.txt soxi.txt soxeffect.txt soxformat.txt soxexam.txt libsox.txt CMakeLists.txt sox.pc.in
 
-pkgconfigdir = $(libdir)/pkgconfig
+if HAVE_PKGCONFIG
+pkgconfigdir = @PKGCONFIGDIR@
 pkgconfig_DATA = sox.pc
+endif
 
 play.1 rec.1: sox.1
 	$(RM) $@ && $(LN_S) $< $@
--- a/configure.ac
+++ b/configure.ac
@@ -52,8 +52,23 @@
 fi
 AM_CONDITIONAL(HAVE_LIBLTDL, test x$using_libltdl = xyes)
 
-m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG])
+AC_ARG_WITH(pkgconfigdir,
+    AC_HELP_STRING([--with-pkgconfigdir],
+                   [location to install .pc files or "no" to disable (default=$(libdir)/pkgconfig)]))
 
+m4_ifndef([PKG_PROG_PKG_CONFIG], with_pkgconfigdir="no")
+
+using_pkgconfig=no
+if test "$with_pkgconfigdir" != "no"; then
+    if test "$with_pkgconfigdir" == ""; then
+        with_pkgconfigdir="\$(libdir)/pkgconfig"
+    fi
+    using_pkgconfig="yes"
+    PKG_PROG_PKG_CONFIG
+fi
+AM_CONDITIONAL(HAVE_PKGCONFIG, test x$using_pkgconfig = xyes)
+AC_SUBST(PKGCONFIGDIR, $with_pkgconfigdir)
+
 dnl Debugging
 AC_MSG_CHECKING([whether to make a debug build])
 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [make a debug build]))
@@ -421,6 +436,12 @@
    gsm_option="in-tree"
 fi
 
+if test "$using_pkgconfig" = "no"; then
+    pkgconfig_option="disabled"
+else
+    pkgconfig_option="$with_pkgconfigdir"
+fi
+
 dnl Report configuration.
 echo
 echo "Debugging build................... $enable_debug"
@@ -442,6 +463,7 @@
 echo "AMR-NB format..................... $using_amr_nb"
 echo "LADSPA effects.................... $using_ladspa"
 echo "Secret Rabbit Code resampling..... $using_samplerate"
+echo "pkg-config location............... $pkgconfig_option"
 echo
 echo "Configure finished.  Do 'make && make install' to compile and install SoX."
 echo