RE: Requires.private with optional dependencies?‏

Jef Driesen jefdriesen at hotmail.com
Tue Sep 27 03:38:10 PDT 2011


On Sat, 24 Sep 2011 14:26:45 +0200, Vincent Torri wrote:
> On Sat, Sep 24, 2011 at 2:10 PM, Jef Driesen <jefdriesen at hotmail.com> wrote:
>
>> On 09/23/2011 04:56 PM, Tollef Fog Heen wrote:
>>
>>> ]] Jef Driesen
>>>
>>> | Is the correct way to add this line inside the if statement above:
>>> |
>>> | AC_SUBST([DEPENDENCIES],[**libusb-1.0])
>>> |
>>> | And then use this line in the *.pc.in file:
>>> |
>>> | Requires.private: @DEPENDENCIES@
>>>
>>> Yes, you have to generate the .pc file.
>>>
>>
>> Seems to work fine too.
>>
>> I was mainly worried that an empty "Requires.private" might cause problems,
>> or that because AC_SUBST is called within an if..then construct, the
>> DEPENDENCIES variable might be undefined and cause errors.
>>
>
> don't call it inside an 'if' construct. Set a variable accordingly in the
> construct, then AC_SUBST it outside.

Thus the correct way should be like this?

# Checks for USB support.
PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], [have_libusb=yes], [have_libusb=no])
if test "$have_libusb" = "yes"; then
   AC_DEFINE([HAVE_LIBUSB], [1], [libusb support])
   dependencies="libusb-1.0"
fi
AC_SUBST([DEPENDENCIES], [dependencies])
 		 	   		  


More information about the pkg-config mailing list