Blame acinclude.m4

Packit b040ce
dnl autoconf macros for libbytesize
Packit b040ce
dnl
Packit b040ce
dnl Copyright (C) 2014  Red Hat, Inc.
Packit b040ce
dnl
Packit b040ce
dnl This program is free software; you can redistribute it and/or modify
Packit b040ce
dnl it under the terms of the GNU Lesser General Public License as published
Packit b040ce
dnl by the Free Software Foundation; either version 2.1 of the License, or
Packit b040ce
dnl (at your option) any later version.
Packit b040ce
dnl
Packit b040ce
dnl This program is distributed in the hope that it will be useful,
Packit b040ce
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit b040ce
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit b040ce
dnl GNU Lesser General Public License for more details.
Packit b040ce
dnl
Packit b040ce
dnl You should have received a copy of the GNU Lesser General Public License
Packit b040ce
dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit b040ce
dnl
Packit b040ce
dnl THIS IS A MODIFIED VERSION OF THE ANACONDA'S acinclude.m4 FILE.
Packit b040ce
dnl
Packit b040ce
dnl Author: David Shea <dshea@redhat.com>
Packit b040ce
dnl         Vratislav Podzimek <vpodzime@redhat.com>
Packit b040ce
Packit b040ce
dnl LIBBYTESIZE_SOFT_FAILURE(MESSAGE)
Packit b040ce
dnl
Packit b040ce
dnl Store a message that in some contexts could be considered indicative
Packit b040ce
dnl of a failure, but in other contexts could be indicative of who cares.
Packit b040ce
dnl
Packit b040ce
dnl Any message sent to this macro will be stored, and they can all be
Packit b040ce
dnl displayed at the end of configure using the LIBBYTESIZE_FAILURES macro.
Packit b040ce
AC_DEFUN([LIBBYTESIZE_SOFT_FAILURE], [dnl
Packit b040ce
AS_IF([test x"$libbytesize_failure_messages" = x],
Packit b040ce
    [libbytesize_failure_messages="[$1]"],
Packit b040ce
    [libbytesize_failure_messages="$libbytesize_failure_messages
Packit b040ce
[$1]"
Packit b040ce
])])dnl
Packit b040ce
Packit b040ce
dnl LIBBYTESIZE_PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES)
Packit b040ce
dnl
Packit b040ce
dnl Check whether a module is available, using pkg-config. Instead of failing
Packit b040ce
dnl if a module is not found, store the failure in a message that can be
Packit b040ce
dnl printed using the LIBBYTESIZE_FAILURES macro.
Packit b040ce
dnl
Packit b040ce
dnl The syntax and behavior of VARIABLE-PREFIX and MODULES is the same as for
Packit b040ce
dnl PKG_CHECK_MODULES.
Packit b040ce
AC_DEFUN([LIBBYTESIZE_PKG_CHECK_MODULES], [dnl
Packit b040ce
PKG_CHECK_MODULES([$1], [$2], [], [LIBBYTESIZE_SOFT_FAILURE($[$1]_PKG_ERRORS)])
Packit b040ce
])dnl
Packit b040ce
Packit b040ce
dnl LIBBYTESIZE_PKG_CHECK_EXISTS(MODULES)
Packit b040ce
dnl
Packit b040ce
dnl Check whether a module exists, using pkg-config. Instead of failing
Packit b040ce
dnl if a module is not found, store the failure in a message that can be
Packit b040ce
dnl printed using the LIBBYTESIZE_FAILURES macro.
Packit b040ce
dnl
Packit b040ce
dnl The syntax and behavior of MODULES is the same as for
Packit b040ce
dnl PKG_CHECK_EXISTS.
Packit b040ce
AC_DEFUN([LIBBYTESIZE_PKG_CHECK_EXISTS], [dnl
Packit b040ce
PKG_CHECK_EXISTS([$1], [], [LIBBYTESIZE_SOFT_FAILURE([Check for $1 failed])])
Packit b040ce
])dnl
Packit b040ce
Packit b040ce
dnl LIBBYTESIZE_FAILURES
Packit b040ce
dnl
Packit b040ce
dnl Print the failure messages collected by LIBBYTESIZE_SOFT_FAILURE and
Packit b040ce
dnl LIBBYTESIZE_PKG_CHECK_MODULES
Packit b040ce
AC_DEFUN([LIBBYTESIZE_FAILURES], [dnl
Packit b040ce
AS_IF([test x"$libbytesize_failure_messages" = x], [], [dnl
Packit b040ce
echo ""
Packit b040ce
echo "*** Libbytesize encountered the following issues during configuration:"
Packit b040ce
echo "$libbytesize_failure_messages"
Packit b040ce
echo ""
Packit b040ce
echo "*** Libbytesize will not successfully build without these missing dependencies"
Packit b040ce
])])dnl