Update to xmodmap 1.0.6

This commit is contained in:
matthieu 2012-04-07 16:07:52 +00:00
parent 8915dc5e75
commit 8563437cef
14 changed files with 10584 additions and 271 deletions

View File

@ -1,3 +1,111 @@
commit b355a23e6787f348db97faaa48085428277c659b
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Thu Mar 22 23:04:32 2012 -0700
xmodmap 1.0.6
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit d0dfd2128e6111b967c51136d97093d3b53ee6d6
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Nov 11 21:07:30 2011 -0800
Replace chk_malloc + sprintf with asprintf
Includes local private copy of asprintf for OS'es without it in libc.
Removes chk_malloc as no callers remain anymore.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit fecb1f5a0c2121de6d9209fc9525ac7d9b9555ea
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Nov 11 20:46:00 2011 -0800
Free copy of input line at end of process_line instead of leaking it
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 66c09c83aa2f64b31dc657f90447c269621545b7
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Nov 11 20:40:18 2011 -0800
Fix gcc -Wwrite-strings warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 8751095511c7d9065ab12a40e90e38bdd9d728e4
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Fri Nov 11 11:22:43 2011 -0800
Add missing _X_NORETURN to functions that need it
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit c71811ebe193cecc4add4c2d9cec751fc721343b
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Fri Nov 11 11:21:45 2011 -0800
Include strings.h for strcasecmp
Our minimum requirement for X11 is currently Unix98. Unix98 provides
strcasecmp in <strings.h>. This commit fixes implicit declarations
of this function on systems that closely adhere to the standard.
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit b6b5bc9e9874934dd1c1b80a1aa0c0b1c454eab2
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Sat May 7 22:05:16 2011 -0700
Improve error handling in copy_to_scratch
handle.c:95:5: warning: Array access (from variable 'buf') results in a null pointer dereference
buf[len] = '\0';
^~~
Found-by: clang static analyzer
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 1f801eea5f4d17b83aee1170423d65a74e01a138
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Sat May 7 21:45:22 2011 -0700
Dead code removal
xmodmap.c:159:5: warning: Value stored to 'status' is never read
status = 0;
^ ~
Found-by: clang static analyzer
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit d427337286e0a8ac061d5acbc326e7bdb8b056a3
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Fri Mar 4 20:50:41 2011 -0500
man: replace hard coded section with __appmansuffix__
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit 65011e8a86f64d5f7e9f39052e04e5ee7e57ce1b
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Wed Jan 12 16:28:02 2011 -0500
config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS
This silences an Autoconf warning
commit ec2cab2dc9b6e7c804984320d8f560adbc3477ff
Author: Jesse Adkins <jesserayadkins@gmail.com>
Date: Tue Sep 28 13:29:50 2010 -0700
Purge cvs tags.
Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
commit 3fe64746bb6c3ede67c9967ebd216a8a39cdb2ea
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Sep 24 11:53:40 2010 -0700

View File

@ -44,9 +44,9 @@ pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
install_sh_DATA = ${SHELL} $(install_sh) -c -m 644
install_sh_PROGRAM = ${SHELL} $(install_sh) -c
install_sh_SCRIPT = ${SHELL} $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
@ -122,6 +122,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -176,6 +177,7 @@ PKG_CONFIG = @PKG_CONFIG@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XMODMAP_CFLAGS = @XMODMAP_CFLAGS@

764
app/xmodmap/aclocal.m4 vendored
View File

@ -498,18 +498,6 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
@ -1034,7 +1022,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
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_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@ -1061,7 +1049,7 @@ AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
# which is not the best choice for supporting other OS'es, but covers most
# of the ones we need for now.
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
AC_MSG_RESULT([no])
else
@ -1079,7 +1067,7 @@ fi
rm -f conftest.$ac_ext
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
AC_MSG_RESULT([no])
else
@ -1429,6 +1417,123 @@ AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
]) # 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])
# ----------------
# Minimum version: 1.5.0
@ -1674,10 +1779,11 @@ AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
]) # XORG_WITH_GROFF
# XORG_WITH_FOP([DEFAULT])
# ----------------
# XORG_WITH_FOP([MIN-VERSION], [DEFAULT])
# ---------------------------------------
# Minimum version: 1.6.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
# not at the appropriate level. This macro enables a module to test for the
@ -1697,7 +1803,7 @@ AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes])
#
AC_DEFUN([XORG_WITH_FOP],[
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,
AS_HELP_STRING([--with-fop],
[Use fop to regenerate documentation (default: ]_defopt[)]),
@ -1726,6 +1832,22 @@ elif test "x$use_fop" = x"no" ; then
else
AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
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])
]) # XORG_WITH_FOP
@ -1808,12 +1930,12 @@ AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
# parm1: specify the default value, yes or no.
#
AC_DEFUN([XORG_ENABLE_DOCS],[
m4_define([default], m4_default([$1], [yes]))
m4_define([docs_default], m4_default([$1], [yes]))
AC_ARG_ENABLE(docs,
AS_HELP_STRING([--enable-docs],
[Enable building the documentation (default: ]default[)]),
[build_docs=$enableval], [build_docs=]default)
m4_undefine([default])
[Enable building the documentation (default: ]docs_default[)]),
[build_docs=$enableval], [build_docs=]docs_default)
m4_undefine([docs_default])
AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
AC_MSG_CHECKING([whether to build documentation])
AC_MSG_RESULT([$build_docs])
@ -1885,6 +2007,288 @@ AC_MSG_CHECKING([whether to build functional specifications])
AC_MSG_RESULT([$build_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_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
# ------------------------------------------------------
# Minimum version: 1.17.0
#
# This macro enables a builder to enable/disable integration testing
# It makes no assumption about the test cases' implementation
# Test cases may or may not use Automake "Support for test suites"
#
# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
# usually requires less dependencies and may be built and run under less
# stringent environments than integration tests.
#
# Interface to module:
# ENABLE_INTEGRATION_TESTS: used in makefiles to conditionally build tests
# enable_integration_tests: used in configure.ac for additional configuration
# --enable-integration-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_INTEGRATION_TESTS],[
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
m4_define([_defopt], m4_default([$1], [auto]))
AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
[Enable building integration test cases (default: ]_defopt[)]),
[enable_integration_tests=$enableval],
[enable_integration_tests=]_defopt)
m4_undefine([_defopt])
AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
[test "x$enable_integration_tests" != xno])
AC_MSG_CHECKING([whether to build unit test cases])
AC_MSG_RESULT([$enable_integration_tests])
]) # XORG_ENABLE_INTEGRATION_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.
#
# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
# test support usually requires less dependencies and may be built and run under
# less stringent environments than integration tests.
#
# 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
# ----------------------
# Minimum version: 1.0.0
@ -1901,18 +2305,16 @@ AC_ARG_ENABLE(malloc0returnsnull,
AC_MSG_CHECKING([whether malloc(0) returns NULL])
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
AC_RUN_IFELSE([
char *malloc();
char *realloc();
char *calloc();
main() {
AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
],[
char *m0, *r0, *c0, *p;
m0 = malloc(0);
p = malloc(10);
r0 = realloc(p,0);
c0 = calloc(0);
exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
}],
c0 = calloc(0,10);
exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
])],
[MALLOC_ZERO_RETURNS_NULL=yes],
[MALLOC_ZERO_RETURNS_NULL=no],
[MALLOC_ZERO_RETURNS_NULL=yes])
@ -2038,59 +2440,300 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
]) # 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])
define([CACHE_PREFIX], [cc])
define([COMPILER], [$CC])
],
[C++], [
define([PREFIX], [CXX])
define([CACHE_PREFIX], [cxx])
define([COMPILER], [$CXX])
]
)
[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
if test "x$[xorg_testset_]CACHE_PREFIX[_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_]CACHE_PREFIX[_flag_unknown_warning_option],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
fi
if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
if test "x$[xorg_testset_]CACHE_PREFIX[_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_]CACHE_PREFIX[_flag_unused_command_line_argument],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_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 ]COMPILER[ supports]flag[])
cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
AC_CACHE_VAL($cacheid,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
[eval $cacheid=yes],
[eval $cacheid=no])])
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
eval supported=\$$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
# ---------------
# Minimum version: 1.2.0
# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
#
# 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_REQUIRE([AC_PROG_CC_C99])
if test "x$GCC" = xyes ; then
CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
-Wbad-function-cast -Wformat=2"
case `$CC -dumpversion` in
3.4.* | 4.*)
CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
;;
esac
else
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
if test "x$SUNCC" = "xyes"; then
CWARNFLAGS="-v"
AC_REQUIRE([XORG_COMPILER_FLAGS])
AC_REQUIRE([XORG_COMPILER_BRAND])
AC_LANG_CASE(
[C], [
CWARNFLAGS="$BASE_CFLAGS"
if test "x$GCC" = xyes ; then
CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
fi
fi
AC_SUBST(CWARNFLAGS)
AC_SUBST(CWARNFLAGS)
]
)
]) # XORG_CWARNFLAGS
# XORG_STRICT_OPTION
# -----------------------
# 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], [
# 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_COMPILER_FLAGS])
AC_ARG_ENABLE(strict-compilation,
AS_HELP_STRING([--enable-strict-compilation],
[Enable all warnings from compiler and make them errors (default: disabled)]),
[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
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
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
[BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
fi
CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
AC_SUBST([CWARNFLAGS])
AC_SUBST([STRICT_]PREFIX[FLAGS])
AC_SUBST([BASE_]PREFIX[FLAGS])
AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
]) # XORG_STRICT_OPTION
# XORG_DEFAULT_OPTIONS
@ -2101,6 +2744,7 @@ AC_SUBST([CWARNFLAGS])
#
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
AC_REQUIRE([AC_PROG_INSTALL])
XORG_COMPILER_FLAGS
XORG_CWARNFLAGS
XORG_STRICT_OPTION
XORG_RELEASE_VERSION

View File

@ -1,5 +1,8 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `asprintf' function. */
#undef HAVE_ASPRINTF
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

9798
app/xmodmap/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ dnl Process this file with autoconf to create configure.
AC_PREREQ([2.60])
AC_INIT([xmodmap],
[1.0.5],
[1.0.6],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[xmodmap])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
@ -35,12 +35,12 @@ m4_ifndef([XORG_MACROS_VERSION],
XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS
AM_CONFIG_HEADER(config.h)
AC_CONFIG_HEADERS([config.h])
AC_CHECK_FUNCS([strncasecmp])
AC_CHECK_FUNCS([strncasecmp asprintf])
# Checks for pkg-config packages
PKG_CHECK_MODULES(XMODMAP, x11)
PKG_CHECK_MODULES(XMODMAP, x11 xproto >= 7.0.17)
dnl Allow checking code with lint, sparse, etc.
XORG_WITH_LINT

View File

@ -1,5 +1,3 @@
/* $XdotOrg: exec.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
/* $Xorg: exec.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
/*
Copyright 1988, 1998 The Open Group
@ -55,7 +53,6 @@ from The Open Group.
* Author: Jim Fulton, MIT X Consortium; derived from parts of the
* original xmodmap, written by David Rosenthal, of Sun Microsystems.
*/
/* $XFree86: xc/programs/xmodmap/exec.c,v 1.5 2001/12/14 20:02:13 dawes Exp $ */
#include <X11/Xos.h>
#include <X11/Xlib.h>
@ -283,7 +280,7 @@ PrintKeyTable(Bool exprs, FILE *fp)
max--;
for (j = 0; j <= max; j++) {
register KeySym ks = keymap[j];
char *s;
const char *s;
if (ks != NoSymbol)
s = XKeysymToString (ks);
else

View File

@ -1,4 +1,3 @@
/* $Xorg: handle.c,v 1.6 2001/02/09 02:05:56 xorgcvs Exp $ */
/*
Copyright 1988, 1998 The Open Group
@ -26,7 +25,6 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
/* $XFree86: xc/programs/xmodmap/handle.c,v 3.6 2001/07/25 15:05:27 dawes Exp $ */
#include "config.h"
#include <X11/Xos.h>
@ -37,6 +35,10 @@ from The Open Group.
#include "wq.h"
#include <stdlib.h>
#ifdef HAVE_STRNCASECMP
#include <strings.h>
#endif
static XModifierKeymap *map = NULL;
@ -84,17 +86,22 @@ copy_to_scratch(const char *s, int len)
static char *buf = NULL;
static int buflen = 0;
if (len > buflen) {
if (len < 0)
len = 0;
if (len >= buflen) {
if (buf) free (buf);
buflen = (len < 40) ? 80 : (len * 2);
buf = (char *) malloc (buflen+1);
if (!buf) {
fprintf (stderr, "attempt to allocate %d byte scratch buffer\n", buflen + 1);
return NULL;
}
}
if (len > 0)
strncpy (buf, s, len);
else
len = 0;
strncpy (buf, s, len);
buf[len] = '\0';
return (buf);
}
@ -137,7 +144,7 @@ static int skip_chars ( const char *s, int len );
static int skip_space ( const char *s, int len );
static struct dt {
char *command; /* name of input command */
const char *command; /* name of input command */
int length; /* length of command */
void (*proc)(char *, int); /* handler */
} dispatch_table[] = {
@ -270,7 +277,7 @@ add_to_work_queue(union op *p) /* this can become a macro someday */
static Bool
parse_number(const char *str, unsigned long *val)
{
char *fmt = "%ld";
const char *fmt = "%ld";
if (*str == '0') {
str++;
@ -317,7 +324,7 @@ static void
do_keycode(char *line, int len)
{
int dummy;
char *fmt = "%d";
const char *fmt = "%d";
KeyCode keycode;
if (len < 3 || !line || *line == '\0') { /* 5=a minimum */

View File

@ -46,9 +46,9 @@ pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
install_sh_DATA = ${SHELL} $(install_sh) -c -m 644
install_sh_PROGRAM = ${SHELL} $(install_sh) -c
install_sh_SCRIPT = ${SHELL} $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
@ -93,6 +93,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@ -147,6 +148,7 @@ PKG_CONFIG = @PKG_CONFIG@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XMODMAP_CFLAGS = @XMODMAP_CFLAGS@

View File

@ -1,5 +1,3 @@
.\" $Xorg: xmodmap.man,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $
.\"
.\" Copyright (c) 1987, 2010, Oracle and/or its affiliates. All rights reserved.
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining a
@ -45,8 +43,6 @@
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
.\"
.\" $XFree86: xc/programs/xmodmap/xmodmap.man,v 1.11 2002/10/12 16:06:48 herrb Exp $
.\"
.de EX \"Begin example
.ne 5
.if n .sp 1
@ -102,7 +98,7 @@ This option turns off the verbose logging. This is the default.
This option indicates that
.I xmodmap
should not change the mappings, but should display what it would do, like
\fImake(1)\fP does when given this option.
\fImake(__appmansuffix__)\fP does when given this option.
.TP 8
.B \-e \fIexpression\fB
This option specifies an expression to be executed. Any number of expressions

View File

@ -1,4 +1,3 @@
/* $Xorg: pf.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
/*
Copyright 1988, 1998 The Open Group
@ -31,6 +30,7 @@ from The Open Group.
#include <X11/Xlib.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include "xmodmap.h"
#define NOTINFILEFILENAME "commandline"
@ -79,27 +79,29 @@ void process_file (const char *filename) /* NULL means use stdin */
}
void process_line (char *buffer)
void process_line (const char *line)
{
int len;
int i;
char *cp;
char *cp, *buffer;
/* copy buffer since it may point to unwritable date */
len = strlen(buffer);
cp = chk_malloc(len + 1);
strcpy(cp, buffer);
buffer = cp;
/* copy line to buffer since it may point to unwritable data */
len = strlen(line);
cp = buffer = strdup(line);
if (buffer == NULL) {
fprintf(stderr, "%s: Could not allocate %d bytes\n", ProgramName, len);
Exit(-1);
}
for (i = 0; i < len; i++) { /* look for blank lines */
register char c = buffer[i];
if (!(isspace(c) || c == '\n')) break;
}
if (i == len) return;
if (i == len) goto done;
cp = &buffer[i];
if (*cp == '!') return; /* look for comments */
if (*cp == '!') goto done; /* look for comments */
len -= (cp - buffer); /* adjust len by how much we skipped */
/* pipe through cpp */
@ -117,4 +119,7 @@ void process_line (char *buffer)
/* handle input */
handle_line (cp, len);
done:
free(buffer);
}

View File

@ -1,4 +1,3 @@
/* $Xorg: wq.h,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
/*
Copyright 1988, 1998 The Open Group
@ -26,7 +25,6 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
/* $XFree86: xc/programs/xmodmap/wq.h,v 1.4 2001/01/17 23:46:21 dawes Exp $ */
#ifndef _WQ_H
#define _WQ_H
@ -137,7 +135,7 @@ extern struct wq {
extern struct modtab {
char *name;
const char *name;
int length;
int value;
} modifier_table[];

View File

@ -1,4 +1,3 @@
/* $Xorg: xmodmap.c,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
/*
Copyright 1988, 1998 The Open Group
@ -26,13 +25,13 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
/* $XFree86: xc/programs/xmodmap/xmodmap.c,v 1.8tsi Exp $ */
#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
#include "xmodmap.h"
const char *ProgramName;
@ -41,7 +40,8 @@ int min_keycode, max_keycode;
Bool verbose = False;
Bool dontExecute = False;
static void
void
_X_NORETURN
Exit(int status)
{
if (dpy) {
@ -51,17 +51,55 @@ Exit(int status)
exit (status);
}
void *
chk_malloc(size_t n_bytes)
static void _X_NORETURN
FatalError(const char *message)
{
void *buf = malloc(n_bytes);
if (!buf) {
fprintf(stderr, "%s: Could not allocate %d bytes\n", ProgramName, (int)n_bytes);
fprintf(stderr, "%s: %s\n", ProgramName, message);
Exit(-1);
}
return buf;
}
#ifndef HAVE_ASPRINTF
/* sprintf variant found in newer libc's which allocates string to print to */
static int _X_ATTRIBUTE_PRINTF(2,3)
asprintf(char ** ret, const char *format, ...)
{
char buf[256];
int len;
va_list ap;
va_start(ap, format);
len = vsnprintf(buf, sizeof(buf), format, ap);
va_end(ap);
if (len < 0)
return -1;
if (len < sizeof(buf))
{
*ret = strdup(buf);
}
else
{
*ret = malloc(len + 1); /* snprintf doesn't count trailing '\0' */
if (*ret != NULL)
{
va_start(ap, format);
len = vsnprintf(*ret, len + 1, format, ap);
va_end(ap);
if (len < 0) {
free(*ret);
*ret = NULL;
}
}
}
if (*ret == NULL)
return -1;
return len;
}
#endif /* HAVE_ASPRINTF */
static const char help_message[] =
"\nwhere options include:\n"
" -display host:dpy X server to use\n"
@ -78,6 +116,7 @@ static const char help_message[] =
static void
_X_NORETURN
usage(void)
{
fprintf (stderr, "usage: %s [-options ...] [filename]\n", ProgramName);
@ -107,6 +146,7 @@ static const char grammar_message[] =
static void
_X_NORETURN
grammar_usage(void)
{
fprintf (stderr, "%s accepts the following input expressions:\n\n",
@ -158,7 +198,6 @@ main(int argc, char *argv[])
* the display being open.
*/
status = 0;
for (i = 1; i < argc; i++) {
char *arg = argv[i];
@ -247,11 +286,11 @@ main(int argc, char *argv[])
char *cmd;
didAnything = True;
if (++i >= argc) usage ();
cmd = chk_malloc (strlen ("remove control = ") + strlen (argv[i]) + 1);
(void) sprintf (cmd, "remove %s = %s",
if (asprintf (&cmd, "remove %s = %s",
((arg[1] == 's') ? "shift" :
((arg[1] == 'l') ? "lock" :
"control")), argv[i]);
"control")), argv[i]) == -1)
FatalError("Could not allocate memory for remove cmd");
process_line (cmd);
continue;
}
@ -269,8 +308,8 @@ main(int argc, char *argv[])
char *cmd;
didAnything = True;
if (++i >= argc) usage ();
cmd = chk_malloc (strlen ("add modX = ") + strlen (argv[i]) + 1);
(void) sprintf (cmd, "add mod%c = %s", arg[1], argv[i]);
if (asprintf (&cmd, "add mod%c = %s", arg[1], argv[i]) == -1)
FatalError("Could not allocate memory for add cmd");
process_line (cmd);
continue;
}
@ -285,11 +324,11 @@ main(int argc, char *argv[])
char *cmd;
didAnything = True;
if (++i >= argc) usage ();
cmd = chk_malloc (strlen ("add control = ") + strlen (argv[i]) + 1);
(void) sprintf (cmd, "add %s = %s",
if (asprintf (&cmd, "add %s = %s",
((arg[1] == 's') ? "shift" :
((arg[1] == 'l') ? "lock" :
"control")), argv[i]);
"control")), argv[i]) == -1)
FatalError("Could not allocate memory for remove cmd");
process_line (cmd);
continue;
}

View File

@ -1,4 +1,3 @@
/* $Xorg: xmodmap.h,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $ */
/*
Copyright 1988, 1998 The Open Group
@ -26,7 +25,10 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
/* $XFree86: xc/programs/xmodmap/xmodmap.h,v 1.4 2001/01/17 23:46:21 dawes Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
extern const char *ProgramName;
extern Display *dpy;
@ -39,7 +41,7 @@ extern int parse_errors;
extern void initialize_map(void);
extern void process_file(const char *filename);
extern void process_line(char *buffer);
extern void process_line(const char *buffer);
extern void handle_line(char *line, int len);
extern void print_work_queue(void);
extern int execute_work_queue(void);
@ -57,4 +59,4 @@ extern void PrintKeyTable(Bool exprs, FILE *fp);
extern void PrintPointerMap(FILE *fp);
extern int SetPointerMap(unsigned char *map, int n);
extern void *chk_malloc(size_t n_bytes);
extern void _X_NORETURN Exit(int status);