This is the mail archive of the
automake@gnu.org
mailing list for the automake project.
Re: pixmap dirs
Ionutz Borcoman <borco@borco-ei.eng.hokudai.ac.jp> writes:
> Tom Tromey wrote:
> >
> > Put `-DFOODIR=whatever' into AM_CFLAGS in Makefile.am.
> > Then use FOODIR in your program.
>
> Ok. I have to admit that this is the simplest solution indeed. But it is
> not what I need.
> The pixmap should be installed in $pkgdatadir. At run time they are in
> the xpm subdir of the source dir (src). Do I have to test by hand if
> there is such a subdir (in the current dir) and otherwise try from
> $pkgdatadir ? This will complicate my code a bit, but if there is no
> other way, I'll do it.
>
> The whole idea is to be able the program before and after it is
> installed.
>
> TIA,
>
> Ionutz
I would have your program use an environment variable to read the pixmap
directory (or better still a colon delimited path list), and fall back to
the compiled in installation directory if either the pixmap being searched for
is not found, and/or if the environment variable is not set. That way, before
installation you can have the makefile set the environment variable (Note:
the _environment_ variable, not the make variable) to point into the source
tree without hardcoding build directories into the binary. After
installation, the program will look in the compiled in pixmap directory, which
can be added to by a user if they set the environment variable.
You would pass the installation pixmap directory to be compiled in to the
executable as Tom outlines above, and change your lookup code to use
getenv("FOO_PIXMAP_PATH") by preference if it is set at runtime.
Cheers,
Gary.
--
___ _ ___ __ _ mailto:gary@oranda.demon.co.uk
/ __|__ _ _ ___ _| | / / | / /_ _ _ _ __ _| |_ __ _ ___ gary@gnu.org
| (_ / _` | '_|// / |/ /| |/ / _` | || / _` | ' \/ _` | _ \
\___\__,_|_|\_, /|___(_)___/\__,_|\_,_\__, |_||_\__,_|//_/
home page: /___/ /___/ pgp-2 public key:
http://www.oranda.demon.co.uk http://www.oranda.demon.co.uk/pgp