autoconf

Autoconf: Breaking long lines in strings


In my configure.ac file I have warnings and errors like this one:

AC_MSG_ERROR([Could not find the Boost Math header files, did you specify the --with-boost-include-path option correctly?])

I'm old-fashioned and like to keep the line width less than 80 characters. However, when I split the line like this (I like some proper indentation as well)

AC_MSG_ERROR([Could not find the Boost Math header files, did you
 specify the --with-boost-include-path option correctly?])

the error message keeps the line break and indentation when printed on the screen by ./configure.

What is the proper way to break a string in Autoconf?


Solution

  • For doing something like this it might be helpful to define M4 macros:

    m4_define([bst_e1], [Could not find the Boost Math header files[,] did you])
    m4_define([bst_e2], [specify the --with-boost-include-path option correctly?])
    AC_MSG_ERROR(bst_e1 bst_e2)
    

    You could also do this when the configure script is run, since AC_MSG_ERROR will take a variable:

    variable=$(cat | tr '\012' ' ' <<ΕΟF
    Could not find the Boost Math header files, did you
    specify the --with-boost-include-path option correctly?
    ΕΟF
    )
    AC_MSG_ERROR($variable)