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

Henning Meier-Geinitz henning@meier-geinitz.de
Sun, 3 Jul 2005 15:10:41 +0200


Hi,

On Thu, Jun 30, 2005 at 12:12:30AM +0200, Franz Bakan wrote:
> Due to a linker problem on OS/2 I get 
> 
>   .../ld.exe: symbol `_optarg' defined more than once in \ 
>  G:/Dev/gcc/335b5/usr/lib/libc_dll.a(IMPORT#45#426bf)
> 
> when compiling SANE with gcc 3.3.5.
> 
> The gcc 3.3.5 guy tells me:
> 
>   "You should probably not be compiling getopt.c, libc have a working
>    getopt already...."
> 
> I assumed this also, so my question: Is this true and when yes,
> what's the trigger for switching off the compilation the getopt.c functions
> that come with SANE?

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.

Bye,
  Henning