[maemo-developers] How to detect Maemo in automake?

From: Juha Kallioinen juha.kallioinen at nokia.com
Date: Wed Feb 20 17:26:30 EET 2008
ext Alberto Garcia wrote:
> On Wed, Feb 20, 2008 at 02:00:50PM +0000, Ross Burton wrote:
> 
>>>> Now for my next question: How do i detect maemo correctly in
>>>> autoconf?
>>> One way is:
>>> AC_ARG_ENABLE(maemo,        [  --enable-maemo           Enable
>>> Maemo-specific build options],
>>> 	                   [enable_maemo=true],
> 
>> You mean something like this:
>>
>> AC_ARG_ENABLE(maemo,
>>   AS_HELP_STRING([--enable-maemo],[enable Maemo-specific features]),
>>   [],
>>   enable_maemo=no)
>> if test x"$enable_maemo" = xyes; then
>> ...
>> fi
> 
> I think that he meant how to *detect* Maemo (i.e, without having to
> ask the user).
> 
> I used to check for the existence of libosso, but since it's available
> in Debian (http://packages.debian.org/libosso) I'm also checking
> whether we're running inside the scratchbox, so you could use
> something like this:
> 
> if $PKG_CONFIG --exists libosso && readlink /etc|grep -q ^/targets; then
>    DETECTED_PLATFORM=maemo                                                      
> fi
> 
> If there's an "official" way (or just a better one) to detect if we're
> compiling for Maemo I'd like to know.

There's a new package 'maemo-version' which can be installed into the SDK. 
This package can be used to detect which version of the SDK is being used or 
more generally that you are in a maemo environment. The maemo-version-dev 
package provides a .pc file that you can check with pkg-config.

As of now it's available for Gregale, latest Bora and Chinook SDKs. It was 
an afterthought, so unfortunately it's not installed in those by default as 
of yet. So in many ways it's not universally usable right now. Any future 
release of the SDK will have it there by default.

Cheers,
  Juha

-- 
Juha Kallioinen                                               JID: kaltsi at ok

More information about the maemo-developers mailing list