[PATCH app-sessreg] Add AC_GNU_SOURCE which provides needed WTMPX_FILE define

Gaetan Nadon memsize at videotron.ca
Wed Feb 3 14:28:04 PST 2010


On Wed, 2010-02-03 at 12:26 -0800, Alan Coopersmith wrote:

> Any reason to not just use AC_USE_SYSTEM_EXTENSIONS?
> I'm not aware of any problems we've hit in the other
> modules that are using that.
> 
> 	-alan-
> 

No special reasons, other than being cautious about just using the
minimum amount of medication :-)

I was not sure if the new code (which requires GNU source) would be
portable to other platforms (meaning non GNU compilers). Jeremy was kind
enough to test it on darwin. 

I'll resubmit.

For reference, in case of problems:


— Macro: AC_USE_SYSTEM_EXTENSIONS
        
        This macro was introduced in Autoconf 2.60. If possible, enable
        extensions to C or Posix on hosts that normally disable the
        extensions, typically due to standards-conformance namespace
        issues. This should be called before any macros that run the C
        compiler. The following preprocessor macros are defined where
        appropriate: 
        
        
        _GNU_SOURCE
                Enable extensions on GNU/Linux. 
        __EXTENSIONS__
                Enable general extensions on Solaris. 
        _POSIX_PTHREAD_SEMANTICS
                Enable threading extensions on Solaris. 
        _TANDEM_SOURCE
                Enable extensions for the HP NonStop platform. 
        _ALL_SOURCE
                Enable extensions for AIX 3, and for Interix. 
        _POSIX_SOURCE
                Enable Posix functions for Minix. 
        _POSIX_1_SOURCE
                Enable additional Posix functions for Minix. 
        _MINIX
                Identify Minix platform. This particular preprocessor
                macro is obsolescent, and may be removed in a future
                release of Autoconf. 
        

________________________________________________________________________


— Macro: _GNU_SOURCE

        If you define this macro, everything is included: ISO C89,
        ISO C99, POSIX.1, POSIX.2, BSD, SVID, X/Open, LFS, and GNU
        extensions. In the cases where POSIX.1 conflicts with BSD, the
        POSIX definitions take precedence. 
        
        If you want to get the full effect of _GNU_SOURCE but make the
        BSD definitions take precedence over the POSIX definitions, use
        this sequence of definitions: 
        
        
        #define _GNU_SOURCE
                  #define _BSD_SOURCE
                  #define _SVID_SOURCE
        
        
        Note that if you do this, you must link your program with the
        BSD compatibility library by passing the ‘-lbsd-compat’ option
        to the compiler or linker. NB: If you forget to do this, you may
        get very strange errors at run time. 
        


config.h seems to have dome the same amount of checking, using either
macro.

/* Enable extensions on AIX 3, Interix.  */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* 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
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */

/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */

/* Define to 1 if on MINIX. */
/* #undef _MINIX */

/* Define to 2 if the system does not provide POSIX.1 features except
with
   this defined. */
/* #undef _POSIX_1_SOURCE */

/* Define to 1 if you need to in order for `stat' and other things to
work. */
/* #undef _POSIX_SOURCE */







> Gaetan Nadon wrote:
> > The WTMPX_FILE is only defined under __USE_GNU conditional
> > compilation. Autoconf provides AC_GNU_SOURCE which is a subset of
> > AC_USE_SYSTEM_EXTENSIONS.
> > 
> > It must be expanded before any other macros that uses the compiler.
> > To reduce the risk of being misplaced, the statements have been
> > grouped (mostly) as per the GNU standard layout.This macro
> > requires Autoconf level 2.60 or later.
> > 
> > The compilation failed under a GNU-Linux OS.
> > 
> > Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
> > ---
> >  configure.ac |   32 +++++++++++++++++++-------------
> >  1 files changed, 19 insertions(+), 13 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index be1b4b4..6287a6b 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -20,25 +20,34 @@ dnl  PERFORMANCE OF THIS SOFTWARE.
> >  dnl
> >  dnl Process this file with autoconf to create configure.
> >  
> > -AC_PREREQ([2.57])
> > +# Initialize Autoconf
> > +AC_PREREQ([2.60])
> >  AC_INIT(sessreg, [1.0.5],
> >  	[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
> >  	sessreg)
> > +AC_CONFIG_SRCDIR([Makefile.am])
> > +AC_CONFIG_HEADERS([config.h])
> > +AC_CANONICAL_HOST
> > +AC_GNU_SOURCE
> > +AC_SYS_LARGEFILE
> > +
> > +# Initialize Automake
> >  AM_INIT_AUTOMAKE([foreign dist-bzip2])
> >  AM_MAINTAINER_MODE
> >  
> > -AM_CONFIG_HEADER(config.h)
> > -
> > -# Require xorg-macros 1.3 or later: XORG_DEFAULT_OPTIONS
> > +# Require xorg-macros: XORG_DEFAULT_OPTIONS
> >  m4_ifndef([XORG_MACROS_VERSION],
> > -	  [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
> > -XORG_MACROS_VERSION(1.3)
> > +	  [m4_fatal([must install xorg-macros 1.4 or later before running autoconf/autogen])])
> > +XORG_MACROS_VERSION(1.4)
> > +XORG_DEFAULT_OPTIONS
> > +XORG_WITH_LINT
> >  
> > +# Checks for programs.
> >  AC_PROG_CC
> > +AC_PROG_CC_C99
> >  AC_PROG_INSTALL
> >  
> > -XORG_DEFAULT_OPTIONS
> > -
> > +# Checks for header files.
> >  AC_CHECK_HEADERS([lastlog.h utmp.h utmpx.h sys/param.h])
> >  AC_CHECK_MEMBER([struct utmpx.ut_syslen],
> >  		HAVE_SYSLEN=1,
> > @@ -46,15 +55,12 @@ AC_CHECK_MEMBER([struct utmpx.ut_syslen],
> >  		[#include <utmpx.h>])
> >  AC_DEFINE_UNQUOTED(HAVE_UTMPX_UT_SYSLEN,$HAVE_SYSLEN,
> >  		   [utmpx structure includes ut_syslen field])
> > -AC_CHECK_FUNCS([updwtmpx utmpxname])
> >  
> > -AC_SYS_LARGEFILE
> > +# Checks for typedefs, structures, and compiler characteristics.
> > +AC_CHECK_FUNCS([updwtmpx utmpxname])
> >  
> >  # Checks for pkg-config packages
> >  PKG_CHECK_MODULES(SESSREG, xproto)
> >  AC_SUBST(SESSREG_CFLAGS)
> >  
> > -# Allow checking code with lint, sparse, etc.
> > -XORG_WITH_LINT
> > -
> >  AC_OUTPUT([Makefile])
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.x.org/archives/xorg-devel/attachments/20100203/4387d3f0/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.x.org/archives/xorg-devel/attachments/20100203/4387d3f0/attachment.pgp 


More information about the xorg-devel mailing list