[sane-devel] sane-backends/lib/getopt.c compiling on OS/2

Franz Bakan Franz Bakan" <fbakan@gmx.net
Wed, 06 Jul 2005 23:55:15 +0200 (CEST)


On Wed, 06 Jul 2005 12:31:11 +0200, Mattias Ellert wrote:

>On Sun, 2005-07-03 at 15:10 +0200, Henning Meier-Geinitz wrote:
>
>> getopt.c is compiled and linked unconditionally on all platforms as
>> far as I can see. As this works on all the other platforms there must
>> be something different on OS/2.
>> 
>> You could try to move getopt and getopt_long to AC_REPLACE_FUNCS in
>> configure.in and modify lib/Makefile.in accordingly. But I haven't
>> checked all the implications of that. Maybe linking the getopt code
>> was done intentionally.
>
>You shouldn't have to do this. If the compiler finds that the glibc has
>the right getopt version all the code in getopt.c is removed by the
>#ifndef ELIDE_CODE conditional and it creates an empty getopt.o.

But the compiler I have available isn't smart enough to decide...
I'm quite shure that the getopt-code included in libc that comes
with the gcc335b5-compiler is good enough for SANE.

What's the trigger for the compiler to decide?

in sane-backends/lib/getopt.c getWe have:

...
#define GETOPT_INTERFACE_VERSION 2
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
# include <gnu-versions.h>
# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#  define ELIDE_CODE
# endif
#endif

#ifndef ELIDE_CODE
...


but _GNU_GETOPT_INTERFACE_VERSION isn't defined in
the headers that come with my compiler.
Should it? and when yes where?

Franz