|
From: | Eric Blake |
Subject: | Re: __USE_UNIX98 to enable late pthread features |
Date: | Mon, 23 Aug 2010 11:54:23 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2 |
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 address@hidden +1-801-349-2682 Libvirt virtualization library http://libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |