Re: Re: getopt and Solaris 10
Derek Price <[email protected]> Mon, 09 May 2005 11:06:07 -0400
| Newsgroups | gmane.comp.lib.gnulib.bugs,gmane.comp.version-control.cvs.bugs,gmane.comp.gnu.core-utils.bugs |
|---|---|
| Organization | Get CVS Support from Ximbiot <http://ximbiot.com>! |
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --------------040907090109080809030606 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Matthias Kurz wrote: >On Thu, May 05, 2005, Paul Eggert wrote: > > > >>Derek Price <[email protected]> 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 <[email protected]> >> >> * 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 <[email protected]> * m4/getopt.m4: Check for Solaris 10 bug, not decl, when possible. Cheers, Derek --------------040907090109080809030606 Content-Type: text/plain; name="getopt-solaris.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="getopt-solaris.diff" 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 --------------040907090109080809030606 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ bug-gnulib mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-gnulib --------------040907090109080809030606--