Re: How to reflect variables like "sysconfdir" in an executable.

2004-02-15 Thread Bob Friesenhahn
On Sun, 15 Feb 2004, Hans Deragon wrote:
>
> Thanks.  It almost works.  The problem is that it substitute "@datadir@" with
> "${prefix}/share".  That is not right.  ${prefix} must be expanded.  Python
> does not understand ${prefix}.  Any suggestions?  In should be something like
> "/usr/share" in my script.

Do something like

eval "eval DATA_DIR=$datadir"
AC_SUBST(DATA_DIR)

and then use

@DATA_DIR@

Bob
==
Bob Friesenhahn
[EMAIL PROTECTED]
http://www.simplesystems.org/users/bfriesen





Re: How to reflect variables like "sysconfdir" in an executable.

2004-02-15 Thread Hans Deragon
Bob Friesenhahn wrote:
On Sun, 15 Feb 2004, Hans Deragon wrote:

Thanks.  It almost works.  The problem is that it substitute "@datadir@" with
"${prefix}/share".  That is not right.  ${prefix} must be expanded.  Python
does not understand ${prefix}.  Any suggestions?  In should be something like
"/usr/share" in my script.


Do something like

eval "eval DATA_DIR=$datadir"
AC_SUBST(DATA_DIR)
and then use

@DATA_DIR@

Bob
==
Bob Friesenhahn
[EMAIL PROTECTED]
http://www.simplesystems.org/users/bfriesen
Bingo.  I confirm that this work.  Thanks.

Best regards,
Hans Deragon
--
Consultant en informatique/Software Consultant
Deragon Informatique inc. Open source:
http://www.deragon.bizhttp://autopoweroff.sourceforge.net
mailto://[EMAIL PROTECTED] (Automatically poweroff home servers)



Re: How to reflect variables like "sysconfdir" in an executable.

2004-02-15 Thread Hans Deragon
Bob Friesenhahn wrote:
On Sun, 15 Feb 2004, Hans Deragon wrote:


  I am working on a project where the executable is a Python script, so no
building is required.  However, since it has to read a configuration file,
like /etc/, my script needs to be modified so that the sysconfdir
directory is reflected somewhere.
  Are there any means with Automake such that an executable script would be
parsed and modified with the $sysconfdir variable hardcoded so it knows where
to read the configuration file?  Couldn't find anything for this in the doc.


This is an Autoconf issue, not Automake.  Provide a ".in" version of
your script, and then list the desired output file in configure.ac's
AC_OUTPUT() statement.
Then earlier in configure.ac:

FOO=/bar
AC_SUBST(FOO)
an in the .in file

@FOO@

will be substituted with the value of FOO.

Bob
==
Thanks.  It almost works.  The problem is that it substitute "@datadir@" with 
"${prefix}/share".  That is not right.  ${prefix} must be expanded.  Python 
does not understand ${prefix}.  Any suggestions?  In should be something like 
"/usr/share" in my script.

Best regards,
Hans Deragon
--
Consultant en informatique/Software Consultant
Deragon Informatique inc. Open source:
http://www.deragon.bizhttp://autopoweroff.sourceforge.net
mailto://[EMAIL PROTECTED] (Automatically poweroff home servers)



Re: How to reflect variables like "sysconfdir" in an executable.

2004-02-15 Thread Bob Friesenhahn
On Sun, 15 Feb 2004, Hans Deragon wrote:

>I am working on a project where the executable is a Python script, so no
> building is required.  However, since it has to read a configuration file,
> like /etc/, my script needs to be modified so that the sysconfdir
> directory is reflected somewhere.
>
>Are there any means with Automake such that an executable script would be
> parsed and modified with the $sysconfdir variable hardcoded so it knows where
> to read the configuration file?  Couldn't find anything for this in the doc.

This is an Autoconf issue, not Automake.  Provide a ".in" version of
your script, and then list the desired output file in configure.ac's
AC_OUTPUT() statement.

Then earlier in configure.ac:

FOO=/bar
AC_SUBST(FOO)

an in the .in file

@FOO@

will be substituted with the value of FOO.

Bob
==
Bob Friesenhahn
[EMAIL PROTECTED]
http://www.simplesystems.org/users/bfriesen





How to reflect variables like "sysconfdir" in an executable.

2004-02-15 Thread Hans Deragon
Greetings.

  I am working on a project where the executable is a Python script, so no 
building is required.  However, since it has to read a configuration file, 
like /etc/, my script needs to be modified so that the sysconfdir 
directory is reflected somewhere.

  Are there any means with Automake such that an executable script would be 
parsed and modified with the $sysconfdir variable hardcoded so it knows where 
to read the configuration file?  Couldn't find anything for this in the doc.

Newbie thanking you for your patience.
Hans Deragon
--
Consultant en informatique/Software Consultant
Deragon Informatique inc. Open source:
http://www.deragon.bizhttp://autopoweroff.sourceforge.net
mailto://[EMAIL PROTECTED] (Automatically poweroff home servers)