bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: present but cannot be compiled (Was: bugreport)


From: Akim Demaille
Subject: Re: present but cannot be compiled (Was: bugreport)
Date: Fri, 20 Jun 2003 09:20:10 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Thanks for the bug report!

Contrary to the message reported by ./configure, this is not a bug in
Autoconf, but the result of a recent incompatible change in Autoconf
that is likely to require the package's configure.ac to be updated.
Please, first make sure you are trying the most recent version of that
package, then, if you are, send all this message (including your
output attached) to the bug list (or the authors) of the package you
were trying to configure.

I've appended two relevant parts of the Autoconf documentation: 1. the
documentation of AC_CHECK_HEADER(S), and 2. how configure.ac should be
upgraded.

If you have some knowledge in C compilation, then there is something
more you can do to help: find out what are the prerequisite headers on
your system.

For instance, if the error message is:

       sys/socket.h: present but cannot be compiled
       sys/socket.h: check for missing prerequisite headers?
       sys/socket.h: proceeding with the preprocessor's result

then try to compile the program sample.c:

       #include <sys/socket.h>

with `cc -c sample.c'.  It will fail.  Then try to understand what
other headers are needed.  For instance, on Darwin, one needs:

       #include <stdio.h>
       #include <stdlib.h>
       #include <sys/socket.h>

to get a successful compilation.  Then, send this additional
information to the package maintainers, together with a description of
your machine.

Thanks!

----------------------------------------------------------------------

Generic Header Checks
---------------------

   These macros are used to find system header files not covered by the
"particular" test macros.  If you need to check the contents of a header
as well as find out whether it is present, you have to write your own
test for it (*note Writing Tests::).

 - Macro: AC_CHECK_HEADER (HEADER-FILE, [ACTION-IF-FOUND],
          [ACTION-IF-NOT-FOUND], [INCLUDES = `default-includes'])
     If the system header file HEADER-FILE is compilable, execute shell
     commands ACTION-IF-FOUND, otherwise execute ACTION-IF-NOT-FOUND.
     If you just want to define a symbol if the header file is
     available, consider using `AC_CHECK_HEADERS' instead.

     For compatibility issues with older versions of Autoconf, please
     read below.

 - Macro: AC_CHECK_HEADERS (HEADER-FILE..., [ACTION-IF-FOUND],
          [ACTION-IF-NOT-FOUND], [INCLUDES = `default-includes'])
     For each given system header file HEADER-FILE in the
     whitespace-separated argument list that exists, define
     `HAVE_HEADER-FILE' (in all capitals).  If ACTION-IF-FOUND is
     given, it is additional shell code to execute when one of the
     header files is found.  You can give it a value of `break' to
     break out of the loop on the first match.  If ACTION-IF-NOT-FOUND
     is given, it is executed when one of the header files is not found.

     For compatibility issues with older versions of Autoconf, please
     read below.

   Previous versions of Autoconf merely checked whether the header was
accepted by the preprocessor.  This was changed because the old test was
inappropriate for typical uses.  Headers are typically used to compile,
not merely to preprocess, and the old behavior sometimes accepted
headers that clashed at compile-time.  If you need to check whether a
header is preprocessable, you can use `AC_PREPROC_IFELSE' (*note
Running the Preprocessor::).

   This scheme, which improves the robustness of the test, also requires
that you make sure that headers that must be included before the
HEADER-FILE be part of the INCLUDES, (*note Default Includes::).  If
looking for `bar.h', which requires that `foo.h' be included before if
it exists, we suggest the following scheme:


AC_CHECK_HEADERS([foo.h])
AC_CHECK_HEADERS([bar.h], [], [],
[#if HAVE_FOO_H
# include <foo.h>
# endif
])

----------------------------------------------------------------------

Header Present But Cannot Be Compiled
=====================================

   The most important guideline to bear in mind when checking for
features is to mimic as much as possible the intended use.
Unfortunately, old versions of `AC_CHECK_HEADER' and `AC_CHECK_HEADERS'
failed to follow this idea, and called the preprocessor, instead of the
compiler, to check for headers.  As a result, incompatibilities between
headers went unnoticed during configuration, and maintainers finally
had to deal with this issue elsewhere.

   As of Autoconf 2.56 both checks are performed, and `configure'
complains loudly if the compiler and the preprocessor do not agree.
For the time being the result used is that of the preprocessor, to give
maintainers time to adjust their `configure.ac', but in the near
future, only the compiler will be considered.

   Consider the following example:

     $ cat number.h
     typedef int number;
     $ cat pi.h
     const number pi = 3;
     $ cat configure.ac
     AC_INIT
     AC_CHECK_HEADERS(pi.h)
     $ autoconf -Wall
     $ ./configure
     checking for gcc... gcc
     checking for C compiler default output... a.out
     checking whether the C compiler works... yes
     checking whether we are cross compiling... no
     checking for suffix of executables...
     checking for suffix of object files... o
     checking whether we are using the GNU C compiler... yes
     checking whether gcc accepts -g... yes
     checking for gcc option to accept ANSI C... none needed
     checking how to run the C preprocessor... gcc -E
     checking for egrep... grep -E
     checking for ANSI C header files... yes
     checking for sys/types.h... yes
     checking for sys/stat.h... yes
     checking for stdlib.h... yes
     checking for string.h... yes
     checking for memory.h... yes
     checking for strings.h... yes
     checking for inttypes.h... yes
     checking for stdint.h... yes
     checking for unistd.h... yes
     checking pi.h usability... no
     checking pi.h presence... yes
     configure: WARNING: pi.h: present but cannot be compiled
     configure: WARNING: pi.h: check for missing prerequisite headers?
     configure: WARNING: pi.h: proceeding with the preprocessor's result
     configure: WARNING:     ## ------------------------------------ ##
     configure: WARNING:     ## Report this to address@hidden ##
     configure: WARNING:     ## ------------------------------------ ##
     checking for pi.h... yes

The proper way the handle this case is using the fourth argument (*note
Generic Headers::):

     $ cat configure.ac
     AC_INIT
     AC_CHECK_HEADERS(number.h pi.h,,,
     [[#if HAVE_NUMBER_H
     # include <number.h>
     #endif
     ]])
     $ autoconf -Wall
     $ ./configure
     checking for gcc... gcc
     checking for C compiler default output... a.out
     checking whether the C compiler works... yes
     checking whether we are cross compiling... no
     checking for suffix of executables...
     checking for suffix of object files... o
     checking whether we are using the GNU C compiler... yes
     checking whether gcc accepts -g... yes
     checking for gcc option to accept ANSI C... none needed
     checking for number.h... yes
     checking for pi.h... yes

   See *Note Particular Headers::, for a list of headers with their
prerequisite.

----------------------------------------------------------------------

Portability of Headers
----------------------

This section tries to collect knowledge about common headers, and the
problems they cause.  By definition, this list will always require
additions.  Please help us keeping it as complete as possible.

`inttypes.h' vs. `stdint.h'
     Paul Eggert notes that: ISO C 1999 says that `inttypes.h' includes
     `stdint.h', so there's no need to include `stdint.h' separately in
     a standard environment.  Many implementations have `inttypes.h'
     but not `stdint.h' (e.g., Solaris 7), but I don't know of any
     implementation that has `stdint.h' but not `inttypes.h'.  Nor do I
     know of any free software that includes `stdint.h'; `stdint.h'
     seems to be a creation of the committee.

`linux/irda.h'
     It requires `linux/types.h' and `sys/socket.h'.

`net/if.h'
     On Darwin, this file requires that `sys/socket.h' be included
     beforehand.  One should run:

          AC_CHECK_HEADERS([sys/socket.h])
          AC_CHECK_HEADERS([net/if.h], [], [],
          [#include <stdio.h>
          #if STDC_HEADERS
          # include <stdlib.h>
          # include <stddef.h>
          #else
          # if HAVE_STDLIB_H
          #  include <stdlib.h>
          # endif
          #endif
          #if HAVE_SYS_SOCKET_H
          # include <sys/socket.h>
          #endif
          ])

`stdint.h'
     See above, item `inttypes.h' vs. `stdint.h'.

`stdlib.h'
     On many systems (e.g., Darwin), `stdio.h' is a prerequisite.

`sys/socket.h'
     On Darwin, `stdlib.h' is a prerequisite.

`sys/ucred.h'
     On HP Tru64 5.1, `sys/types.h' is a prerequisite.

`X11/extensions/scrnsaver.h'
     Using XFree86, this header requires `X11/Xlib.h', which is probably
     so required that you might not even consider looking for it.

          AC_CHECK_HEADERS([X11/extensions/scrnsaver.h], [], [],
          [[#include <X11/Xlib.h>
          ]])

----------------------------------------------------------------------
Warning on configure proftpd1.2.8  (compiled and worked well)

configure: WARNING: sys/mount.h: present but cannot be compiled
configure: WARNING: sys/mount.h: check for missing prerequisite headers?
configure: WARNING: sys/mount.h: proceeding with the preprocessor's
result
configure: WARNING:     ## ------------------------------------ ##
configure: WARNING:     ## Report this to address@hidden ##
configure: WARNING:     ## ------------------------------------ ##

# dmesg
OpenBSD 3.3 (GENERIC) #44: Sat Mar 29 13:22:05 MST 2003
    address@hidden:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Pentium 4 ("GenuineIntel" 686-class) 2.40 GHz
cpu0:
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SYS,MTRR,PGE,MCA,CMOV,PAT,PSE36,
MMX,FXSR,SIMD,3DNOW
real mem  = 1071493120 (1046380K)
avail mem = 988725248 (965552K)
using 4278 buffers containing 53678080 bytes (52420K) of memory
mainbus0 (root)
bios0 at mainbus0: AT/286+(00) BIOS, date 11/15/02, BIOS32 rev. 0 @
0xf0010
pcibios0 at bios0: rev. 2.1 @ 0xf0000/0x10000
pcibios0: PCI IRQ Routing Table rev. 1.0 @ 0xf4630/208 (11 entries)
pcibios0: PCI Interrupt Router at 000:31:0 ("Intel 82371FB PCI-ISA" rev
0x00)
pcibios0: PCI bus #1 is the last bus
bios0: ROM list: 0xc0000/0xb200!
pci0 at mainbus0 bus 0: configuration mode 1 (no bios)
pchb0 at pci0 dev 0 function 0 "Intel 82845G/GL" rev 0x03
vga1 at pci0 dev 2 function 0 "Intel 82845G/GL Video" rev 0x03: aperture
at 0xf0000000, size 0x8000000
wsdisplay0 at vga1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
uhci0 at pci0 dev 29 function 0 "Intel 82801DB USB" rev 0x02: irq 11
usb0 at uhci0: USB revision 1.0
uhub0 at usb0
uhub0: vendor 0x0000 UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhci1 at pci0 dev 29 function 1 "Intel 82801DB USB" rev 0x02: irq 5
usb1 at uhci1: USB revision 1.0
uhub1 at usb1
uhub1: vendor 0x0000 UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
uhci2 at pci0 dev 29 function 2 "Intel 82801DB USB" rev 0x02: irq 9
usb2 at uhci2: USB revision 1.0
uhub2 at usb2
uhub2: vendor 0x0000 UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub2: 2 ports with 2 removable, self powered
"Intel 82801DB USB" rev 0x02 at pci0 dev 29 function 7 not configured
ppb0 at pci0 dev 30 function 0 "Intel 82801BA AGP" rev 0x82
pci1 at ppb0 bus 1
fxp0 at pci1 dev 8 function 0 "Intel PRO/100 VE" rev 0x82: irq 11,
address 00:07:e9:8f:0a:3e
inphy0 at fxp0 phy 1: i82562ET 10/100 media interface, rev. 0
pcib0 at pci0 dev 31 function 0 "Intel 82801DB LPC" rev 0x02
pciide0 at pci0 dev 31 function 1 "Intel 82801DB IDE" rev 0x02: DMA,
channel 0 configured to compatibility, channel 1 configured to
compatibility
wd0 at pciide0 channel 0 drive 0: <Maxtor 6Y120L0>
wd0: 16-sector PIO, LBA, 117246MB, 16383 cyl, 16 head, 63 sec, 240121728
sectors
wd1 at pciide0 channel 0 drive 1: <Maxtor 6Y120L0>
wd1: 16-sector PIO, LBA, 117246MB, 16383 cyl, 16 head, 63 sec, 240121728
sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
wd1(pciide0:0:1): using PIO mode 4, Ultra-DMA mode 5
atapiscsi0 at pciide0 channel 1 drive 1
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: <ASUS, CD-S520/A, 2.0K> SCSI0 5/cdrom
removable
cd0(pciide0:1:1): using PIO mode 4, Ultra-DMA mode 2
"Intel 82801DB SMB" rev 0x02 at pci0 dev 31 function 3 not configured
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: <PC speaker>
sysbeep0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
npx0 at isa0 port 0xf0/16: using exception 16
pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
biomask ca60 netmask ca60 ttymask cae2
pctr: user-level cycle counter enabled
dkcsum: wd0 matched BIOS disk 80
dkcsum: wd1 matched BIOS disk 81
root on wd0a
rootdev=0x0 rrootdev=0x300 rawdev=0x302







reply via email to

[Prev in Thread] Current Thread [Next in Thread]