autoconf
[Top][All Lists]
Advanced

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

test in a m4 macro and variable created from pushdef


From: Vincent Torri
Subject: test in a m4 macro and variable created from pushdef
Date: Wed, 8 Aug 2007 19:03:48 +0200 (CEST)


hey

I have written that code in my configure.ac:

if test "x${use_pcf_driver}" = "xyes"; then
   AC_MSG_NOTICE([Creating pcf driver...])
   rm -f src/lib/drv_pcf.c
echo "/* CAUTION! NEVER EDIT THIS FILE */" > src/lib/drv_pcf.c sed 's/bdf/pcf/g' src/lib/drv_bdf.c | sed 's/BDF/PCF/g' >> src/lib/drv_pcf.c
fi

it's working well. As I have to use it a lot (replacing 'bdf' and 'pcf' upper and lower case by other values), i decided to write a macro that takes 2 parameters. Here it is:

AC_DEFUN([AS_CREATE_DRIVER], [

pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl

pushdef([SRCUP], translit([$2], [a-z], [A-Z]))dnl
pushdef([SRCDOWN], translit([$2], [A-Z], [a-z]))dnl

if test "x${use_]DOWN[_driver}" = "xyes"; then
   AC_MSG_NOTICE([Creating UP[] driver...])
   rm -f src/lib/drv_]DOWN[.c
   echo "/* CAUTION! NEVER EDIT THIS FILE */"  >  src/lib/drv_]DOWN[.c
sed 's/]SRCDOWN[/]DOWN[/g' src/lib/drv_]SRCDOWN[.c | sed 's/]SRCUP[/]UP[/g' >> src/lib/drv_]DOWN[.c
fi

popdef([UP])
popdef([DOWN])

popdef([SRCUP])
popdef([SRCDOWN])

])

the notice is not written. That means that the test fails (I know that with the value I gave, the test must succeed, I've verified that point).

So I think that ${use_]DOWN[_driver} in the test is not replaced correctly.

Does someone know what the correct syntax for test is, please ?

thank you

Vincent Torri




reply via email to

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