autoconf
[Top][All Lists]
Advanced

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

Use system extensions conditionally?


From: Fredrik Tolf
Subject: Use system extensions conditionally?
Date: Thu, 27 Feb 2014 03:16:31 +0100 (CET)
User-agent: Alpine 2.10 (DEB 1266 2009-07-14)

Dear list,

I'm trying to write a program that can use custom stdio streams on both Linux/glibc and FreeBSD, and to that end, I'm trying to modify to autoconf script to properly detect these and turn on the necessary compiler flags to support them.

On glibc, I need to define `_GNU_SOURCE' in order to gain access to fopencookie() and cookie_io_functions_t. Autoconf neatly supports turning this on with `AC_USE_SYSTEM_EXTENSIONS(_GNU_SOURCE)', but I can't quite seem to figure out how to only do this when necessary. Currently, I'm trying to do it like this:

    HAS_FOPENCOOKIE=yes
    AC_CHECK_FUNC(fopencookie, [AC_USE_SYSTEM_EXTENSIONS(_GNU_SOURCE)], 
[HAS_FOPENCOOKIE=no])
    AC_CHECK_MEMBER([cookie_io_functions_t.read], [], [HAS_FOPENCOOKIE=no])

This /works/, per se, but autoconf complains loudly when I try to generate the configure script, several times, that `AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS'. Apparently, it thinks it is really bad practice to actually do any tests before turning on system extensions.

What should I do about this? Just ignore the warnings? Do the necessary AC_DEFINE manually instead? (This seems ugly, since I'd need to define an `AH_TEMPLATE` as well and all that.) Just turn on all extensions that I may or may not use, unconditionally at the top of the file? Something completely different?

Thanks for reading!

--
Fredrik Tolf



reply via email to

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