[sane-devel] Re: Problem compiling 1.0.7 on HPUX 10.20

Henning Meier-Geinitz henning@meier-geinitz.de
Sun, 3 Feb 2002 11:20:01 +0100


Hi,

On Sat, Feb 02, 2002 at 09:47:56PM +0100, Michael Piotrowski wrote:
> I just compiled 1.0.7beta2 on HP-UX 10.20; if you're using the HP C
> compiler, the flags described in README.hpux are still correct:
> 
>    CC=cc CFLAGS="-Ae -O" ./configure

Thanks. So I will add this to the list of supported platforms for 1.0.7.

> However, if you're using gcc, you now have to specify -D_HPUX_SOURCE
> (to get the definition of struct stat), e.g.:
> 
>    CC=gcc CFLAGS="-D_HPUX_SOURCE -O" ./configure
> 
> This is necessary, because (in contrast to earlier versions) gcc is
> now called with the -ansi option, which undefines the symbols which
> control the inclusion of "beyond-C89" definitions.
> 
> I couldn't find where this is happening, but since config.h already
> contains:

That's what I mentioned in my previous mail: All the releases are
compiled with "--disable-warnings" while the CVS and beta versions are
compiled with "--enable-warnings" by default. So the "-ansi" can be
found in the configure.in file.

Can you try make distclean and ./configure --disable-warnings or
better, try my latest snapshot at
http://www.meier-geinitz.de/sane/tmp/sane-backends-1.0.7-cvs.tar.gz 

This one has the warnings already disabled.

>    #if defined (__sun) && defined (__GNUC__)
>    # define _POSIX_SOURCE
>    # define __EXTENSIONS__
>    #endif
> 
> I would suggest adding something like:
> 
>    #if defined (__hpux) && defined (__GNUC__)
>    # define _HPUX_SOURCE
>    #endif

Or we just disable -ansi for HPUX in configure. I'll think about it
for CVS.

> Unfortunately, at least in umax_pp_low.c, sys/time.h is included
> before sane/config.h, which results in another problem (struct timeval
> isn't defined), so maybe adding -D_HPUX_SOURCE to the compiler options
> when gcc is used is safer and easier.

That's a bug in umax_pp_low. This will be fixed after the
release because with "--disable-warnings" compilation should work.
I don't want to introduce new #include order bugs that short before
release.

Thanks for testing.

Bye,
  Henning