Jordan Crouse wrote:
+pc_CFLAGS="$(pkg-config libpci --cflags 2>/dev/null)" +pc_LDFLAGS="$(pkg-config libpci --libs 2>/dev/null)" +CFLAGS=$(trycompile "libpci (from pciutils)" "${pc_CFLAGS}" "-I/usr/local/include") || {
- rm -f .config.c
- exit 1
Any reason why we don't just drink all the koolaid and use the full autoconf/automake/pkgconfig system in all its glory?
findprog(), trycompile() and trylink() in the configure script are short, fairly easy to understand and hopefully portable enough.
This seems to be fairly prone to porting issues - especially the -I/usr/local/include bit.
The first parameter to trycompile and trylink is a message, all the rest are CFLAGS that should be tried in order, one at a time, until one is found that will successfully compile/link the file.
So pkg-config output is tried first, if that doesn't work (maybe no pkg-config installed) then -I/usr/local/include is tried. On Gentoo no CFLAGS are needed at all because the library is in /usr and /usr/include is always searched by gcc.
My thinking is that this is flexible enough while staying simpler than autotools. I hope to get a similar configure script into flashrom too, ticket 101.
//Peter