On Fri, Mar 5, 2010 at 4:13 PM, Charles Brown <charles.br...@sensis.com> wrote: > Dave Hart wrote: >> >> On Fri, Mar 5, 2010 at 19:25 UTC, Charles Brown wrote: >> > >> > Very new to automake, and can't find an answer to this; What would be >> put in >> > configure.ac to determine whether the detected preprocessor/compiler >> > automatically supplies -I/usr/local/include (for example, g++ does, but >> sun >> > CC does not), and if not, how to add it to some CFLAGS variable? >> >> To expand on a point Ralf touched on, the typical Autoconf approach is >> to predict as little as possible, and test for exactly what you need. >> So I would ask you, when your package in built with Sun cc and fails >> for lack of -I/usr/local/include, which header file in >> /usr/local/include causes the break? It should be in the compiler's >> error message. And I would suggest you then consider using a >> configure.ac test for that specific header file, assuming your code >> #includes it, or for the header file your project #includes which >> triggers the inclusion of the wrong/missing header. That test would >> then result in the addition of -I/usr/local/include on your Sun cc >> configuration. At the same time, you could easily expand it later if >> another system has that header file in a different directory, by >> searching a list of directories for the needed .h, rather than simply >> /usr/local/include. >> >> Instead of "my project needs -I/foo/include on system bar", I suggest >> "my project needs to find the correct foo.h on all systems". >> > > If the file is; /usr/local/include/package/header.h > and source is; #include <package/header.h> > what goes in configure.ac? > > AC_CHECK_HEADER([package/header.h]) just says 'no'.
Something like this would error out if the header isn't found: AC_CHECK_HEADER([package/header.h],[],[AC_MSG_ERROR([header.h not found but required])])