Next Up Previous Contents
Next: A.29 STAR_XML_DOCUMENTATION
Up: A The Starconf macros and variables
Previous: A.27 STAR_SPECIAL_INSTALL_COMMAND
[ID index][Keyword index]

A.28 STAR_SUPPRESS_BUILD_IF

STAR_SUPPRESS_BUILD_IF(test, message)

Some components should be built only conditionally, if certain conditions apply. For example, the sgmlkit component can be built only if the host system has jade installed on it, but the lack of this is not an error, in the sense that it should cause a tree-wide ./configure to fail. This macro helps with this situation.

If this macro is triggered, by the given condition being true, then ./configure, make and make install will all succeed without compiling anything, with the latter installing a correctly formed manifest file which does not list any installed files.

The test in the first argument is a shell expression which should evaluate to true (ie, return a zero status) if the build should be suppressed. In the case of the sgmlkit component, the configure.ac includes the lines:


AC_PATH_PROGS(JADE, [openjade jade], NOJADE)
AC_PATH_PROGS(SGMLNORM, [osgmlnorm sgmlnorm], NOSGMLNORM)
...
STAR_SUPPRESS_BUILD_IF([test $JADE = NOJADE -o $SGMLNORM = NOSGMLNORM],
    [JADE=$JADE, SGMLNORM=$SGMLNORM: both needed for sgmlkit])
The test expression evaluates to true if either of the $JADE or $SGMLNORM variables has the special values given as defaults in the AC_PATH_PROGS macros earlier.

If the test is true, the message is displayed during the ./configure run, but the configuration does not fail. Instead, a stamp file STAR_SUPPRESS_BUILD is left in the build directory, with the consequence that if you subsequently type make, that build will do nothing, emit the same message, and also not fail. If you subsequently invoke make install, that will also succeed, but install no files, except a manifest without a <files> element.

If you do any special installation work in your Makefile.am, remember to check for the existence of this stamp file, and make sure that you do not actually install anything if the file is present.

The difference between this and the standard AC_FATAL macro is that the latter is for an error in the configuration script -- either a logic error there, or a serious problem like being unable to compile anything at all! Alternatively, if a dependency should be present because it is listed in the configure.ac as such, but it isn't, that's a case for a call to AC_FATAL. The STAR_SUPPRESS_BUILD_IF macro is for rather more well-mannered interactions with the user, indicating that there is other work they might have to do to get this component building.

You should use this macro rather sparingly. If a component depends on a component thus suppressed, there will likely be trouble.


Next Up Previous Contents
Next: A.29 STAR_XML_DOCUMENTATION
Up: A The Starconf macros and variables
Previous: A.27 STAR_SPECIAL_INSTALL_COMMAND
[ID index][Keyword index]
The Starlink Build System
Starlink System Note 78
Norman Gray, Peter W Draper, Mark B Taylor, Steven E Rankin
11 April 2005. Release snapshot: $Revision: 1.116 $. Last updated 28 May 2006