- dnl BSD getopt_long uses an incompatible method to reset option processing,
- dnl but the testsuite does not show a need to use this 'optreset' variable.
- if false && test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
- AC_CHECK_DECL([optreset], [gl_replace_getopt=yes], [],
- [#include <getopt.h>])
+ dnl BSD getopt_long uses an incompatible method to reset option processing.
+ 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([getopt_clip], [], [],
+ [[#include <getopt.h>]])
+ ],
+ [[#include <getopt.h>]])