Unix Programming - Fining Configuration Files

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > August 2006 > Fining Configuration Files





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Fining Configuration Files
Jonathan Lamothe

2006-08-13, 1:23 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've got some more Automake fun if anyone's feels like helping. I've
been up and down the info pages, and I can't find find an answer I like.

Suppose I have a program called foo. This program has a configuration
file in the etc directory called foo.conf. How do I make my program
aware of the location of this file?

The only workable solution I've been able to find is to add something
like this to my Makefile.in:

INCLUDES = -DCONF_FILE=\"$(etcdir)/foo.conf\"

....but that looks like a bit of a kludge to me. Can anyone suggest a
better option?

I think it would be best if there were some way to define the macro in
my config.h file, but I don't know if that can be done.

Anyway, thanks in advance for the help (again).

- --
Regards,
Jonathan Lamothe

/*
* Oops. The kernel tried to access some bad page. We'll have to
* terminate things with extreme prejudice.
*/

die_if_kernel("Oops", regs, error_code);
-- From linux/arch/i386/mm/fault.c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFE3xx9q9nD47x87JYRAgGCAKDnxrpOFdy9
bqADxF0ZLdTYaktO3ACffWym
sRfamAFuboOdtB9jPcad0cA=
=5B0f
-----END PGP SIGNATURE-----
Jonathan Lamothe

2006-08-14, 1:26 am

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan Lamothe wrote:
> I've got some more Automake fun if anyone's feels like helping.* I've
> been up and down the info pages, and I can't find find an answer I like.
>
> Suppose I have a program called foo. This program has a configuration
> file in the etc directory called foo.conf. How do I make my program
> aware of the location of this file?
>
> The only workable solution I've been able to find is to add something
> like this to my Makefile.in:
>
> INCLUDES = -DCONF_FILE=\"$(etcdir)/foo.conf\" # **
>
> ...but that looks like a bit of a kludge to me. Can anyone suggest a
> better option?
>
> I think it would be best if there were some way to define the macro in
> my config.h file, but I don't know if that can be done.
>
> Anyway, thanks in advance for the help (again).
>


** Oops... forgot the line:
etcdir = $(prefix)/etc

* I also should have proof-read my post a little better before clicking
Send. I types teh English gud. :P

- --
Regards,
Jonathan Lamothe

/*
* Oops. The kernel tried to access some bad page. We'll have to
* terminate things with extreme prejudice.
*/

die_if_kernel("Oops", regs, error_code);
-- From linux/arch/i386/mm/fault.c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFE39/ 6q9nD47x87JYRAsSdAKDCwSkOjJlsWWJr31+JK5C
j0SKFdgCgsXcp
MG+r2iaj/sJeG78i8lLcD90=
=nw5K
-----END PGP SIGNATURE-----
James Antill

2006-08-15, 1:25 am

On Sun, 13 Aug 2006 22:29:15 -0400, Jonathan Lamothe wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jonathan Lamothe wrote:
>
> ** Oops... forgot the line:
> etcdir = $(prefix)/etc
>
> * I also should have proof-read my post a little better before clicking
> Send. I types teh English gud. :P


You should be using sysconfdir, and it should be specified via. -D
in the Makefile.am the rationale is found in info autoconf
Setup/Makefile Substitutions/Installation Directory Variables,:

"""\
Most of these variables have values that rely on `prefix' or
`exec_prefix'. It is deliberate that the directory output variables
keep them unexpanded: typically `@datadir@' will be replaced by
`${prefix}/share', not `/usr/local/share'.

This behavior is mandated by the GNU coding standards, so that when
the user runs:

`make'
she can still specify a different prefix from the one specified to
`configure', in which case, if needed, the package shall hard code
dependencies corresponding to the make-specified prefix.

`make install'
she can specify a different installation location, in which case
the package _must_ still depend on the location which was compiled
in [...]

In order to support these features, it is essential that `datadir'
remains being defined as `${prefix}/share' to depend upon the current
value of `prefix'.
....
"""

--
James Antill -- james@and.org
http://www.and.org/and-httpd

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com