2 dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
3 dnl This file is free software, distributed under the terms of the GNU
4 dnl General Public License. As a special exception to the GNU General
5 dnl Public License, this file may be distributed as part of a program
6 dnl that contains a configuration script generated by Autoconf, under
7 dnl the same distribution terms as the rest of that program.
9 AC_DEFUN([gl_POSIXVER],
11 AC_CHECK_HEADERS_ONCE(unistd.h)
12 AC_REQUIRE([gl_DEFAULT_POSIX2_VERSION])
15 # Set the default level of POSIX conformance at configure-time.
16 # Build with `./configure DEFAULT_POSIX2_VERSION=199209 ...' to
17 # support the older version, thus preserving portability with
18 # scripts that use sort +1, tail +32, head -1, etc.
19 # Note however, that this breaks tools that might run commands
20 # like `sort +some-file' that conform with the newer standard.
21 AC_DEFUN([gl_DEFAULT_POSIX2_VERSION],
23 AC_MSG_CHECKING([for desired default level of POSIX conformance])
24 gl_default_posix2_version=none-specified
25 if test -n "$ac_cv_env_DEFAULT_POSIX2_VERSION_set"; then
26 gl_default_posix2_version=$ac_cv_env_DEFAULT_POSIX2_VERSION_value
27 AC_DEFINE_UNQUOTED(DEFAULT_POSIX2_VERSION,
28 $gl_default_posix2_version,
29 [Define the default level of POSIX conformance. The value is of
30 the form YYYYMM, specifying the year and month the standard was
31 adopted. If not defined here, it defaults to the value of
32 _POSIX2_VERSION in <unistd.h>. Define to 199209 to default to
33 POSIX 1003.2-1992, which makes standard programs like `head',
34 `tail', and `sort' accept obsolete options like `+10' and
35 `-10'. Define to 200112 to default to POSIX 1003.1-2001, which
36 makes these standard programs treat leading-`+' operands as
37 file names and require modern usages like `-n 10' instead of
38 `-10'. Whether defined here or not, the default can be
39 overridden at run time via the _POSIX2_VERSION environment
42 AC_MSG_RESULT($gl_default_posix2_version)
44 [DEFAULT_POSIX2_VERSION],
45 [POSIX version to default to; see 'config.hin'.])