CMake: Use CMAKE_THREAD_LIBS_INIT in liblzma.pc only with pthreads
[xz/debian.git] / lib / getopt-pfx-core.h
blobee22d3f77f427de0e4fbbd43088323bc1cfc585a
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 /* getopt (basic, portable features) gnulib wrapper header.
4 Copyright (C) 1989-2023 Free Software Foundation, Inc.
5 This file is part of gnulib.
6 Unlike most of the getopt implementation, it is NOT shared
7 with the GNU C Library.
9 This file is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation; either version 2.1 of the
12 License, or (at your option) any later version.
14 This file is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with this program. If not, see <https://www.gnu.org/licenses/>. */
22 #ifndef _GETOPT_PFX_CORE_H
23 #define _GETOPT_PFX_CORE_H 1
25 /* This header should not be used directly; include getopt.h or
26 unistd.h instead. It does not have a protective #error, because
27 the guard macro for getopt.h in gnulib is not fixed. */
29 /* Standalone applications should #define __GETOPT_PREFIX to an
30 identifier that prefixes the external functions and variables
31 defined in getopt-core.h and getopt-ext.h. Systematically
32 rename identifiers so that they do not collide with the system
33 functions and variables. Renaming avoids problems with some
34 compilers and linkers. */
35 #ifdef __GETOPT_PREFIX
36 # ifndef __GETOPT_ID
37 # define __GETOPT_CONCAT(x, y) x ## y
38 # define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
39 # define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
40 # endif
41 # undef getopt
42 # undef optarg
43 # undef opterr
44 # undef optind
45 # undef optopt
46 # define getopt __GETOPT_ID (getopt)
47 # define optarg __GETOPT_ID (optarg)
48 # define opterr __GETOPT_ID (opterr)
49 # define optind __GETOPT_ID (optind)
50 # define optopt __GETOPT_ID (optopt)
52 /* Work around a problem on macOS, which declares getopt with a
53 trailing __DARWIN_ALIAS(getopt) that would expand to something like
54 __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following
55 hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */
56 # ifdef __APPLE__
57 # define _GETOPT
58 # endif
60 /* The system's getopt.h may have already included getopt-core.h to
61 declare the unprefixed identifiers. Undef _GETOPT_CORE_H so that
62 getopt-core.h declares them with prefixes. */
63 # undef _GETOPT_CORE_H
64 #endif
66 #include <getopt-core.h>
68 #endif /* _GETOPT_PFX_CORE_H */