autoconf
[Top][All Lists]
Advanced

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

Excess quoting required in AC_CHECK_TYPES in autoconf 2.53


From: Jonathan Lennox
Subject: Excess quoting required in AC_CHECK_TYPES in autoconf 2.53
Date: Wed, 31 Jul 2002 14:17:25 -0400

There seems to be a quoting bug in AC_CHECK_TYPES in autoconf 2.53 when
checking types that have commas in them (i.e., C++ template types).

I would expect that the following would determine whether these two C++
template types could be found:

AC_CHECK_TYPES([[std::hash_map<int,int>], [__gnu_cxx::hash_map<int,int>]])

but this doesn't work.  The generated configure script checks for the
existence of the type 'std::hash_map<int', then errors out reporting a
syntax error with the expression 'int>'.

Instead, I have to pass an additional set of quotes to the command:

AC_CHECK_TYPES([[[std::hash_map<int,int>]], [[__gnu_cxx::hash_map<int,int>]]])

This doesn't seem correct to me; I don't think this should be necessary, and
it's certainly non-obvious.

It looks like what's happening in the failing case is that
_AC_CHECK_TYPE_NEW is getting called as
   _AC_CHECK_TYPE_NEW(std::hash_map<int,int>, {other arguments})
i.e., the first argument isn't quoted properly, so the second half of the
type is interpreted as the if-true argument, and inserted into the configure
script as shell code.  All the subsequent arguments are then shifted down by
one.

I don't know enough m4 quoting magic to know what the proper fix for
types.m4 would be, unfortunately.

The attached (working) configure.ac file includes the workaround, and checks
for the header file and name of the G++ STL extension 'hash_map' for G++
2.95, 3.0, and 3.1. It uses the doubled-quoting trick -- removing the extra
brackets reveals the bug.

I'm using autoconf 2.53 on FreeBSD 4.6-RELEASE, installed using the FreeBSD
package.

AC_INIT(foo, 1.0)

AC_CONFIG_HEADERS([config.h])

AC_LANG([C++])

AC_PROG_CXX

AC_CHECK_HEADERS(hash_map ext/hash_map)

AC_CHECK_TYPES([[[std::hash_map<int,int>]], [[__gnu_cxx::hash_map<int,int>]]], 
, ,
[#ifdef HAVE_HASH_MAP
#include <hash_map>
#endif
#ifdef HAVE_EXT_HASH_MAP
#include <ext/hash_map>
#endif
])

AC_OUTPUT
-- 
Jonathan Lennox
address@hidden

reply via email to

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