summaryrefslogtreecommitdiffstats
path: root/gl/m4/getopt.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/getopt.m4')
-rw-r--r--gl/m4/getopt.m425
1 files changed, 9 insertions, 16 deletions
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4
index 297722ea..c620b2b7 100644
--- a/gl/m4/getopt.m4
+++ b/gl/m4/getopt.m4
@@ -1,9 +1,10 @@
1# getopt.m4 1# getopt.m4
2# serial 49 2# serial 52
3dnl Copyright (C) 2002-2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Request a POSIX compliant getopt function. 9# Request a POSIX compliant getopt function.
9AC_DEFUN([gl_FUNC_GETOPT_POSIX], 10AC_DEFUN([gl_FUNC_GETOPT_POSIX],
@@ -77,7 +78,7 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
77 fi 78 fi
78 79
79 dnl POSIX 2008 does not specify leading '+' behavior, but see 80 dnl POSIX 2008 does not specify leading '+' behavior, but see
80 dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on 81 dnl https://austingroupbugs.net/view.php?id=191 for a recommendation on
81 dnl the next version of POSIX. For now, we only guarantee leading '+' 82 dnl the next version of POSIX. For now, we only guarantee leading '+'
82 dnl behavior with getopt-gnu. 83 dnl behavior with getopt-gnu.
83 if test -z "$gl_replace_getopt"; then 84 if test -z "$gl_replace_getopt"; then
@@ -87,8 +88,8 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
87 dnl Merging these three different test programs into a single one 88 dnl Merging these three different test programs into a single one
88 dnl would require a reset mechanism. On BSD systems, it can be done 89 dnl would require a reset mechanism. On BSD systems, it can be done
89 dnl through 'optreset'; on some others (glibc), it can be done by 90 dnl through 'optreset'; on some others (glibc), it can be done by
90 dnl setting 'optind' to 0; on others again (HP-UX, IRIX, OSF/1, 91 dnl setting 'optind' to 0; on others again (HP-UX, Solaris 9,
91 dnl Solaris 9, musl libc), there is no such mechanism. 92 dnl musl libc), there is no such mechanism.
92 if test $cross_compiling = no; then 93 if test $cross_compiling = no; then
93 dnl Sanity check. Succeeds everywhere (except on MSVC, 94 dnl Sanity check. Succeeds everywhere (except on MSVC,
94 dnl which lacks <unistd.h> and getopt() entirely). 95 dnl which lacks <unistd.h> and getopt() entirely).
@@ -237,8 +238,7 @@ dnl is ambiguous with environment values that contain newlines.
237 nocrash_init(); 238 nocrash_init();
238 239
239 /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, 240 /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw,
240 and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, 241 and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, Solaris 10. */
241 OSF/1 5.1, Solaris 10. */
242 { 242 {
243 static char conftest[] = "conftest"; 243 static char conftest[] = "conftest";
244 static char plus[] = "-+"; 244 static char plus[] = "-+";
@@ -249,7 +249,7 @@ dnl is ambiguous with environment values that contain newlines.
249 } 249 }
250 /* This code succeeds on glibc 2.8, mingw, 250 /* This code succeeds on glibc 2.8, mingw,
251 and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, 251 and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
252 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ 252 Solaris 10, Cygwin 1.5.x. */
253 { 253 {
254 static char program[] = "program"; 254 static char program[] = "program";
255 static char p[] = "-p"; 255 static char p[] = "-p";
@@ -366,14 +366,7 @@ dnl is ambiguous with environment values that contain newlines.
366 366
367AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], 367AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
368[ 368[
369 AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) 369 gl_CHECK_HEADER_SYS_CDEFS_H
370 if test $ac_cv_header_sys_cdefs_h = yes; then
371 HAVE_SYS_CDEFS_H=1
372 else
373 HAVE_SYS_CDEFS_H=0
374 fi
375 AC_SUBST([HAVE_SYS_CDEFS_H])
376
377 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], 370 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
378 [Define to rpl_ if the getopt replacement functions and variables 371 [Define to rpl_ if the getopt replacement functions and variables
379 should be used.]) 372 should be used.])