How to determine if m4 macro exists or can be called

we are developing a software package that uses autotools (autoconf 2.69 and automake 1.13.3, to be precise). This package requires wxwidgets, and this library provides its own m4 file, allowing you to test the installation of wxwidgets on the final installation system. wxwidgets recently changed version from 2.8 to 3.0, and in this change they also changed the macro used to determine accessibility (i.e. the macro changed from AM_PATH_WXCONFIG to WX_CONFIG_CHECK), as well as its parameterization. It also means that if we distribute the source code from our package, and external developers want to rebuild the configuration, then the configure.ac file must know which one should be used.

So, the question is, does our package have the ability to check if the m4 macro exists before executing it? If this is not possible, then should we include the m4 files from wxwidgets in our package?

+4
source share
1 answer

As you said in your comment, use m4_ifdef:

m4_ifdef([AM_PATH_WXCONFIG], [
    AM_PATH_WXCONFIG(parameters)
], [
    m4_ifdef([WX_CONFIG_CHECK], [
        WX_CONFIG_CHECK(parameters)
    ], [
        AC_MSG_ERROR([You need to install the wxWidgets development package.])
    ])
])
+3
source

Source: https://habr.com/ru/post/1599487/


All Articles