bug-gnulib
[Top][All Lists]
Advanced

[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 16:24:14 -0400
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Derek Price wrote:

>>>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.
>  
>

I've attached almost the same patch as before, except that I remembered
to put `$' in front of all my variables this time.  Matthias confirmed
that ithis new patch does the right thing on Solaris 10.

This patch is against Paul's last commit.

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 20:20:00 -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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]