2 dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN([gl_POSIXVER],
9 AC_CHECK_HEADERS_ONCE(unistd.h)
10 AC_REQUIRE([gl_DEFAULT_POSIX2_VERSION])
13 # Set the default level of POSIX conformance at configure-time.
14 # Build with `./configure DEFAULT_POSIX2_VERSION=199209 ...' to
15 # support the older version, thus preserving portability with
16 # scripts that use sort +1, tail +32, head -1, etc.
17 # Note however, that this breaks tools that might run commands
18 # like `sort +some-file' that conform with the newer standard.
19 AC_DEFUN([gl_DEFAULT_POSIX2_VERSION],
21 AC_MSG_CHECKING([for desired default level of POSIX conformance])
22 gl_default_posix2_version=none-specified
23 if test -n "$ac_cv_env_DEFAULT_POSIX2_VERSION_set"; then
24 gl_default_posix2_version=$ac_cv_env_DEFAULT_POSIX2_VERSION_value
25 AC_DEFINE_UNQUOTED(DEFAULT_POSIX2_VERSION,
26 $gl_default_posix2_version,
27 [Define the default level of POSIX conformance. The value is of
28 the form YYYYMM, specifying the year and month the standard was
29 adopted. If not defined here, it defaults to the value of
30 _POSIX2_VERSION in <unistd.h>. Define to 199209 to default to
31 POSIX 1003.2-1992, which makes standard programs like `head',
32 `tail', and `sort' accept obsolete options like `+10' and
33 `-10'. Define to 200112 to default to POSIX 1003.1-2001, which
34 makes these standard programs treat leading-`+' operands as
35 file names and require modern usages like `-n 10' instead of
36 `-10'. Whether defined here or not, the default can be
37 overridden at run time via the _POSIX2_VERSION environment
40 AC_MSG_RESULT($gl_default_posix2_version)
42 [DEFAULT_POSIX2_VERSION],
43 [POSIX version to default to; see 'config.hin'.])