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

Michael Piotrowski mxp@dynalabs.de
Sun, 03 Feb 2002 13:15:32 +0100


Henning Meier-Geinitz <henning@meier-geinitz.de> writes:

> 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.

Yup, and the frontends compile and work fine with cc, too.

>> 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.

Hmm, must have overlooked it.

> 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.

Yes, I noticed that--but see my followup to you "Supported platforms"
post: It works fine with cc, but something breaks when compiled with gcc.

>>    #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.

Or that.  It might be good to do it consistenly, because I think you
have the same problem with gcc -ansi on other platforms, too.

>> 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.

Sure.

> Thanks for testing.

You're welcome ;-) Thanks for developing!

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