On 05/16/2010 03:43 PM, Bruno Haible wrote: > Can someone explain why the argument of AS_TR_SH apparently needs to be > double-quoted? The autoconf doc does not mention this. (I experimentally > determine the number of needed quotations by adding too many [[[]]] here > and there, look at the generated configure file for input like > gl_ABSOLUTE_HEADER_ONE([unistr.h]) > gl_ABSOLUTE_HEADER([foobar.h baz.h]) > and remove the quotation levels one by one, until the generated code is fine. > This means, if I were to remove one more level of quotation, I would enable > some unwanted m4 evaluations, right?)
Which version of autoconf are you using? But yes, anything where you don't want extra m4 evaluations should be double-quoted. Using AS_TR_SH([$1]) is just fine if you know that $1 will not contain any macro names, but if you want the transliteration to be used as a literal string, then AS_TR_SH([[$1]]) is the correct approach. This behavior mirrors how m4_translit behaves. Arguably, we could have made AS_TR_SH double-quote it's output since it's fairly obvious from semantics that whatever we are transliterating should not be producing any macro names on output, but it's probably too late to change that in autoconf now for backwards compatibility. > +AC_DEFUN([gl_ABSOLUTE_HEADER_ONE], > +[ > + AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote([$1])[[>]])]) That use of m4_dquote is overkill. You could have just used: AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <$1>]])]) for identical results with less m4 execution time. -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature