Update to makedepend 1.0.4. Tested by naddy@ on a bulk ports build

This commit is contained in:
matthieu 2012-03-12 20:27:35 +00:00
parent b95fc6de31
commit 8a1e57d115
16 changed files with 10446 additions and 314 deletions

View File

@ -1,3 +1,82 @@
commit b6605e3945eaaabbd090672f33e888d394f9a4f0
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Mar 7 21:52:14 2012 -0800
makedepend 1.0.4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit cb8bbc06de0baf2dff4a703e6d2bb47bdf90d896
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Oct 7 18:07:24 2011 -0700
define(): Avoid assigning constant string to non-const char *
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit b9770941ae829ad2cb985efe809d6e3dd690648b
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Oct 7 18:02:34 2011 -0700
Call strdup directly, instead of via copy macro
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 0ecf5f3251033ab6efa1a0d881f75ed9ce60b5a4
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Oct 7 18:00:39 2011 -0700
Add const attributes to fix gcc -Wwrite-strings warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 97ae52f80f9e382917889bde1913367572e89012
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Oct 7 17:47:36 2011 -0700
Move extern variable declarations to common header (def.h)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 3602fb0b7ba2bde9c73610693dbb50534fe42b81
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Oct 7 17:34:17 2011 -0700
Strip trailing whitespace
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}'
git diff -w & git diff -b show no diffs from this change
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit c1f32dc1d4c1758065468e1f5d34707099f59f33
Author: Stuart Kreitman <Stuart.Kreitman@Oracle.COM>
Date: Mon May 24 14:21:21 2010 -0700
Raise MAXFILES from 1024 to 2048
Required in order to build OpenTTD on Solaris
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6917536
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit cc23acdd80fa0cad53e46f99cd0ff5998ec7f607
Author: Cyril Brulebois <kibi@debian.org>
Date: Sun Oct 31 15:50:36 2010 +0100
Fix bashism: shell string comparison is =, not ==.
Signed-off-by: Cyril Brulebois <kibi@debian.org>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 186aae76a84860d0efef638ff499ab1968fffd75
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Oct 29 22:53:25 2010 -0700
Add README with pointers to mailing list, bugzilla & git repos
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit e67389ecc0c425bcfec0a3184ee48919e0e2c61a commit e67389ecc0c425bcfec0a3184ee48919e0e2c61a
Author: Alan Coopersmith <alan.coopersmith@oracle.com> Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Oct 29 22:45:35 2010 -0700 Date: Fri Oct 29 22:45:35 2010 -0700

View File

@ -24,9 +24,9 @@ pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = . top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@ INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644 install_sh_DATA = ${SHELL} $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c install_sh_PROGRAM = ${SHELL} $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c install_sh_SCRIPT = ${SHELL} $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA) INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name) transform = $(program_transform_name)
NORMAL_INSTALL = : NORMAL_INSTALL = :
@ -38,7 +38,7 @@ POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
bin_PROGRAMS = makedepend$(EXEEXT) bin_PROGRAMS = makedepend$(EXEEXT)
DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/makedepend-config.h.in \ $(srcdir)/Makefile.in $(srcdir)/makedepend-config.h.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog config.guess \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog config.guess \
config.sub depcomp install-sh missing config.sub depcomp install-sh missing
@ -103,6 +103,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@ AUTOMAKE = @AUTOMAKE@
AWK = @AWK@ AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@ CC = @CC@
CCDEPMODE = @CCDEPMODE@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@
@ -159,6 +160,7 @@ PKG_CONFIG = @PKG_CONFIG@
SED = @SED@ SED = @SED@
SET_MAKE = @SET_MAKE@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@ SHELL = @SHELL@
STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@ STRIP = @STRIP@
VERSION = @VERSION@ VERSION = @VERSION@
XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_MAN_PAGE = @XORG_MAN_PAGE@

25
util/makedepend/README Normal file
View File

@ -0,0 +1,25 @@
makedepend - create dependencies in makefiles
All questions regarding this software should be directed at the
Xorg mailing list:
http://lists.freedesktop.org/mailman/listinfo/xorg
Please submit bug reports to the Xorg bugzilla:
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
The master development code repository can be found at:
git://anongit.freedesktop.org/git/xorg/util/makedepend
http://cgit.freedesktop.org/xorg/util/makedepend
For patch submission instructions, see:
http://www.x.org/wiki/Development/Documentation/SubmittingPatches
For more information on the git code manager, see:
http://wiki.x.org/wiki/GitPage

View File

@ -1034,7 +1034,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what # See the "minimum version" comment for each macro you use to see what
# version you require. # version you require.
m4_defun([XORG_MACROS_VERSION],[ m4_defun([XORG_MACROS_VERSION],[
m4_define([vers_have], [1.11.0]) m4_define([vers_have], [1.16.2])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,, m4_if(m4_cmp(maj_have, maj_needed), 0,,
@ -1061,7 +1061,7 @@ AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
# which is not the best choice for supporting other OS'es, but covers most # which is not the best choice for supporting other OS'es, but covers most
# of the ones we need for now. # of the ones we need for now.
AC_MSG_CHECKING([if $RAWCPP requires -undef]) AC_MSG_CHECKING([if $RAWCPP requires -undef])
AC_LANG_CONFTEST([Does cpp redefine unix ?]) AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])])
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
else else
@ -1079,7 +1079,7 @@ fi
rm -f conftest.$ac_ext rm -f conftest.$ac_ext
AC_MSG_CHECKING([if $RAWCPP requires -traditional]) AC_MSG_CHECKING([if $RAWCPP requires -traditional])
AC_LANG_CONFTEST([Does cpp preserve "whitespace"?]) AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])])
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
else else
@ -1429,6 +1429,123 @@ AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes]) AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
]) # XORG_WITH_XMLTO ]) # XORG_WITH_XMLTO
# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT])
# --------------------------------------------
# Minimum version: 1.12.0
# Minimum version for optional DEFAULT argument: 1.12.0
#
# XSLT (Extensible Stylesheet Language Transformations) is a declarative,
# XML-based language used for the transformation of XML documents.
# The xsltproc command line tool is for applying XSLT stylesheets to XML documents.
# It is used under the cover by xmlto to generate html files from DocBook/XML.
# The XSLT processor is often used as a standalone tool for transformations.
# It should not be assumed that this tool is used only to work with documnetation.
# When DEFAULT is not specified, --with-xsltproc assumes 'auto'.
#
# Interface to module:
# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation
# XSLTPROC: returns the path of the xsltproc program found
# returns the path set by the user in the environment
# --with-xsltproc: 'yes' user instructs the module to use xsltproc
# 'no' user instructs the module not to use xsltproc
# have_xsltproc: returns yes if xsltproc found in PATH or no
#
# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path.
#
AC_DEFUN([XORG_WITH_XSLTPROC],[
AC_ARG_VAR([XSLTPROC], [Path to xsltproc command])
# Preserves the interface, should it be implemented later
m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])])
m4_define([_defopt], m4_default([$2], [auto]))
AC_ARG_WITH(xsltproc,
AS_HELP_STRING([--with-xsltproc],
[Use xsltproc for the transformation of XML documents (default: ]_defopt[)]),
[use_xsltproc=$withval], [use_xsltproc=]_defopt)
m4_undefine([_defopt])
if test "x$use_xsltproc" = x"auto"; then
AC_PATH_PROG([XSLTPROC], [xsltproc])
if test "x$XSLTPROC" = "x"; then
AC_MSG_WARN([xsltproc not found - cannot transform XML documents])
have_xsltproc=no
else
have_xsltproc=yes
fi
elif test "x$use_xsltproc" = x"yes" ; then
AC_PATH_PROG([XSLTPROC], [xsltproc])
if test "x$XSLTPROC" = "x"; then
AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH])
fi
have_xsltproc=yes
elif test "x$use_xsltproc" = x"no" ; then
if test "x$XSLTPROC" != "x"; then
AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified])
fi
have_xsltproc=no
else
AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no'])
fi
AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes])
]) # XORG_WITH_XSLTPROC
# XORG_WITH_PERL([MIN-VERSION], [DEFAULT])
# ----------------------------------------
# Minimum version: 1.15.0
#
# PERL (Practical Extraction and Report Language) is a language optimized for
# scanning arbitrary text files, extracting information from those text files,
# and printing reports based on that information.
#
# When DEFAULT is not specified, --with-perl assumes 'auto'.
#
# Interface to module:
# HAVE_PERL: used in makefiles to conditionally scan text files
# PERL: returns the path of the perl program found
# returns the path set by the user in the environment
# --with-perl: 'yes' user instructs the module to use perl
# 'no' user instructs the module not to use perl
# have_perl: returns yes if perl found in PATH or no
#
# If the user sets the value of PERL, AC_PATH_PROG skips testing the path.
#
AC_DEFUN([XORG_WITH_PERL],[
AC_ARG_VAR([PERL], [Path to perl command])
# Preserves the interface, should it be implemented later
m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])])
m4_define([_defopt], m4_default([$2], [auto]))
AC_ARG_WITH(perl,
AS_HELP_STRING([--with-perl],
[Use perl for extracting information from files (default: ]_defopt[)]),
[use_perl=$withval], [use_perl=]_defopt)
m4_undefine([_defopt])
if test "x$use_perl" = x"auto"; then
AC_PATH_PROG([PERL], [perl])
if test "x$PERL" = "x"; then
AC_MSG_WARN([perl not found - cannot extract information and report])
have_perl=no
else
have_perl=yes
fi
elif test "x$use_perl" = x"yes" ; then
AC_PATH_PROG([PERL], [perl])
if test "x$PERL" = "x"; then
AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH])
fi
have_perl=yes
elif test "x$use_perl" = x"no" ; then
if test "x$PERL" != "x"; then
AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified])
fi
have_perl=no
else
AC_MSG_ERROR([--with-perl expects 'yes' or 'no'])
fi
AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes])
]) # XORG_WITH_PERL
# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT]) # XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT])
# ---------------- # ----------------
# Minimum version: 1.5.0 # Minimum version: 1.5.0
@ -1674,10 +1791,11 @@ AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes]) AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
]) # XORG_WITH_GROFF ]) # XORG_WITH_GROFF
# XORG_WITH_FOP([DEFAULT]) # XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
# ---------------- # ---------------------------------------
# Minimum version: 1.6.0 # Minimum version: 1.6.0
# Minimum version for optional DEFAULT argument: 1.11.0 # Minimum version for optional DEFAULT argument: 1.11.0
# Minimum version for optional MIN-VERSION argument: 1.15.0
# #
# Documentation tools are not always available on all platforms and sometimes # Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the # not at the appropriate level. This macro enables a module to test for the
@ -1697,7 +1815,7 @@ AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
# #
AC_DEFUN([XORG_WITH_FOP],[ AC_DEFUN([XORG_WITH_FOP],[
AC_ARG_VAR([FOP], [Path to fop command]) AC_ARG_VAR([FOP], [Path to fop command])
m4_define([_defopt], m4_default([$1], [auto])) m4_define([_defopt], m4_default([$2], [auto]))
AC_ARG_WITH(fop, AC_ARG_WITH(fop,
AS_HELP_STRING([--with-fop], AS_HELP_STRING([--with-fop],
[Use fop to regenerate documentation (default: ]_defopt[)]), [Use fop to regenerate documentation (default: ]_defopt[)]),
@ -1726,6 +1844,22 @@ elif test "x$use_fop" = x"no" ; then
else else
AC_MSG_ERROR([--with-fop expects 'yes' or 'no']) AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
fi fi
# Test for a minimum version of fop, if provided.
m4_ifval([$1],
[if test "$have_fop" = yes; then
# scrape the fop version
AC_MSG_CHECKING([for fop minimum version])
fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3`
AC_MSG_RESULT([$fop_version])
AS_VERSION_COMPARE([$fop_version], [$1],
[if test "x$use_fop" = xauto; then
AC_MSG_WARN([fop version $fop_version found, but $1 needed])
have_fop=no
else
AC_MSG_ERROR([fop version $fop_version found, but $1 needed])
fi])
fi])
AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
]) # XORG_WITH_FOP ]) # XORG_WITH_FOP
@ -1808,12 +1942,12 @@ AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
# parm1: specify the default value, yes or no. # parm1: specify the default value, yes or no.
# #
AC_DEFUN([XORG_ENABLE_DOCS],[ AC_DEFUN([XORG_ENABLE_DOCS],[
m4_define([default], m4_default([$1], [yes])) m4_define([docs_default], m4_default([$1], [yes]))
AC_ARG_ENABLE(docs, AC_ARG_ENABLE(docs,
AS_HELP_STRING([--enable-docs], AS_HELP_STRING([--enable-docs],
[Enable building the documentation (default: ]default[)]), [Enable building the documentation (default: ]docs_default[)]),
[build_docs=$enableval], [build_docs=]default) [build_docs=$enableval], [build_docs=]docs_default)
m4_undefine([default]) m4_undefine([docs_default])
AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes]) AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
AC_MSG_CHECKING([whether to build documentation]) AC_MSG_CHECKING([whether to build documentation])
AC_MSG_RESULT([$build_docs]) AC_MSG_RESULT([$build_docs])
@ -1885,6 +2019,251 @@ AC_MSG_CHECKING([whether to build functional specifications])
AC_MSG_RESULT([$build_specs]) AC_MSG_RESULT([$build_specs])
]) # XORG_ENABLE_SPECS ]) # XORG_ENABLE_SPECS
# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto)
# ----------------------------------------------
# Minimum version: 1.13.0
#
# This macro enables a builder to enable/disable unit testing
# It makes no assumption about the test cases implementation
# Test cases may or may not use Automake "Support for test suites"
# They may or may not use the software utility library GLib
#
# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL
# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib.
# The variable enable_unit_tests is used by other macros in this file.
#
# Interface to module:
# ENABLE_UNIT_TESTS: used in makefiles to conditionally build tests
# enable_unit_tests: used in configure.ac for additional configuration
# --enable-unit-tests: 'yes' user instructs the module to build tests
# 'no' user instructs the module not to build tests
# parm1: specify the default value, yes or no.
#
AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
AC_BEFORE([$0], [XORG_WITH_GLIB])
AC_BEFORE([$0], [XORG_LD_WRAP])
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
m4_define([_defopt], m4_default([$1], [auto]))
AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
[Enable building unit test cases (default: ]_defopt[)]),
[enable_unit_tests=$enableval], [enable_unit_tests=]_defopt)
m4_undefine([_defopt])
AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno])
AC_MSG_CHECKING([whether to build unit test cases])
AC_MSG_RESULT([$enable_unit_tests])
]) # XORG_ENABLE_UNIT_TESTS
# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
# ----------------------------------------
# Minimum version: 1.13.0
#
# GLib is a library which provides advanced data structures and functions.
# This macro enables a module to test for the presence of Glib.
#
# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
# Otherwise the value of $enable_unit_tests is blank.
#
# Interface to module:
# HAVE_GLIB: used in makefiles to conditionally build targets
# with_glib: used in configure.ac to know if GLib has been found
# --with-glib: 'yes' user instructs the module to use glib
# 'no' user instructs the module not to use glib
#
AC_DEFUN([XORG_WITH_GLIB],[
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
m4_define([_defopt], m4_default([$2], [auto]))
AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib],
[Use GLib library for unit testing (default: ]_defopt[)]),
[with_glib=$withval], [with_glib=]_defopt)
m4_undefine([_defopt])
have_glib=no
# Do not probe GLib if user explicitly disabled unit testing
if test "x$enable_unit_tests" != x"no"; then
# Do not probe GLib if user explicitly disabled it
if test "x$with_glib" != x"no"; then
m4_ifval(
[$1],
[PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])],
[PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])]
)
fi
fi
# Not having GLib when unit testing has been explicitly requested is an error
if test "x$enable_unit_tests" = x"yes"; then
if test "x$have_glib" = x"no"; then
AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
fi
fi
# Having unit testing disabled when GLib has been explicitly requested is an error
if test "x$enable_unit_tests" = x"no"; then
if test "x$with_glib" = x"yes"; then
AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found])
fi
fi
# Not having GLib when it has been explicitly requested is an error
if test "x$with_glib" = x"yes"; then
if test "x$have_glib" = x"no"; then
AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found])
fi
fi
AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
]) # XORG_WITH_GLIB
# XORG_LD_WRAP([required|optional])
# ---------------------------------
# Minimum version: 1.13.0
#
# Check if linker supports -wrap, passed via compiler flags
#
# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
# Otherwise the value of $enable_unit_tests is blank.
#
# Argument added in 1.16.0 - default is "required", to match existing behavior
# of returning an error if enable_unit_tests is yes, and ld -wrap is not
# available, an argument of "optional" allows use when some unit tests require
# ld -wrap and others do not.
#
AC_DEFUN([XORG_LD_WRAP],[
XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
[AC_LANG_PROGRAM([#include <stdlib.h>
void __wrap_exit(int status) { return; }],
[exit(0);])])
# Not having ld wrap when unit testing has been explicitly requested is an error
if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
if test "x$have_ld_wrap" = x"no"; then
AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
fi
fi
AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
#
]) # XORG_LD_WRAP
# XORG_CHECK_LINKER_FLAGS
# -----------------------
# SYNOPSIS
#
# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
#
# DESCRIPTION
#
# Check whether the given linker FLAGS work with the current language's
# linker, or whether they give an error.
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# PROGRAM-SOURCE is the program source to link with, if needed
#
# NOTE: Based on AX_CHECK_COMPILER_FLAGS.
#
# LICENSE
#
# Copyright (c) 2009 Mike Frysinger <vapier@gentoo.org>
# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2009 Matteo Frigo
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.#
AC_DEFUN([XORG_CHECK_LINKER_FLAGS],
[AC_MSG_CHECKING([whether the linker accepts $1])
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
AS_LITERAL_IF([$1],
[AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
ax_save_FLAGS=$LDFLAGS
LDFLAGS="$1"
AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
LDFLAGS=$ax_save_FLAGS])],
[ax_save_FLAGS=$LDFLAGS
LDFLAGS="$1"
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
LDFLAGS=$ax_save_FLAGS])
eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1])
AC_MSG_RESULT($xorg_check_linker_flags)
if test "x$xorg_check_linker_flags" = xyes; then
m4_default([$2], :)
else
m4_default([$3], :)
fi
]) # XORG_CHECK_LINKER_FLAGS
# XORG_MEMORY_CHECK_FLAGS
# -----------------------
# Minimum version: 1.16.0
#
# This macro attempts to find appropriate memory checking functionality
# for various platforms which unit testing code may use to catch various
# forms of memory allocation and access errors in testing.
#
# Interface to module:
# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
# Usually added to TESTS_ENVIRONMENT in Makefile.am
#
# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
#
AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
[Environment variables to enable memory checking in tests])
# Check for different types of support on different platforms
case $host_os in
solaris*)
AC_CHECK_LIB([umem], [umem_alloc],
[malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
;;
*-gnu*) # GNU libc - Value is used as a single byte bit pattern,
# both directly and inverted, so should not be 0 or 255.
malloc_debug_env='MALLOC_PERTURB_=15'
;;
darwin*)
malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
;;
*bsd*)
malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
;;
esac
# User supplied flags override default flags
if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
fi
AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
]) # XORG_WITH_LINT
# XORG_CHECK_MALLOC_ZERO # XORG_CHECK_MALLOC_ZERO
# ---------------------- # ----------------------
# Minimum version: 1.0.0 # Minimum version: 1.0.0
@ -1901,18 +2280,16 @@ AC_ARG_ENABLE(malloc0returnsnull,
AC_MSG_CHECKING([whether malloc(0) returns NULL]) AC_MSG_CHECKING([whether malloc(0) returns NULL])
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
AC_RUN_IFELSE([ AC_RUN_IFELSE([AC_LANG_PROGRAM([
char *malloc(); #include <stdlib.h>
char *realloc(); ],[
char *calloc();
main() {
char *m0, *r0, *c0, *p; char *m0, *r0, *c0, *p;
m0 = malloc(0); m0 = malloc(0);
p = malloc(10); p = malloc(10);
r0 = realloc(p,0); r0 = realloc(p,0);
c0 = calloc(0); c0 = calloc(0,10);
exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1); exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
}], ])],
[MALLOC_ZERO_RETURNS_NULL=yes], [MALLOC_ZERO_RETURNS_NULL=yes],
[MALLOC_ZERO_RETURNS_NULL=no], [MALLOC_ZERO_RETURNS_NULL=no],
[MALLOC_ZERO_RETURNS_NULL=yes]) [MALLOC_ZERO_RETURNS_NULL=yes])
@ -2038,59 +2415,296 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
]) # XORG_LINT_LIBRARY ]) # XORG_LINT_LIBRARY
# XORG_COMPILER_BRAND
# -------------------
# Minimum version: 1.14.0
#
# Checks for various brands of compilers and sets flags as appropriate:
# GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
# GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
# clang compiler - sets CLANGCC to "yes"
# Intel compiler - sets INTELCC to "yes"
# Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
#
AC_DEFUN([XORG_COMPILER_BRAND], [
AC_LANG_CASE(
[C], [
AC_REQUIRE([AC_PROG_CC_C99])
],
[C++], [
AC_REQUIRE([AC_PROG_CXX])
]
)
AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
]) # XORG_COMPILER_BRAND
# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
# ---------------
# Minimum version: 1.16.0
#
# Test if the compiler works when passed the given flag as a command line argument.
# If it succeeds, the flag is appeneded to the given variable. If not, it tries the
# next flag in the list until there are no more options.
#
# Note that this does not guarantee that the compiler supports the flag as some
# compilers will simply ignore arguments that they do not understand, but we do
# attempt to weed out false positives by using -Werror=unknown-warning-option and
# -Werror=unused-command-line-argument
#
AC_DEFUN([XORG_TESTSET_CFLAG], [
m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
AC_LANG_COMPILER_REQUIRE
AC_LANG_CASE(
[C], [
AC_REQUIRE([AC_PROG_CC_C99])
define([PREFIX], [C])
],
[C++], [
define([PREFIX], [CXX])
]
)
[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
if test "x$xorg_testset_unknown_warning_option" = "x" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
AC_CACHE_CHECK([if compiler supports -Werror=unknown-warning-option],
xorg_cv_compiler_flag_unknown_warning_option,
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[xorg_cv_compiler_flag_unknown_warning_option=yes],
[xorg_cv_compiler_flag_unknown_warning_option=no]))
xorg_testset_unknown_warning_option=$xorg_cv_compiler_flag_unknown_warning_option
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
fi
if test "x$xorg_testset_unused_command_line_argument" = "x" ; then
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
fi
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
AC_CACHE_CHECK([if compiler supports -Werror=unused-command-line-argument],
xorg_cv_compiler_flag_unused_command_line_argument,
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[xorg_cv_compiler_flag_unused_command_line_argument=yes],
[xorg_cv_compiler_flag_unused_command_line_argument=no]))
xorg_testset_unused_command_line_argument=$xorg_cv_compiler_flag_unused_command_line_argument
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
fi
found="no"
m4_foreach([flag], m4_cdr($@), [
if test $found = "no" ; then
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
fi
if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
fi
PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
AC_MSG_CHECKING([if $CC supports ]flag[])
cacheid=`AS_ECHO([xorg_cv_cc_flag_]flag[])`
AC_CACHE_VAL(AS_TR_SH($cacheid),
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
[eval AS_TR_SH($cacheid)=yes],
[eval AS_TR_SH($cacheid)=no])])
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
eval supported=$AS_TR_SH($cacheid)
AC_MSG_RESULT([$supported])
if test "$supported" = "yes" ; then
$1="$$1 ]flag["
found="yes"
fi
fi
])
]) # XORG_TESTSET_CFLAG
# XORG_COMPILER_FLAGS
# ---------------
# Minimum version: 1.16.0
#
# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
# arguments supported by the selected compiler which do NOT alter the generated
# code. These arguments will cause the compiler to print various warnings
# during compilation AND turn a conservative set of warnings into errors.
#
# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
# future versions of util-macros as options are added to new compilers.
#
AC_DEFUN([XORG_COMPILER_FLAGS], [
AC_REQUIRE([XORG_COMPILER_BRAND])
AC_ARG_ENABLE(selective-werror,
AS_HELP_STRING([--disable-selective-werror],
[Turn off selective compiler errors. (default: enabled)]),
[SELECTIVE_WERROR=$enableval],
[SELECTIVE_WERROR=yes])
AC_LANG_CASE(
[C], [
define([PREFIX], [C])
],
[C++], [
define([PREFIX], [CXX])
]
)
# -v is too short to test reliably with XORG_TESTSET_CFLAG
if test "x$SUNCC" = "xyes"; then
[BASE_]PREFIX[FLAGS]="-v"
else
[BASE_]PREFIX[FLAGS]=""
fi
# This chunk of warnings were those that existed in the legacy CWARNFLAGS
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
AC_LANG_CASE(
[C], [
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
]
)
# This chunk adds additional warnings that could catch undesired effects.
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
# These are currently disabled because they are noisy. They will be enabled
# in the future once the codebase is sufficiently modernized to silence
# them. For now, I don't want them to drown out the other warnings.
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
# Turn some warnings into errors, so we don't accidently get successful builds
# when there are problems that should be fixed.
if test "x$SELECTIVE_WERROR" = "xyes" ; then
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
else
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])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
fi
AC_SUBST([BASE_]PREFIX[FLAGS])
]) # XORG_COMPILER_FLAGS
# XORG_CWARNFLAGS # XORG_CWARNFLAGS
# --------------- # ---------------
# Minimum version: 1.2.0 # Minimum version: 1.2.0
# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
# #
# Defines CWARNFLAGS to enable C compiler warnings. # Defines CWARNFLAGS to enable C compiler warnings.
# #
# This function is deprecated because it defines -fno-strict-aliasing
# which alters the code generated by the compiler. If -fno-strict-aliasing
# is needed, then it should be added explicitly in the module when
# it is updated to use BASE_CFLAGS.
#
AC_DEFUN([XORG_CWARNFLAGS], [ AC_DEFUN([XORG_CWARNFLAGS], [
AC_REQUIRE([AC_PROG_CC_C99]) AC_REQUIRE([XORG_COMPILER_FLAGS])
if test "x$GCC" = xyes ; then AC_REQUIRE([XORG_COMPILER_BRAND])
CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ AC_LANG_CASE(
-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \ [C], [
-Wbad-function-cast -Wformat=2" CWARNFLAGS="$BASE_CFLAGS"
case `$CC -dumpversion` in if test "x$GCC" = xyes ; then
3.4.* | 4.*) CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement" fi
;; AC_SUBST(CWARNFLAGS)
esac ]
else )
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
if test "x$SUNCC" = "xyes"; then
CWARNFLAGS="-v"
fi
fi
AC_SUBST(CWARNFLAGS)
]) # XORG_CWARNFLAGS ]) # XORG_CWARNFLAGS
# XORG_STRICT_OPTION # XORG_STRICT_OPTION
# ----------------------- # -----------------------
# Minimum version: 1.3.0 # Minimum version: 1.3.0
# #
# Add configure option to enable strict compilation # Add configure option to enable strict compilation flags, such as treating
# warnings as fatal errors.
# If --enable-strict-compilation is passed to configure, adds strict flags to
# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
#
# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
# when strict compilation is unconditionally desired.
AC_DEFUN([XORG_STRICT_OPTION], [ AC_DEFUN([XORG_STRICT_OPTION], [
# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
AC_REQUIRE([AC_PROG_CC_C99])
AC_REQUIRE([XORG_CWARNFLAGS]) AC_REQUIRE([XORG_CWARNFLAGS])
AC_REQUIRE([XORG_COMPILER_FLAGS])
AC_ARG_ENABLE(strict-compilation, AC_ARG_ENABLE(strict-compilation,
AS_HELP_STRING([--enable-strict-compilation], AS_HELP_STRING([--enable-strict-compilation],
[Enable all warnings from compiler and make them errors (default: disabled)]), [Enable all warnings from compiler and make them errors (default: disabled)]),
[STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
AC_LANG_CASE(
[C], [
define([PREFIX], [C])
],
[C++], [
define([PREFIX], [CXX])
]
)
[STRICT_]PREFIX[FLAGS]=""
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
# activate it with -Werror, so we add it here explicitly.
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
if test "x$STRICT_COMPILE" = "xyes"; then if test "x$STRICT_COMPILE" = "xyes"; then
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
if test "x$GCC" = xyes ; then
STRICT_CFLAGS="-pedantic -Werror"
elif test "x$SUNCC" = "xyes"; then
STRICT_CFLAGS="-errwarn"
elif test "x$INTELCC" = "xyes"; then
STRICT_CFLAGS="-Werror"
fi
fi fi
CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" AC_SUBST([STRICT_]PREFIX[FLAGS])
AC_SUBST([CWARNFLAGS]) AC_SUBST([BASE_]PREFIX[FLAGS])
AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
]) # XORG_STRICT_OPTION ]) # XORG_STRICT_OPTION
# XORG_DEFAULT_OPTIONS # XORG_DEFAULT_OPTIONS
@ -2101,6 +2715,7 @@ AC_SUBST([CWARNFLAGS])
# #
AC_DEFUN([XORG_DEFAULT_OPTIONS], [ AC_DEFUN([XORG_DEFAULT_OPTIONS], [
AC_REQUIRE([AC_PROG_INSTALL]) AC_REQUIRE([AC_PROG_INSTALL])
XORG_COMPILER_FLAGS
XORG_CWARNFLAGS XORG_CWARNFLAGS
XORG_STRICT_OPTION XORG_STRICT_OPTION
XORG_RELEASE_VERSION XORG_RELEASE_VERSION

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
AC_PREREQ([2.60]) AC_PREREQ([2.60])
AC_INIT([makedepend], [1.0.3], AC_INIT([makedepend], [1.0.4],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]) [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE AM_MAINTAINER_MODE

View File

@ -40,7 +40,7 @@ in this Software without prior written authorization from The Open Group.
#include <sys/stat.h> #include <sys/stat.h>
#define MAXDEFINES 512 #define MAXDEFINES 512
#define MAXFILES 1024 #define MAXFILES 2048
#define MAXINCFILES 128 /* "-include" files */ #define MAXINCFILES 128 /* "-include" files */
#define MAXDIRS 64 #define MAXDIRS 64
#define SYMTABINC 10 /* must be > 1 for define() to work right */ #define SYMTABINC 10 /* must be > 1 for define() to work right */
@ -130,14 +130,13 @@ struct filepointer {
#include <stdlib.h> #include <stdlib.h>
#define copy(s) strdup(s)
int match(const char *str, const char * const *list); int match(const char *str, const char * const *list);
char *base_name(const char *file); char *base_name(const char *file);
char *getnextline(struct filepointer *fp); char *getnextline(struct filepointer *fp);
struct symtab **slookup(char *symbol, struct inclist *file); struct symtab **slookup(const char *symbol, struct inclist *file);
struct symtab **isdefined(char *symbol, struct inclist *file, struct symtab **isdefined(const char *symbol, struct inclist *file,
struct inclist **srcfile); struct inclist **srcfile);
struct symtab **fdefined(char *symbol, struct inclist *file, struct symtab **fdefined(const char *symbol, struct inclist *file,
struct inclist **srcfile); struct inclist **srcfile);
struct filepointer *getfile(const char *file); struct filepointer *getfile(const char *file);
void included_by(struct inclist *ip, void included_by(struct inclist *ip,
@ -150,9 +149,10 @@ struct inclist *inc_path(const char *file, const char *include,
void freefile(struct filepointer *fp); void freefile(struct filepointer *fp);
void define2(char *name, char *val, struct inclist *file); void define2(const char *name, const char *val,
struct inclist *file);
void define(char *def, struct inclist *file); void define(char *def, struct inclist *file);
void undefine(char *symbol, struct inclist *file); void undefine(const char *symbol, struct inclist *file);
int find_includes(struct filepointer *filep, int find_includes(struct filepointer *filep,
struct inclist *file, struct inclist *file,
struct inclist *file_red, struct inclist *file_red,
@ -176,3 +176,20 @@ int cppsetup(const char *filename,
extern void fatalerr(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2); extern void fatalerr(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2);
extern void warning(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2); extern void warning(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2);
extern void warning1(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2); extern void warning1(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2);
extern struct inclist inclist[ MAXFILES ];
extern struct inclist *inclistp;
extern struct inclist *inclistnext;
extern struct inclist maininclist;
extern const char *includedirs[ ];
extern const char **includedirsnext;
extern const char * const directives[];
extern char *notdotdot[ ];
extern const char *objprefix;
extern const char *objsuffix;
extern int width;
extern boolean printed;
extern boolean verbose;
extern boolean show_where_not;
extern boolean warn_multiple;

View File

@ -27,14 +27,6 @@ in this Software without prior written authorization from The Open Group.
#include "def.h" #include "def.h"
extern struct inclist inclist[ MAXFILES ],
*inclistp, *inclistnext;
extern const char *includedirs[ ],
**includedirsnext;
extern char *notdotdot[ ];
extern boolean show_where_not;
extern boolean warn_multiple;
static boolean static boolean
isdot(const char *p) isdot(const char *p)
{ {
@ -64,7 +56,7 @@ issymbolic(const char *dir, const char *component)
return (TRUE); return (TRUE);
if (lstat(buf, &st) == 0 if (lstat(buf, &st) == 0
&& (st.st_mode & S_IFMT) == S_IFLNK) { && (st.st_mode & S_IFMT) == S_IFLNK) {
*pp++ = copy(buf); *pp++ = strdup(buf);
if (pp >= &notdotdot[ MAXDIRS ]) if (pp >= &notdotdot[ MAXDIRS ])
fatalerr("out of .. dirs, increase MAXDIRS\n"); fatalerr("out of .. dirs, increase MAXDIRS\n");
return(TRUE); return(TRUE);
@ -161,12 +153,12 @@ newinclude(const char *newfile, const char *incstring)
ip = inclistp++; ip = inclistp++;
if (inclistp == inclist + MAXFILES - 1) if (inclistp == inclist + MAXFILES - 1)
fatalerr("out of space: increase MAXFILES\n"); fatalerr("out of space: increase MAXFILES\n");
ip->i_file = copy(newfile); ip->i_file = strdup(newfile);
if (incstring == NULL) if (incstring == NULL)
ip->i_incstring = ip->i_file; ip->i_incstring = ip->i_file;
else else
ip->i_incstring = copy(incstring); ip->i_incstring = strdup(incstring);
inclistnext = inclistp; inclistnext = inclistp;
return(ip); return(ip);

View File

@ -99,9 +99,9 @@ const char *includedirs[ MAXDIRS + 1 ],
char *notdotdot[ MAXDIRS ]; char *notdotdot[ MAXDIRS ];
static int cmdinc_count = 0; static int cmdinc_count = 0;
static char *cmdinc_list[ 2 * MAXINCFILES ]; static char *cmdinc_list[ 2 * MAXINCFILES ];
char *objprefix = ""; const char *objprefix = "";
char *objsuffix = OBJSUFFIX; const char *objsuffix = OBJSUFFIX;
static char *startat = "# DO NOT DELETE"; static const char *startat = "# DO NOT DELETE";
int width = 78; int width = 78;
static boolean append = FALSE; static boolean append = FALSE;
boolean printed = FALSE; boolean printed = FALSE;
@ -159,7 +159,7 @@ main(int argc, char *argv[])
char *makefile = NULL; char *makefile = NULL;
struct filepointer *filecontent; struct filepointer *filecontent;
const struct symtab *psymp = predefs; const struct symtab *psymp = predefs;
char *endmarker = NULL; const char *endmarker = NULL;
char *defincdir = NULL; char *defincdir = NULL;
char **undeflist = NULL; char **undeflist = NULL;
int numundefs = 0, i; int numundefs = 0, i;
@ -742,7 +742,7 @@ done:
char *base_name(const char *in_file) char *base_name(const char *in_file)
{ {
char *p; char *p;
char *file = copy(in_file); char *file = strdup(in_file);
for(p=file+strlen(file); p>file && *p != '.'; p--) ; for(p=file+strlen(file); p>file && *p != '.'; p--) ;
if (*p == '.') if (*p == '.')

View File

@ -26,13 +26,6 @@ in this Software without prior written authorization from The Open Group.
#include "def.h" #include "def.h"
extern const char * const directives[];
extern struct inclist inclist[ MAXFILES ],
*inclistnext,
maininclist;
extern const char *includedirs[ ],
**includedirsnext;
static int deftype (char *line, struct filepointer *filep, static int deftype (char *line, struct filepointer *filep,
struct inclist *file_red, struct inclist *file, struct inclist *file_red, struct inclist *file,
int parse_it); int parse_it);
@ -258,7 +251,7 @@ deftype (char *line, struct filepointer *filep,
} }
struct symtab ** struct symtab **
fdefined(char *symbol, struct inclist *file, struct inclist **srcfile) fdefined(const char *symbol, struct inclist *file, struct inclist **srcfile)
{ {
struct inclist **ip; struct inclist **ip;
struct symtab **val; struct symtab **val;
@ -289,7 +282,7 @@ fdefined(char *symbol, struct inclist *file, struct inclist **srcfile)
} }
struct symtab ** struct symtab **
isdefined(char *symbol, struct inclist *file, struct inclist **srcfile) isdefined(const char *symbol, struct inclist *file, struct inclist **srcfile)
{ {
struct symtab **val; struct symtab **val;
@ -320,7 +313,7 @@ zero_value(char *filename,
} }
void void
define2(char *name, char *val, struct inclist *file) define2(const char *name, const char *val, struct inclist *file)
{ {
int first, last, below; int first, last, below;
register struct symtab **sp = NULL, **dest; register struct symtab **sp = NULL, **dest;
@ -346,8 +339,8 @@ define2(char *name, char *val, struct inclist *file)
while (last >= first) while (last >= first)
{ {
/* Fast inline binary search */ /* Fast inline binary search */
register char *s1; register const char *s1;
register char *s2; register const char *s2;
register int middle = (first + last) / 2; register int middle = (first + last) / 2;
/* Fast inline strchr() */ /* Fast inline strchr() */
@ -383,7 +376,7 @@ define2(char *name, char *val, struct inclist *file)
debug(1,("redefining %s from %s to %s in file %s\n", debug(1,("redefining %s from %s to %s in file %s\n",
name, (*sp)->s_value, val, file->i_file)); name, (*sp)->s_value, val, file->i_file));
free((*sp)->s_value); free((*sp)->s_value);
(*sp)->s_value = copy(val); (*sp)->s_value = strdup(val);
return; return;
} }
@ -399,8 +392,8 @@ define2(char *name, char *val, struct inclist *file)
fatalerr("malloc()/realloc() failure in insert_defn()\n"); fatalerr("malloc()/realloc() failure in insert_defn()\n");
debug(1,("defining %s to %s in file %s\n", name, val, file->i_file)); debug(1,("defining %s to %s in file %s\n", name, val, file->i_file));
stab->s_name = copy(name); stab->s_name = strdup(name);
stab->s_value = copy(val); stab->s_value = strdup(val);
*sp = stab; *sp = stab;
} }
@ -419,12 +412,13 @@ define(char *def, struct inclist *file)
val++; val++;
if (!*val) if (!*val)
val = "1"; define2(def, "1", file);
define2(def, val, file); else
define2(def, val, file);
} }
struct symtab ** struct symtab **
slookup(char *symbol, struct inclist *file) slookup(const char *symbol, struct inclist *file)
{ {
register int first = 0; register int first = 0;
register int last; register int last;
@ -437,8 +431,8 @@ slookup(char *symbol, struct inclist *file)
while (last >= first) while (last >= first)
{ {
/* Fast inline binary search */ /* Fast inline binary search */
register char *s1; register const char *s1;
register char *s2; register const char *s2;
register int middle = (first + last) / 2; register int middle = (first + last) / 2;
/* Fast inline strchr() */ /* Fast inline strchr() */
@ -536,7 +530,7 @@ merge2defines(struct inclist *file1, struct inclist *file2)
} }
void void
undefine(char *symbol, struct inclist *file) undefine(const char *symbol, struct inclist *file)
{ {
register struct symtab **ptr; register struct symtab **ptr;
struct inclist *srcfile; struct inclist *srcfile;

View File

@ -26,15 +26,6 @@ in this Software without prior written authorization from The Open Group.
#include "def.h" #include "def.h"
extern struct inclist inclist[ MAXFILES ],
*inclistp;
extern char *objprefix;
extern char *objsuffix;
extern int width;
extern boolean printed;
extern boolean verbose;
extern boolean show_where_not;
void void
add_include(struct filepointer *filep, struct inclist *file, add_include(struct filepointer *filep, struct inclist *file,
struct inclist *file_red, const char *include, int type, struct inclist *file_red, const char *include, int type,

View File

@ -5,7 +5,7 @@
set -e set -e
if [ "x$MAKEDEPEND" == "x" ]; then if [ "x$MAKEDEPEND" = "x" ]; then
MAKEDEPEND=makedepend MAKEDEPEND=makedepend
fi fi