[PATCH libxtrans] configure: under glibc define _GNU_SOURCE rather then _BSD_SOURCE

Gaetan Nadon memsize at videotron.ca
Sat Mar 8 08:07:01 PST 2014


On 14-03-08 09:03 AM, Hans de Goede wrote:
> So I've just been looking into using AC_USE_SYSTEM_EXTENSIONS but that
> seem pretty
> useless, it only adds the relevant defines to confdefs.h, not into
> cflags,
> and in libxtrans we want to add them to the .pc file, so we need them
> in a variable.
>
> I'm open to different suggestions, but I think my initial patch might
> be the best
> way to fix this.
>
Check the pattern in other modules such as libX11. The source code
includes the content of the generated config.h (see config.h.in).

    #ifdef HAVE_CONFIG_H
    #include <config.h>
    #endif

which contains definitions such as:

    /* Enable GNU extensions on systems that have them.  */
    #ifndef _GNU_SOURCE
    # define _GNU_SOURCE 1
    #endif
    /* Enable threading extensions on Solaris.  */
    #ifndef _POSIX_PTHREAD_SEMANTICS
    # define _POSIX_PTHREAD_SEMANTICS 1
    #endif
    /* Enable extensions on HP NonStop.  */
    #ifndef _TANDEM_SOURCE
    # define _TANDEM_SOURCE 1
    #endif
    /* Enable general extensions on Solaris.  */
    #ifndef __EXTENSIONS__
    # define __EXTENSIONS__ 1
    #endif

and so on...

When a module is configured (running ./configure), the appropriate
values are filled-in based on what the platform is. If hard coded in the
C code, all this work has to be done all over again. In addition, this
mechanism was put in place because the gcc command might be lengthy on
some platforms.

Check it out, it should solve the problem.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140308/267d02f2/attachment.html>


More information about the xorg-devel mailing list