[Nut-upsdev] pkgconfig fix for nut

Peter Selinger selinger at mathstat.dal.ca
Tue Aug 7 18:00:11 UTC 2007


Dear Stanislav,

thanks for your patch. The problem with your "recommended"
pkgconfigdir is that in many cases, it does not work. Namely, when
${prefix} is not one of the standard places such as /usr. 

As I understand it, the whole point of a tool like pkgconfig is to
allow other software to automatically detect the install location of
NUT, especially when that location is not one of the standard ones. If
you therefore install the pkgconfig files in the same non-standard
location, then there is a circularity, as you could not find the
location of the pkgconfig data without reading the pkgconfig data
first.

For this reason, our default behavior is to install the pkgconfig data
in a place where it can definitely be found, regardless of where NUT
is installed. 

The installer who doesn't like this can override it with
--with-pkgconfig-dir. 

There are also situations where you would not want to install
pkgconfig support at all. One cannot assume that all systems where NUT
runs are a Linux PC, or even a GNU system. NUT runs in a lot of
places, mostly servers. Some of them can be very old installations,
predating pkgconfig. 

-- Peter


Stanislav Brabec wrote:
> Hallo.
> 
> Here is a small fix for pkgconfig files (bad expansion) and their
> location (optional to apply).
> 
> I don't see any reason to make pkgconfig stuff optional and configurable
> (especially if the default location is wrong on some platforms).
> Most current packages install it by default.
> 
> Attached patch removes configurability of pkgconfig support and installs
> it to the recommended path.
> 
> Note that you may even think about removal of libupsclient-config:
> pkg-config is a more current and more flexible way to do the same and
> you don't have to keep both in sync.

--- configure.in
+++ configure.in
@@ -39,10 +39,6 @@
 cgiexecdir='${exec_prefix}/cgi-bin'
 driverexecdir='${exec_prefix}/bin'
 htmldir='${prefix}/html'
-pkgcfgdir='/usr/lib/pkgconfig'
-if test ! -d "${pkgcfgdir}"; then
-   pkgcfgdir=''
-fi
 hotplugdir='/etc/hotplug'
 if test ! -d "${hotplugdir}"; then
    hotplugdir=''
@@ -635,35 +631,6 @@
 ])
 
 
-AC_MSG_CHECKING(whether to enable pkg-config support)
-AC_ARG_WITH(pkgconfig-dir,
- AC_HELP_STRING([--with-pkgconfig-dir=PATH], [where to install pkg-config *.pc files (/usr/lib/pkgconfig)]),
- [
-    case "${withval}" in
-        yes)
-            if test -z "${pkgcfgdir}"; then
-	       AC_MSG_RESULT(no)
-               AC_MSG_ERROR(["pkg-config directory requested but not found])
-            fi
-        ;;
-        auto)
-        ;;
-        no)
-            pkgcfgdir=""
-        ;;
-        *)
-            pkgcfgdir="${withval}"
-        ;;
-    esac
- ],
- )
-if test -n "${pkgcfgdir}"; then
-  AC_MSG_RESULT(using ${pkgcfgdir})
-else
-  AC_MSG_RESULT(no)
-fi
-AM_CONDITIONAL(WITH_PKG_CONFIG, test -n "${pkgcfgdir}")
-
 AC_MSG_CHECKING(whether to install hotplug rules)
 AC_ARG_WITH(hotplug-dir,
  AC_HELP_STRING([--with-hotplug-dir=PATH], [where to install hotplug rules (/etc/hotplug)]),
--- lib/Makefile.am
+++ lib/Makefile.am
@@ -1,8 +1,7 @@
 # Network UPS Tools: lib
 
 if WITH_LIB
-if WITH_PKG_CONFIG
- pkgcfg_DATA = libupsclient.pc
-endif
+pkgconfig_DATA = libupsclient.pc
+pkgconfigdir = $(libdir)/pkgconfig
 bin_SCRIPTS = libupsclient-config
 endif
--- lib/libupsclient-config.in
+++ lib/libupsclient-config.in
@@ -10,8 +10,8 @@
 Version="@PACKAGE_VERSION@"
 prefix=@prefix@
 exec_prefix=@exec_prefix@
-Libs="-L at libdir@ -lupsclient @SSL_LDFLAGS@"
-Cflags="-I at includedir@ @SSL_CFLAGS@"
+Libs="-L at libdir@ -lupsclient @LIBSSL_LDFLAGS@"
+Cflags="-I at includedir@ @LIBSSL_CFLAGS@"
 
 case "$1" in
 
--- lib/libupsclient.pc.in
+++ lib/libupsclient.pc.in
@@ -9,5 +9,5 @@
 Name: libupsclient
 Description: UPS monitoring with Network UPS Tools
 Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lupsclient @SSL_LDFLAGS@
-Cflags: -I${includedir} @SSL_CFLAGS@
+Libs: -L${libdir} -lupsclient @LIBSSL_LDFLAGS@
+Cflags: -I${includedir} @LIBSSL_CFLAGS@


-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec at suse.cz
Lihovarská 1060/12                            tel: +420 284 028 966
190 00 Praha 9                                fax: +420 284 028 951
Czech Republic                                http://www.suse.cz/



More information about the Nut-upsdev mailing list