1016
1016
AC_SUBST([am__untar])
1017
1017
]) # _AM_PROG_TAR
1019
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
1021
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
1023
# This program is free software; you can redistribute it and/or modify
1024
# it under the terms of the GNU General Public License as published by
1025
# the Free Software Foundation; either version 2 of the License, or
1026
# (at your option) any later version.
1028
# This program is distributed in the hope that it will be useful, but
1029
# WITHOUT ANY WARRANTY; without even the implied warranty of
1030
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1031
# General Public License for more details.
1033
# You should have received a copy of the GNU General Public License
1034
# along with this program; if not, write to the Free Software
1035
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1037
# As a special exception to the GNU General Public License, if you
1038
# distribute this file as part of a program that contains a
1039
# configuration script generated by Autoconf, you may include it under
1040
# the same distribution terms that you use for the rest of that program.
1042
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
1043
# ----------------------------------
1044
AC_DEFUN([PKG_PROG_PKG_CONFIG],
1045
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
1046
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
1047
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
1048
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
1049
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
1051
if test -n "$PKG_CONFIG"; then
1052
_pkg_min_version=m4_default([$1], [0.9.0])
1053
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
1054
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
1055
AC_MSG_RESULT([yes])
1062
])# PKG_PROG_PKG_CONFIG
1064
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
1066
# Check to see whether a particular set of modules exists. Similar
1067
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
1070
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
1071
# this or PKG_CHECK_MODULES is called, or make sure to call
1072
# PKG_CHECK_EXISTS manually
1073
# --------------------------------------------------------------
1074
AC_DEFUN([PKG_CHECK_EXISTS],
1075
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1076
if test -n "$PKG_CONFIG" && \
1077
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
1078
m4_ifval([$2], [$2], [:])
1079
m4_ifvaln([$3], [else
1084
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
1085
# ---------------------------------------------
1086
m4_define([_PKG_CONFIG],
1087
[if test -n "$$1"; then
1089
elif test -n "$PKG_CONFIG"; then
1090
PKG_CHECK_EXISTS([$3],
1091
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
1098
# _PKG_SHORT_ERRORS_SUPPORTED
1099
# -----------------------------
1100
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
1101
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
1102
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1103
_pkg_short_errors_supported=yes
1105
_pkg_short_errors_supported=no
1107
])# _PKG_SHORT_ERRORS_SUPPORTED
1110
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
1111
# [ACTION-IF-NOT-FOUND])
1114
# Note that if there is a possibility the first call to
1115
# PKG_CHECK_MODULES might not happen, you should be sure to include an
1116
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
1119
# --------------------------------------------------------------
1120
AC_DEFUN([PKG_CHECK_MODULES],
1121
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
1122
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
1123
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
1126
AC_MSG_CHECKING([for $1])
1128
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
1129
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
1131
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
1132
and $1[]_LIBS to avoid the need to call pkg-config.
1133
See the pkg-config man page for more details.])
1135
if test $pkg_failed = yes; then
1136
_PKG_SHORT_ERRORS_SUPPORTED
1137
if test $_pkg_short_errors_supported = yes; then
1138
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
1140
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
1142
# Put the nasty error message in config.log where it belongs
1143
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
1145
ifelse([$4], , [AC_MSG_ERROR(dnl
1146
[Package requirements ($2) were not met:
1150
Consider adjusting the PKG_CONFIG_PATH environment variable if you
1151
installed software in a non-standard prefix.
1155
[AC_MSG_RESULT([no])
1157
elif test $pkg_failed = untried; then
1158
ifelse([$4], , [AC_MSG_FAILURE(dnl
1159
[The pkg-config script could not be found or is too old. Make sure it
1160
is in your PATH or set the PKG_CONFIG environment variable to the full
1165
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
1168
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
1169
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
1170
AC_MSG_RESULT([yes])
1171
ifelse([$3], , :, [$3])
1173
])# PKG_CHECK_MODULES
1019
1175
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1021
1177
dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
2396
2609
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2397
2610
]) # XORG_COMPILER_BRAND
2612
# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
2614
# Minimum version: 1.16.0
2616
# Test if the compiler works when passed the given flag as a command line argument.
2617
# If it succeeds, the flag is appeneded to the given variable. If not, it tries the
2618
# next flag in the list until there are no more options.
2620
# Note that this does not guarantee that the compiler supports the flag as some
2621
# compilers will simply ignore arguments that they do not understand, but we do
2622
# attempt to weed out false positives by using -Werror=unknown-warning-option and
2623
# -Werror=unused-command-line-argument
2625
AC_DEFUN([XORG_TESTSET_CFLAG], [
2626
AC_REQUIRE([AC_PROG_CC_C99])
2627
m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2628
m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
2630
xorg_testset_save_CFLAGS="$CFLAGS"
2632
if test "x$xorg_testset_unknown_warning_option" = "x" ; then
2633
CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2634
AC_CACHE_CHECK([if $CC supports -Werror=unknown-warning-option],
2635
xorg_cv_cc_flag_unknown_warning_option,
2636
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2637
[xorg_cv_cc_flag_unknown_warning_option=yes],
2638
[xorg_cv_cc_flag_unknown_warning_option=no]))
2639
xorg_testset_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option
2640
CFLAGS="$xorg_testset_save_CFLAGS"
2643
if test "x$xorg_testset_unused_command_line_argument" = "x" ; then
2644
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2645
CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2647
CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2648
AC_CACHE_CHECK([if $CC supports -Werror=unused-command-line-argument],
2649
xorg_cv_cc_flag_unused_command_line_argument,
2650
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
2651
[xorg_cv_cc_flag_unused_command_line_argument=yes],
2652
[xorg_cv_cc_flag_unused_command_line_argument=no]))
2653
xorg_testset_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument
2654
CFLAGS="$xorg_testset_save_CFLAGS"
2658
m4_foreach([flag], m4_cdr($@), [
2659
if test $found = "no" ; then
2660
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
2661
CFLAGS="$CFLAGS -Werror=unknown-warning-option"
2664
if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
2665
CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
2668
CFLAGS="$CFLAGS ]flag["
2670
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
2671
AC_MSG_CHECKING([if $CC supports ]flag[])
2672
cacheid=`AS_ECHO_N([xorg_cv_cc_flag_]flag[])`
2673
AC_CACHE_VAL(AS_TR_SH($cacheid),
2674
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
2675
[eval AS_TR_SH($cacheid)=yes],
2676
[eval AS_TR_SH($cacheid)=no])])
2678
CFLAGS="$xorg_testset_save_CFLAGS"
2680
eval supported=$AS_TR_SH($cacheid)
2681
AC_MSG_RESULT([$supported])
2682
if test "$supported" = "yes" ; then
2688
]) # XORG_TESTSET_CFLAG
2690
# XORG_COMPILER_FLAGS
2692
# Minimum version: 1.16.0
2694
# Defines BASE_CFLAGS to contain a set of command line arguments supported
2695
# by the selected compiler which do NOT alter the generated code. These
2696
# arguments will cause the compiler to print various warnings during
2697
# compilation AND turn a conservative set of warnings into errors.
2699
# The set of flags supported by BASE_CFLAGS will grow in future
2700
# versions of util-macros as options are added to new compilers.
2702
AC_DEFUN([XORG_COMPILER_FLAGS], [
2703
AC_REQUIRE([XORG_COMPILER_BRAND])
2705
AC_ARG_ENABLE(selective-werror,
2706
AS_HELP_STRING([--disable-selective-werror],
2707
[Turn off selective compiler errors. (default: enabled)]),
2708
[SELECTIVE_WERROR=$enableval],
2709
[SELECTIVE_WERROR=yes])
2711
# -v is too short to test reliably with XORG_TESTSET_CFLAG
2712
if test "x$SUNCC" = "xyes"; then
2718
# This chunk of warnings were those that existed in the legacy CWARNFLAGS
2719
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall])
2720
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith])
2721
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes])
2722
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes])
2723
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations])
2724
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs])
2725
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast])
2726
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat])
2727
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition])
2728
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement])
2730
# This chunk adds additional warnings that could catch undesired effects.
2731
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused])
2732
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized])
2733
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow])
2734
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual])
2735
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn])
2736
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute])
2737
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
2739
# These are currently disabled because they are noisy. They will be enabled
2740
# in the future once the codebase is sufficiently modernized to silence
2741
# them. For now, I don't want them to drown out the other warnings.
2742
# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op])
2743
# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses])
2744
# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align])
2746
# Turn some warnings into errors, so we don't accidently get successful builds
2747
# when there are problems that should be fixed.
2749
if test "x$SELECTIVE_WERROR" = "xyes" ; then
2750
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
2751
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
2752
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
2753
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main])
2754
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces])
2755
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point])
2756
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
2757
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs])
2758
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds])
2759
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
2760
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
2761
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
2762
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
2764
AC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
2765
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
2766
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
2767
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
2768
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
2769
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
2770
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
2771
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
2772
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
2773
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
2774
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
2775
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
2776
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
2777
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
2780
AC_SUBST([BASE_CFLAGS])
2781
]) # XORG_COMPILER_FLAGS
2399
2783
# XORG_CWARNFLAGS
2400
2784
# ---------------
2401
2785
# Minimum version: 1.2.0
2786
# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2403
2788
# Defines CWARNFLAGS to enable C compiler warnings.
2790
# This function is deprecated because it defines -fno-strict-aliasing
2791
# which alters the code generated by the compiler. If -fno-strict-aliasing
2792
# is needed, then it should be added explicitly in the module when
2793
# it is updated to use BASE_CFLAGS.
2405
2795
AC_DEFUN([XORG_CWARNFLAGS], [
2406
AC_REQUIRE([AC_PROG_CC_C99])
2796
AC_REQUIRE([XORG_COMPILER_FLAGS])
2407
2797
AC_REQUIRE([XORG_COMPILER_BRAND])
2798
CWARNFLAGS="$BASE_CFLAGS"
2408
2799
if test "x$GCC" = xyes ; then
2409
CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
2410
-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
2411
-Wbad-function-cast -Wformat=2"
2412
case `$CC -dumpversion` in
2414
CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
2418
if test "x$SUNCC" = "xyes"; then
2800
CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2422
2802
AC_SUBST(CWARNFLAGS)
2423
2803
]) # XORG_CWARNFLAGS
2429
2809
# Add configure option to enable strict compilation flags, such as treating
2430
2810
# warnings as fatal errors.
2431
2811
# If --enable-strict-compilation is passed to configure, adds strict flags to
2812
# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
2434
2814
# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
2435
2815
# when strict compilation is unconditionally desired.
2436
2816
AC_DEFUN([XORG_STRICT_OPTION], [
2437
# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
2438
AC_REQUIRE([AC_PROG_CC_C99])
2439
AC_REQUIRE([XORG_COMPILER_BRAND])
2440
2817
AC_REQUIRE([XORG_CWARNFLAGS])
2818
AC_REQUIRE([XORG_COMPILER_FLAGS])
2442
2820
AC_ARG_ENABLE(strict-compilation,
2443
2821
AS_HELP_STRING([--enable-strict-compilation],
2444
2822
[Enable all warnings from compiler and make them errors (default: disabled)]),
2445
2823
[STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
2446
if test "x$GCC" = xyes ; then
2447
STRICT_CFLAGS="-pedantic -Werror"
2448
# Add -Werror=attributes if supported (gcc 4.2 & later)
2449
AC_MSG_CHECKING([if $CC supports -Werror=attributes])
2450
save_CFLAGS="$CFLAGS"
2451
CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes"
2452
AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])],
2453
[STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes"
2454
AC_MSG_RESULT([yes])],
2455
[AC_MSG_RESULT([no])])
2456
CFLAGS="$save_CFLAGS"
2457
elif test "x$SUNCC" = "xyes"; then
2458
STRICT_CFLAGS="-errwarn"
2459
elif test "x$INTELCC" = "xyes"; then
2460
STRICT_CFLAGS="-Werror"
2826
XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
2827
XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
2829
# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
2830
# activate it with -Werror, so we add it here explicitly.
2831
XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes])
2462
2833
if test "x$STRICT_COMPILE" = "xyes"; then
2834
BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
2463
2835
CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
2465
2837
AC_SUBST([STRICT_CFLAGS])
2838
AC_SUBST([BASE_CFLAGS])
2466
2839
AC_SUBST([CWARNFLAGS])
2467
2840
]) # XORG_STRICT_OPTION
2565
2939
AC_SUBST([CHANGELOG_CMD])
2566
2940
]) # XORG_CHANGELOG
2568
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
2570
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2572
# This program is free software; you can redistribute it and/or modify
2573
# it under the terms of the GNU General Public License as published by
2574
# the Free Software Foundation; either version 2 of the License, or
2575
# (at your option) any later version.
2577
# This program is distributed in the hope that it will be useful, but
2578
# WITHOUT ANY WARRANTY; without even the implied warranty of
2579
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2580
# General Public License for more details.
2582
# You should have received a copy of the GNU General Public License
2583
# along with this program; if not, write to the Free Software
2584
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2586
# As a special exception to the GNU General Public License, if you
2587
# distribute this file as part of a program that contains a
2588
# configuration script generated by Autoconf, you may include it under
2589
# the same distribution terms that you use for the rest of that program.
2591
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
2592
# ----------------------------------
2593
AC_DEFUN([PKG_PROG_PKG_CONFIG],
2594
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2595
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2596
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
2597
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2598
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2600
if test -n "$PKG_CONFIG"; then
2601
_pkg_min_version=m4_default([$1], [0.9.0])
2602
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2603
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2604
AC_MSG_RESULT([yes])
2611
])# PKG_PROG_PKG_CONFIG
2613
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2615
# Check to see whether a particular set of modules exists. Similar
2616
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
2619
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
2620
# this or PKG_CHECK_MODULES is called, or make sure to call
2621
# PKG_CHECK_EXISTS manually
2622
# --------------------------------------------------------------
2623
AC_DEFUN([PKG_CHECK_EXISTS],
2624
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2625
if test -n "$PKG_CONFIG" && \
2626
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2627
m4_ifval([$2], [$2], [:])
2628
m4_ifvaln([$3], [else
2633
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2634
# ---------------------------------------------
2635
m4_define([_PKG_CONFIG],
2636
[if test -n "$$1"; then
2638
elif test -n "$PKG_CONFIG"; then
2639
PKG_CHECK_EXISTS([$3],
2640
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2647
# _PKG_SHORT_ERRORS_SUPPORTED
2648
# -----------------------------
2649
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
2650
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2651
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
2652
_pkg_short_errors_supported=yes
2654
_pkg_short_errors_supported=no
2656
])# _PKG_SHORT_ERRORS_SUPPORTED
2659
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2660
# [ACTION-IF-NOT-FOUND])
2663
# Note that if there is a possibility the first call to
2664
# PKG_CHECK_MODULES might not happen, you should be sure to include an
2665
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
2668
# --------------------------------------------------------------
2669
AC_DEFUN([PKG_CHECK_MODULES],
2670
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2671
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2672
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2675
AC_MSG_CHECKING([for $1])
2677
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2678
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
2680
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
2681
and $1[]_LIBS to avoid the need to call pkg-config.
2682
See the pkg-config man page for more details.])
2684
if test $pkg_failed = yes; then
2685
_PKG_SHORT_ERRORS_SUPPORTED
2686
if test $_pkg_short_errors_supported = yes; then
2687
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
2689
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
2691
# Put the nasty error message in config.log where it belongs
2692
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
2694
ifelse([$4], , [AC_MSG_ERROR(dnl
2695
[Package requirements ($2) were not met:
2699
Consider adjusting the PKG_CONFIG_PATH environment variable if you
2700
installed software in a non-standard prefix.
2704
[AC_MSG_RESULT([no])
2706
elif test $pkg_failed = untried; then
2707
ifelse([$4], , [AC_MSG_FAILURE(dnl
2708
[The pkg-config script could not be found or is too old. Make sure it
2709
is in your PATH or set the PKG_CONFIG environment variable to the full
2714
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
2717
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2718
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2719
AC_MSG_RESULT([yes])
2720
ifelse([$3], , :, [$3])
2722
])# PKG_CHECK_MODULES