fi
AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
- with_upsclient_config="libupsclient-config"
- with_upsclient_cflags=""
- with_upsclient_libs=""
- AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
- [
- if test "x$withval" = "xno"
+PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
+ [with_libnotify="yes"],
+ [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
+
+ with_libupsclient="no (pkg-config isn't available)"
+ with_libupsclient_cflags=""
+ with_libupsclient_libs=""
+ if test "x$PKG_CONFIG" != "x"
+ then
+ pkg-config --exists 'libupsclient' 2>/dev/null
+ if test "$?" = "0"
then
- with_libupsclient="no"
- else
- if test "x$withval" != "xyes"
- then
- if test -f "$withval" && test -x "$withval";
- then
- with_upsclient_config="$withval"
- else
- with_upsclient_config="$withval/bin/libupsclient-config"
- fi
- fi
with_libupsclient="yes"
+ else
+ with_libupsclient="no (pkg-config doesn't know library)"
fi
- ],
- [
- with_libupsclient="yes"
- ])
+ fi
if test "x$with_libupsclient" = "xyes"
then
- with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
- upsclient_config_status=$?
-
- if test $upsclient_config_status -ne 0
+ with_libupsclient_cflags="`pkg-config --cflags 'libupsclient'`"
+ if test $? -ne 0
then
- with_libupsclient="no ($with_upsclient_config failed)"
+ with_libupsclient="no"
+ fi
+ with_libupsclient_libs="`pkg-config --libs 'libupsclient'`"
+ if test $? -ne 0
+ then
+ with_libupsclient="no"
fi
fi
if test "x$with_libupsclient" = "xyes"