aldorlang / aldor

The Aldor Programming Language
http://pippijn.github.io/aldor/
33 stars 10 forks source link

Produce pkg-config files for aldor libraries #27

Open pippijn opened 11 years ago

pippijn commented 11 years ago

Instead of querying the aldor about where its programs are (see #10), we could use the standard mechanism of pkg-config. For example, pkg-config --cflags libfoam would return -I${includedir}, which can be used for building external libraries. The .pc files can also contain arbitrary additional information, such as the location of aldor includes, recommended aldor compiler flags, etc.

hemmecke commented 11 years ago

How would that work with non-system-wide (i.e. user installed) versions of the aldor compiler + libfoam?

pippijn commented 11 years ago

You can use the PKG_CONFIG_PATH environment variable for that, just like you would set your PATH variable accordingly.

hemmecke commented 11 years ago

Maybe that defeats the whole purpose. I want minimal user interaction. Setting PKG_CONFIG_PATH is something that can be avoided.

Use case: A library writer who want's to use libtool and the _LIBRARIES primary of automake. Then the .c->.o->.a compilation is taken over by automake rules. But since that proces will not call the aldor executable anymore, the paths that are included in the wrapper do not help. So one has to provide an additional -I${includedir} which points to a place of foam_c.h.

If that library author now gives the sources to someone else, there must be a mechanism to figure out this additional include path on the recipient's computer. Of course, configure.ac can rely on PKG_CONFIG_PATH to be set correctly. But I doubt that every user will do that. Setting PATH for the aldor executable, however, is probably more common.

PKG_CONFIG_PATH is certainly a good idea, but maybe the aldor --print-confvar prefix 5ca3e2fbb6b4b759de126f75af26ac7b2be7b455, (which can be run by configure) is easier than an additional user interaction after a failed configure run. The latter even means to write documentation for the user to let him/her figure out what went wrong and how to cure it.

pippijn commented 11 years ago

You can set PKG_CONFIG_PATH in configure automatically. Once you have that (perhaps from which aldor or aldor --print-confvar), you can get the rest out of the pkg-config variables.

hemmecke commented 11 years ago

Is by general (non-aldor-specific) convention aldor --print-confvar prefix related in any way to what I should set PKG_CONFIG_PATH to?