Re: [Vala] Accessing build-time config from Vala (was: Vala-list Digest, Vol 26, Issue 8)



On Wed, Jan 06, 2010 at 10:56:32AM +0100, Frederik wrote:

golnaz nilieh wrote:
Thanks to all. I defined an empty constructor for Global, and called it in
main function. also I changed dataDir to a constant variable.
But a new question: Is there a way to pass the installation path to dataDir?
I use this macro in configure.ac:

AC_PREFIX_DEFAULT(/usr/local)

can i use it as a variable in a vala source file?

Yes, all you need is a small vapi file for your 'config.h', e.g.:
http://code.google.com/p/xnoise/source/browse/vapi/config.vapi

Use it with

  --pkg config --vapidir path/to/my/vapi

and access it via

  Config.DATADIR

I like this solution. Only, I can't seem to find a way to get DATADIR
defined in config.h.

Looking at xnoise, I was unable to find any obvious spot where the magic
happens. Is that done by gnome-autogen? I have a custom autogen.sh. Or am
I missing something hidden in plain sight?

-- 
Andrea Bolognani <eof kiyuko org>
Resistance is futile, you will be garbage collected.

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]