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.
#if HAVE_FOOBAR #include <foo_bar.h> #else #include <My_foo_bar_replacement.h> #endif
#if HAVE_FOOBAR var = SillyFunction(x); #else var = MyRewiteOfSillyFunction(x); #endif
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. I'd use HAVE_FDATASYNC.
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 configure.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.
-g
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf