| Automake conditionals are a way to omit or include different parts of the `Makefile' depending on what For instance, here is how to make a condition named `TRUE' which is always true:
As another example, here is how to make a condition named `DEBUG' which is true when the user has given the `-- enable-debug ' option to
Once you've defined a condition in `configure.in' , you can refer to it in your `Makefile.am' using the `if' statement. Here is a part of a sample `Makefile.am' that uses the conditions defined above:
It's important to remember that Automake conditionals are configure-time conditionals. They don't rely on any special feature of Traditionally, Automake conditionals have been considered an advanced feature. However, practice has shown that they are often easier to use and understand than other approaches to solving the same problem. I now recommend the use of conditionals to everyone. For instance, consider this example:
In this case, the equivalent code without conditionals is more confusing and correspondingly more difficult for the new Automake user to figure out:
Automake conditionals have some limitations. One known problem is that conditionals don't interact properly with `+=' assignment. For instance, consider this code:
This code appears to have an unambiguous meaning, but Automake 1.4 doesn't implement this and will give an error. This bug will be fixed in the next major Automake release. |