[maemo-developers] Find out OS version in configure script
From: Graham Cobb g+770 at cobb.uk.netDate: Wed Apr 29 15:10:00 EEST 2009
- Previous message: Find out OS version in configure script
- Next message: Find out OS version in configure script
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wednesday 29 April 2009 11:02:52 Cornelius Hald wrote:
> I´m wondering what is the recomended way to find out the OS version in my
> configure script? Do I have to check for library availability and then make
> a guess or is there some test program that I can call or some file with the
> version name?
The "recommended" (at least by me) way is to not use OS **names** at all --
names are unreliable (what would your code had done when Diablo was
introduced if it had been relying on the name Chinook). The standard way to
address these sorts of issues in configure scripts is not to try to work out
the name or version but to look for features you need.
As an example, here is how most of my GPE configure.ac scripts handle this
today (not yet including Freemantle):
ENABLE_HILDON=false
AC_ARG_ENABLE(hildon,
[ --enable-hildon Enable Hildon GUI],
[
ENABLE_HILDON=true
PKG_CHECK_MODULES(HILDON, hildon-1,
[
AC_DEFINE(HILDON_VER, 2, [Version of hildon libraries])
DEP_MODULES="$DEP_MODULES hildon-fm-2"
],
[
AC_DEFINE(HILDON_VER, 0, [Version of hildon
libraries])
PKG_CHECK_MODULES(HILDON, hildon-lgpl hildon-libs)
DEP_MODULES="$DEP_MODULES hildon-fm"
])
DEP_MODULES="$DEP_MODULES libosso"
],
[
ENABLE_HILDON=false
])
AC_SUBST(ENABLE_HILDON)
AM_CONDITIONAL(HILDON, test x$ENABLE_HILDON = xtrue)
...
PKG_CHECK_MODULES(DEPS, $DEP_MODULES)
I then use HILDON, HILDON_CFLAGS, HILDON_LIBS, DEPS_CFLAGS and DEPS_LIBS in my
Makefile.am, for example in lines like:
if HILDON
DEPS_CFLAGS += -DIS_HILDON
endif
...
INCLUDES = $(DEPS_CFLAGS) $(HILDON_CFLAGS) \
$(SERVERDEPS_CFLAGS) -I$(top_srcdir)/gpe -I$(top_srcdir) \
-DPREFIX=\"@prefix@\" -D_GNU_SOURCE -Wall \
-DPACKAGE_LOCALE_DIR=\"@gpecalendar_localedir@\" \
-DDBUS_API_SUBJECT_TO_CHANGE
...
gpe_calendar_LDADD = $(DEPS_LIBS) $(HILDON_LIBS) libwidgets.la
...
The .c files make use of the IS_HILDON and the HILDON_VER macros to
conditionalise code.
I can send you full versions of these files by email if you want, or just
check out the source package for something like gpe-calendar (where these
examples came from).
Graham
- Previous message: Find out OS version in configure script
- Next message: Find out OS version in configure script
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
