bug-gnulib
[Top][All Lists]
Advanced

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

Re: Gnulib needed in AC_CHECK_HEADERS


From: Bruno Haible
Subject: Re: Gnulib needed in AC_CHECK_HEADERS
Date: Wed, 26 Dec 2007 18:24:35 +0100
User-agent: KMail/1.5.4

Sylvain Beucler wrote:
> it seems alloca.h is not yet present at ./configure time
> (there's only gnulib/lib/alloca.in.h). So AC_CHECK_HEADERS fails
> anyway:
> 
> configure:14417: checking SDL.h usability
> configure:14434: i586-mingw32msvc-gcc -c -g -O2
> -I/usr/local/cross-tools/i386-mingw32/include/SDL -D_GNU_SOURCE=1 
> -Dmain=SDL_main 
> -I/usr/local/cross-tools/i386-mingw32/include/SDL -D_GNU_SOURCE=1 
> -Dmain=SDL_main
> -I../gnulib/lib -I./gnulib/lib conftest.c >&5
> In file included from 
> /usr/local/cross-tools/i386-mingw32/include/SDL/SDL_main.h:26,
>                  from 
> /usr/local/cross-tools/i386-mingw32/include/SDL/SDL.h:28,
>                  from conftest.c:117:
> /usr/local/cross-tools/i386-mingw32/include/SDL/SDL_stdinc.h:169:22: error: 
> alloca.h: No such
> file or directory

This should be fixable by using AH_VERBATIM instead of AC_DEFINE to define
HAVE_ALLOCA_H. As I understand it, AC_DEFINE makes the macro available
immediately, at configure time, whereas AH_VERBATIM makes it available only
after configuration, when config.h is created. See patch below (untested).

Paul Eggert wrote:
> Well, it _has_ been 3 years.  If the backward-compatibility gorp is
> causing real problems, perhaps it's time to bite the bullet and drop
> it, something like the following.  This won't affect coreutils or
> diffutils or tar or any modernish program.  What would it hurt?

The problems mentioned in the 2004 thread
  http://lists.gnu.org/archive/html/bug-gnulib/2004-04/threads.html#00021
have not gone away.
  - The autoconf manual still recommends to include <alloca.h> only if
    HAVE_ALLOCA_H.
  - fnmatch.c and regex.c are still included in gcc's libiberty. Its regex.c
    also includes <alloca.h> only if HAVE_ALLOCA_H.

So, if AH_VERBATIM solves Sylvain's problem, I would prefer to not disturb
all the sources which follow the advice in the autoconf manual.

Paul, what do you think?

Bruno



*** m4/alloca.m4.orig
--- m4/alloca.m4
***************
*** 1,4 ****
! # alloca.m4 serial 7
  dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # alloca.m4 serial 8
  dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 40,48 ****
    fi
    AC_SUBST([ALLOCA_H])
  
!   AC_DEFINE(HAVE_ALLOCA_H, 1,
!     [Define HAVE_ALLOCA_H for backward compatibility with older code
!      that includes <alloca.h> only if HAVE_ALLOCA_H is defined.])
  ])
  
  # Prerequisites of lib/alloca.c.
--- 40,55 ----
    fi
    AC_SUBST([ALLOCA_H])
  
!   dnl Use AH_VERBATIM here, not AC_DEFINE, so that the HAVE_ALLOCA_H
!   dnl is still undefined at configuration time. This is needed for
!   dnl AC_CHECK_HEADER tests that look for include files that use the idiom:
!   dnl #if HAVE_ALLOCA_H
!   dnl # include <alloca.h>
!   dbl #endif
!   AH_VERBATIM([gl_FUNC_ALLOCA], [
! /* Define HAVE_ALLOCA_H for backward compatibility with older code
!    that includes <alloca.h> only if HAVE_ALLOCA_H is defined.  */
! #define HAVE_ALLOCA_H 1])
  ])
  
  # Prerequisites of lib/alloca.c.




reply via email to

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