On Tue, Sep 28, 2010 at 18:01, Ralf Corsepius <rc040203@xxxxxxxxxx> wrote: > On 09/28/2010 04:52 PM, Andrew W. Nosenko wrote: >> >> On Tue, Sep 28, 2010 at 06:13, Sergio Belkin<sebelk@xxxxxxxxx> wrote: >>> >>> Hi, >>> >>> I am autoconfiscating a project that has a header file with a line: >>> >>> #include<postgresql/libpq-fe.h> >>> >>> configure.ac has: >>> >>> AC_CHECK_HEADERS(postgresql/libpq-fe.h) >>> >>> The problem is that Ubuntu has such a header file on >>> /usr/include/postgresq but fedora has it on /usr/include. So how can >>> I make that configure script checks for differents paths? >> >> Assuming that >> o Fedora has requested header as /usr/include/libpq-fe.h >> o Ubuntu has requested header as /usr/include/postgresql/libpq-fe.h >> (otherwise I see no problems at all, just use CPPFLAGS approrach >> as already suggested) >> >> Then you can to check both in configure.ac and use result in the source >> code: >> >> configure.ac: >> >> AC_CHECK_HEADERS([postgresql/libpq-fe.h libpq-fe.h], >> [break], >> [AC_MSG_ERROR([PostgreSQL headers not found or not >> usable])]) >> >> Source code: >> >> #if defined(POSTGRESQL_LIBPQ_FE_H) >> # include<postgresql/libpq-fe.h> >> #elif defined(LIBPQ_FE_H) >> # include<libpq-fe.h> >> #else >> # error impossible because of AC_MSG_ERROR(), but... >> #endif >> >> Of cource you can play with [action-not-found] (for example remove >> AC_MSG_ERROR() completely and don't abort configure if nither header >> found), and simplify "#include" dance to >> >> #if defined(POSTGRESQL_LIBPQ_FE_H) >> # include<postgresql/libpq-fe.h> >> #else >> # include<libpq-fe.h> >> #endif >> >> for allow tuning CPPFLAGS by hands at the make(1) invocation, for >> example... Or anything what you want. > > Much easier than this is modifying the source code to > #include <libpq-fe.h> > instead of > #include <postresql/libpq-fe.h> > and to rely on the user passing appropriate CPPFLAGS. Yes, you right. And if user didn't specified anything, then proper flags may be obtained using the 'pg_config' utility. -- Andrew W. Nosenko <andrew.w.nosenko@xxxxxxxxx> _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf