Library header files with autoconf preprocessor macros
From: Alan Johnson (alanwj_at_stanford.dot.nospam_edu)
Date: 06/28/05
- Next message: loic-dev_at_gmx.net: "Re: Library header files with autoconf preprocessor macros"
- Previous message: Ross: "Re: Database applications in Linux"
- Next in thread: loic-dev_at_gmx.net: "Re: Library header files with autoconf preprocessor macros"
- Reply: loic-dev_at_gmx.net: "Re: Library header files with autoconf preprocessor macros"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 28 Jun 2005 03:11:22 -0700
I would like to use autoconf/automake/libtool to build a library I have
written (which we'll call foo), but there is a problem, the solution to
which eludes me. Let's say, for example, that autoconf decides that
<sys/socket.h> exists on the system for which the library is being
built. And let's say that I have some header bar.h, which will contain
something along the lines of:
#ifndef FOO_BAR_H
#define FOO_BAR_H
#if HAVE_CONFIG_H
# include <foo/config.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
/* Lots of functions that use symbols from <sys/socket.h> */
#endif /* FOO_BAR_H */
This is all fine and great, unless bar.h is one of the header files that
is supposed to be installed for my library. Let's say I write the
following program:
#include <foo/bar.h>
int main()
{
/* Do some interesting stuff with functions from
the foo library. */
return 0 ;
}
Here the problem arises that when <foo/bar.h> is included, HAVE_CONFIG_H
is not defined, which means HAVE_SYS_SOCKET_H never gets defined,
meaning all the types/functions/macros that <foo/bar.h> used from
<sys/socket.h> cause compile errors.
Any suggestions about how to get around this problem?
Thanks,
Alan
- Next message: loic-dev_at_gmx.net: "Re: Library header files with autoconf preprocessor macros"
- Previous message: Ross: "Re: Database applications in Linux"
- Next in thread: loic-dev_at_gmx.net: "Re: Library header files with autoconf preprocessor macros"
- Reply: loic-dev_at_gmx.net: "Re: Library header files with autoconf preprocessor macros"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]