Leetle hildon-1/chinook migration things
October 21, 2007 on 12:55 pm | In maemo | 1 CommentMost of "my" applications are now chinook ready, at least in the svn. However, I prefer to keep them compatible with mistral and bora, so I need to do little quirks. Let's investigate osso-xterm's modifications for example.
What was previously known as hildon-libs, is now hildon-1, so we need to tell configure.ac about this. Before the change, I had:
PKG_CHECK_MODULES(HILDON, hildon-libs >= 0.12.0) AC_SUBST(HILDON_CFLAGS) AC_SUBST(HILDON_LIBS)
Now, as we need to also check for hildon-1, and due to the fact that we need to know it in source as the include paths have changed, it goes like this:
PKG_CHECK_MODULES(HILDON, hildon-1 >= 0.9.9, \
AC_DEFINE(HILDON, 1, [Version of hildon libraries]), \
[AC_DEFINE(HILDON, 0, [Version of hildon libraries]) \
PKG_CHECK_MODULES(HILDON_LIBS, hildon-libs >= 0.12.0)])
AC_SUBST(HILDON_CFLAGS)
AC_SUBST(HILDON_LIBS)
In code, I do the following:
#ifdef HAVE_CONFIG_H # include <config.h> #endif #if HILDON == 1 # include <hildon/hildon-window.h> #else # include <hildon-widgets/hildon-window.h> #endif
There are also some real changes, but with this I get to compile stuff and get warnings/errors for the other stuff that has changed. Those I've, again, separated with #if HILDON == 1.
For projects that don't use autotools, I use this kind of stuff:
mh_shot_tool_CFLAGS += $(shell if pkg-config hildon-1 --exists; then \
pkg-config hildon-1 --cflags; echo -DHILDON=1; \
elif pkg-config hildon-libs --exists; then \
pkg-config hildon-libs --cflags; echo -DHILDON=0; \
else pkg-config gtk+-2.0 --cflags; fi)
Edit: thanks to Loïc for pointing out, the AC_SUBSTs aren't actually needed, PKG_CHECK_MODULES already does that. You may omit them and it will still work.
1 Comment »
RSS feed for comments on this post. TrackBack URI
AC_SUBST(HILDON_CFLAGS) and
AC_SUBST(HILDON_LIBS) are not needed as PKG_CHECK_MODULES(HILDON, ...) will do the substs.