Re: Autoconf and differences between GNU getopt and OpenBSD getopt

Derek Robert Price <[email protected]> Thu, 14 Oct 2004 21:15:34 -0400
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.version-control.cvs.bugs
Organization Ximbiot <http://ximbiot.com>
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Taler wrote:

>>>>>>"Paul" == Paul Eggert <[email protected]> writes:
>
>  Paul> Date: Sun, 10 Oct 2004 21:16:05 -0700
>
>  Paul> Alexander Taler <[email protected]> writes:
>
>  >> Since this behaviour has shipped in OpenBSD 3.5, I guess adding
a test to
>  >> autoconf is the correct thing to do.
>
>  Paul> I'm a little puzzled here, since you emailed your suggestion to
>  Paul> bug-gnulib.  My impression is that gnulib's gl_GETOPT macro
will detect
>  Paul> incompatibilities in the OpenBSD 3.5 implementation, and will
refuse to
>  Paul> use it, so you shouldn't have this problem if you use the
gnulib getopt
>  Paul> module.  This was fixed in gnulib on August 12.  If I'm wrong
please
>  Paul> let bug-gnulib know more details about the problem.
>
>Great!  I guess all that needs to be done is bring the latest
>changes over to CVS.  I guess Derek will take care of that.


Correct me if I'm wrong, Alex, but I think you said you were using the
development version of CVS.  I imported the latest getopt module from
GNULIB on October 6th, which, IIRC, is exactly when you began
encountering problems.  Anyhow, whatever issue you are having should
be with GNULIB.

Glancing at the latest gl_GETOPT test, it appears to be only using the
existance of the getopt.h header file to decide whether to use the
substitute getopt() function or not:

AC_DEFUN([gl_GETOPT],
[
  gl_PREREQ_GETOPT
                                                                            
 

  GETOPT_H=
  AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
  AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
                                                                            
 

  if test -n "$GETOPT_H"; then
     gl_GETOPT_SUBSTITUTE
  fi
])


So, it does make sense that, if Alex's version of BSD comes packaged
with a getopt.h header but an incompatible getopt() function, then the
latest gl_GETOPT would incorrectly choose to use the system getopt()
function rather than the GNULIB substitute.

Something like Alex's test program should probably be added to
gl_GETOPT, unless someone can suggest a better way to detect or work
around the problem.

Cheers,

Derek

- --
                *8^)

Email: [email protected]

Get CVS support at <http://ximbiot.com>!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBbyS1LD1OTBfyMaQRAvptAJ9AHzH1QYlCNvxfsZaz2UYJ1zdzLACgxeiz
kCincw64TUgJqVTTc/qfInI=
=cZ+1
-----END PGP SIGNATURE-----