Artem
Artem

Reputation: 1

autotools project - using prefix variable in scripts

Having scripts in autotools project that are using some paths I want to forward prefix that is entered by user during ./configure to those scripts. Lets say I have a bash script that echo file in directory that is set during ./configure. What is the best way to do it? I am thinking about having myscript.sh.hpp that will be used by preprocessor and passing -DMYPATH to preprocessor to substitute it into myscript.sh.hpp to generate myscript.sh with appropriate path. Is that right direction?

Upvotes: 0

Views: 346

Answers (1)

William Pursell
William Pursell

Reputation: 212238

prefix is the location to which your software is installed, and is not really the correct place to look for things like bash. It would be better to provide the user the ability to specify a bash interpreter or to probe PATH to find bash and use that value. However, it is often desirable to reference prefix in a script. The easiest way is to let config.status expand it. In configure.ac:

AC_CONFIG_FILES([foo])

and in foo.in

@prefix@

Upvotes: 1

Related Questions