Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autoconf: Breaking long lines in strings

Tags:

autoconf

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?

like image 967
ph0t0nix Avatar asked Oct 22 '25 16:10

ph0t0nix


2 Answers

This is an old question, but I found another solution, you can use m4_normalize like this:

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

Or even:

AC_MSG_ERROR(m4_normalize([
    Could not find the Boost Math header files, did you
    specify the --with-boost-include-path option correctly?
]))
like image 115
lanoxx Avatar answered Oct 25 '25 18:10

lanoxx


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)
like image 26
ldav1s Avatar answered Oct 25 '25 20:10

ldav1s



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!