[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/5] getopt-posix: avoid spurious failure on Solaris
From: |
Eric Blake |
Subject: |
[PATCH 2/5] getopt-posix: avoid spurious failure on Solaris |
Date: |
Tue, 13 Apr 2010 17:17:17 -0600 |
* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Check for getopt_clip as
an indicator that setting optind=1 is sufficient for reset.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 4 ++++
m4/getopt.m4 | 11 ++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d796015..7de81f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2010-04-13 Eric Blake <address@hidden>
+ getopt-posix: avoid spurious failure on Solaris
+ * m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Check for getopt_clip as
+ an indicator that setting optind=1 is sufficient for reset.
+
getopt-posix: avoid spurious failure on FreeBSD
* m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Check for optreset even
in POSIX mode, since the m4 test uses it.
diff --git a/m4/getopt.m4 b/m4/getopt.m4
index 0ee5821..8d3d8b6 100644
--- a/m4/getopt.m4
+++ b/m4/getopt.m4
@@ -1,4 +1,4 @@
-# getopt.m4 serial 25
+# getopt.m4 serial 26
dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -79,8 +79,13 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
dnl Existence of the variable, in and of itself, is not a reason to replace
dnl getopt, but knowledge of the variable is needed to determine how to
dnl reset and whether a reset reparses the environment.
+ dnl Solaris supports neither optreset nor optind=0, but keeps no state that
+ dnl needs a reset beyond setting optind=1; detect Solaris by getopt_clip.
if test -z "$gl_replace_getopt"; then
- AC_CHECK_DECLS([optreset], [], [],
+ AC_CHECK_DECLS([optreset], [],
+ [AC_CHECK_DECLS([getopt_clip], [], [],
+ [[#include <getopt.h>]])
+ ],
[[#include <getopt.h>]])
fi
@@ -99,7 +104,7 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
#include <stdlib.h>
#include <string.h>
-#if !HAVE_DECL_OPTRESET
+#if !HAVE_DECL_OPTRESET && !HAVE_DECL_GETOPT_CLIP
# define OPTIND_MIN 0
#else
# define OPTIND_MIN 1
--
1.6.6.1
- [PATCH 1/2] getopt: merge bug fixes from glibc, Eric Blake, 2010/04/10
- [PATCH 2/2] getopt: match recent glibc fixes and posix ruling, Eric Blake, 2010/04/10
- [PATCH 1/5] getopt-posix: avoid spurious failure on FreeBSD, Eric Blake, 2010/04/13
- [PATCH 2/5] getopt-posix: avoid spurious failure on Solaris,
Eric Blake <=
- [PATCH 0/5] sync getopt to glibc, Eric Blake, 2010/04/13
- [PATCH 3/5] getopt-posix: detect MacOS bug, Eric Blake, 2010/04/13
- [PATCH 5/5] getopt-gnu: match recent glibc fixes and posix ruling, Eric Blake, 2010/04/13
- [PATCH 4/5] getopt: merge bug fixes from glibc, Eric Blake, 2010/04/13