Can you override the default help message generated as part of running autoconf?
I would like to modify the configure.ac script so that when I build it the configure script using autoconf, it will have a custom help message.
autoconf ./configure --help
Instead of default, which talks about fine-tuning the installation directories and changing build flags.
Is it possible?
source to share
This script will insert text in various deviations as stated in
dnl The order of the diversions here is dnl - HELP_BEGIN dnl which may be extended by extra generic options such as with X or dnl AC_ARG_PROGRAM. Displayed only in long --help. dnl dnl - HELP_CANON dnl Support for cross compilation (--build, --host and --target). dnl Display only in long --help. dnl dnl - HELP_ENABLE dnl which starts with the trailer of the HELP_BEGIN, HELP_CANON section, dnl then implements the header of the non generic options. dnl dnl - HELP_WITH dnl dnl - HELP_VAR dnl dnl - HELP_VAR_END dnl dnl - HELP_END dnl initialized below, in which we dump the trailer (handling of the dnl recursion for instance).
The easiest way to display a help message
is to simply paste the following code at the end of the configure.ac file:
m4_cleardivert([HELP_BEGIN])dnl m4_cleardivert([HELP_CANON])dnl m4_cleardivert([HELP_ENABLE])dnl m4_cleardivert([HELP_WITH])dnl m4_cleardivert([HELP_VAR])dnl m4_cleardivert([HELP_VAR_END])dnl m4_cleardivert([HELP_END])dnl m4_divert_push([HELP_BEGIN])dnl cat <<_ACEOF Hello World _ACEOF m4_divert_pop([HELP_BEGIN])dnl m4_divert_push([HELP_END])dnl exit 0 m4_divert_pop([HELP_END])dnl
It will clean up all leaks and add your custom text without having to include any custom scripts
need to stop processing
script when displaying help.
If you would like to make additional changes to the help text, you can include your own m4 script at the beginning of the file
Copy the macro
script and modify it to suit your needs.
source to share