Sometimes we want to only set a particular set of compiler flags if a particular header file or library is present.
AM_CONDITIONAL(HAVE_CDDA, false)
AC_CHECK_HEADERS(cdda_interface.h cdda_paranoia.h, [
CDDA_LIBS="-lcdda_paranoia -lcdda_interface"
AM_CONDITIONAL(HAVE_CDDA, true)
])
|
Another, more complicated example.
AC_CHECK_LIB(jpeg, jpeg_start_decompress,
[AC_CHECK_HEADER(jpeglib.h,
jpeg_ok=yes,
jpeg_ok=no)],
AC_MSG_WARN(*** (jpeg library not found) ***), -lm)
if test "$jpeg_ok" = yes; then
JPEG='jpeg'; LIBJPEG='-ljpeg'
AC_DEFINE(HAVE_LIBJPEG)
else
AC_MSG_WARN(*** JPEG loader will not be built ***)
fi
|