From: Blikje Ham on
Hi all,

For my code I use autoconf and automake etc to build the ./configure
script and the diverse Makefiles. The result is that by default the
binaries are placed in /usr/local/bin and the configfile for my project
is installed in /usr/local/etc. That's no problem. I can hardcode the
location of the configfile to /usr/local/etc.
When I do a `./configure --prefix=/usr` or similar, the configfile will
be in a different location.

My question is: how can I use the --prefix value from ./configure in my
code.
I've tried adding some stuff to config.h.in, but it does not seem to get
used with a ./configure.

Can someone give me pointers to how to resolve this? I've searched the
web, but I'm getting only results about how to use --prefix while
installing, not while coding.

Thanks in advance
From: Daniel Molina Wegener on
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Jue 04 Feb 2010 08:16,
Blikje Ham wrote:

> Hi all,

Hello Blikje

>
> For my code I use autoconf and automake etc to build the ./configure
> script and the diverse Makefiles. The result is that by default the
> binaries are placed in /usr/local/bin and the configfile for my project
> is installed in /usr/local/etc. That's no problem. I can hardcode the
> location of the configfile to /usr/local/etc.
> When I do a `./configure --prefix=/usr` or similar, the configfile will
> be in a different location.

Sure, that's the goal of autoconf...

>
> My question is: how can I use the --prefix value from ./configure in my
> code.
> I've tried adding some stuff to config.h.in, but it does not seem to get
> used with a ./configure.

Have you tried using an /auto header/ file and defining a symbol
for the preprocessor?

http://www.gnu.org/software/hello/manual/autoconf/Defining-Symbols.html

http://www.gnu.org/software/hello/manual/autoconf/Configuration-Headers.html

>
> Can someone give me pointers to how to resolve this? I've searched the
> web, but I'm getting only results about how to use --prefix while
> installing, not while coding.

Sure, that should help. Also you can try using similar kinds of
file/string sustitution in your code. Remember that both autoconf
and automake are using the GNU M4 macro processor.

>
> Thanks in advance

Best regards,
- --
Daniel Molina Wegener <dmw [at] coder [dot] cl>
Software Architect, System Programmer & Web Developer
Phone: +1 (510) 629-4267 | Blog: http://coder.cl/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQIcBAEBCgAGBQJLaswRAAoJEHxqfq6Y4O5N0VIP/1cD8rojThfS8C95qLS7aIUy
7QRho76OuhX42t9AYj42AKBROFldIt93IJ7FGF1qksYk7FJkKSAtet6Ic7HZN+Wi
uTbJqzd89BRc48XwQjyeOqzm3BFRg1eb7Wilx3BfnDUrovgdftIOcxDjOUNT7Yxf
mAPhZjmOV6ujZvkDqAPaEomMfkRD+iO0BFesN/xohLHKIEhDWYnDJMZoRwe8LC4a
FVqeyvCOiUmLB6wzCFcaAX6L2gC5JO6ciu3UEnEDIgItcMNaRCjM1PhlHv3/GyyY
zSmjQjXXfcoQlMK1kGSjYC/6v4ejP6k0BSqP58BDdqVEIwiSAXL16lu2j7uNlJof
q0zfKidHdaGl0IhsXnyYDPGcz0zGjyD38VeNkwZHRk8RLBxSfSVB0zAP806xxbCz
5mTf/laWULM4EoCQlkJwKpGtNQQ0qGagcFb+7TRathSZPJJspztrXYXPBrpVRRVz
WTGSHFuiRPzWoZ9DDrLgqpR81UEFdqo8k1tvGa2D9E9KFlZ4lCUPaq6QQ9nk2tD6
bc3cvZtKiAhYxYeTt3wKBMsqIrvtkI6PkiHOcC0gsOvxJH57RuOhKzlZ/ZfHkzIb
/yebxE5r0gNKAR7wuMxocUEH/2wPb4abIzrCkJrHy4oX/QEIaY2FIevBEbuoHXty
1U8r48jkzb8aBa1d7EHW
=BvFb
-----END PGP SIGNATURE-----