Translations: Update the Hungarian translation.
[xz.git] / m4 / getopt.m4
blobaf8bfd4cb1b8bdc789d56091ac0807035fe2104e
1 dnl SPDX-License-Identifier: FSFULLR
3 # getopt.m4 serial 49 (modified version)
4 dnl Copyright (C) 2002-2006, 2008-2023 Free Software Foundation, Inc.
5 dnl This file is free software; the Free Software Foundation
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
9 # This version has been modified to reduce complexity since we only need
10 # GNU getopt_long and do not care about replacing getopt.
12 # Check for a POSIX compliant getopt function with GNU extensions (such as
13 # options with optional arguments) and the functions getopt_long,
14 # getopt_long_only.
15 AC_DEFUN([gl_FUNC_GETOPT_GNU],
17   AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
19   if test -n "$gl_replace_getopt"; then
20     gl_GETOPT_SUBSTITUTE
21   fi
24 AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
26   gl_replace_getopt=
28   if test -z "$gl_replace_getopt"; then
29     AC_CHECK_HEADERS([getopt.h], [], [gl_replace_getopt=yes])
30   fi
32   if test -z "$gl_replace_getopt"; then
33     AC_CHECK_FUNCS([getopt_long], [], [gl_replace_getopt=yes])
34   fi
36   dnl BSD getopt_long uses a way to reset option processing, that is different
37   dnl from GNU and Solaris (which copied the GNU behavior). We support both
38   dnl GNU and BSD style resetting of getopt_long(), so there's no need to use
39   dnl GNU getopt_long() on BSD due to different resetting style.
40   if test -z "$gl_replace_getopt"; then
41     AC_CHECK_DECL([optreset],
42       [AC_DEFINE([HAVE_OPTRESET], 1,
43         [Define to 1 if getopt.h declares extern int optreset.])],
44       [], [#include <getopt.h>])
45   fi
47   dnl POSIX 2008 does not specify leading '+' behavior, but see
48   dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on
49   dnl the next version of POSIX.  We don't use that feature, so this
50   dnl is not a problem for us. Thus, the respective test was removed here.
52   dnl Checks for getopt handling '-' as a leading character in an option
53   dnl string were removed, since we also don't use that feature.
57 AC_DEFUN([gl_GETOPT_SUBSTITUTE],
59   AC_LIBOBJ([getopt])
60   AC_LIBOBJ([getopt1])
62   AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
64   AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
65     [Define to rpl_ if the getopt replacement functions and variables
66      should be used.])
68   GETOPT_H=getopt.h
69   AC_SUBST([GETOPT_H])
72 AC_DEFUN([gl_GETOPT], [gl_FUNC_GETOPT_GNU])