aboutsummaryrefslogtreecommitdiffstats
path: root/ServiceBasedPlugins/dists/autogen/m4
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-03-21 19:25:18 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-03-21 19:25:18 +0000
commitb38772ffdbcc6bf2189d0e14a9828f911ea44a7d (patch)
tree2101a9210ae02284af56415f65e9f108ebd12163 /ServiceBasedPlugins/dists/autogen/m4
parent5d69ab51fd28961fd43b7e7646768b5a6dcbcb25 (diff)
downloadusdx-b38772ffdbcc6bf2189d0e14a9828f911ea44a7d.tar.gz
usdx-b38772ffdbcc6bf2189d0e14a9828f911ea44a7d.tar.xz
usdx-b38772ffdbcc6bf2189d0e14a9828f911ea44a7d.zip
new branch for whiteshark's service and hook based (party) plugins
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1643 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'ServiceBasedPlugins/dists/autogen/m4')
-rw-r--r--ServiceBasedPlugins/dists/autogen/m4/ac_define_dir.m447
-rw-r--r--ServiceBasedPlugins/dists/autogen/m4/ax_extract_version.m458
-rw-r--r--ServiceBasedPlugins/dists/autogen/m4/fpc.m4268
-rw-r--r--ServiceBasedPlugins/dists/autogen/m4/macosx_version.m431
-rw-r--r--ServiceBasedPlugins/dists/autogen/m4/pkg_config_utils.m4190
5 files changed, 594 insertions, 0 deletions
diff --git a/ServiceBasedPlugins/dists/autogen/m4/ac_define_dir.m4 b/ServiceBasedPlugins/dists/autogen/m4/ac_define_dir.m4
new file mode 100644
index 00000000..f3d8734f
--- /dev/null
+++ b/ServiceBasedPlugins/dists/autogen/m4/ac_define_dir.m4
@@ -0,0 +1,47 @@
+##### http://autoconf-archive.cryp.to/ac_define_dir.html
+#
+# SYNOPSIS
+#
+# AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
+#
+# DESCRIPTION
+#
+# This macro sets VARNAME to the expansion of the DIR variable,
+# taking care of fixing up ${prefix} and such.
+#
+# VARNAME is then offered as both an output variable and a C
+# preprocessor symbol.
+#
+# Example:
+#
+# AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.])
+#
+# LAST MODIFICATION
+#
+# 2006-10-13
+#
+# COPYLEFT
+#
+# Copyright (c) 2006 Stepan Kasal <kasal@ucw.cz>
+# Copyright (c) 2006 Andreas Schwab <schwab@suse.de>
+# Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2006 Alexandre Oliva
+#
+# Copying and distribution of this file, with or without
+# modification, are permitted in any medium without royalty provided
+# the copyright notice and this notice are preserved.
+
+AC_DEFUN([AC_DEFINE_DIR], [
+ prefix_NONE=
+ exec_prefix_NONE=
+ test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
+dnl refers to ${prefix}. Thus we have to use `eval' twice.
+ eval ac_define_dir="\"[$]$2\""
+ eval ac_define_dir="\"$ac_define_dir\""
+ AC_SUBST($1, "$ac_define_dir")
+ AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
+ test "$prefix_NONE" && prefix=NONE
+ test "$exec_prefix_NONE" && exec_prefix=NONE
+])
diff --git a/ServiceBasedPlugins/dists/autogen/m4/ax_extract_version.m4 b/ServiceBasedPlugins/dists/autogen/m4/ax_extract_version.m4
new file mode 100644
index 00000000..c514e3c3
--- /dev/null
+++ b/ServiceBasedPlugins/dists/autogen/m4/ax_extract_version.m4
@@ -0,0 +1,58 @@
+# This file is part of UltraStar Deluxe
+# Created by the UltraStar Deluxe Team
+
+# SYNOPSIS
+#
+# AX_EXTRACT_VERSION(VARIABLE_PREFIX, VERSION)
+#
+# DESCRIPTION
+#
+# Splits a version number ("major.minor.release") into its components.
+# The resulting components of the version are guaranteed to be
+# numeric. All non-numeric chars are removed.
+#
+# Sets
+# [$VARIABLE_PREFIX]_VERSION_MAJOR
+# [$VARIABLE_PREFIX]_VERSION_MINOR
+# [$VARIABLE_PREFIX]_VERSION_RELEASE
+#
+# This function calls
+# AC_SUBST([$VARIABLE_PREFIX]_VERSION_type] for each type
+
+AC_DEFUN([AX_EXTRACT_VERSION],
+[
+ version=[$2]
+
+ # strip leading non-numeric tokens
+ # (necessary for some ffmpeg-packages in ubuntu)
+ # example: 0d.51.1.0 -> 51.1.0
+ version=`echo $version | sed 's/^[[^.]]*[[^0-9.]][[^.]]*\.//'`
+
+ # replace "." and "-" with " " and ignore trailing tokens.
+ # 1.23.4-r2 will be splitted to [maj=1, min=23, rel=4].
+ # In addition we delete everything after the first character
+ # which is not 0-9.
+ # 1.3a4-r32 will be [maj=1, min=3, rel=0].
+ read major minor release ignore <<eof
+ `echo $version | tr '.-' ' ' | sed 's/[[^0-9\ ]].*//'`
+eof
+ # Note: Do NOT indent the eof-delimiter
+ # We use a here-document (<<< here-strings not POSIX compatible)
+
+ test -z $major && major=0
+ test -z $minor && minor=0
+ test -z $release && release=0
+
+ # strip preceding 0s and set unset version-parts to 0
+ [$1][_VERSION_MAJOR]=$(($major))
+ [$1][_VERSION_MINOR]=$(($minor))
+ [$1][_VERSION_RELEASE]=$(($release))
+ # integer representation: MMMmmmrrr (M:major,m:minor,r:release)
+ # can be used if pkg-config's comparison fails
+ [$1][_VERSION_INT]=$(($[$1][_VERSION_MAJOR]*1000000+$[$1][_VERSION_MINOR]*1000+$[$1][_VERSION_RELEASE]))
+
+ AC_SUBST([$1][_VERSION_MAJOR])
+ AC_SUBST([$1][_VERSION_MINOR])
+ AC_SUBST([$1][_VERSION_RELEASE])
+ AC_SUBST([$1][_VERSION_INT])
+])
diff --git a/ServiceBasedPlugins/dists/autogen/m4/fpc.m4 b/ServiceBasedPlugins/dists/autogen/m4/fpc.m4
new file mode 100644
index 00000000..740071cb
--- /dev/null
+++ b/ServiceBasedPlugins/dists/autogen/m4/fpc.m4
@@ -0,0 +1,268 @@
+# Based on fpc.m4 Version 1.1 provided with
+# J Sound System (http://jss.sourceforge.net)
+#
+# Originally written by
+# Matti "ccr/TNSP" Hamalainen
+# (C) Copyright 2000-2001 Tecnic Software productions (TNSP)
+#
+# Mostly rewritten by
+# UltraStar Deluxe Team
+
+# SYNOPSIS
+#
+# AC_PROG_FPC
+#
+# DESCRIPTION
+#
+# Checks for Free Pascal Compiler
+#
+# Sets:
+# PPC : fpc command
+# FPCMAKE : fpcmake command
+#
+# PFLAGS : flags passed to fpc (overwrite default)
+# PFLAGS_BASE : base flags (release + debug)
+# PFLAGS_EXTRA : additional flags (appended to default PFLAGS)
+# PFLAGS_DEBUG : flags used in debug build
+# PFLAGS_RELEASE : flags used in release build
+#
+# Note:
+# all PFLAGS/PFLAGS_XYZ vars are set to $(PFLAGS_XYZ_DEFAULT)
+# if not set by the user, so the Makefile can assign default
+# values to them.
+#
+# FPC_VERSION : fpc version string, e.g. 2.3.1
+# FPC_VERSION_MAJOR : major version (here 2)
+# FPC_VERSION_MINOR : minor version (here 3)
+# FPC_VERSION_RELEASE: release version (here 1)
+#
+# FPC_PLATFORM : platform of the target (linux/darwin/win32/...)
+# FPC_PROCESSOR : processor of the target, (i386/...)
+# FPC_CPLATFORM : platform of the compiler host, (linux/darwin/win32/...)
+# FPC_CPROCESSOR : processor of the compiler host, (i386/...)
+# FPC_TARGET : FPC_PROCESSOR-FPC_PLATFORM (e.g. i386-linux)
+#
+# FPC_PREFIX : prefix of fpc install path, (default: /usr)
+# FPC_BASE_PATH : $FPC_PREFIX/lib/fpc/$FPC_VERSION
+# FPC_UNIT_PATH : $FPC_BASE_PATH/units/$FPC_TARGET
+#
+# See "fpc -i" for a list of supported platforms and processors
+
+AC_DEFUN([AC_PROG_FPC], [
+
+##
+# User PFLAGS
+##
+
+AC_ARG_VAR(PFLAGS, [Free Pascal Compiler flags (replaces all other flags)])
+AC_ARG_VAR(PFLAGS_BASE, [Free Pascal Compiler base flags, e.g. -Si])
+AC_ARG_VAR(PFLAGS_DEBUG, [Free Pascal Compiler debug flags, e.g. -gl])
+AC_ARG_VAR(PFLAGS_RELEASE, [Free Pascal Compiler release flags, e.g. -O2])
+AC_ARG_VAR(PFLAGS_EXTRA, [Free Pascal Compiler additional flags])
+
+##
+# Compiler options
+##
+
+AC_ARG_ENABLE(dummy_fpc1,[
+Free Pascal Compiler specific options:])
+
+# fpc path
+AC_ARG_WITH(fpc,
+ [AS_HELP_STRING([--with-fpc=DIR],
+ [Directory of the FPC executable @<:@PATH@:>@])],
+ [PPC_PATH=$withval], [])
+
+# verbose
+AC_ARG_ENABLE(verbose,
+ [AS_HELP_STRING([--disable-verbose],
+ [Disable verbose compiler output @<:@default=no@:>@])],
+ [test x$enableval = xno && PFLAGS_EXTRA="$PFLAGS_EXTRA -v0Bew"], [])
+
+# gprof
+AC_ARG_ENABLE(gprof,
+ [AS_HELP_STRING([--enable-gprof],
+ [Enable profiling with gprof @<:@default=no@:>@])],
+ [test x$enableval = xyes && PFLAGS_EXTRA="$PFLAGS_EXTRA -pg"], [])
+
+# valgrind
+AC_ARG_ENABLE(valgrind,
+ [AS_HELP_STRING([--enable-valgrind],
+ [Enable debugging with valgrind @<:@default=no@:>@])],
+ [test x$enableval = xyes && PFLAGS_EXTRA="$PFLAGS_EXTRA -gv"], [])
+
+# heaptrace
+AC_ARG_ENABLE(heaptrace,
+ [AS_HELP_STRING([--enable-heaptrace],
+ [Enable heaptrace (memory corruption detection) @<:@default=no@:>@])],
+ [test x$enableval = xyes && PFLAGS_EXTRA="$PFLAGS_EXTRA -gh"], [])
+
+# range-checks
+AC_ARG_ENABLE(rangechecks,
+ [AS_HELP_STRING([--enable-rangechecks],
+ [Enables range-checks @<:@default=no@:>@])],
+ [test x$enableval = xyes && PFLAGS_EXTRA="$PFLAGS_EXTRA -Crtoi"], [])
+
+# allow execstack (see noexecstack compiler check below)
+AC_ARG_ENABLE(noexecstack,
+ [AS_HELP_STRING([--disable-noexecstack],
+ [Allow executable stacks @<:@default=no@:>@])],
+ [], [enable_noexecstack="yes"])
+
+###
+# Find compiler executable
+###
+
+PPC_CHECK_PROGS="fpc FPC ppc386 ppc PPC386"
+
+if test -z "$PPC_PATH"; then
+ PPC_PATH=$PATH
+ AC_CHECK_PROGS(PPC, $PPC_CHECK_PROGS)
+ AC_CHECK_PROGS(FPCMAKE, [fpcmake])
+else
+ AC_PATH_PROGS(PPC, $PPC_CHECK_PROGS, [], $PPC_PATH)
+ AC_PATH_PROGS(FPCMAKE, [fpcmake], [], $PPC_PATH)
+fi
+if test -z "$PPC"; then
+ AC_MSG_ERROR([no Free Pascal Compiler found in $PPC_PATH])
+fi
+
+###
+# Get the FPC compiler info
+###
+
+AC_MSG_CHECKING([version of fpc])
+FPC_VERSION=`${PPC} -iV`
+AX_EXTRACT_VERSION(FPC, $FPC_VERSION)
+AC_SUBST(FPC_VERSION)
+AC_MSG_RESULT([@<:@$FPC_VERSION@:>@])
+
+FPC_PLATFORM=`${PPC} -iTO`
+FPC_PROCESSOR=`${PPC} -iTP`
+FPC_CPLATFORM=`${PPC} -iSO`
+FPC_CPROCESSOR=`${PPC} -iSP`
+
+FPC_TARGET=${FPC_PROCESSOR}-${FPC_PLATFORM}
+
+
+AC_SUBST(FPC_PLATFORM)
+AC_SUBST(FPC_PROCESSOR)
+AC_SUBST(FPC_CPLATFORM)
+AC_SUBST(FPC_CPROCESSOR)
+AC_SUBST(FPC_TARGET)
+
+###
+# Get paths
+###
+
+if test "x$prefix" != xNONE; then
+ FPC_PREFIX=$prefix
+else
+ FPC_PREFIX=$ac_default_prefix
+fi
+
+FPC_BASE_PATH="${FPC_PREFIX}/lib/fpc/${FPC_VERSION}"
+FPC_UNIT_PATH="${FPC_BASE_PATH}/units/${FPC_TARGET}"
+
+AC_SUBST(FPC_PREFIX)
+AC_SUBST(FPC_BASE_PATH)
+AC_SUBST(FPC_UNIT_PATH)
+
+###
+# Compiler checks
+###
+
+SIMPLE_PROGRAM="program foo; begin writeln; end."
+
+# Check if FPC works and can compile a program
+AC_CACHE_CHECK([whether the Free Pascal Compiler works], ac_cv_prog_ppc_works,
+[
+ AC_PROG_FPC_CHECK([ac_cv_prog_ppc_works], [], [$SIMPLE_PROGRAM])
+])
+if test x$ac_cv_prog_ppc_works = xno; then
+ AC_MSG_ERROR([installation or configuration problem: Cannot create executables.])
+fi
+
+# Check if FPC can link with standard libraries
+AC_CACHE_CHECK([whether the Free Pascal Compiler can link], ac_cv_prog_ppc_links,
+[
+ AC_PROG_FPC_CHECK([ac_cv_prog_ppc_links], [],
+ [program foo; uses crt; begin writeln; end.]
+ )
+])
+if test x$ac_cv_prog_ppc_links = xno; then
+ AC_MSG_ERROR([installation or configuration problem: Cannot link with some standard libraries.])
+fi
+
+# Check whether FPC's linker knows "-z noexecstack"
+# FPC does not set the NX-flag on stack memory. Binaries generated with FPC
+# might crash on platforms that require the stack to be non-executable.
+# So we will try to find a workaround here.
+# See http://bugs.freepascal.org/view.php?id=11563
+
+AC_CACHE_CHECK([whether FPC supports -k"-z noexecstack"], ac_cv_prog_ppc_noexecstack,
+[
+ AC_PROG_FPC_CHECK([ac_cv_prog_ppc_noexecstack], [-k"-z noexecstack"], [$SIMPLE_PROGRAM])
+])
+if test x$enable_noexecstack = xyes; then
+ if test x$ac_cv_prog_ppc_noexecstack = xyes; then
+ PFLAGS_EXTRA="$PFLAGS_EXTRA -k\"-z noexecstack\""
+ fi
+fi
+
+# Finally substitute PFLAGS
+
+# set unset PFLAGS_XYZ vars to $(PFLAGS_XYZ_DEFAULT)
+# so the Makefile can define default values to it.
+true ${PFLAGS:=\$(PFLAGS_DEFAULT)}
+true ${PFLAGS_BASE:=\$(PFLAGS_BASE_DEFAULT)}
+true ${PFLAGS_EXTRA:=\$(PFLAGS_EXTRA_DEFAULT)}
+true ${PFLAGS_DEBUG:=\$(PFLAGS_DEBUG_DEFAULT)}
+true ${PFLAGS_RELEASE:=\$(PFLAGS_RELEASE_DEFAULT)}
+
+AC_SUBST(PFLAGS)
+AC_SUBST(PFLAGS_BASE)
+AC_SUBST(PFLAGS_EXTRA)
+AC_SUBST(PFLAGS_DEBUG)
+AC_SUBST(PFLAGS_RELEASE)
+
+])
+
+#######################################
+# Helper functions
+#######################################
+
+# SYNOPSIS
+#
+# AC_PROG_FPC_CHECK(RESULT, FPC_FLAGS, CODE)
+#
+# DESCRIPTION
+#
+# Checks if FPC is able to compile CODE with FPC_FLAGS.
+# The result ("yes" on success, "no" otherwise) is
+# stored in [$RESULT]
+#
+# Parameters:
+# RESULT: Name of result variable
+# FPC_FLAGS: Flags passed to FPC
+# CODE:
+
+AC_DEFUN([AC_PROG_FPC_CHECK],
+[
+ # create test file
+ rm -f conftest*
+ echo "[$3]" > conftest.pp
+
+ # compile test file
+ ${PPC} [$2] conftest.pp >> config.log 2>&1
+
+ # check if test file was compiled
+ if test -f conftest || test -f conftest.exe; then
+ [$1]="yes"
+ else
+ [$1]="no"
+ fi
+
+ # remove test file
+ rm -f conftest*
+])
diff --git a/ServiceBasedPlugins/dists/autogen/m4/macosx_version.m4 b/ServiceBasedPlugins/dists/autogen/m4/macosx_version.m4
new file mode 100644
index 00000000..ddedd908
--- /dev/null
+++ b/ServiceBasedPlugins/dists/autogen/m4/macosx_version.m4
@@ -0,0 +1,31 @@
+# This file is part of UltraStar Deluxe
+# Created by the UltraStar Deluxe Team
+
+# SYNOPSIS
+#
+# AC_MACOSX_VERSION
+#
+# DESCRIPTION
+#
+# Determines the Mac OS X and Darwin version.
+#
+# +----------+---------+
+# | Mac OS X | Darwin |
+# +----------+---------+
+# | 10.4 | 8 |
+# | 10.5 | 9 |
+# +----------+---------+
+
+AC_DEFUN([AC_MACOSX_VERSION],
+[
+ AC_MSG_CHECKING([for Mac OS X version])
+ MACOSX_VERSION=`sw_vers -productVersion`
+ AX_EXTRACT_VERSION(MACOSX, $MACOSX_VERSION)
+ AC_MSG_RESULT(@<:@$MACOSX_VERSION@:>@)
+ AC_SUBST(MACOSX_VERSION)
+
+ AC_MSG_CHECKING([for Darwin version])
+ DARWIN_VERSION=`uname -r | cut -f1 -d.`
+ AC_MSG_RESULT(@<:@$DARWIN_VERSION@:>@)
+ AC_SUBST(DARWIN_VERSION)
+])
diff --git a/ServiceBasedPlugins/dists/autogen/m4/pkg_config_utils.m4 b/ServiceBasedPlugins/dists/autogen/m4/pkg_config_utils.m4
new file mode 100644
index 00000000..903e0fc9
--- /dev/null
+++ b/ServiceBasedPlugins/dists/autogen/m4/pkg_config_utils.m4
@@ -0,0 +1,190 @@
+# This file is part of UltraStar Deluxe
+# Created by the UltraStar Deluxe Team
+
+
+# OVERVIEW
+#
+# PKG_VALUE(VARIABLE_PREFIX, POSTFIX, COMMAND, MODULE, HELP-STRING)
+# PKG_VERSION(VARIABLE_PREFIX, MODULE)
+# PKG_HAVE(VARIABLE_PREFIX, MODULE, [REQUIRED])
+# AX_TRIM(STRING)
+
+# SYNOPSIS
+#
+# PKG_VALUE(VARIABLE_PREFIX, POSTFIX, COMMAND, MODULE, HELP-STRING)
+#
+# DESCRIPTION
+#
+# Calls pkg-config with a given command and stores the result.
+# If the variable was already defined by the user or the package
+# is not present on the system ([$VARIABLE_PREFIX]_HAVE <> yes)
+# pkg-config will not be executed and the old value remains.
+# In addition the variable will be shown on "./configure --help"
+# described by a given help-string.
+#
+# Parameters:
+# - VARIABLE_PREFIX: the prefix for the variables storing
+# information about the package.
+# - POSTFIX: [$VARIABLE_PREFIX]_[$POSTFIX] will contain the value
+# - COMMAND: a pkg-config command, e.g. "variable=prefix"
+# - MODULE: the package pkg-config will retrieve info from
+# - HELP-STRING: description of the variable
+#
+# Sets:
+# [$VARIABLE_PREFIX]_[$POSTFIX] # value (AC_SUBST)
+
+AC_DEFUN([PKG_VALUE],
+[
+ AC_ARG_VAR([$1]_[$2], [$5, overriding pkg-config])
+ # check if variable was defined by the user
+ if test -z "$[$1]_[$2]"; then
+ # if not, get it from pkg-config
+ if test x$[$1][_HAVE] = xyes; then
+ PKG_CHECK_EXISTS([$4],
+ [[$1]_[$2]=`$PKG_CONFIG --[$3] --silence-errors "$4"`],
+ [# print error message and quit
+ err_msg=`$PKG_CONFIG --errors-to-stdout --print-errors "$4"`
+ AC_MSG_ERROR(
+[
+
+$err_msg
+
+If --with-[$1]=nocheck is defined the environment variable
+[$1]_[$2]
+must be set to avoid the need to call pkg-config.
+
+See the pkg-config man page for more details.
+])
+
+ ])
+ fi
+ fi
+ AC_SUBST([$1]_[$2])
+])
+
+# SYNOPSIS
+#
+# PKG_VERSION(VARIABLE_PREFIX, MODULE)
+#
+# DESCRIPTION
+#
+# Retrieves the version of a package
+#
+# Parameters:
+# - VARIABLE_PREFIX: the prefix for the variables storing
+# information about the package.
+# - MODULE: package name according to pkg-config
+#
+# Sets:
+# [$VARIABLE_PREFIX]_VERSION # full version string
+# # (format: "major.minor.release")
+#
+# [$VARIABLE_PREFIX]_VERSION_MAJOR # major version number
+# [$VARIABLE_PREFIX]_VERSION_MINOR # minor version number
+# [$VARIABLE_PREFIX]_VERSION_RELEASE # release version number
+#
+# [$VARIABLE_PREFIX]_VERSION_INT # integer representation:
+# # MMMmmmrrr (M:major,m:minor,r:release)
+
+AC_DEFUN([PKG_VERSION],
+[
+ if test x$[$1][_HAVE] = xyes; then
+ AC_MSG_CHECKING([version of $1])
+ PKG_VALUE([$1], [VERSION], [modversion], [$2], [version of $1])
+ AC_MSG_RESULT(@<:@$[$1][_VERSION]@:>@)
+ else
+ [$1][_VERSION]="0.0.0"
+ fi
+ AX_EXTRACT_VERSION([$1], $[$1][_VERSION])
+])
+
+
+# SYNOPSIS
+#
+# AX_TRIM(STRING)
+#
+# DESCRIPTION
+#
+# Removes surrounding whitespace
+
+AC_DEFUN([AX_TRIM],
+[
+ echo "[$1]" | $SED 's/^[[ \t]]*//' | $SED 's/[[ \t]]*$//'
+])
+
+# SYNOPSIS
+#
+# PKG_HAVE(VARIABLE_PREFIX, MODULE, [REQUIRED])
+#
+# DESCRIPTION
+#
+# Checks with pkg-config if a package exists and retrieves
+# information about it.
+#
+# Parameters:
+# - VARIABLE_PREFIX: the prefix for the variables storing information about the package.
+# - MODULE: package name according to pkg-config
+# - REQUIRED: if true, the configure-script is aborted if the package was not found
+#
+# Uses:
+# with_[$VARIABLE_PREFIX]: whether and how the package should be checked for
+# "check": check for the package but do not abort if it does not exist (default)
+# "no": do not check for the package (sets _HAVE to "no" and _VERSION to "0.0.0")
+# "yes": check for the package and abort if it does not exist
+# "nocheck": do not check for the package (sets _HAVE to "yes")
+#
+# Sets:
+# [$VARIABLE_PREFIX]_HAVE # package is available (values: "yes"|"no")
+# [$VARIABLE_PREFIX]_LIBS # linker flags (e.g. -Lmylibdir -lmylib)
+# [$VARIABLE_PREFIX]_LIBDIRS # library dirs (e.g. -Lmylibdir)
+
+AC_DEFUN([PKG_HAVE],
+[
+ have_lib="no"
+ AC_MSG_CHECKING([for $2])
+ if test x"$with_[$1]" = xnocheck; then
+ # do not call pkg-config, use user settings
+ have_lib="yes"
+ elif test x"$with_[$1]" != xno; then
+ # check if package exists
+ PKG_CHECK_EXISTS([$2], [
+ have_lib="yes"
+ [$1][_LIBS]=`$PKG_CONFIG --libs --silence-errors "$2"`
+ [$1][_LIBDIRS]=`$PKG_CONFIG --libs-only-L --silence-errors "$2"`
+ [$1][_LIBDIRS]=`AX_TRIM($[$1][_LIBDIRS])`
+ # add library directories to LIBS (ignore *_LIBS for now)
+ if test -n "$[$1][_LIBDIRS]"; then
+ LIBS="$LIBS $[$1][_LIBDIRS]"
+ fi
+ ])
+ fi
+ if test x$have_lib = xyes; then
+ [$1][_HAVE]="yes"
+ if test -n "$[$1][_LIBDIRS]"; then
+ # show additional lib-dirs
+ AC_MSG_RESULT(yes [(]$[$1][_LIBDIRS][)])
+ else
+ AC_MSG_RESULT(yes)
+ fi
+ else
+ [$1][_HAVE]="no"
+ AC_MSG_RESULT(no)
+
+ # check if package is required
+ if test x$3 = xyes -o x"$with_[$1]" = xyes ; then
+ # print error message and quit
+ err_msg=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+ AC_MSG_ERROR(
+[
+
+$err_msg
+
+Alternatively, you may set --with-[$1]=nocheck and the environment
+variables [$1]_[[...]] (see configure --help)
+to appropriate values to avoid the need to call pkg-config.
+
+See the pkg-config man page for more details.
+])
+ fi
+ fi
+])