configure.ac has precious variables[1], which are supposed to be subbed-in when calling configure, e.g. configuring the location of the system Lua interpreter as a precious variable[2]:

  dnl Make LUA a precious variable.
  AC_ARG_VAR([LUA], [The Lua interpreter, e.g. /usr/bin/lua5.1])
command line:

./configure LUA=lua-5.3.6/src/lua


export LUA=lua-5.3.6/src/lua

However, I'd like to hard code the location of the Lua interpreter instead of having to ask users to add it as an environment variable every time. How can I hard code it into configure.ac?

[1] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html

[2]: The AC_ARG_VAR is really nested inside a m4 macro: http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_lua.m4


Assuming you want to use AX_PROG_LUA, a much better way is to use the action-not-found branch:


Inside that branch you can just set up the necessary paths with your default values (or even better, first check that lua can be really found under those paths).

That has the advantages that (1) you don't need to modify existing macros, and (2) it won't break your package for people who do not have lua in the paths that you want to hardcode.

If that is not your use-case, and your use case is that you include a particular version of LUA with your package (you didn't tell us your use-case, so I have to guess), then I'd probably just set the paths directly instead of relying on AX_PROG_LUA.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.