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

Michael Piotrowski mxp@dynalabs.de
Sat, 02 Feb 2002 21:47:56 +0100


Morten Sickel <Morten.Sickel@nrpa.no> writes:

> I tried to compile the sane 1.0.7 backends on an HP 712 running
> HP-UX 10.02 using gcc 2.95.2 and gnu make. configure runs fine, and
> then compile ends with:

[...]

> isfdtype.c: In function `isfdtype':
> isfdtype.c:10: storage size of `st' isn't known
> isfdtype.c:12: warning: implicit declaration of function `fstat'

[...]

> I got 1.0.6 up and running without any problems...

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

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:

   #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

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.

Greetings

-- 
Michael Piotrowski, M.A.                                  <mxp@dynalabs.de>