<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.26.0">
</HEAD>
<BODY>
On Wed, 2010-02-03 at 12:26 -0800, Alan Coopersmith wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
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-
</PRE>
</BLOCKQUOTE>
No special reasons, other than being cautious about just using the minimum amount of medication :-)<BR>
<BR>
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. <BR>
<BR>
I'll resubmit.<BR>
<BR>
For reference, in case of problems:<BR>
<BR>
<BR>
— Macro: <B>AC_USE_SYSTEM_EXTENSIONS</B>
<BLOCKQUOTE>
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: <BR>
<BR>
<BR>
<DL>
<TT>_GNU_SOURCE</TT><BR>
<DL>
Enable extensions on GNU/Linux. <BR>
</DL>
<TT>__EXTENSIONS__</TT><BR>
<DL>
Enable general extensions on Solaris. <BR>
</DL>
<TT>_POSIX_PTHREAD_SEMANTICS</TT><BR>
<DL>
Enable threading extensions on Solaris. <BR>
</DL>
<TT>_TANDEM_SOURCE</TT><BR>
<DL>
Enable extensions for the HP NonStop platform. <BR>
</DL>
<TT>_ALL_SOURCE</TT><BR>
<DL>
Enable extensions for AIX 3, and for Interix. <BR>
</DL>
<TT>_POSIX_SOURCE</TT><BR>
<DL>
Enable Posix functions for Minix. <BR>
</DL>
<TT>_POSIX_1_SOURCE</TT><BR>
<DL>
Enable additional Posix functions for Minix. <BR>
</DL>
<TT>_MINIX</TT><BR>
<DL>
Identify Minix platform. This particular preprocessor macro is obsolescent, and may be removed in a future release of Autoconf. <BR>
</DL>
</DL>
<BR>
</BLOCKQUOTE>
<HR>
<BR>
<BR>
— Macro: <B>_GNU_SOURCE</B><BR>
<BLOCKQUOTE>
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. <BR>
<BR>
If you want to get the full effect of <TT>_GNU_SOURCE</TT> but make the BSD definitions take precedence over the POSIX definitions, use this sequence of definitions: <BR>
<BR>
<PRE>
#define _GNU_SOURCE
#define _BSD_SOURCE
#define _SVID_SOURCE
</PRE>
<BR>
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. <B>NB:</B> If you forget to do this, you may get very strange errors at run time. <BR>
<BR>
</BLOCKQUOTE>
<BR>
<BR>
config.h seems to have dome the same amount of checking, using either macro.<BR>
<BR>
/* Enable extensions on AIX 3, Interix. */<BR>
#ifndef _ALL_SOURCE<BR>
# define _ALL_SOURCE 1<BR>
#endif<BR>
/* Enable GNU extensions on systems that have them. */<BR>
#ifndef _GNU_SOURCE<BR>
# define _GNU_SOURCE 1<BR>
#endif<BR>
/* Enable threading extensions on Solaris. */<BR>
#ifndef _POSIX_PTHREAD_SEMANTICS<BR>
# define _POSIX_PTHREAD_SEMANTICS 1<BR>
#endif<BR>
/* Enable extensions on HP NonStop. */<BR>
#ifndef _TANDEM_SOURCE<BR>
# define _TANDEM_SOURCE 1<BR>
#endif<BR>
/* Enable general extensions on Solaris. */<BR>
#ifndef __EXTENSIONS__<BR>
# define __EXTENSIONS__ 1<BR>
#endif<BR>
/* Number of bits in a file offset, on hosts where this is settable. */<BR>
/* #undef _FILE_OFFSET_BITS */<BR>
<BR>
/* Define for large files, on AIX-style hosts. */<BR>
/* #undef _LARGE_FILES */<BR>
<BR>
/* Define to 1 if on MINIX. */<BR>
/* #undef _MINIX */<BR>
<BR>
/* Define to 2 if the system does not provide POSIX.1 features except with<BR>
this defined. */<BR>
/* #undef _POSIX_1_SOURCE */<BR>
<BR>
/* Define to 1 if you need to in order for `stat' and other things to work. */<BR>
/* #undef _POSIX_SOURCE */<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
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 <<A HREF="mailto:memsize@videotron.ca">memsize@videotron.ca</A>>
> ---
> 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],
>         [<A HREF="https://bugs.freedesktop.org/enter_bug.cgi?product=xorg">https://bugs.freedesktop.org/enter_bug.cgi?product=xorg</A>],
>         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])
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>