autoconf
[Top][All Lists]
Advanced

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

Re: finding datadir from executable


From: Bob Friesenhahn
Subject: Re: finding datadir from executable
Date: Sat, 11 Sep 2004 10:47:20 -0500 (CDT)

On Sat, 11 Sep 2004, Bruce Korb wrote:

Bob Friesenhahn wrote:

On Sat, 11 Sep 2004, Daniel Jacobowitz wrote:
That, unfortunately, is too convoluted to figure out without real study.
Without a clear example, I simply find the full, real path of the executable
and presume that the standard ../share/${program}/ is correct.  Probably
an illuminating example would make life easier.....  :-)

If a GPL'd solution is OK, I recommend libiberty.  I moved GCC's
make_relative_prefix into libiberty some time ago because I kept
needing this functionality elsewhere.

You give it argv[0], BINDIR, and OTHERDIR; it computes the relative
path between bindir and otherdir, finds your application in $PATH or
similar, and works out the likely location of otherdir.

Similar code is currently embedded in libtool in order to support
wrappers for executables under Cygwin.  The code should be portable.

All of these are buried to various degrees.  To be useful, it needs
to be a clear example -- maybe even a web page.  I haven't looked at
the libiberty code yet, but the gettext example was too obtuse for
me to want to spend the energy to reverse engineer it; and the libtool
example is also not readily apparent.  I suspect that the libiberty
variation is a run time computation, though BINDIR and DATADIR are
constructed at build time.  An autoconf macro that produced
BINDIR_TO_xxxxDIR at build time would be nice, simple and appreciated.

It seems to me that this issue is a small matter of application programming which is outside the scope of autoconf.

Even my own package (GraphicsMagick) includes code to find its installed data files based on the location of the executable.

Bob
======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]