On 08/23/2010 11:28 AM, John Calcote wrote:
Hi all, I ran into an interesting issue today. Hoping some of you have some insight for me. I needed to use a later addition to the pthreads spec - pthread_mutexaddr_settype (in order to initialize a recursive mutex). To use this function, you need to define __USE_UNIX98 before including pthread.h - at least on my platform (opensuse 11.3 64-bit).
Are you using the AC_USE_SYSTEM_EXTENSIONS macro, prior to anything else that probes the C compiler? If so, then that should be defining all macros necessary to make the headers declare extensions such as pthread_mutexaddr_settype (and if it isn't, then that's a bug in AC_USE_SYSTEM_EXTENSIONS that we need to fix).
What is the correct approach for this situation? Should I simply define __USE_UNIX98 in my source code because I need the associated functionality? Is __USE_UNIX98 a widely used and understood macro? (Google searches didn't really help me understand the proper use of this macro.)
Generally, using AC_USE_SYSTEM_EXTENSIONS, then ensuring that your files include <config.h> before any system headers, should be adequate without you having to know whether the system spelled their extension guard as __USE_UNIX98, _GNU_SOURCE, __EXTENSIONS__, or some other spelling.
-- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf