diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
commit | 47e6e7c84f008a53061e661f31ae96629bc694ef (patch) | |
tree | 648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /m4 | |
download | pcp-debian/3.9.10.tar.gz |
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'm4')
-rw-r--r-- | m4/GNUmakefile | 21 | ||||
-rw-r--r-- | m4/manual_format.m4 | 15 | ||||
-rw-r--r-- | m4/multilib.m4 | 43 | ||||
-rw-r--r-- | m4/package_globals.m4 | 94 | ||||
-rw-r--r-- | m4/package_pthread.m4 | 19 | ||||
-rw-r--r-- | m4/package_qtdev.m4 | 47 | ||||
-rw-r--r-- | m4/package_utilies.m4 | 200 | ||||
-rw-r--r-- | m4/pkg.m4 | 214 |
8 files changed, 653 insertions, 0 deletions
diff --git a/m4/GNUmakefile b/m4/GNUmakefile new file mode 100644 index 0000000..4043e4d --- /dev/null +++ b/m4/GNUmakefile @@ -0,0 +1,21 @@ +# +# Copyright (c) 2003-2006 Silicon Graphics, Inc. All Rights Reserved. +# + +TOPDIR = .. +include $(TOPDIR)/src/include/builddefs + +LSRCFILES = \ + pkg.m4 \ + manual_format.m4 \ + package_globals.m4 \ + package_utilies.m4 \ + package_pthread.m4 \ + package_qtdev.m4 \ + multilib.m4 + +default: + +include $(BUILDRULES) + +install install-dev install-lib: default diff --git a/m4/manual_format.m4 b/m4/manual_format.m4 new file mode 100644 index 0000000..898bd95 --- /dev/null +++ b/m4/manual_format.m4 @@ -0,0 +1,15 @@ +# +# Find format of installed man pages. +# +AC_DEFUN([AC_MANUAL_FORMAT], + [ have_zipped_manpages=false + have_bzip2ed_manpages=false + eval export `grep PCP_MAN_DIR /etc/pcp.conf` + if test -f "$PCP_MAN_DIR/man1/pcp.1.gz"; then + have_zipped_manpages=true + elif test -f "$PCP_MAN_DIR/man1/pcp.1.bz2"; then + have_bzip2ed_manpages=true + fi + AC_SUBST(have_zipped_manpages) + AC_SUBST(have_bzip2ed_manpages) + ]) diff --git a/m4/multilib.m4 b/m4/multilib.m4 new file mode 100644 index 0000000..8d991d8 --- /dev/null +++ b/m4/multilib.m4 @@ -0,0 +1,43 @@ +# The AC_MULTILIB macro was extracted and modified from +# gettext-0.15's AC_LIB_PREPARE_MULTILIB macro in the lib-prefix.m4 file +# so that the correct paths can be used for 64-bit libraries. +# +dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl From Bruno Haible. + +dnl AC_MULTILIB creates a variable libdirsuffix, containing +dnl the suffix of the libdir, either "" or "64". +dnl Only do this if the given enable parameter is "yes". +AC_DEFUN([AC_MULTILIB], +[ + dnl There is no formal standard regarding lib and lib64. The current + dnl practice is that on a system supporting 32-bit and 64-bit instruction + dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit + dnl libraries go under $prefix/lib. We determine the compiler's default + dnl mode by looking at the compiler's library search path. If at least + dnl of its elements ends in /lib64 or points to a directory whose absolute + dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the + dnl default, namely "lib". + enable_lib64="$1" + libdirsuffix="" + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test "$enable_lib64" = "yes" -a -n "$searchpath"; then + save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) libdirsuffix=64 ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) libdirsuffix=64 ;; + esac ;; + esac + fi + done + IFS="$save_IFS" + fi + AC_SUBST(libdirsuffix) +]) diff --git a/m4/package_globals.m4 b/m4/package_globals.m4 new file mode 100644 index 0000000..18296f9 --- /dev/null +++ b/m4/package_globals.m4 @@ -0,0 +1,94 @@ +# +# Generic macro, sets up all of the global packaging variables. +# The following environment variables may be set to override defaults: +# DEBUG OPTIMIZER MALLOCLIB PLATFORM DISTRIBUTION INSTALL_USER INSTALL_GROUP +# BUILD_VERSION +# +AC_DEFUN([AC_PACKAGE_GLOBALS], + [ pkg_name="$1" + AC_SUBST(pkg_name) + + . ./VERSION + pkg_major=$PKG_MAJOR + pkg_minor=$PKG_MINOR + pkg_revision=$PKG_REVISION + pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION} + AC_SUBST(pkg_major) + AC_SUBST(pkg_minor) + AC_SUBST(pkg_revision) + AC_SUBST(pkg_version) + pkg_release=$PKG_BUILD + test -z "$BUILD_VERSION" || pkg_release="$BUILD_VERSION" + AC_SUBST(pkg_release) + + pkg_build_date=`date +%Y-%m-%d` + AC_SUBST(pkg_build_date) + + DEBUG=${DEBUG:-'-DDEBUG'} dnl -DNDEBUG + debug_build="$DEBUG" + AC_SUBST(debug_build) + + OPTIMIZER=${OPTIMIZER:-'-g -O2'} + opt_build="$OPTIMIZER" + AC_SUBST(opt_build) + + pkg_user=`id -u -n root` + test $? -eq 0 || pkg_user=`id -u -n` + test -z "$INSTALL_USER" || pkg_user="$INSTALL_USER" + AC_SUBST(pkg_user) + + pkg_group=`id -g -n root` + test $? -eq 0 || pkg_group=`id -g -n` + test -z "$INSTALL_GROUP" || pkg_group="$INSTALL_GROUP" + AC_SUBST(pkg_group) + + pkg_distribution=unknown + test -f /etc/SuSE-release && pkg_distribution=suse + test -f /etc/fedora-release && pkg_distribution=fedora + test -f /etc/redhat-release && pkg_distribution=redhat + test -f /etc/debian_version && pkg_distribution=debian + test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION" + AC_SUBST(pkg_distribution) + + pkg_doc_dir=`eval echo $datadir` + pkg_doc_dir=`eval echo $pkg_doc_dir/doc/pcp-gui` + if test "`echo $pkg_doc_dir | sed 's;/.*\$;;'`" = NONE + then + if test -d /usr/share/doc + then + pkg_doc_dir=/usr/share/doc/pcp-gui + else + pkg_doc_dir=/usr/share/pcp-gui + fi + fi + test -z "$DOCDIR" || pkg_doc_dir="$DOCDIR" + AC_SUBST(pkg_doc_dir) + + pkg_books_dir=`eval echo $datadir` + pkg_books_dir=`eval echo $pkg_books_dir/doc/pcp-doc` + if test "`echo $pkg_books_dir | sed 's;/.*\$;;'`" = NONE + then + if test -d /usr/share/doc + then + pkg_books_dir=/usr/share/doc/pcp-doc + else + pkg_books_dir=/usr/share/pcp-doc + fi + fi + test -z "$BOOKSDIR" || pkg_books_dir="$BOOKSDIR" + AC_SUBST(pkg_books_dir) + + pkg_icon_dir=`eval echo $datadir` + pkg_icon_dir=`eval echo $pkg_icon_dir/pixmaps` + if test "`echo $pkg_icon_dir | sed 's;/.*\$;;'`" = NONE + then + if test -d /usr/share/doc + then + pkg_icon_dir=/usr/share/doc/pcp-gui/pixmaps + else + pkg_icon_dir=/usr/share/pcp-gui/pixmaps + fi + fi + test -z "$ICONDIR" || pkg_icon_dir="$ICONDIR" + AC_SUBST(pkg_icon_dir) + ]) diff --git a/m4/package_pthread.m4 b/m4/package_pthread.m4 new file mode 100644 index 0000000..be21d29 --- /dev/null +++ b/m4/package_pthread.m4 @@ -0,0 +1,19 @@ +AC_DEFUN([AC_PACKAGE_NEED_PTHREAD_H], + [ AC_CHECK_HEADERS(pthread.h) + if test $ac_cv_header_pthread_h = no; then + AC_CHECK_HEADERS(pthread.h,, [ + echo + echo 'FATAL ERROR: could not find a valid pthread header.' + exit 1]) + fi + ]) + +AC_DEFUN([AC_PACKAGE_NEED_PTHREADMUTEXINIT], + [ AC_CHECK_LIB(pthread, pthread_mutex_init,, [ + echo + echo 'FATAL ERROR: could not find a valid pthread library.' + exit 1 + ]) + libpthread=-lpthread + AC_SUBST(libpthread) + ]) diff --git a/m4/package_qtdev.m4 b/m4/package_qtdev.m4 new file mode 100644 index 0000000..0eb2181 --- /dev/null +++ b/m4/package_qtdev.m4 @@ -0,0 +1,47 @@ +AC_DEFUN([AC_PACKAGE_NEED_QT_QMAKE], + [ if test -x "$QTDIR/bin/qmake.exe"; then + QMAKE="$QTDIR/bin/qmake.exe" + fi + if test -z "$QMAKE"; then + AC_PATH_PROGS(QMAKE, [qmake-qt4 qmake],, [$QTDIR/bin:/usr/bin:/usr/lib64/qt4/bin:/usr/lib/qt4/bin]) + fi + qmake=$QMAKE + AC_SUBST(qmake) + AC_PACKAGE_NEED_UTILITY($1, "$qmake", qmake, [Qt make]) + ]) + +AC_DEFUN([AC_PACKAGE_NEED_QT_VERSION4], + [ AC_MSG_CHECKING([Qt version]) + eval `$qmake --version | awk '/Using Qt version/ { ver=4; print $ver }' | awk -F. '{ major=1; minor=2; point=3; printf "export QT_MAJOR=%d QT_MINOR=%d QT_POINT=%d\n",$major,$minor,$point }'` + if test "$QT_MAJOR" -lt 4 ; then + echo + echo FATAL ERROR: Qt version 4 does not seem to be installed. + echo Cannot proceed with the Qt $QT_MAJOR installation found. + exit 1 + fi + if test "$QT_MAJOR" -eq 4 -a "$QT_MINOR" -lt 4 ; then + echo + echo FATAL ERROR: Qt version 4.$QT_MINOR is too old. + echo Qt version 4.4 or later is required. + exit 1 + fi + AC_MSG_RESULT([$QT_MAJOR.$QT_MINOR.$QT_POINT]) + ]) + +AC_DEFUN([AC_PACKAGE_NEED_QT_UIC], + [ if test -z "$UIC"; then + AC_PATH_PROGS(UIC, [uic-qt4 uic],, [$QTDIR/bin:/usr/bin:/usr/lib64/qt4/bin:/usr/lib/qt4/bin]) + fi + uic=$UIC + AC_SUBST(uic) + AC_PACKAGE_NEED_UTILITY($1, "$uic", uic, [Qt User Interface Compiler]) + ]) + +AC_DEFUN([AC_PACKAGE_NEED_QT_MOC], + [ if test -z "$MOC"; then + AC_PATH_PROGS(MOC, [moc-qt4 moc],, [$QTDIR/bin:/usr/bin:/usr/lib64/qt4/bin:/usr/lib/qt4/bin]) + fi + moc=$MOC + AC_SUBST(moc) + AC_PACKAGE_NEED_UTILITY($1, "$uic", uic, [Qt Meta-Object Compiler]) + ]) diff --git a/m4/package_utilies.m4 b/m4/package_utilies.m4 new file mode 100644 index 0000000..c6c5102 --- /dev/null +++ b/m4/package_utilies.m4 @@ -0,0 +1,200 @@ +# +# Check for specified utility (env var) - if unset, fail. +# +AC_DEFUN([AC_PACKAGE_NEED_UTILITY], + [ if test -z "$2"; then + echo + echo FATAL ERROR: $3 does not seem to be installed. + echo $1 cannot be built without a working $4 installation. + exit 1 + fi + ]) + +# +# Generic macro, sets up all of the global build variables. +# The following environment variables may be set to override defaults: +# MAKE TAR BZIP2 MAKEDEPEND AWK SED ECHO SORT RPMBUILD DPKG LEX YACC +# +AC_DEFUN([AC_PACKAGE_UTILITIES], + [ AC_PROG_CXX + AC_PACKAGE_NEED_UTILITY($1, "$CXX", cc, [C++ compiler]) + + if test -z "$MAKE"; then + AC_PATH_PROG(MAKE, mingw32-make,, /mingw/bin:/usr/bin:/usr/local/bin) + fi + if test -z "$MAKE"; then + AC_PATH_PROG(MAKE, gmake,, /usr/bin:/usr/local/bin) + fi + if test -z "$MAKE"; then + AC_PATH_PROG(MAKE, make,, /usr/bin) + fi + make=$MAKE + AC_SUBST(make) + AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make]) + + if test -z "$TAR"; then + AC_PATH_PROG(TAR, tar,, /bin:/usr/local/bin:/usr/bin) + fi + tar=$TAR + AC_SUBST(tar) + + if test -z "$ZIP"; then + AC_PATH_PROG(ZIP, gzip,, /bin:/usr/bin:/usr/local/bin) + fi + zip=$ZIP + AC_SUBST(zip) + + if test -z "$BZIP2"; then + AC_PATH_PROG(BZIP2, bzip2,, /bin:/usr/bin:/usr/local/bin) + fi + bzip2=$BZIP2 + AC_SUBST(bzip2) + + if test -z "$MAKEDEPEND"; then + AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true) + fi + makedepend=$MAKEDEPEND + AC_SUBST(makedepend) + + if test -z "$AWK"; then + AC_PATH_PROG(AWK, awk,, /bin:/usr/bin) + fi + awk=$AWK + AC_SUBST(awk) + + if test -z "$SED"; then + AC_PATH_PROG(SED, sed,, /bin:/usr/bin) + fi + sed=$SED + AC_SUBST(sed) + + if test -z "$ECHO"; then + AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin) + fi + echo=$ECHO + AC_SUBST(echo) + + if test -z "$SORT"; then + AC_PATH_PROG(SORT, sort,, /bin:/usr/bin) + fi + sort=$SORT + AC_SUBST(sort) + + dnl check if symbolic links are supported + AC_PROG_LN_S + + dnl check if rpmbuild is available + if test -z "$RPMBUILD" + then + AC_PATH_PROG(RPMBUILD, rpmbuild) + fi + rpmbuild=$RPMBUILD + AC_SUBST(rpmbuild) + + dnl check if the dpkg program is available + if test -z "$DPKG" + then + AC_PATH_PROG(DPKG, dpkg) + fi + dpkg=$DKPG + AC_SUBST(dpkg) + + dnl Check for the MacOSX PackageMaker + AC_MSG_CHECKING([for PackageMaker]) + if test -z "$PACKAGE_MAKER" + then + devapps=/Developer/Applications + darwin6=${devapps}/PackageMaker.app/Contents/MacOS + darwin7=${devapps}/Utilities/PackageMaker.app/Contents/MacOS + if test -x ${darwin6}/PackageMaker + then + package_maker=${darwin6}/PackageMaker + AC_MSG_RESULT([ yes (darwin 6.x)]) + elif test -x ${darwin7}/PackageMaker + then + AC_MSG_RESULT([ yes (darwin 7.x)]) + package_maker=${darwin7}/PackageMaker + else + AC_MSG_RESULT([ no]) + fi + else + package_maker="$PACKAGE_MAKER" + fi + AC_SUBST(package_maker) + + dnl check if the MacOSX hdiutil program is available + test -z "$HDIUTIL" && AC_PATH_PROG(HDIUTIL, hdiutil) + hdiutil=$HDIUTIL + AC_SUBST(hdiutil) + + dnl check if a toolchain is available for the books + test -z "$PUBLICAN" && AC_PATH_PROG(PUBLICAN, publican) + publican=$PUBLICAN + AC_SUBST(publican) + test -z "$DBLATEX" && AC_PATH_PROG(DBLATEX, dblatex) + dblatex=$DBLATEX + AC_SUBST(dblatex) + test -z "$XMLTO" && AC_PATH_PROG(XMLTO, xmlto) + xmlto=$XMLTO + AC_SUBST(xmlto) + + book_toolchain="" + if test "$do_books" = "check" -o "$do_books" = "yes" + then + if test "$BOOK_TOOLCHAIN" != "" + then + book_toolchain=$BOOK_TOOLCHAIN + elif test "$DBLATEX" != "" + then + book_toolchain=dblatex + elif test "$PUBLICAN" != "" + then + book_toolchain=publican + elif test "$XMLTO" != "" + then + book_toolchain=xmlto + elif test "$do_books" = "yes" + then + AC_MSG_ERROR(cannot enable books build - no toolchain found) + fi + fi + AC_SUBST(book_toolchain) + + dnl check if user wants their own lex, yacc + AC_PROG_YACC + yacc=$YACC + AC_SUBST(yacc) + AC_PROG_LEX + lex=$LEX + AC_SUBST(lex) + + dnl extra check for lex and yacc as these are often not installed + AC_MSG_CHECKING([if yacc is executable]) + binary=`echo $yacc | awk '{cmd=1; print $cmd}'` + binary=`which "$binary"` + if test -x "$binary" + then + AC_MSG_RESULT([ yes]) + else + AC_MSG_RESULT([ no]) + echo + echo "FATAL ERROR: did not find a valid yacc executable." + echo "You can either set \$YACC as the full path to yacc" + echo "in the environment, or install a yacc/bison package." + exit 1 + fi + AC_MSG_CHECKING([if lex is executable]) + binary=`echo $lex | awk '{cmd=1; print $cmd}'` + binary=`which "$binary"` + if test -x "$binary" + then + AC_MSG_RESULT([ yes]) + else + AC_MSG_RESULT([ no]) + echo + echo "FATAL ERROR: did not find a valid lex executable." + echo "You can either set \$LEX as the full path to lex" + echo "in the environment, or install a lex/flex package." + exit 1 + fi +]) diff --git a/m4/pkg.m4 b/m4/pkg.m4 new file mode 100644 index 0000000..c5b26b5 --- /dev/null +++ b/m4/pkg.m4 @@ -0,0 +1,214 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR |