Search code examples
autoconf

How to use a variable which is defined by m4_define macro in m4_esyscmd?


I would like to do something similar with following code in configure.ac:

m4_define([product], [NGU29832])
m4_define([version], [R1A1])

After that use these variables in AC_INIT macro like this:

AC_INIT([foo], m4_esyscmd([$(pwd)/modify_version_script.sh $version $product]))

unfortunately, this doesn't work because $version and $product are both empty while parsed to m4_esyscmd macro.

Does anyone know how to do it?


Solution

  • I found a solution for this:

    m4_define([product], [NGU29832])
    m4_define([version], [R1A1])
    
    AC_INIT([foo], m4_esyscmd([$(pwd)/modify_version_script.sh m4_defn([version] m4_defn([product])))