~ubuntu-branches/ubuntu/wily/xfonts-utils/wily-proposed

« back to all changes in this revision

Viewing changes to mkfontscale/aclocal.m4

  • Committer: Package Import Robot
  • Author(s): Julien Cristau
  • Date: 2012-05-06 00:01:33 UTC
  • Revision ID: package-import@ubuntu.com-20120506000133-t3s2kq76s15z0stw
Tags: 1:7.7~1
* font-util 1.3.0
* mkfontdir 1.0.7
* mkfontscale 1.1.0
* Drop dh_testroot from debian/rules clean.
* Move fontutil.pc to /usr/share/pkgconfig.
* Mark xfonts-utils Multi-arch: foreign.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1016
1016
AC_SUBST([am__untar])
1017
1017
]) # _AM_PROG_TAR
1018
1018
 
 
1019
# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 
1020
 
1021
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
 
1022
#
 
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.
 
1027
#
 
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.
 
1032
#
 
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.
 
1036
#
 
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.
 
1041
 
 
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])
 
1050
fi
 
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])
 
1056
        else
 
1057
                AC_MSG_RESULT([no])
 
1058
                PKG_CONFIG=""
 
1059
        fi
 
1060
                
 
1061
fi[]dnl
 
1062
])# PKG_PROG_PKG_CONFIG
 
1063
 
 
1064
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
1065
#
 
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.
 
1068
#
 
1069
#
 
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
 
1080
  $3])dnl
 
1081
fi])
 
1082
 
 
1083
 
 
1084
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
 
1085
# ---------------------------------------------
 
1086
m4_define([_PKG_CONFIG],
 
1087
[if test -n "$$1"; then
 
1088
    pkg_cv_[]$1="$$1"
 
1089
 elif test -n "$PKG_CONFIG"; then
 
1090
    PKG_CHECK_EXISTS([$3],
 
1091
                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
 
1092
                     [pkg_failed=yes])
 
1093
 else
 
1094
    pkg_failed=untried
 
1095
fi[]dnl
 
1096
])# _PKG_CONFIG
 
1097
 
 
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
 
1104
else
 
1105
        _pkg_short_errors_supported=no
 
1106
fi[]dnl
 
1107
])# _PKG_SHORT_ERRORS_SUPPORTED
 
1108
 
 
1109
 
 
1110
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
 
1111
# [ACTION-IF-NOT-FOUND])
 
1112
#
 
1113
#
 
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
 
1117
#
 
1118
#
 
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
 
1124
 
 
1125
pkg_failed=no
 
1126
AC_MSG_CHECKING([for $1])
 
1127
 
 
1128
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 
1129
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
1130
 
 
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.])
 
1134
 
 
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`
 
1139
        else 
 
1140
                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
 
1141
        fi
 
1142
        # Put the nasty error message in config.log where it belongs
 
1143
        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
 
1144
 
 
1145
        ifelse([$4], , [AC_MSG_ERROR(dnl
 
1146
[Package requirements ($2) were not met:
 
1147
 
 
1148
$$1_PKG_ERRORS
 
1149
 
 
1150
Consider adjusting the PKG_CONFIG_PATH environment variable if you
 
1151
installed software in a non-standard prefix.
 
1152
 
 
1153
_PKG_TEXT
 
1154
])],
 
1155
                [AC_MSG_RESULT([no])
 
1156
                $4])
 
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
 
1161
path to pkg-config.
 
1162
 
 
1163
_PKG_TEXT
 
1164
 
 
1165
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
 
1166
                [$4])
 
1167
else
 
1168
        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
 
1169
        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
 
1170
        AC_MSG_RESULT([yes])
 
1171
        ifelse([$3], , :, [$3])
 
1172
fi[]dnl
 
1173
])# PKG_CHECK_MODULES
 
1174
 
1019
1175
dnl xorg-macros.m4.  Generated from xorg-macros.m4.in xorgversion.m4 by configure.
1020
1176
dnl
1021
1177
dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1055
1211
# See the "minimum version" comment for each macro you use to see what 
1056
1212
# version you require.
1057
1213
m4_defun([XORG_MACROS_VERSION],[
1058
 
m4_define([vers_have], [1.15.0])
 
1214
m4_define([vers_have], [1.16.1])
1059
1215
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
1060
1216
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
1061
1217
m4_if(m4_cmp(maj_have, maj_needed), 0,,
2063
2219
AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
2064
2220
AC_BEFORE([$0], [XORG_WITH_GLIB])
2065
2221
AC_BEFORE([$0], [XORG_LD_WRAP])
 
2222
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
2066
2223
m4_define([_defopt], m4_default([$1], [auto]))
2067
2224
AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
2068
2225
        [Enable building unit test cases (default: ]_defopt[)]),
2134
2291
AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
2135
2292
]) # XORG_WITH_GLIB
2136
2293
 
2137
 
# XORG_LD_WRAP
2138
 
# ------------
 
2294
# XORG_LD_WRAP([required|optional])
 
2295
# ---------------------------------
2139
2296
# Minimum version: 1.13.0
2140
2297
#
2141
2298
# Check if linker supports -wrap, passed via compiler flags
2143
2300
# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
2144
2301
# Otherwise the value of $enable_unit_tests is blank.
2145
2302
#
 
2303
# Argument added in 1.16.0 - default is "required", to match existing behavior
 
2304
# of returning an error if enable_unit_tests is yes, and ld -wrap is not
 
2305
# available, an argument of "optional" allows use when some unit tests require
 
2306
# ld -wrap and others do not.
 
2307
#
2146
2308
AC_DEFUN([XORG_LD_WRAP],[
2147
 
XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no])
 
2309
XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
 
2310
    [AC_LANG_PROGRAM([#include <stdlib.h>
 
2311
                      void __wrap_exit(int status) { return; }],
 
2312
                     [exit(0);])])
2148
2313
# Not having ld wrap when unit testing has been explicitly requested is an error
2149
 
if test "x$enable_unit_tests" = x"yes"; then
 
2314
if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
2150
2315
  if test "x$have_ld_wrap" = x"no"; then
2151
2316
    AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
2152
2317
  fi
2159
2324
# -----------------------
2160
2325
# SYNOPSIS
2161
2326
#
2162
 
#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
 
2327
#   XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
2163
2328
#
2164
2329
# DESCRIPTION
2165
2330
#
2169
2334
#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
2170
2335
#   success/failure.
2171
2336
#
 
2337
#   PROGRAM-SOURCE is the program source to link with, if needed
 
2338
#
2172
2339
#   NOTE: Based on AX_CHECK_COMPILER_FLAGS.
2173
2340
#
2174
2341
# LICENSE
2209
2376
  [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
2210
2377
      ax_save_FLAGS=$LDFLAGS
2211
2378
      LDFLAGS="$1"
2212
 
      AC_LINK_IFELSE([AC_LANG_PROGRAM()],
 
2379
      AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
2213
2380
        AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
2214
2381
        AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
2215
2382
      LDFLAGS=$ax_save_FLAGS])],
2228
2395
fi
2229
2396
]) # XORG_CHECK_LINKER_FLAGS
2230
2397
 
 
2398
# XORG_MEMORY_CHECK_FLAGS
 
2399
# -----------------------
 
2400
# Minimum version: 1.16.0
 
2401
#
 
2402
# This macro attempts to find appropriate memory checking functionality
 
2403
# for various platforms which unit testing code may use to catch various
 
2404
# forms of memory allocation and access errors in testing.
 
2405
#
 
2406
# Interface to module:
 
2407
# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
 
2408
#                         Usually added to TESTS_ENVIRONMENT in Makefile.am
 
2409
#
 
2410
# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
 
2411
#
 
2412
AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
 
2413
 
 
2414
AC_REQUIRE([AC_CANONICAL_HOST])
 
2415
AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
 
2416
           [Environment variables to enable memory checking in tests])
 
2417
 
 
2418
# Check for different types of support on different platforms
 
2419
case $host_os in
 
2420
    solaris*)
 
2421
        AC_CHECK_LIB([umem], [umem_alloc],
 
2422
            [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
 
2423
        ;;
 
2424
    *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
 
2425
        # both directly and inverted, so should not be 0 or 255.
 
2426
        malloc_debug_env='MALLOC_PERTURB_=15'
 
2427
        ;;
 
2428
    darwin*)
 
2429
        malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
 
2430
        ;;
 
2431
    *bsd*)
 
2432
        malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
 
2433
        ;;
 
2434
esac
 
2435
 
 
2436
# User supplied flags override default flags
 
2437
if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
 
2438
    malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
 
2439
fi
 
2440
 
 
2441
AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
 
2442
]) # XORG_WITH_LINT
 
2443
 
2231
2444
# XORG_CHECK_MALLOC_ZERO
2232
2445
# ----------------------
2233
2446
# Minimum version: 1.0.0
2396
2609
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
2397
2610
]) # XORG_COMPILER_BRAND
2398
2611
 
 
2612
# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
 
2613
# ---------------
 
2614
# Minimum version: 1.16.0
 
2615
#
 
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.
 
2619
#
 
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
 
2624
#
 
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])])
 
2629
 
 
2630
xorg_testset_save_CFLAGS="$CFLAGS"
 
2631
 
 
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"
 
2641
fi
 
2642
 
 
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"
 
2646
        fi
 
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"
 
2655
fi
 
2656
 
 
2657
found="no"
 
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"
 
2662
                fi
 
2663
 
 
2664
                if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
 
2665
                        CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
 
2666
                fi
 
2667
 
 
2668
                CFLAGS="$CFLAGS ]flag["
 
2669
 
 
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])])
 
2677
 
 
2678
                CFLAGS="$xorg_testset_save_CFLAGS"
 
2679
 
 
2680
                eval supported=$AS_TR_SH($cacheid)
 
2681
                AC_MSG_RESULT([$supported])
 
2682
                if test "$supported" = "yes" ; then
 
2683
                        $1="$$1 ]flag["
 
2684
                        found="yes"
 
2685
                fi
 
2686
        fi
 
2687
])
 
2688
]) # XORG_TESTSET_CFLAG
 
2689
 
 
2690
# XORG_COMPILER_FLAGS
 
2691
# ---------------
 
2692
# Minimum version: 1.16.0
 
2693
#
 
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.
 
2698
#
 
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.
 
2701
#
 
2702
AC_DEFUN([XORG_COMPILER_FLAGS], [
 
2703
AC_REQUIRE([XORG_COMPILER_BRAND])
 
2704
 
 
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])
 
2710
 
 
2711
# -v is too short to test reliably with XORG_TESTSET_CFLAG
 
2712
if test "x$SUNCC" = "xyes"; then
 
2713
    BASE_CFLAGS="-v"
 
2714
else
 
2715
    BASE_CFLAGS=""
 
2716
fi
 
2717
 
 
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])
 
2729
 
 
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])
 
2738
 
 
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])
 
2745
 
 
2746
# Turn some warnings into errors, so we don't accidently get successful builds
 
2747
# when there are problems that should be fixed.
 
2748
 
 
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
 
2763
else
 
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])
 
2778
fi
 
2779
 
 
2780
AC_SUBST([BASE_CFLAGS])
 
2781
]) # XORG_COMPILER_FLAGS
 
2782
 
2399
2783
# XORG_CWARNFLAGS
2400
2784
# ---------------
2401
2785
# Minimum version: 1.2.0
 
2786
# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
2402
2787
#
2403
2788
# Defines CWARNFLAGS to enable C compiler warnings.
2404
2789
#
 
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.
 
2794
#
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
2413
 
    3.4.* | 4.*)
2414
 
        CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
2415
 
        ;;
2416
 
    esac
2417
 
else
2418
 
    if test "x$SUNCC" = "xyes"; then
2419
 
        CWARNFLAGS="-v"
2420
 
    fi
 
2800
    CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
2421
2801
fi
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
2432
 
# $CWARNFLAGS.
 
2812
# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
2433
2813
#
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])
2441
2819
 
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"
2461
 
fi
 
2824
 
 
2825
STRICT_CFLAGS=""
 
2826
XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
 
2827
XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
 
2828
 
 
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])
 
2832
 
2462
2833
if test "x$STRICT_COMPILE" = "xyes"; then
 
2834
    BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
2463
2835
    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
2464
2836
fi
2465
2837
AC_SUBST([STRICT_CFLAGS])
 
2838
AC_SUBST([BASE_CFLAGS])
2466
2839
AC_SUBST([CWARNFLAGS])
2467
2840
]) # XORG_STRICT_OPTION
2468
2841
 
2474
2847
#
2475
2848
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
2476
2849
AC_REQUIRE([AC_PROG_INSTALL])
 
2850
XORG_COMPILER_FLAGS
2477
2851
XORG_CWARNFLAGS
2478
2852
XORG_STRICT_OPTION
2479
2853
XORG_RELEASE_VERSION
2565
2939
AC_SUBST([CHANGELOG_CMD])
2566
2940
]) # XORG_CHANGELOG
2567
2941
 
2568
 
# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2569
 
2570
 
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2571
 
#
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.
2576
 
#
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.
2581
 
#
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.
2585
 
#
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.
2590
 
 
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])
2599
 
fi
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])
2605
 
        else
2606
 
                AC_MSG_RESULT([no])
2607
 
                PKG_CONFIG=""
2608
 
        fi
2609
 
                
2610
 
fi[]dnl
2611
 
])# PKG_PROG_PKG_CONFIG
2612
 
 
2613
 
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2614
 
#
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.
2617
 
#
2618
 
#
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
2629
 
  $3])dnl
2630
 
fi])
2631
 
 
2632
 
 
2633
 
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2634
 
# ---------------------------------------------
2635
 
m4_define([_PKG_CONFIG],
2636
 
[if test -n "$$1"; then
2637
 
    pkg_cv_[]$1="$$1"
2638
 
 elif test -n "$PKG_CONFIG"; then
2639
 
    PKG_CHECK_EXISTS([$3],
2640
 
                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2641
 
                     [pkg_failed=yes])
2642
 
 else
2643
 
    pkg_failed=untried
2644
 
fi[]dnl
2645
 
])# _PKG_CONFIG
2646
 
 
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
2653
 
else
2654
 
        _pkg_short_errors_supported=no
2655
 
fi[]dnl
2656
 
])# _PKG_SHORT_ERRORS_SUPPORTED
2657
 
 
2658
 
 
2659
 
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2660
 
# [ACTION-IF-NOT-FOUND])
2661
 
#
2662
 
#
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
2666
 
#
2667
 
#
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
2673
 
 
2674
 
pkg_failed=no
2675
 
AC_MSG_CHECKING([for $1])
2676
 
 
2677
 
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2678
 
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
2679
 
 
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.])
2683
 
 
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`
2688
 
        else 
2689
 
                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
2690
 
        fi
2691
 
        # Put the nasty error message in config.log where it belongs
2692
 
        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
2693
 
 
2694
 
        ifelse([$4], , [AC_MSG_ERROR(dnl
2695
 
[Package requirements ($2) were not met:
2696
 
 
2697
 
$$1_PKG_ERRORS
2698
 
 
2699
 
Consider adjusting the PKG_CONFIG_PATH environment variable if you
2700
 
installed software in a non-standard prefix.
2701
 
 
2702
 
_PKG_TEXT
2703
 
])],
2704
 
                [AC_MSG_RESULT([no])
2705
 
                $4])
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
2710
 
path to pkg-config.
2711
 
 
2712
 
_PKG_TEXT
2713
 
 
2714
 
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
2715
 
                [$4])
2716
 
else
2717
 
        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2718
 
        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2719
 
        AC_MSG_RESULT([yes])
2720
 
        ifelse([$3], , :, [$3])
2721
 
fi[]dnl
2722
 
])# PKG_CHECK_MODULES
2723