A lot of Linux programs state that the config file(s) location is distribution dependent. I was wondering how the different distributions do this. Do they actually modify the source code? Is there build parameters that sets these locations? I have searched for this but cannot find any information. I know it's out there, I just can't seem to find it. What is the "Linux way" in regards to this?
It depends on the distribution and the original ('upstream') source.
With most autoconf- and automake-using packages, it is possible to specify the directory where the configuration files will be looked for using the
It that isn't the case, then often the distribution will indeed have to add patches to the source to make it move files in what they consider to be the 'right' location. In most cases, distribution packagers will then write a patch which will allow the source to be configured in the above sense, so that they can send the patch to the upstream maintainers, and don't have to keep maintaining/updating it. This is the case for configuration file locations, but also for other things, like the
Side note: if you maintain some free software, please make it easy for packagers to talk to you. Otherwise we have to maintain such patches for no particularly good reason...
They have patches applied to the source code tree that adapt the locations.
There are enough "standards" available that every distribution can take their pick based on (personal) preferences and/or historical practises. There is seldom a solution that only has advantages. That is sometimes annoying/confusing, but consistency within one distribution is the most important objective: it leads to less clutter and easier guessing where things might be for program Y if you already know where similar things (setup/configuration files e.g) are for program X.
Example of patch application
My python package
For Sid this is not a problem: older versions of
Other distributions have similar setups. E.g. if you look at the specifications of creating a source RPM file (e.g for RedHat/CentOS/SuSE), you'll see that you combine the original original tarball of a package with one or more patches that will be applied before configuring/compiling.