Best way to enable _GNU_SOURCE

Ray Van Dolson rayvd at bludgeon.org
Sun Jun 1 16:24:04 UTC 2008


automake / autoconf newbie here.  I have a package that isn't currently
being built with _GNU_SOURCE defined and is running into compile
problems when a portion of it attempts to access hostent->h_addr.

If I compile with -D_GNU_SOURCE all is well, but I want to get this
fixed correctly upstream.  What is the proper / preferred way to do
this?  I see a couple options:

  - Get it added to acinclude.m4 and it will show up somewhere in a
    header file(?)
  - Modify configure.ac (or other) to generage a configure.in that
    tacks it onto DEFS which shows up then as DEFS in configure and
    populates DEFS in the resultant Makefile so we have -D_GNU_SOURCE
    passed to the compiler

What other ways are there to do this and what's the preferred way?

I'll answer my own question if I find the answer in the automake /
autoconf docs. :)

Ray




More information about the devel mailing list