autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About AC_CHECK_HEADERS and different locations


From: Ralf Corsepius
Subject: Re: About AC_CHECK_HEADERS and different locations
Date: Tue, 28 Sep 2010 17:01:52 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Thunderbird/3.1.4

On 09/28/2010 04:52 PM, Andrew W. Nosenko wrote:
On Tue, Sep 28, 2010 at 06:13, Sergio Belkin<address@hidden>  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.

Ralf



reply via email to

[Prev in Thread] Current Thread [Next in Thread]