automake
[Top][All Lists]
Advanced

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

Re: finding the location of header (.h) files


From: tomas
Subject: Re: finding the location of header (.h) files
Date: Tue, 1 Aug 2006 05:13:25 +0000
User-agent: Mutt/1.5.9i

On Sun, Jul 30, 2006 at 02:19:50PM +1000, mick wrote:
> On Fri, 14 Jul 2006 18:39, Stepan Kasal wrote:
> I have an application that depends on gtkhtml-2.0, which seems to put its 
> headers in a diferent location in almost every linux or BSD distribution so I 
> need to replace 
> INCLUDES = -I/usr/include/gtkhtml-2.0
> in Makefile.am.
> 
> Its been suggested that I use 
> AC_CHECK_HEADER ([libgtkhtml/gtkhtml.h], 
>                  [action-if-found], 
>               [AC_MSG_ERROR([BUMMER, Maybe if you install libgtkhtml-2 & 
> libgtkhtml-2-dev 
> this pig will fly])],
>                  [Macro]
>                  [includes = 'default-includes'])
> in configure.ac.
> I'm trying to nut it out but getting more confused with every step, I'm 
> guessing I need to replace "macro" with something like 'locate gtkhtml.h' 
> then some sed? to trim it down.
> 
> Have I got that right?
> if locate gtkhtml.h gives
> /usr/include/gtkhtml-2.0/libgtkhtml/gtkhtml.h
> what would clean it up to produce the required string?

That's what pkg-config is for (yes, yet another little tool :-/
Many packages intended to be used as libs come these days with
pkg-config descriptions (*.pc files). libgtkhtml is one of those. For
those, you can say, e.g.

  pkg-config gtkhtml-1.1 --cflags

and you get whatever you need to stuff into the compiler command:

  -DNEED_GNOMESUPPORT_H -DGTKHTML_HAVE_GCONF -I/usr/include/gtkhtml-1.1 \
    -I/usr/include/gdk-pixbuf-1.0 -I/usr/include/gtk-1.2 \
    -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/include/gnome-1.0 \
    -I/usr/include/freetype2 -I/usr/lib/gnome-libs/include \
    -I/usr/include/gnome-xml -I/usr/include/gal-1.0 \
    -I/usr/include/libglade-1.0 -I/usr/include/gconf/1 \
    -I/usr/include/orbit-1.0

(yes, it ain't pretty).

So you would first check for the existence of pkg-config (and complain
if not there) and then use it to get the info needed.

HTH
-- tomas

Attachment: signature.asc
Description: Digital signature


reply via email to

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