[Top][All Lists]

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

Re: Help with differing build environments

From: Geoffrey Huang
Subject: Re: Help with differing build environments
Date: Wed, 06 Oct 2004 11:49:54 -0700
User-agent: Mozilla Thunderbird 0.7.1 (X11/20040626)

Hi Chris,

Thanks for the response. Yeah - I'd read about this in the manuals. I don't really like the prospect of having #if statements throughout the code, especially since the use of the functions in question is quite widespread.

Additionally, it isn't just a matter of using my version of the function vs. the system's function. I don't want my toolkit's functions linked in when unnecessary, and likewise, I don't want the system's functions linked in when unnecessary.

I think I've worked it out to have configure check for the presence of the API/header files in question, then based on that, conditionally set the appropriate search-path for the header file. Likewise, based on this condition, I'll have configure compile and link the appropriate code, so:



Thanks again for the suggestion.


Chris Albertson wrote:
This is covered in the manuals in more detail but in general the idea is that you get "configure" to test for some required API and if found
set a variable like "HAVE_FOOBAR" if libFOOBAR is found and usaable

Then inside your code you use a bunch of #if statemnets to either use the system API or yours.

#include <foo_bar.h>
#include <My_foo_bar_replacement.h>

  var = SillyFunction(x);
  var = MyRewiteOfSillyFunction(x);

Sometimes you can simply fall back to another function if one is
not available  Like using "fsync" if "fdatasync" is not available.
(older Solaris lacks fdatasync) but I would never write #if SOLARIS.

Geoffrey Huang wrote:

Hi there,

I have a question on how to use autotools in differing build environments.

I'm working on a project that's meant to be a portable library. On some systems, I'll be using a set of APIs provided by the platform. In these cases, I want autotools to look for the system's header files for the API's. Likewise, I want autotools to look for the system-provided .c-files for these API's.

On other targets, the system doesn't provide the API's, so I want autotools to use the code I've implemented in the portable library itself.

How would I go about doing this? I've considered using the AC_CANONICAL_SYSTEM statement in to get me the target system. However, that directive only seems to recognize standard gnu platforms. Some of my platforms aren't standard.

Then I considered using the AM_CONDITIONAL test to specify the system type directly to the configure script, but I have doubts that this is the best way.

Anyhoo, I'd appreciate any help.


Autoconf mailing list

reply via email to

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