[Top][All Lists]

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

Re: Installation dirs in code

From: Yevgen Muntyan
Subject: Re: Installation dirs in code
Date: Tue, 12 Dec 2006 17:44:05 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060809 Debian/1.7.13-0.3

Brendon Costa wrote:

Hi all,

I was wondering if there exists a kindof standard way to obtain final installation directory information within code being compiled when using autotools?

I have a program that requires a configuration file that will usually go into the ${prefix}/etc as given by $sysconfdir. So this program needs to know where it is going to find this installed configuration file. I was initially going to export the evaluated value of $sysconfigdir into a define in config.h as an absolute path, however I found there are two problems with this.

1) On windows using MinGW/MSYS the path is not a native windows one but rather a MSYS path. So then i started to write a autoconf macro that converted a MSYS path to a native windows one.

2) I also often perform cross compiles as it is a whole lot simpler than rebooting into a different operating system. When doing a cross compile usually the installation prefix is not the name of the actual install path that will be used on the end system, but just some temporary directory that the binaries are compiled into before being copied across to the host system later. This gets even more complex with problem 1 above when cross compiling on say NetBSD for a host system of i386-mingw32 as I cant convert the MSYS path to a windows native one without the build actually being done on the windows machine...

Is there a standard way of solving this problem or even just a method of doing things that will work in the above scenarios?

You just can't hardcode paths for windows, unless you are going to
make your program to work only in C:\somepath\ (there may not
even be C: drive or user may not be able to install into there, etc).
You have to use registry (or similar) to kind-of-hardcode paths in
installation time, or get the paths in runtime using location of your
exe or dll, or something similar. In any case you have to get the path
in runtime because the program may be installed anywhere.

Thing is that auto* --prefix option is just a conventional unix thing -
normally you do "./configure; make; make install" and use the
program; it simply doesn't work on windows (relocation is not
windows-specific thing, of course, but on unix we can often just
ignore it and use hardcoded paths).

Best regards,

reply via email to

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