configure: WARNING: sys/sysinfo.h: present but cannot be compiled

Tim Van Holder tim.vanholder at
Mon Oct 29 08:57:33 CET 2007

John David Anglin wrote:
>>From config.status:
> GNU MP config.status 4.2.2
> configured by ../configure, generated by GNU Autoconf 2.59,
>   with options \"'--prefix=/opt/gnu/gcc/gcc-4.2.3' '--disable-shared' '--build=h
>   ppa1.1-hp-hpux11.11' '--host=hppa1.1-hp-hpux11.11' '--target=hppa1.1-hp-hpux11.1
>   1' 'CC=gcc' 'CFLAGS=-O2' 'CXXFLAGS=-O2' 'CXX=g++' 'LDFLAGS=-s' 'build_alias=hppa
>   1.1-hp-hpux11.11' 'host_alias=hppa1.1-hp-hpux11.11' 'target_alias=hppa1.1-hp-hpu
>   x11.11'\"
> configure output:
> ...
> checking sys/sysinfo.h usability... no
> checking sys/sysinfo.h presence... yes
> configure: WARNING: sys/sysinfo.h: present but cannot be compiled
> configure: WARNING: sys/sysinfo.h:     check for missing prerequisite headers?
> configure: WARNING: sys/sysinfo.h: see the Autoconf documentation
> configure: WARNING: sys/sysinfo.h:     section "Present But Cannot Be Compiled"
> configure: WARNING: sys/sysinfo.h: proceeding with the preprocessor's result
> configure: WARNING: sys/sysinfo.h: in the future, the compiler will take precedence
> configure: WARNING:     ## -------------------------------- ##
> configure: WARNING:     ## Report this to gmp-bugs at ##
> configure: WARNING:     ## -------------------------------- ##
> checking for sys/sysinfo.h... yes
> ...
> This fails with gcc 4.0.0 and later because
> configure:24719: gcc -c -O2  conftest.c >&5
> In file included from conftest.c:71:
> /usr/include/sys/sysinfo.h:180: error: array type has incomplete element type
> configure:24725: $? = 1
> This is line 180:
> extern struct syswait syswait[];
> Relevant gcc threads:
> I'm not what if anything gmp can do about this.  Generating GCC include
> fixes would appear to be a major pain.  Besides this one, there seem to
> be quite a few other similar occurences in HP-UX 11 headers, particularly
> those relevent to the kernel.

It's not a GCC issue - the linked threads are not really relevant.
The problem is that of system headers depending on others but not
#including them. For configure script writers, that means they have to
check for those headers before checking for headers that require them.
In this case, configure should be adapted to check for sys/sar.h before
sys/sysinfo.h (it declares struct syswait) and #include it for the
tests, as the referenced Autoconf manual topic explains.

More information about the gmp-bugs mailing list