autotools - how to use variables for strings in autoconf:configure.ac -


how use variables messages inside configure.ac

if test "$foo" = "yes";     ac_msg_error([this string being used in warn error]) else     ac_msg_warn([this string being used in warn error]) fi 

it make sense define string "this string being used in warn error" in variable , use variable in both ac_msg_warn , ac_msg_error. best way ?

in addition that, m4 has macro can replace entire if else taking string , $foo argument ?

this should work:

msg="this string being used in warn error" if test "$foo" = "yes";     ac_msg_error([$msg]) else     ac_msg_warn([$msg]) fi 

in addition that, m4 has macro can replace entire if else taking string , $foo argument ?

if write one, will. :-). if-else isn't in m4, it's in output of m4, configure shell script. like:

ac_defun([ax_test_foo], [     pushdef([msg],$1)     pushdef([foo],$2)     as_if([test $foo = yes], [ac_msg_error([$msg])], [ac_msg_warn([$msg])])     popdef([foo])     popdef([msg]) ]) 

called like:

ax_test_foo(["this string being used in warn error"], [$foo]) 

should close. didn't try it.


Comments