[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] Re: getopt and Solaris 10
From: |
Derek Price |
Subject: |
Re: [bug-gnulib] Re: getopt and Solaris 10 |
Date: |
Mon, 09 May 2005 11:06:07 -0400 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Matthias Kurz wrote:
>On Thu, May 05, 2005, Paul Eggert wrote:
>
>
>
>>Derek Price <address@hidden> writes:
>>
>>
>>
>>>I prefer door #2. Trivial patch attached:
>>>
>>>
>>Thanks, but I'd rather use AC_CHECK_DECL, so I installed this instead,
>>into both coreutils and gnulib. Does it work?
>>
>>2005-05-05 Paul Eggert <address@hidden>
>>
>> * lib/getopt.m4 (gl_GETOPT): Check for Solaris 10 getopt, and
>> avoid needless checks.
>>
>>
>
>Yes, this also works for me.
>
>
Okay, one more revision, to actually check if the -+ registers as an
option or not. This fits the autoconf paradigm of testing for the bug,
even if it is using AC_TRY_RUN. This way, if Sun fixes the problem in a
later Solaris release, we shouldn't need to change anything.
When cross-compiling, I fall back on looking for the odd Solaris decl to
decide whether to use the GNULIB version of getopt or not. If we wanted
to be really pessimistic, we could always use the GNULIB getopt when
cross-compiling, but I thought this could wait at least until we get a
report of similar behavior from some system other than Solaris 10.
Matthias, would you mind testing this version out? If you could send me
your config.log when you are done building, that would be helpful as well.
2005-05-09 Derek Price <address@hidden>
* m4/getopt.m4: Check for Solaris 10 bug, not decl, when possible.
Cheers,
Derek
Index: m4/getopt.m4
===================================================================
RCS file: /cvs/ccvs/m4/getopt.m4,v
retrieving revision 1.7
diff -u -p -r1.7 getopt.m4
--- m4/getopt.m4 6 May 2005 15:50:05 -0000 1.7
+++ m4/getopt.m4 9 May 2005 14:47:15 -0000
@@ -36,11 +36,26 @@ AC_DEFUN([gl_GETOPT],
AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
fi
- dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
- dnl option string (as of 2005-05-05).
if test -z "$GETOPT_H"; then
- AC_CHECK_DECL([getopt_clip], [GETOPT_H=getopt.h], [],
- [#include <getopt.h>])
+ AC_CACHE_CHECK([for working GNU getopt function], gl_cv_func_gnu_getopt,
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM([#include <getopt.h>],[
+ char *myargv[[2]];
+ myargv[[0]] = "conftest";
+ myargv[[1]] = "-+";
+ return '?' != getopt (2, myargv, "+a");
+ ])],
+ gl_cv_func_gnu_getopt=yes,
+ gl_cv_func_gnu_getopt=no,
+ [dnl cross compiling - pessimistically guess based on decls
+ dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
+ dnl option string (as of 2005-05-05).
+ AC_CHECK_DECL([getopt_clip],
+ [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes],
+ [#include <getopt.h>])])])
+ if test gl_cv_func_gnu_getopt = "no"; then
+ GETOPT_H=getopt.h
+ fi
fi
if test -n "$GETOPT_H"; then
- [bug-gnulib] getopt and Solaris 10, Derek Price, 2005/05/05
- Re: [bug-gnulib] getopt and Solaris 10, James Youngman, 2005/05/05
- [bug-gnulib] Re: getopt and Solaris 10, Derek Price, 2005/05/05
- Re: [bug-gnulib] Re: getopt and Solaris 10, Derek Price, 2005/05/05
- Re: [bug-gnulib] Re: getopt and Solaris 10, Paul Eggert, 2005/05/05
- Re: [bug-gnulib] Re: getopt and Solaris 10, Matthias Kurz, 2005/05/07
- Re: [bug-gnulib] Re: getopt and Solaris 10,
Derek Price <=
- Re: [bug-gnulib] Re: getopt and Solaris 10, Derek Price, 2005/05/09
- Re: [bug-gnulib] Re: getopt and Solaris 10, Paul Eggert, 2005/05/09
- Re: [bug-gnulib] Re: getopt and Solaris 10, Matthias Kurz, 2005/05/10
- Re: [bug-gnulib] Re: getopt and Solaris 10, Matthias Kurz, 2005/05/10
- Re: [bug-gnulib] Re: getopt and Solaris 10, Derek Price, 2005/05/10
- Re: [bug-gnulib] Re: getopt and Solaris 10, Derek Price, 2005/05/10
- Re: [bug-gnulib] Re: getopt and Solaris 10, Derek Price, 2005/05/10
- Re: [bug-gnulib] Re: getopt and Solaris 10, Larry Jones, 2005/05/10
- Re: [bug-gnulib] Re: getopt and Solaris 10, Paul Eggert, 2005/05/10
- Re: [bug-gnulib] Re: getopt and Solaris 10, Derek Price, 2005/05/10