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: cpp related bug ?)


From: Akim Demaille
Subject: Re: present but cannot be compiled (Was: cpp related bug ?)
Date: Tue, 06 May 2003 17:43:44 +0200
User-agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3 (gnu/linux)

Thanks for the bug report!

Unfortunately, the problem comes from the package itself, not from
Autoconf.  The configure.ac script needs to be updated.  Please, send
all this message (which your output attached) to the bug list (or the
authors) of the package you were trying to configure.

Below two parts of the Autoconf documentation are included: 1. the
documentation of AC_CHECK_HEADER(S), and 2. what's to be done to
upgrade configure.ac.

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.

`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
          ])

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

`sys/socket.h'
     On Darwin, `stdlib.h' is a prerequisite.
Hi,
I guess, there is a bug in autoconf which results in an error wrt. cpp check:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
...
checking gdbm.h usability... yes
checking gdbm.h presence... no
configure: WARNING: gdbm.h: accepted by the compiler, rejected by the 
preprocessor!
configure: WARNING: gdbm.h: proceeding with the preprocessor's result
configure: WARNING:     ## ------------------------------------ ##
configure: WARNING:     ## Report this to address@hidden ##
configure: WARNING:     ## ------------------------------------ ##
checking for gdbm.h... no
...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

log says:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
configure:7350: checking gdbm.h usability
configure:7363: cc -c -I/home/elkner/tmp/build/root4build/usr/include  
conftest.c >&5
configure:7366: $? = 0
configure:7369: test -s conftest.o
configure:7372: $? = 0
configure:7382: result: yes
configure:7386: checking gdbm.h presence
configure:7397: cc -E  conftest.c
"configure", line 7405: cannot find include file: <gdbm.h>
cc: acomp failed for conftest.c
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

So include flags are used, when testing the compile result, but not
when testing the preprocessor :(


Environment details:
--------------------
Solaris 8
Sun Workshop 6
autoconf (GNU Autoconf) 2.57
automake (GNU automake) 1.7.4

Example Apache 2.0.45 (copy paste from the build script):
---------------------------------------------------------
        cd $TMPBUILD
        export LDFLAGS="-L${ROOT4BUILD}/usr/lib -lpthread"
        export CFLAGS="-I${ROOT4BUILD}/usr/include"
        # for the crazy apr-utl stuff - LDFLAGS are not propagated
        export LD_LIBRARY_PATH="${ROOT4BUILD}/usr/lib"

        # check http://httpd.apache.org/docs-2.0/mod/ for modules

        ./configure --prefix=$PROTO/opt/www \
        --with-z=${ROOT4BUILD}/usr \
        --with-ssl=${ROOT4BUILD}/opt/openssl \
        --with-mpm=worker \
        --enable-module=so \
        \
        --enable-access=shared \
        --enable-actions=shared \
        --enable-alias=shared \
        --enable-asis=shared \
        --enable-auth=shared \
        --enable-auth_anon=shared \
        --enable-auth_dbm=shared \
        --enable-auth_digest=shared \
        --enable-autoindex=shared \
        --enable-cache=shared \
        --enable-cern_meta=shared \
        --enable-cgi=shared \
        --enable-cgid=shared \
        --enable-dav=shared \
        --enable-deflate=shared \
        --enable-dir=shared \
        --enable-disk_cache=shared \
        --enable-echo=shared \
        --enable-env=shared \
        --enable-expires=shared \
        --enable-file_cache=shared \
        --enable-headers=shared \
        --enable-imap=shared \
        --enable-include=shared \
        --enable-info=shared \
        --enable-log_config=shared \
        --enable-mem_cache=shared \
        --enable-mime=shared \
        --enable-mime_magic=shared \
        --enable-negotiation=shared \
        \
        --enable-rewrite=shared \
        --enable-setenvif=shared \
        --enable-ssl=shared \
        --enable-status=shared \
        --enable-userdir=shared \
        --enable-usertrack=shared \
        --enable-vhost_alias=shared \
        --enable-proxy=shared \
        \
        --disable-ldap \
        --disable-charset_lite \
        --disable-example \
        --disable-ext_filter \
        --disable-unique-id \
        --disable-spelling \

        # fix libtool to accept $ORIGIN/ (avail. via patches)
        cp ${SCRIPTDIR}/libtool ${TMPBUILD}/srclib/apr/
        cp ${SCRIPTDIR}/libtool ${TMPBUILD}/srclib/apr-util/xml/expat/
        cp ${SCRIPTDIR}/libtool ${TMPBUILD}/shlibtool

        echo "make log goes to $MAKELOG"
        make >$MAKELOG

the gdbm stuff is in $ROOT4BUILD/usr:
-------------------------------------
/home/elkner/tmp/build/root4build/usr/:
total 8
drwxr-xr-x   4 elkner   ivs          512 May  6 03:18 .
drwxr-xr-x   4 elkner   ivs          512 May  6 03:18 ..
drwxr-xr-x   2 elkner   ivs          512 May  6 03:18 include
drwxr-xr-x   2 elkner   ivs          512 May  6 03:18 lib

/home/elkner/tmp/build/root4build/usr/include:
total 110
drwxr-xr-x   2 elkner   ivs          512 May  6 03:18 .
drwxr-xr-x   4 elkner   ivs          512 May  6 03:18 ..
-rw-r--r--   1 elkner   ivs         4744 May  6 03:18 gdbm.h

/home/elkner/tmp/build/root4build/usr/lib:
total 542
drwxr-xr-x   2 elkner   ivs          512 May  6 03:18 .
drwxr-xr-x   4 elkner   ivs          512 May  6 03:18 ..
-rw-r--r--   1 elkner   ivs        99708 May  6 03:18 libgdbm.a
lrwxrwxrwx   1 elkner   ivs           12 May  6 03:18 libgdbm.so -> 
libgdbm.so.2lrwxrwxrwx   1 elkner   ivs           14 May  6 03:18 libgdbm.so.2 
-> libgdbm.so.2.0
lrwxrwxrwx   1 elkner   ivs           16 May  6 03:18 libgdbm.so.2.0 -> 
libgdbm.so.2.0.0
-rw-r--r--   1 elkner   ivs        74440 May  6 03:18 libgdbm.so.2.0.0


I hope, this is enough (and not considered to be spam ;-))
to reproduce the bug.


Rgeards,
jens.




reply via email to

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