autoconf
[Top][All Lists]
Advanced

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

Re: include location detection


From: Nicolai Stange
Subject: Re: include location detection
Date: Wed, 31 Aug 2011 10:12:26 +0200

> Some distros install them directly below /usr/include (e.g. 
> /usr/include/fastcgi.h) some others use a subdir for this (e.g. 
> /usr/include/fastcgi/fastcgi.h). :(
In my opinion, there are two ways of handling that:
1.) Introduce a --with-fastcgi flag and simply check with test whether a
$fastcgi_prefix/include/fastcgi does exist.
See
http://www.gnu.org/s/hello/manual/autoconf/Limitations-of-Builtins.html#Limitations-of-Builtins
for limitations of test on files and cross compilation

2.) AC_CHECK_HEADER once for fastcgi/fastcgi.h and for fastcgi.h only.
Remember which one works by defining a CPP macro (actually the
AC_CHECK_HEADERS defines one for you). Use CPP conditionals to include
the right one into your sources.
See
http://www.gnu.org/s/hello/manual/autoconf/Generic-Headers.html#Generic-Headers
For example:
fast_cgi_h_found=n
AC_CHECK_HEADERS ([fastcgi/fastcgi.h fastcgi.h], [fastcgi_h_found=y;
break;], [])
test $fast_cgi_h_found = n && AC_MSG_ERROR([fastcgi.h not found])

In your sources:
#ifdef HAVE_FASTCGI_H
#include <fastcgi.h>
#elif defined HAVE_FASTCGI_FASTCGI_H
#include <fastcgi/fastcgi.h>
#endif

Of course, a combination of both is also possible: Set CPPFLAGS
unconditionally to $fastcgi_prefix/include (if --with-fastcgi has been
given) and AC_CHECK_HEADERS. I think I would prefer that solution.

Best,

Nicolai




reply via email to

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