diff --git a/app/xwininfo/COPYING b/app/xwininfo/COPYING index 687540f0a..5e41b534a 100644 --- a/app/xwininfo/COPYING +++ b/app/xwininfo/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 1999, 2010, 2023, Oracle and/or its affiliates. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/app/xwininfo/ChangeLog b/app/xwininfo/ChangeLog index c4e2f499d..e24739f27 100644 --- a/app/xwininfo/ChangeLog +++ b/app/xwininfo/ChangeLog @@ -1,3 +1,88 @@ +commit 13826f0412926eb4659bca21a6f0e179c7a45f11 +Author: Alan Coopersmith +Date: Sun Apr 9 09:59:46 2023 -0700 + + xwininfo 1.1.6 + + Signed-off-by: Alan Coopersmith + +commit 9a5623e2ffc6995b2c6edf379f191d76d7b4444a +Author: Alan Coopersmith +Date: Sat Feb 25 13:06:06 2023 -0800 + + Add option to use libxcb-errors to improve X protocol error messages + + Requires passing --with-xcb-errors to configure + + Signed-off-by: Alan Coopersmith + +commit a60fe9c681990e0710e81ce88839aef2247e0d28 +Author: Alan Coopersmith +Date: Sun Nov 13 15:43:57 2022 -0800 + + Variable scope reduction as recommended by cppcheck + + Signed-off-by: Alan Coopersmith + +commit a4505ad3a938cfecb501b1ce806aa39ead42ec81 +Author: Alan Coopersmith +Date: Sun Nov 13 15:19:02 2022 -0800 + + Silence -Wdiscarded-qualifiers warning on systems with non-const iconv + + xwininfo.c: In function ‘print_utf8’: + xwininfo.c:1914:26: warning: initialization discards ‘const’ qualifier + from pointer target type [-Wdiscarded-qualifiers] + ICONV_CONST char *inp = u8str; + ^~~~~ + + Signed-off-by: Alan Coopersmith + +commit 41ea77d4b64413648dd2fb61c42bf7b980b17783 +Author: Alan Coopersmith +Date: Thu Jul 28 17:30:21 2022 -0700 + + gitlab CI: stop requiring Signed-off-by in commits + + Signed-off-by: Alan Coopersmith + +commit 90fe017c5db9ead2e8fe64bfc1d146268a2eae97 +Author: Alan Coopersmith +Date: Sun Apr 10 13:59:59 2022 -0700 + + Window_With_Name(): make sure cookies.get_net_wm_name is set + + Reported by Oracle Parfait: + + Error: Uninitialised memory + Uninitialised memory [uninitialised-mem] (CWE 456): + Possible access to uninitialised memory referenced by 'cookies' + at line 289 of dsimple.c in function 'recursive_Window_With_Name'. + called at line 420 in function 'Window_With_Name' with cookies = &cookies. + Path avoiding write at line 416 + Write does not overlap at line 417 + Write does not overlap at line 418 + cookies allocated at line 410 + cookies passed in at line 276 in function 'recursive_Window_With_Name' + + Signed-off-by: Alan Coopersmith + +commit f8ff22d7d00a96ab43bab7accbd2fcc01a1b5e0c +Author: Alan Coopersmith +Date: Tue Dec 7 15:56:32 2021 -0800 + + Build xz tarballs instead of bzip2 + + Signed-off-by: Alan Coopersmith + +commit 9882388975f299bbff8788326e698752dd32c73c +Author: Alan Coopersmith +Date: Tue Dec 7 15:56:29 2021 -0800 + + gitlab CI: add a basic build test + + Signed-off-by: Alan Coopersmith + commit 985a3a70918038bf2569e0a5ebe3fa14d720e4de Author: Alan Coopersmith Date: Sun Jul 14 13:51:36 2019 -0700 @@ -53,7 +138,7 @@ Date: Sun Jun 9 10:21:39 2019 -0700 Signed-off-by: Alan Coopersmith commit 58213a0cd39dc4ba044f48fab52ed3256ab9a9bd -Author: Stéphane Aulery +Author: Stéphane Aulery Date: Wed Jul 3 00:29:17 2013 +0200 Improve manpage and -h option @@ -1082,7 +1167,7 @@ Date: Wed Jul 20 19:32:05 2005 +0000 configure cache, you cache it, and the cached value is probably wrong. commit 97aa768841e147fde3cf16ba9a4c852358085d27 -Author: Søren Sandmann Pedersen +Author: Søren Sandmann Pedersen Date: Fri Jul 8 21:00:46 2005 +0000 Build system for xwininfo diff --git a/app/xwininfo/Makefile.bsd-wrapper b/app/xwininfo/Makefile.bsd-wrapper index 3c96052e1..13d1d05b5 100644 --- a/app/xwininfo/Makefile.bsd-wrapper +++ b/app/xwininfo/Makefile.bsd-wrapper @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.5 2014/08/24 20:22:20 matthieu Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.6 2023/04/10 16:16:52 matthieu Exp $ -CONFIGURE_ARGS += --with-xcb-icccm +CONFIGURE_ARGS += --with-xcb-icccm --without-xcb-errors .include diff --git a/app/xwininfo/Makefile.in b/app/xwininfo/Makefile.in index d17b28b82..86d47a225 100644 --- a/app/xwininfo/Makefile.in +++ b/app/xwininfo/Makefile.in @@ -181,9 +181,9 @@ am__relativize = \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" -DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz GZIP_ENV = --best -DIST_TARGETS = dist-bzip2 dist-gzip +DIST_TARGETS = dist-xz dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -305,6 +305,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -654,6 +655,7 @@ distdir: $(DISTFILES) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) + dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) @@ -661,7 +663,6 @@ dist-bzip2: distdir dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) - dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) diff --git a/app/xwininfo/README.md b/app/xwininfo/README.md index 6412b1d24..44b7b56b9 100644 --- a/app/xwininfo/README.md +++ b/app/xwininfo/README.md @@ -6,7 +6,7 @@ Xorg mailing list: https://lists.x.org/mailman/listinfo/xorg -The master development code repository can be found at: +The primary development code repository can be found at: https://gitlab.freedesktop.org/xorg/app/xwininfo diff --git a/app/xwininfo/aclocal.m4 b/app/xwininfo/aclocal.m4 index 9edf32e9b..c2099f536 100644 --- a/app/xwininfo/aclocal.m4 +++ b/app/xwininfo/aclocal.m4 @@ -19,8 +19,8 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# host-cpu-c-abi.m4 serial 11 -dnl Copyright (C) 2002-2019 Free Software Foundation, Inc. +# host-cpu-c-abi.m4 serial 15 +dnl Copyright (C) 2002-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -76,7 +76,7 @@ AC_DEFUN([gl_HOST_CPU_C_ABI], [case "$host_cpu" in changequote(,)dnl - i[4567]86 ) + i[34567]86 ) changequote([,])dnl gl_cv_host_cpu_c_abi=i386 ;; @@ -232,7 +232,7 @@ changequote([,])dnl # be generating 64-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( - [[#if defined __powerpc64__ || defined _ARCH_PPC64 + [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail @@ -403,6 +403,9 @@ EOF #ifndef __ia64__ #undef __ia64__ #endif +#ifndef __loongarch64__ +#undef __loongarch64__ +#endif #ifndef __m68k__ #undef __m68k__ #endif @@ -478,7 +481,8 @@ EOF dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI -dnl (application binary interface) is a 32-bit one, or to 'no' otherwise. +dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit +dnl one, or to 'unknown' if unknown. dnl This is a simplified variant of gl_HOST_CPU_C_ABI. AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT], [ @@ -488,14 +492,44 @@ AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT], case "$gl_cv_host_cpu_c_abi" in i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) gl_cv_host_cpu_c_abi_32bit=yes ;; - *) + x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) gl_cv_host_cpu_c_abi_32bit=no ;; + *) + gl_cv_host_cpu_c_abi_32bit=unknown ;; esac else case "$host_cpu" in + # CPUs that only support a 32-bit ABI. + arc \ + | bfin \ + | cris* \ + | csky \ + | epiphany \ + | ft32 \ + | h8300 \ + | m68k \ + | microblaze | microblazeel \ + | nds32 | nds32le | nds32be \ + | nios2 | nios2eb | nios2el \ + | or1k* \ + | or32 \ + | sh | sh[1234] | sh[1234]e[lb] \ + | tic6x \ + | xtensa* ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; + + # CPUs that only support a 64-bit ABI. changequote(,)dnl - i[4567]86 ) + alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ + | mmix ) +changequote([,])dnl + gl_cv_host_cpu_c_abi_32bit=no + ;; + +changequote(,)dnl + i[34567]86 ) changequote([,])dnl gl_cv_host_cpu_c_abi_32bit=yes ;; @@ -595,7 +629,7 @@ changequote([,])dnl # be generating 64-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( - [[#if defined __powerpc64__ || defined _ARCH_PPC64 + [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail @@ -655,7 +689,7 @@ changequote([,])dnl ;; *) - gl_cv_host_cpu_c_abi_32bit=no + gl_cv_host_cpu_c_abi_32bit=unknown ;; esac fi @@ -664,8 +698,8 @@ changequote([,])dnl HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" ]) -# iconv.m4 serial 21 -dnl Copyright (C) 2000-2002, 2007-2014, 2016-2019 Free Software Foundation, +# iconv.m4 serial 24 +dnl Copyright (C) 2000-2002, 2007-2014, 2016-2022 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -673,6 +707,12 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. +AC_PREREQ([2.64]) + +dnl Note: AM_ICONV is documented in the GNU gettext manual +dnl . +dnl Don't make changes that are incompatible with that documentation! + AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. @@ -752,8 +792,9 @@ AC_DEFUN([AM_ICONV_LINK], #endif ]], [[int result = 0; - /* Test against AIX 5.1 bug: Failures are not distinguishable from successful - returns. */ + /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from + successful returns. This is even documented in + */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) @@ -891,8 +932,7 @@ AC_DEFUN([AM_ICONV_LINK], AC_SUBST([LTLIBICONV]) ]) -dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to -dnl avoid warnings like +dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". dnl This is tricky because of the way 'aclocal' is implemented: dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. @@ -900,61 +940,50 @@ dnl Otherwise aclocal's initial scan pass would miss the macro definition. dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. dnl Otherwise aclocal would emit many "Use of uninitialized value $1" dnl warnings. -m4_define([gl_iconv_AC_DEFUN], - m4_version_prereq([2.64], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [m4_ifdef([gl_00GNULIB], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [[AC_DEFUN( - [$1], [$2])]])])) -gl_iconv_AC_DEFUN([AM_ICONV], +AC_DEFUN_ONCE([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then - AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL([am_cv_proto_iconv], [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ + AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature], + [gl_cv_iconv_nonconst], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ #include #include extern #ifdef __cplusplus "C" #endif -#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif - ]], - [[]])], - [am_cv_proto_iconv_arg1=""], - [am_cv_proto_iconv_arg1="const"]) - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) - am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([ - $am_cv_proto_iconv]) + ]], + [[]])], + [gl_cv_iconv_nonconst=yes], + [gl_cv_iconv_nonconst=no]) + ]) else dnl When compiling GNU libiconv on a system that does not have iconv yet, dnl pick the POSIX compliant declaration without 'const'. - am_cv_proto_iconv_arg1="" + gl_cv_iconv_nonconst=yes fi - AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], + if test $gl_cv_iconv_nonconst = yes; then + iconv_arg1="" + else + iconv_arg1="const" + fi + AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1], [Define as const if the declaration of iconv() needs const.]) dnl Also substitute ICONV_CONST in the gnulib generated . m4_ifdef([gl_ICONV_H_DEFAULTS], [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) - if test -n "$am_cv_proto_iconv_arg1"; then + if test $gl_cv_iconv_nonconst != yes; then ICONV_CONST="const" fi ]) ]) -# lib-ld.m4 serial 9 -dnl Copyright (C) 1996-2003, 2009-2019 Free Software Foundation, Inc. +# lib-ld.m4 serial 10 +dnl Copyright (C) 1996-2003, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -1077,7 +1106,7 @@ else *-*-aix*) AC_COMPILE_IFELSE( [AC_LANG_SOURCE( - [[#if defined __powerpc64__ || defined _ARCH_PPC64 + [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail @@ -1122,8 +1151,8 @@ fi AC_LIB_PROG_LD_GNU ]) -# lib-link.m4 serial 28 -dnl Copyright (C) 2001-2019 Free Software Foundation, Inc. +# lib-link.m4 serial 33 +dnl Copyright (C) 2001-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -1316,10 +1345,12 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" ]) AC_ARG_WITH(PACK[-prefix], -[[ --with-]]PACK[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib - --without-]]PACK[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], +[[ --with-]]PACK[[-prefix[=DIR] search for ]]PACKLIBS[[ in DIR/include and DIR/lib + --without-]]PACK[[-prefix don't search for ]]PACKLIBS[[ in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no @@ -1328,17 +1359,23 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && test ! -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi + additional_libdir2="$withval/$acl_libdirstem2" + additional_libdir3="$withval/$acl_libdirstem3" fi fi ]) + if test "X$additional_libdir2" = "X$additional_libdir"; then + additional_libdir2= + fi + if test "X$additional_libdir3" = "X$additional_libdir"; then + additional_libdir3= + fi dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= @@ -1394,58 +1431,14 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], shrext= fi if test $use_additional = yes; then - dir="$additional_libdir" - dnl The same code as in the loop below: - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` + for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do + if test "X$found_dir" = "X"; then + eval dir=\$$additional_libdir_variable + if test -n "$dir"; then + dnl The same code as in the loop below: dnl First look for a shared library. if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else @@ -1455,14 +1448,14 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do - if test -f "$dir/$f"; then + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break @@ -1473,7 +1466,57 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], fi dnl Then look for a static library. if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + fi + done + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi @@ -1499,7 +1542,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dnl standard /usr/lib. if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else @@ -1599,6 +1643,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], fi additional_includedir="$basedir/include" ;; + */$acl_libdirstem3 | */$acl_libdirstem3/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. @@ -1649,19 +1700,21 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], for dep in $dependency_libs; do case "$dep" in -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; @@ -1672,29 +1725,29 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then + if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + if test -d "$dependency_libdir"; then + dnl Really add $dependency_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then + if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + if test -d "$dependency_libdir"; then + dnl Really add $dependency_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir" fi fi fi @@ -1731,7 +1784,20 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], ;; -l*) dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + dnl But on GNU systems, ignore -lc options, because + dnl - linking with libc is the default anyway, + dnl - linking with libc.a may produce an error + dnl "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie" + dnl or may produce an executable that always crashes, see + dnl . + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi ;; *.la) dnl Handle this in the next round. Throw away the .la's @@ -1842,7 +1908,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], dir="$next" dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then + && test "X$dir" != "X/usr/$acl_libdirstem2" \ + && test "X$dir" != "X/usr/$acl_libdirstem3"; then rpathdirs="$rpathdirs $dir" fi next= @@ -1852,7 +1919,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then + && test "X$dir" != "X/usr/$acl_libdirstem2" \ + && test "X$dir" != "X/usr/$acl_libdirstem3"; then rpathdirs="$rpathdirs $dir" fi next= ;; @@ -1897,8 +1965,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], AC_SUBST([$1]) ]) -# lib-prefix.m4 serial 14 -dnl Copyright (C) 2001-2005, 2008-2019 Free Software Foundation, Inc. +# lib-prefix.m4 serial 20 +dnl Copyright (C) 2001-2005, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -2046,21 +2114,24 @@ AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], ]) dnl AC_LIB_PREPARE_MULTILIB creates -dnl - a variable acl_libdirstem, containing the basename of the libdir, either -dnl "lib" or "lib64" or "lib/64", -dnl - a variable acl_libdirstem2, as a secondary possible value for -dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or -dnl "lib/amd64". +dnl - a function acl_is_expected_elfclass, that tests whether standard input +dn; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI, +dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing +dnl the basename of the libdir to try in turn, either "lib" or "lib64" or +dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar. AC_DEFUN([AC_LIB_PREPARE_MULTILIB], [ - dnl There is no formal standard regarding lib and lib64. - dnl On glibc systems, the current practice is that on a system supporting + dnl There is no formal standard regarding lib, lib32, and lib64. + dnl On most glibc systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine - dnl the compiler's default mode by looking at the compiler's library search - dnl path. If at least one of its elements ends in /lib64 or points to a - dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. - dnl Otherwise we use the default, namely "lib". + dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on + dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go + dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib. + dnl We determine the compiler's default mode by looking at the compiler's + dnl library search path. If at least one of its elements ends in /lib64 or + dnl points to a directory whose absolute pathname ends in /lib64, we use that + dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default, + dnl namely "lib". dnl On Solaris systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or @@ -2068,27 +2139,75 @@ AC_DEFUN([AC_LIB_PREPARE_MULTILIB], AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT]) - case "$host_os" in - solaris*) - AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], - [AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#ifdef _LP64 - int ok; - #else - error fail - #endif - ]])], - [gl_cv_solaris_64bit=yes], - [gl_cv_solaris_64bit=no]) - ]);; - esac + AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf], + [AC_EGREP_CPP([Extensible Linking Format], + [#if defined __ELF__ || (defined __linux__ && defined __EDG__) + Extensible Linking Format + #endif + ], + [gl_cv_elf=yes], + [gl_cv_elf=no]) + ]) + if test $gl_cv_elf = yes; then + # Extract the ELF class of a file (5th byte) in decimal. + # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header + if od -A x < /dev/null >/dev/null 2>/dev/null; then + # Use POSIX od. + func_elfclass () + { + od -A n -t d1 -j 4 -N 1 + } + else + # Use BSD hexdump. + func_elfclass () + { + dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' + echo + } + fi + # Use 'expr', not 'test', to compare the values of func_elfclass, because on + # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, + # not 1 or 2. +changequote(,)dnl + case $HOST_CPU_C_ABI_32BIT in + yes) + # 32-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null + } + ;; + no) + # 64-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null + } + ;; + *) + # Unknown. + acl_is_expected_elfclass () + { + : + } + ;; + esac +changequote([,])dnl + else + acl_is_expected_elfclass () + { + : + } + fi dnl Allow the user to override the result by setting acl_cv_libdirstems. AC_CACHE_CHECK([for the common suffixes of directories in the library search path], [acl_cv_libdirstems], - [acl_libdirstem=lib + [dnl Try 'lib' first, because that's the default for libdir in GNU, see + dnl . + acl_libdirstem=lib acl_libdirstem2= + acl_libdirstem3= case "$host_os" in solaris*) dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment @@ -2096,60 +2215,83 @@ AC_DEFUN([AC_LIB_PREPARE_MULTILIB], dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the dnl symlink is missing, so we set acl_libdirstem2 too. - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 + if test $HOST_CPU_C_ABI_32BIT = no; then + acl_libdirstem2=lib/64 case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + sparc*) acl_libdirstem3=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; esac fi ;; *) dnl If $CC generates code for a 32-bit ABI, the libraries are - dnl surely under $prefix/lib, not $prefix/lib64. - if test "$HOST_CPU_C_ABI_32BIT" != yes; then - dnl The result is a property of the system. However, non-system - dnl compilers sometimes have odd library search paths. Therefore - dnl prefer asking /usr/bin/gcc, if available, rather than $CC. - searchpath=`(if test -f /usr/bin/gcc \ - && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \ - LC_ALL=C /usr/bin/gcc -print-search-dirs; \ - else \ - LC_ALL=C $CC -print-search-dirs; \ - fi) 2>/dev/null \ - | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" + dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64. + dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries + dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32. + dnl Find the compiler's search path. However, non-system compilers + dnl sometimes have odd library search paths. But we can't simply invoke + dnl '/usr/bin/gcc -print-search-dirs' because that would not take into + dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS. + searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ + | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test $HOST_CPU_C_ABI_32BIT != no; then + # 32-bit or unknown ABI. + if test -d /usr/lib32; then + acl_libdirstem2=lib32 + fi + fi + if test $HOST_CPU_C_ABI_32BIT != yes; then + # 64-bit or unknown ABI. + if test -d /usr/lib64; then + acl_libdirstem3=lib64 + fi + fi + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; + */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib32 ) acl_libdirstem2=lib32 ;; + */lib64 ) acl_libdirstem3=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + if test $HOST_CPU_C_ABI_32BIT = yes; then + # 32-bit ABI. + acl_libdirstem3= + fi + if test $HOST_CPU_C_ABI_32BIT = no; then + # 64-bit ABI. + acl_libdirstem2= fi fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" - acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2" + test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" + acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" ]) - # Decompose acl_cv_libdirstems into acl_libdirstem and acl_libdirstem2. + dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and + dnl acl_libdirstem3. +changequote(,)dnl acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` - acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e '/,/s/.*,//'` + acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` + acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` +changequote([,])dnl ]) -dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29.1) -dnl +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl @@ -2190,7 +2332,7 @@ dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29.1]) +[m4_define([PKG_MACROS_VERSION], [0.29.2]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ @@ -2291,7 +2433,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no -AC_MSG_CHECKING([for $1]) +AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) @@ -2301,11 +2443,11 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs @@ -2322,7 +2464,7 @@ installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full @@ -3446,7 +3588,7 @@ AC_SUBST([am__untar]) dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl -dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. +dnl Copyright (c) 2005, 2023, Oracle and/or its affiliates. dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), @@ -3483,7 +3625,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.19.2]) +m4_define([vers_have], [1.20.0]) 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,, @@ -3504,7 +3646,7 @@ AM_MAINTAINER_MODE # such as man pages and config files AC_DEFUN([XORG_PROG_RAWCPP],[ AC_REQUIRE([AC_PROG_CPP]) -AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], +AC_PATH_TOOL(RAWCPP, [cpp], [${CPP}], [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib]) # Check for flag to avoid builtin definitions - assumes unix is predefined, @@ -3814,7 +3956,7 @@ AC_SUBST(MAKE_HTML) # 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 # presence of the tool and obtain it's path in separate variables. Coupled with -# the --with-xmlto option, it allows maximum flexibilty in making decisions +# the --with-xmlto option, it allows maximum flexibility in making decisions # as whether or not to use the xmlto package. When DEFAULT is not specified, # --with-xmlto assumes 'auto'. # @@ -4028,7 +4170,7 @@ AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes]) # 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 # presence of the tool and obtain it's path in separate variables. Coupled with -# the --with-asciidoc option, it allows maximum flexibilty in making decisions +# the --with-asciidoc option, it allows maximum flexibility in making decisions # as whether or not to use the asciidoc package. When DEFAULT is not specified, # --with-asciidoc assumes 'auto'. # @@ -4098,7 +4240,7 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) # 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 # presence of the tool and obtain it's path in separate variables. Coupled with -# the --with-doxygen option, it allows maximum flexibilty in making decisions +# the --with-doxygen option, it allows maximum flexibility in making decisions # as whether or not to use the doxygen package. When DEFAULT is not specified, # --with-doxygen assumes 'auto'. # @@ -4182,7 +4324,7 @@ AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) # 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 # presence of the tool and obtain it's path in separate variables. Coupled with -# the --with-groff option, it allows maximum flexibilty in making decisions +# the --with-groff option, it allows maximum flexibility in making decisions # as whether or not to use the groff package. When DEFAULT is not specified, # --with-groff assumes 'auto'. # @@ -4290,7 +4432,7 @@ AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes]) # 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 # presence of the tool and obtain it's path in separate variables. Coupled with -# the --with-fop option, it allows maximum flexibilty in making decisions +# the --with-fop option, it allows maximum flexibility in making decisions # as whether or not to use the fop package. When DEFAULT is not specified, # --with-fop assumes 'auto'. # @@ -4384,7 +4526,7 @@ AC_SUBST([M4], [$ac_cv_path_M4]) # 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 # presence of the tool and obtain it's path in separate variables. Coupled with -# the --with-ps2pdf option, it allows maximum flexibilty in making decisions +# the --with-ps2pdf option, it allows maximum flexibility in making decisions # as whether or not to use the ps2pdf package. When DEFAULT is not specified, # --with-ps2pdf assumes 'auto'. # @@ -4439,7 +4581,7 @@ AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes]) # not at the appropriate level. This macro enables a builder to skip all # documentation targets except traditional man pages. # Combined with the specific tool checking macros XORG_WITH_*, it provides -# maximum flexibilty in controlling documentation building. +# maximum flexibility in controlling documentation building. # Refer to: # XORG_WITH_XMLTO --with-xmlto # XORG_WITH_ASCIIDOC --with-asciidoc @@ -4472,7 +4614,7 @@ AC_MSG_RESULT([$build_docs]) # # This macro enables a builder to skip all developer documentation. # Combined with the specific tool checking macros XORG_WITH_*, it provides -# maximum flexibilty in controlling documentation building. +# maximum flexibility in controlling documentation building. # Refer to: # XORG_WITH_XMLTO --with-xmlto # XORG_WITH_ASCIIDOC --with-asciidoc @@ -4505,7 +4647,7 @@ AC_MSG_RESULT([$build_devel_docs]) # # This macro enables a builder to skip all functional specification targets. # Combined with the specific tool checking macros XORG_WITH_*, it provides -# maximum flexibilty in controlling documentation building. +# maximum flexibility in controlling documentation building. # Refer to: # XORG_WITH_XMLTO --with-xmlto # XORG_WITH_ASCIIDOC --with-asciidoc @@ -4980,7 +5122,11 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) AC_DEFUN([XORG_COMPILER_BRAND], [ AC_LANG_CASE( [C], [ - AC_REQUIRE([AC_PROG_CC_C99]) + dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC + dnl and complains that AC_PROG_CC_C99 is obsolete + m4_version_prereq([2.70], + [AC_REQUIRE([AC_PROG_CC])], + [AC_REQUIRE([AC_PROG_CC_C99])]) ], [C++], [ AC_REQUIRE([AC_PROG_CXX]) @@ -4996,7 +5142,7 @@ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) # 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 +# If it succeeds, the flag is appended 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 @@ -5012,7 +5158,11 @@ AC_LANG_COMPILER_REQUIRE AC_LANG_CASE( [C], [ - AC_REQUIRE([AC_PROG_CC_C99]) + dnl autoconf-2.70 folded AC_PROG_CC_C99 into AC_PROG_CC + dnl and complains that AC_PROG_CC_C99 is obsolete + m4_version_prereq([2.70], + [AC_REQUIRE([AC_PROG_CC])], + [AC_REQUIRE([AC_PROG_CC_C99])]) define([PREFIX], [C]) define([CACHE_PREFIX], [cc]) define([COMPILER], [$CC]) @@ -5143,7 +5293,7 @@ XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) 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]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # These are currently disabled because they are noisy. They will be enabled @@ -5153,7 +5303,7 @@ XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) -# Turn some warnings into errors, so we don't accidently get successful builds +# Turn some warnings into errors, so we don't accidentally get successful builds # when there are problems that should be fixed. if test "x$SELECTIVE_WERROR" = "xyes" ; then @@ -5262,23 +5412,35 @@ AC_SUBST([BASE_]PREFIX[FLAGS]) AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS])) ]) # XORG_STRICT_OPTION -# XORG_DEFAULT_OPTIONS -# -------------------- -# Minimum version: 1.3.0 +# XORG_DEFAULT_NOCODE_OPTIONS +# --------------------------- +# Minimum version: 1.20.0 # -# Defines default options for X.Org modules. +# Defines default options for X.Org modules which don't compile code, +# such as fonts, bitmaps, cursors, and docs. # -AC_DEFUN([XORG_DEFAULT_OPTIONS], [ +AC_DEFUN([XORG_DEFAULT_NOCODE_OPTIONS], [ AC_REQUIRE([AC_PROG_INSTALL]) -XORG_COMPILER_FLAGS -XORG_CWARNFLAGS -XORG_STRICT_OPTION XORG_RELEASE_VERSION XORG_CHANGELOG XORG_INSTALL XORG_MANPAGE_SECTIONS m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) +]) # XORG_DEFAULT_NOCODE_OPTIONS + +# XORG_DEFAULT_OPTIONS +# -------------------- +# Minimum version: 1.3.0 +# +# Defines default options for X.Org modules which compile code. +# +AC_DEFUN([XORG_DEFAULT_OPTIONS], [ +AC_REQUIRE([AC_PROG_INSTALL]) +XORG_COMPILER_FLAGS +XORG_CWARNFLAGS +XORG_STRICT_OPTION +XORG_DEFAULT_NOCODE_OPTIONS ]) # XORG_DEFAULT_OPTIONS # XORG_INSTALL() diff --git a/app/xwininfo/compile b/app/xwininfo/compile index a85b723c7..df363c8fb 100644 --- a/app/xwininfo/compile +++ b/app/xwininfo/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC # 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 . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) @@ -255,7 +255,8 @@ EOF echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/app/xwininfo/config.h.in b/app/xwininfo/config.h.in index 1fb52e5d7..bcf2e7c41 100644 --- a/app/xwininfo/config.h.in +++ b/app/xwininfo/config.h.in @@ -94,6 +94,10 @@ #endif +/* Define to 1 to call xcb-errors library functions instead of local + replacements */ +#undef USE_XCB_ERRORS + /* Define to 1 to call xcb-icccm library functions instead of local replacements */ #undef USE_XCB_ICCCM diff --git a/app/xwininfo/configure b/app/xwininfo/configure index 9fed59951..e416c6aa6 100644 --- a/app/xwininfo/configure +++ b/app/xwininfo/configure @@ -1,8 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for xwininfo 1.1.5. +# Generated by GNU Autoconf 2.69 for xwininfo 1.1.6. # -# Report bugs to . +# Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -267,7 +267,7 @@ fi $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: https://gitlab.freedesktop.org/xorg/app/xwininfo/issues +$0: https://gitlab.freedesktop.org/xorg/app/xwininfo/-/issues $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do @@ -581,9 +581,9 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='xwininfo' PACKAGE_TARNAME='xwininfo' -PACKAGE_VERSION='1.1.5' -PACKAGE_STRING='xwininfo 1.1.5' -PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/xwininfo/issues' +PACKAGE_VERSION='1.1.6' +PACKAGE_STRING='xwininfo 1.1.6' +PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/xwininfo/-/issues' PACKAGE_URL='' ac_unique_file="Makefile.am" @@ -658,6 +658,9 @@ CHANGELOG_CMD STRICT_CFLAGS CWARNFLAGS BASE_CFLAGS +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE LTLIBICONV LIBICONV host_os @@ -668,9 +671,6 @@ build_os build_vendor build_cpu build -MAINT -MAINTAINER_MODE_FALSE -MAINTAINER_MODE_TRUE am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -733,6 +733,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -756,14 +757,15 @@ ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking -enable_maintainer_mode with_gnu_ld enable_rpath with_libiconv_prefix +enable_maintainer_mode enable_selective_werror enable_strict_compilation enable_silent_rules with_xcb_icccm +with_xcb_errors ' ac_precious_vars='build_alias host_alias @@ -819,6 +821,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1071,6 +1074,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1208,7 +1220,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1321,7 +1333,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xwininfo 1.1.5 to adapt to many kinds of systems. +\`configure' configures xwininfo 1.1.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1361,6 +1373,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1391,7 +1404,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xwininfo 1.1.5:";; + short | recursive ) echo "Configuration of xwininfo 1.1.6:";; esac cat <<\_ACEOF @@ -1403,10 +1416,10 @@ Optional Features: do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build + --disable-rpath do not hardcode runtime library paths --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer - --disable-rpath do not hardcode runtime library paths --disable-selective-werror Turn off selective compiler errors. (default: enabled) @@ -1423,6 +1436,7 @@ Optional Packages: --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-xcb-icccm use xcb-icccm (default: no) + --with-xcb-errors use xcb-errors (default: no) Some influential environment variables: CC C compiler command @@ -1448,7 +1462,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to . +Report bugs to . _ACEOF ac_status=$? fi @@ -1511,7 +1525,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xwininfo configure 1.1.5 +xwininfo configure 1.1.6 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1670,9 +1684,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ---------------------------------------------------------------------- ## -## Report this to https://gitlab.freedesktop.org/xorg/app/xwininfo/issues ## -## ---------------------------------------------------------------------- ##" +( $as_echo "## ------------------------------------------------------------------------ ## +## Report this to https://gitlab.freedesktop.org/xorg/app/xwininfo/-/issues ## +## ------------------------------------------------------------------------ ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac @@ -1926,7 +1940,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xwininfo $as_me 1.1.5, which was +It was created by xwininfo $as_me 1.1.6, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4066,7 +4080,7 @@ fi # Define the identity of the package. PACKAGE='xwininfo' - VERSION='1.1.5' + VERSION='1.1.6' cat >>confdefs.h <<_ACEOF @@ -4240,29 +4254,6 @@ fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 -$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } - # Check whether --enable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then : - enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 -$as_echo "$USE_MAINTAINER_MODE" >&6; } - if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - - MAINT=$MAINTAINER_MODE_TRUE - - # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 @@ -4453,7 +4444,7 @@ else *-*-aix*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined __powerpc64__ || defined _ARCH_PPC64 +#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail @@ -4573,13 +4564,41 @@ else case "$gl_cv_host_cpu_c_abi" in i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) gl_cv_host_cpu_c_abi_32bit=yes ;; - *) + x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) gl_cv_host_cpu_c_abi_32bit=no ;; + *) + gl_cv_host_cpu_c_abi_32bit=unknown ;; esac else case "$host_cpu" in - i[4567]86 ) + # CPUs that only support a 32-bit ABI. + arc \ + | bfin \ + | cris* \ + | csky \ + | epiphany \ + | ft32 \ + | h8300 \ + | m68k \ + | microblaze | microblazeel \ + | nds32 | nds32le | nds32be \ + | nios2 | nios2eb | nios2el \ + | or1k* \ + | or32 \ + | sh | sh1234 | sh1234elb \ + | tic6x \ + | xtensa* ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; + + # CPUs that only support a 64-bit ABI. + alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ + | mmix ) + gl_cv_host_cpu_c_abi_32bit=no + ;; + + i[34567]86 ) gl_cv_host_cpu_c_abi_32bit=yes ;; @@ -4703,7 +4722,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # be generating 64-bit code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined __powerpc64__ || defined _ARCH_PPC64 +#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail @@ -4783,7 +4802,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; *) - gl_cv_host_cpu_c_abi_32bit=no + gl_cv_host_cpu_c_abi_32bit=unknown ;; esac fi @@ -4798,90 +4817,153 @@ $as_echo "$gl_cv_host_cpu_c_abi_32bit" >&6; } - case "$host_os" in - solaris*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 -$as_echo_n "checking for 64-bit host... " >&6; } -if ${gl_cv_solaris_64bit+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF binary format" >&5 +$as_echo_n "checking for ELF binary format... " >&6; } +if ${gl_cv_elf+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef _LP64 - int ok; - #else - error fail - #endif +#if defined __ELF__ || (defined __linux__ && defined __EDG__) + Extensible Linking Format + #endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_solaris_64bit=yes +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : + gl_cv_elf=yes else - gl_cv_solaris_64bit=no + gl_cv_elf=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest* + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 -$as_echo "$gl_cv_solaris_64bit" >&6; };; - esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_elf" >&5 +$as_echo "$gl_cv_elf" >&6; } + if test $gl_cv_elf = yes; then + # Extract the ELF class of a file (5th byte) in decimal. + # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header + if od -A x < /dev/null >/dev/null 2>/dev/null; then + # Use POSIX od. + func_elfclass () + { + od -A n -t d1 -j 4 -N 1 + } + else + # Use BSD hexdump. + func_elfclass () + { + dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' + echo + } + fi + # Use 'expr', not 'test', to compare the values of func_elfclass, because on + # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, + # not 1 or 2. + case $HOST_CPU_C_ABI_32BIT in + yes) + # 32-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null + } + ;; + no) + # 64-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null + } + ;; + *) + # Unknown. + acl_is_expected_elfclass () + { + : + } + ;; + esac + else + acl_is_expected_elfclass () + { + : + } + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the common suffixes of directories in the library search path" >&5 $as_echo_n "checking for the common suffixes of directories in the library search path... " >&6; } if ${acl_cv_libdirstems+:} false; then : $as_echo_n "(cached) " >&6 else - acl_libdirstem=lib + acl_libdirstem=lib acl_libdirstem2= + acl_libdirstem3= case "$host_os" in solaris*) - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 + if test $HOST_CPU_C_ABI_32BIT = no; then + acl_libdirstem2=lib/64 case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + sparc*) acl_libdirstem3=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; esac fi ;; *) - if test "$HOST_CPU_C_ABI_32BIT" != yes; then - searchpath=`(if test -f /usr/bin/gcc \ - && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \ - LC_ALL=C /usr/bin/gcc -print-search-dirs; \ - else \ - LC_ALL=C $CC -print-search-dirs; \ - fi) 2>/dev/null \ - | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" + searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ + | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test $HOST_CPU_C_ABI_32BIT != no; then + # 32-bit or unknown ABI. + if test -d /usr/lib32; then + acl_libdirstem2=lib32 + fi + fi + if test $HOST_CPU_C_ABI_32BIT != yes; then + # 64-bit or unknown ABI. + if test -d /usr/lib64; then + acl_libdirstem3=lib64 + fi + fi + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; + */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib32 ) acl_libdirstem2=lib32 ;; + */lib64 ) acl_libdirstem3=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + if test $HOST_CPU_C_ABI_32BIT = yes; then + # 32-bit ABI. + acl_libdirstem3= + fi + if test $HOST_CPU_C_ABI_32BIT = no; then + # 64-bit ABI. + acl_libdirstem2= fi fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" - acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2" + test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" + acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libdirstems" >&5 $as_echo "$acl_cv_libdirstems" >&6; } - # Decompose acl_cv_libdirstems into acl_libdirstem and acl_libdirstem2. - acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` - acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e '/,/s/.*,//'` + acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` + acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` + acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` @@ -4902,6 +4984,8 @@ $as_echo "$acl_cv_libdirstems" >&6; } eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" @@ -4922,6 +5006,8 @@ if test "${with_libiconv_prefix+set}" = set; then : eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" @@ -4929,15 +5015,19 @@ if test "${with_libiconv_prefix+set}" = set; then : else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && test ! -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi + additional_libdir2="$withval/$acl_libdirstem2" + additional_libdir3="$withval/$acl_libdirstem3" fi fi fi + if test "X$additional_libdir2" = "X$additional_libdir"; then + additional_libdir2= + fi + if test "X$additional_libdir3" = "X$additional_libdir"; then + additional_libdir3= + fi LIBICONV= LTLIBICONV= INCICONV= @@ -4983,45 +5073,51 @@ fi shrext= fi if test $use_additional = yes; then - dir="$additional_libdir" - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then + for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do + if test "X$found_dir" = "X"; then + eval dir=\$$additional_libdir_variable + if test -n "$dir"; then + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" - found_so="$dir/$f" - break + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi fi - done + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi fi fi - fi - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi + done fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBICONV; do @@ -5038,7 +5134,7 @@ fi -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else @@ -5048,14 +5144,14 @@ fi | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do - if test -f "$dir/$f"; then + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break @@ -5065,7 +5161,7 @@ fi fi fi if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi @@ -5087,7 +5183,8 @@ fi if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else haveit= @@ -5166,6 +5263,13 @@ fi fi additional_includedir="$basedir/include" ;; + */$acl_libdirstem3 | */$acl_libdirstem3/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then @@ -5211,12 +5315,14 @@ fi for dep in $dependency_libs; do case "$dep" in -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; @@ -5235,14 +5341,14 @@ fi exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" - if test "X$x" = "X-L$additional_libdir"; then + if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + if test -d "$dependency_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$dependency_libdir" fi fi haveit= @@ -5256,14 +5362,14 @@ fi exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" - if test "X$x" = "X-L$additional_libdir"; then + if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + if test -d "$dependency_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$dependency_libdir" fi fi fi @@ -5295,7 +5401,14 @@ fi fi ;; -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` @@ -5470,8 +5583,9 @@ int main () { int result = 0; - /* Test against AIX 5.1 bug: Failures are not distinguishable from successful - returns. */ + /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from + successful returns. This is even documented in + */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) @@ -5619,13 +5733,12 @@ $as_echo "$LIBICONV" >&6; } if test "$am_cv_func_iconv" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 -$as_echo_n "checking for iconv declaration... " >&6; } - if ${am_cv_proto_iconv+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether iconv is compatible with its POSIX signature" >&5 +$as_echo_n "checking whether iconv is compatible with its POSIX signature... " >&6; } +if ${gl_cv_iconv_nonconst+:} false; then : $as_echo_n "(cached) " >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -5634,11 +5747,7 @@ extern #ifdef __cplusplus "C" #endif -#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif int main () @@ -5649,25 +5758,26 @@ main () } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - am_cv_proto_iconv_arg1="" + gl_cv_iconv_nonconst=yes else - am_cv_proto_iconv_arg1="const" + gl_cv_iconv_nonconst=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" -fi - am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: - $am_cv_proto_iconv" >&5 -$as_echo " - $am_cv_proto_iconv" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_iconv_nonconst" >&5 +$as_echo "$gl_cv_iconv_nonconst" >&6; } else - am_cv_proto_iconv_arg1="" + gl_cv_iconv_nonconst=yes + fi + if test $gl_cv_iconv_nonconst = yes; then + iconv_arg1="" + else + iconv_arg1="const" fi cat >>confdefs.h <<_ACEOF -#define ICONV_CONST $am_cv_proto_iconv_arg1 +#define ICONV_CONST $iconv_arg1 _ACEOF @@ -7998,7 +8108,124 @@ $as_echo "$supported" >&6; } fi -# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wredundant-decls" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wredundant-decls" >&5 +$as_echo_n "checking if $CC supports -Wredundant-decls... " >&6; } + cacheid=xorg_cv_cc_flag__Wredundant_decls + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wredundant-decls" + found="yes" + fi + fi + + @@ -8125,7 +8352,7 @@ $as_echo "$supported" >&6; } # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) -# Turn some warnings into errors, so we don't accidently get successful builds +# Turn some warnings into errors, so we don't accidentally get successful builds # when there are problems that should be fixed. if test "x$SELECTIVE_WERROR" = "xyes" ; then @@ -11797,6 +12024,8 @@ fi + + cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION_MAJOR `echo $PACKAGE_VERSION | cut -d . -f 1` _ACEOF @@ -11999,6 +12228,7 @@ AM_BACKSLASH='\' + # Checks for library functions for ac_func in strlcat do : @@ -12096,22 +12326,42 @@ $as_echo "#define USE_XCB_ICCCM 1" >>confdefs.h xcb_icccm_pc='xcb-icccm >= 0.3.8' fi +# Define a configure option for using the XCB Error helper functions +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use xcb-errors library" >&5 +$as_echo_n "checking whether to use xcb-errors library... " >&6; } + +# Check whether --with-xcb-errors was given. +if test "${with_xcb_errors+set}" = set; then : + withval=$with_xcb_errors; +else + with_xcb_errors=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_xcb_errors" >&5 +$as_echo "$with_xcb_errors" >&6; } +if test "x$with_xcb_errors" != xno ; then + +$as_echo "#define USE_XCB_ERRORS 1" >>confdefs.h + + xcb_errors_pc='xcb-errors >= 1.0' +fi + # Obtain compiler/linker options for xwininfo dependencies pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XWININFO" >&5 -$as_echo_n "checking for XWININFO... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xcb >= 1.6 xcb-shape ${xcb_icccm_pc} ${xcb_errors_pc}" >&5 +$as_echo_n "checking for xcb >= 1.6 xcb-shape ${xcb_icccm_pc} ${xcb_errors_pc}... " >&6; } if test -n "$XWININFO_CFLAGS"; then pkg_cv_XWININFO_CFLAGS="$XWININFO_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xcb >= 1.6 xcb-shape \${xcb_icccm_pc}\""; } >&5 - ($PKG_CONFIG --exists --print-errors "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xcb >= 1.6 xcb-shape \${xcb_icccm_pc} \${xcb_errors_pc}\""; } >&5 + ($PKG_CONFIG --exists --print-errors "xcb >= 1.6 xcb-shape ${xcb_icccm_pc} ${xcb_errors_pc}") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_XWININFO_CFLAGS=`$PKG_CONFIG --cflags "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}" 2>/dev/null` + pkg_cv_XWININFO_CFLAGS=`$PKG_CONFIG --cflags "xcb >= 1.6 xcb-shape ${xcb_icccm_pc} ${xcb_errors_pc}" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12123,12 +12373,12 @@ if test -n "$XWININFO_LIBS"; then pkg_cv_XWININFO_LIBS="$XWININFO_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xcb >= 1.6 xcb-shape \${xcb_icccm_pc}\""; } >&5 - ($PKG_CONFIG --exists --print-errors "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xcb >= 1.6 xcb-shape \${xcb_icccm_pc} \${xcb_errors_pc}\""; } >&5 + ($PKG_CONFIG --exists --print-errors "xcb >= 1.6 xcb-shape ${xcb_icccm_pc} ${xcb_errors_pc}") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_XWININFO_LIBS=`$PKG_CONFIG --libs "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}" 2>/dev/null` + pkg_cv_XWININFO_LIBS=`$PKG_CONFIG --libs "xcb >= 1.6 xcb-shape ${xcb_icccm_pc} ${xcb_errors_pc}" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12140,7 +12390,7 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -12149,14 +12399,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - XWININFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}" 2>&1` + XWININFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xcb >= 1.6 xcb-shape ${xcb_icccm_pc} ${xcb_errors_pc}" 2>&1` else - XWININFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xcb >= 1.6 xcb-shape ${xcb_icccm_pc}" 2>&1` + XWININFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xcb >= 1.6 xcb-shape ${xcb_icccm_pc} ${xcb_errors_pc}" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$XWININFO_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (xcb >= 1.6 xcb-shape ${xcb_icccm_pc}) were not met: + as_fn_error $? "Package requirements (xcb >= 1.6 xcb-shape ${xcb_icccm_pc} ${xcb_errors_pc}) were not met: $XWININFO_PKG_ERRORS @@ -12167,7 +12417,7 @@ Alternatively, you may set the environment variables XWININFO_CFLAGS and XWININFO_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} @@ -12193,8 +12443,8 @@ fi # and libX11 headers for cursorfont.h pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XLIB" >&5 -$as_echo_n "checking for XLIB... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x11 xproto >= 7.0.25" >&5 +$as_echo_n "checking for x11 xproto >= 7.0.25... " >&6; } if test -n "$XLIB_CFLAGS"; then pkg_cv_XLIB_CFLAGS="$XLIB_CFLAGS" @@ -12234,7 +12484,7 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -12261,7 +12511,7 @@ Alternatively, you may set the environment variables XLIB_CFLAGS and XLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} @@ -12420,10 +12670,6 @@ else am__EXEEXT_FALSE= fi -if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -12825,7 +13071,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xwininfo $as_me 1.1.5, which was +This file was extended by xwininfo $as_me 1.1.6, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12885,13 +13131,13 @@ $config_headers Configuration commands: $config_commands -Report bugs to ." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -xwininfo config.status 1.1.5 +xwininfo config.status 1.1.6 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/app/xwininfo/configure.ac b/app/xwininfo/configure.ac index 1dcc651be..b875b7279 100644 --- a/app/xwininfo/configure.ac +++ b/app/xwininfo/configure.ac @@ -23,15 +23,14 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([xwininfo], [1.1.5], - [https://gitlab.freedesktop.org/xorg/app/xwininfo/issues], [xwininfo]) +AC_INIT([xwininfo], [1.1.6], + [https://gitlab.freedesktop.org/xorg/app/xwininfo/-/issues], [xwininfo]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) AC_USE_SYSTEM_EXTENSIONS # Initialize Automake -AM_INIT_AUTOMAKE([foreign dist-bzip2]) -AM_MAINTAINER_MODE +AM_INIT_AUTOMAKE([foreign dist-xz]) AM_ICONV # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS @@ -62,8 +61,21 @@ if test "x$with_xcb_icccm" != xno ; then xcb_icccm_pc='xcb-icccm >= 0.3.8' fi +# Define a configure option for using the XCB Error helper functions +AC_MSG_CHECKING([whether to use xcb-errors library]) +AC_ARG_WITH([xcb-errors], + [AS_HELP_STRING([--with-xcb-errors], + [use xcb-errors (default: no)])], + [], [with_xcb_errors=no]) +AC_MSG_RESULT([$with_xcb_errors]) +if test "x$with_xcb_errors" != xno ; then + AC_DEFINE([USE_XCB_ERRORS], 1, + [Define to 1 to call xcb-errors library functions instead of local replacements]) + xcb_errors_pc='xcb-errors >= 1.0' +fi + # Obtain compiler/linker options for xwininfo dependencies -PKG_CHECK_MODULES(XWININFO, [xcb >= 1.6] xcb-shape ${xcb_icccm_pc}) +PKG_CHECK_MODULES(XWININFO, [xcb >= 1.6 xcb-shape ${xcb_icccm_pc} ${xcb_errors_pc}]) # Even when using xcb, xproto is still required for Xfuncproto.h # and libX11 headers for cursorfont.h diff --git a/app/xwininfo/dsimple.c b/app/xwininfo/dsimple.c index fc050c9ec..48ac02adb 100644 --- a/app/xwininfo/dsimple.c +++ b/app/xwininfo/dsimple.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2023, Oracle and/or its affiliates. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -55,6 +55,9 @@ from The Open Group. #ifdef USE_XCB_ICCCM # include #endif +#ifdef USE_XCB_ERRORS +# include +#endif #include #include #include @@ -73,6 +76,9 @@ from The Open Group. * Written by Mark Lillibridge. Last updated 7/1/87 */ +#ifdef USE_XCB_ERRORS +xcb_errors_context_t *error_context; +#endif /* This stuff is defined in the calling program by dsimple.h */ const char *program_name = "unknown_program"; @@ -108,7 +114,7 @@ void Setup_Display_And_Screen ( xcb_connection_t **dpy, /* MODIFIED */ xcb_screen_t **screen) /* MODIFIED */ { - int screen_number, i, err; + int screen_number, err; /* Open Display */ *dpy = xcb_connect (display_name, &screen_number); @@ -130,6 +136,13 @@ void Setup_Display_And_Screen ( } } +#ifdef USE_XCB_ERRORS + if (xcb_errors_context_new(*dpy, &error_context) != 0) { + fprintf (stderr, "%s: unable to load xcb-errors\n\n", + program_name); + } +#endif + if (screen) { /* find our screen */ const xcb_setup_t *setup = xcb_get_setup(*dpy); @@ -141,7 +154,7 @@ void Setup_Display_And_Screen ( screen_number, screen_count-1 ); } - for (i = 0; i < screen_number; i++) + for (int i = 0; i < screen_number; i++) xcb_screen_next(&screen_iter); *screen = screen_iter.data; } @@ -178,7 +191,6 @@ xcb_window_t Select_Window(xcb_connection_t *dpy, int descend) { xcb_cursor_t cursor; - xcb_generic_event_t *event; xcb_window_t target_win = XCB_WINDOW_NONE; xcb_window_t root = screen->root; int buttons = 0; @@ -202,6 +214,8 @@ xcb_window_t Select_Window(xcb_connection_t *dpy, /* Let the user select a window... */ while ((target_win == XCB_WINDOW_NONE) || (buttons != 0)) { /* allow one more event */ + xcb_generic_event_t *event; + xcb_allow_events (dpy, XCB_ALLOW_SYNC_POINTER, XCB_TIME_CURRENT_TIME); xcb_flush (dpy); event = xcb_wait_for_event (dpy); @@ -414,6 +428,8 @@ Window_With_Name ( if (atom_net_wm_name && atom_utf8_string) cookies.get_net_wm_name = xcb_get_net_wm_name (dpy, top); + else + cookies.get_net_wm_name.sequence = 0; cookies.get_wm_name = xcb_icccm_get_wm_name (dpy, top); cookies.query_tree = xcb_query_tree (dpy, top); xcb_flush (dpy); @@ -437,6 +453,35 @@ void Fatal_Error (const char *msg, ...) exit (EXIT_FAILURE); } +/* + * Descriptions for core protocol error codes + * + * Since 0 is not used for an error code in X, we use it for unknown error. + */ +#define UNKNOWN_ERROR 0 +#define LAST_ERROR XCB_IMPLEMENTATION + +static const char *error_desc[] = { + [UNKNOWN_ERROR] = "Unknown error", + [XCB_REQUEST] = "Bad Request", + [XCB_VALUE] = "Bad Value", + [XCB_WINDOW] = "Bad Window", + [XCB_PIXMAP] = "Bad Pixmap", + [XCB_ATOM] = "Bad Atom", + [XCB_CURSOR] = "Bad Cursor", + [XCB_FONT] = "Bad Font", + [XCB_MATCH] = "Bad Match", + [XCB_DRAWABLE] = "Bad Drawable", + [XCB_ACCESS] = "Access Denied", + [XCB_ALLOC] = "Server Memory Allocation Failure", + [XCB_COLORMAP] = "Bad Color", + [XCB_G_CONTEXT] = "Bad GC", + [XCB_ID_CHOICE] = "Bad XID", + [XCB_NAME] = "Bad Name", + [XCB_LENGTH] = "Bad Request Length", + [XCB_IMPLEMENTATION] = "Server Implementation Failure", +}; + /* * Print X error information like the default Xlib error handler */ @@ -446,117 +491,89 @@ Print_X_Error ( xcb_generic_error_t *err ) { - char buffer[256] = ""; + const char *error = NULL; + const char *extension = NULL; + const char *value_type = NULL; + const char *major_name = NULL; + const char *minor_name = NULL; if ((err == NULL) || (err->response_type != 0)) /* not an error */ return; - /* Todo: find a more user friendly way to show request/extension info */ +#ifdef USE_XCB_ERRORS + if (error_context != NULL) { + error = xcb_errors_get_name_for_error(error_context, err->error_code, + &extension); + major_name = xcb_errors_get_name_for_major_code(error_context, + err->major_code); + minor_name = xcb_errors_get_name_for_minor_code(error_context, + err->major_code, + err->minor_code); + } + /* Fallback to old code if xcb-errors wasn't initialized */ + else +#endif if (err->error_code >= 128) { - fprintf (stderr, "X Extension Error: Error code %d\n", - err->error_code); + error = "Unknown extension error"; } else { - switch (err->error_code) - { - case XCB_REQUEST: - snprintf (buffer, sizeof(buffer), "Bad Request"); - break; - - case XCB_VALUE: - snprintf (buffer, sizeof(buffer), - "Bad Value: 0x%x", err->resource_id); - break; - - case XCB_WINDOW: - snprintf (buffer, sizeof(buffer), - "Bad Window: 0x%x", err->resource_id); - break; - - case XCB_PIXMAP: - snprintf (buffer, sizeof(buffer), - "Bad Pixmap: 0x%x", err->resource_id); - break; - - case XCB_ATOM: - snprintf (buffer, sizeof(buffer), - "Bad Atom: 0x%x", err->resource_id); - break; - - case XCB_CURSOR: - snprintf (buffer, sizeof(buffer), - "Bad Cursor: 0x%x", err->resource_id); - break; - - case XCB_FONT: - snprintf (buffer, sizeof(buffer), - "Bad Font: 0x%x", err->resource_id); - break; - - case XCB_MATCH: - snprintf (buffer, sizeof(buffer), "Bad Match"); - break; - - case XCB_DRAWABLE: - snprintf (buffer, sizeof(buffer), - "Bad Drawable: 0x%x", err->resource_id); - break; - - case XCB_ACCESS: - snprintf (buffer, sizeof(buffer), "Access Denied"); - break; - - case XCB_ALLOC: - snprintf (buffer, sizeof(buffer), - "Server Memory Allocation Failure"); - break; - - case XCB_COLORMAP: - snprintf (buffer, sizeof(buffer), - "Bad Color: 0x%x", err->resource_id); - break; - - case XCB_G_CONTEXT: - snprintf (buffer, sizeof(buffer), - "Bad GC: 0x%x", err->resource_id); - break; - - case XCB_ID_CHOICE: - snprintf (buffer, sizeof(buffer), - "Bad XID: 0x%x", err->resource_id); - break; - - case XCB_NAME: - snprintf (buffer, sizeof(buffer), - "Bad Name"); - break; - - case XCB_LENGTH: - snprintf (buffer, sizeof(buffer), - "Bad Request Length"); - break; - - case XCB_IMPLEMENTATION: - snprintf (buffer, sizeof(buffer), - "Server Implementation Failure"); - break; - - default: - snprintf (buffer, sizeof(buffer), "Unknown error"); - break; + if (err->error_code > 0 && err->error_code <= LAST_ERROR) { + error = error_desc[err->error_code]; + } else { + error = error_desc[UNKNOWN_ERROR]; } - fprintf (stderr, "X Error: %d: %s\n", err->error_code, buffer); } - fprintf (stderr, " Request Major code: %d\n", err->major_code); + fprintf (stderr, "X Error: %d: %s\n", err->error_code, error); + if (extension != NULL) { + fprintf (stderr, " Request extension: %s\n", extension); + } + + fprintf (stderr, " Request Major code: %d", err->major_code); + if (major_name != NULL) { + fprintf (stderr, " (%s)", major_name); + } + fputs ("\n", stderr); + if (err->major_code >= 128) { - fprintf (stderr, " Request Minor code: %d\n", err->minor_code); + fprintf (stderr, " Request Minor code: %d", err->minor_code); + if (minor_name != NULL) { + fprintf (stderr, " (%s)", minor_name); + } + fputs ("\n", stderr); } - fprintf (stderr, " Request serial number: %d\n", err->full_sequence); + switch (err->error_code) + { + case XCB_VALUE: + value_type = "Value"; + break; + case XCB_ATOM: + value_type = "AtomID"; + break; + case XCB_WINDOW: + case XCB_PIXMAP: + case XCB_CURSOR: + case XCB_FONT: + case XCB_DRAWABLE: + case XCB_COLORMAP: + case XCB_G_CONTEXT: + case XCB_ID_CHOICE: + value_type = "ResourceID"; + break; + default: + value_type = NULL; + } + if (value_type != NULL) { + fprintf (stderr, " %s in failed request: 0x%x\n", + value_type, err->resource_id); + } + + fprintf (stderr, " Serial number of failed request: %d\n", + err->full_sequence); } /* diff --git a/app/xwininfo/man/Makefile.in b/app/xwininfo/man/Makefile.in index 3771c95fa..3d6194647 100644 --- a/app/xwininfo/man/Makefile.in +++ b/app/xwininfo/man/Makefile.in @@ -226,6 +226,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/app/xwininfo/xwininfo.c b/app/xwininfo/xwininfo.c index 73cc344e3..05845e34b 100644 --- a/app/xwininfo/xwininfo.c +++ b/app/xwininfo/xwininfo.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -343,11 +343,10 @@ scale_init (xcb_screen_t *scale_screen) static char * nscale (int n, int np, int nmm, char *nbuf, size_t nbufsize) { - int s; snprintf (nbuf, nbufsize, "%d", n); if (metric||english) { - s = strlcat (nbuf, " (", nbufsize); + int s = strlcat (nbuf, " (", nbufsize); if (metric) { snprintf (nbuf+s, nbufsize-s, "%.2f mm%s", @@ -356,13 +355,13 @@ nscale (int n, int np, int nmm, char *nbuf, size_t nbufsize) if (english) { double inch_frac; Bool printed_anything = False; - int mi, yar, ft, inr; + int inr; inch_frac = ((double) n)*(nmm/25.4)/np; inr = (int)inch_frac; inch_frac -= (double)inr; if (inr >= MILE) { - mi = inr/MILE; + int mi = inr/MILE; inr %= MILE; s = strlen (nbuf); snprintf (nbuf+s, nbufsize-s, "%d %s(?!?)", @@ -370,7 +369,7 @@ nscale (int n, int np, int nmm, char *nbuf, size_t nbufsize) printed_anything = True; } if (inr >= YARD) { - yar = inr/YARD; + int yar = inr/YARD; inr %= YARD; if (printed_anything) strlcat (nbuf, ", ", nbufsize); @@ -380,7 +379,7 @@ nscale (int n, int np, int nmm, char *nbuf, size_t nbufsize) printed_anything = True; } if (inr >= FOOT) { - ft = inr/FOOT; + int ft = inr/FOOT; inr %= FOOT; if (printed_anything) strlcat (nbuf, ", ", nbufsize); @@ -440,7 +439,6 @@ window_id_str (xcb_window_t id) int main (int argc, char **argv) { - register int i; int tree = 0, stats = 0, bits = 0, events = 0, wm = 0, size = 0, shape = 0; int frame = 0, children = 0; int use_root = 0; @@ -461,7 +459,7 @@ main (int argc, char **argv) memset (w, 0, sizeof(struct wininfo)); /* Handle our command line arguments */ - for (i = 1; i < argc; i++) { + for (int i = 1; i < argc; i++) { if (!strcmp (argv[i], "-help")) usage (); if (!strcmp (argv[i], "-display") || !strcmp (argv[i], "-d")) { @@ -745,9 +743,9 @@ wm_size_hints_reply (xcb_connection_t *wshr_dpy, xcb_get_property_cookie_t cooki static xcb_size_hints_t * fetch_normal_hints (struct wininfo *w, xcb_size_hints_t *hints_return) { - xcb_size_hints_t hints; - if (!w->normal_hints) { + xcb_size_hints_t hints; + if (xcb_icccm_get_wm_normal_hints_reply (dpy, w->normal_hints_cookie, &hints, NULL)) { w->normal_hints = malloc (sizeof(xcb_size_hints_t)); @@ -764,7 +762,6 @@ fetch_normal_hints (struct wininfo *w, xcb_size_hints_t *hints_return) /* * Lookup: lookup a code in a table. */ -static char _lookup_buffer[100]; static const char * LookupL (long code, const binding *table) @@ -780,6 +777,8 @@ LookupL (long code, const binding *table) } if (name == NULL) { + static char _lookup_buffer[100]; + snprintf (_lookup_buffer, sizeof(_lookup_buffer), "unknown (code = %ld. = 0x%lx)", code, code); name = _lookup_buffer; @@ -1280,7 +1279,6 @@ Display_Tree_Info (struct wininfo *w, int recurse) static void display_tree_info_1 (struct wininfo *w, int recurse, int level) { - int i, j; unsigned int num_children; xcb_query_tree_reply_t *tree; @@ -1311,7 +1309,7 @@ display_tree_info_1 (struct wininfo *w, int recurse, int level) if (level == 0 || num_children > 0) { printf (" "); - for (j = 0; j < level; j++) printf (" "); + for (int j = 0; j < level; j++) printf (" "); printf ("%d child%s%s\n", num_children, num_children == 1 ? "" : "ren", num_children ? ":" : "."); } @@ -1324,7 +1322,7 @@ display_tree_info_1 (struct wininfo *w, int recurse, int level) if (children == NULL) Fatal_Error ("Failed to allocate memory in display_tree_info"); - for (i = (int)num_children - 1; i >= 0; i--) { + for (int i = (int)num_children - 1; i >= 0; i--) { struct wininfo *cw = &children[i]; cw->window = child_list[i]; @@ -1339,7 +1337,7 @@ display_tree_info_1 (struct wininfo *w, int recurse, int level) } xcb_flush (dpy); - for (i = (int)num_children - 1; i >= 0; i--) { + for (int i = (int)num_children - 1; i >= 0; i--) { struct wininfo *cw = &children[i]; Bool got_wm_class = False; char *instance_name = NULL, *class_name = NULL; @@ -1352,7 +1350,7 @@ display_tree_info_1 (struct wininfo *w, int recurse, int level) xcb_get_geometry_reply_t *geometry; printf (" "); - for (j = 0; j < level; j++) printf (" "); + for (int j = 0; j < level; j++) printf (" "); Display_Window_Id (cw, False); printf (": ("); @@ -1660,8 +1658,6 @@ Display_WM_Info (struct wininfo *w) { xcb_icccm_wm_hints_t wmhints; long flags; - xcb_get_property_reply_t *prop; - int i; printf ("\n"); if (!xcb_icccm_get_wm_hints_reply(dpy, w->hints_cookie, &wmhints, &err)) @@ -1698,6 +1694,8 @@ Display_WM_Info (struct wininfo *w) Lookup (wmhints.initial_state, _state_hints)); if (atom_net_wm_desktop) { + xcb_get_property_reply_t *prop; + prop = xcb_get_property_reply (dpy, w->wm_desktop_cookie, NULL); if (prop && (prop->type != XCB_NONE)) { uint32_t *desktop = xcb_get_property_value (prop); @@ -1711,6 +1709,8 @@ Display_WM_Info (struct wininfo *w) } if (atom_net_wm_window_type) { + xcb_get_property_reply_t *prop; + prop = xcb_get_property_reply (dpy, w->wm_window_type_cookie, NULL); if (prop && (prop->type != XCB_NONE) && (prop->value_len > 0)) { @@ -1719,7 +1719,7 @@ Display_WM_Info (struct wininfo *w) if (atom_count > 0) { printf (" Window type:\n"); - for (i = 0; i < atom_count; i++) + for (int i = 0; i < atom_count; i++) Display_Atom_Name (atoms[i], "_NET_WM_WINDOW_TYPE_"); } } @@ -1727,6 +1727,8 @@ Display_WM_Info (struct wininfo *w) } if (atom_net_wm_state) { + xcb_get_property_reply_t *prop; + prop = xcb_get_property_reply (dpy, w->wm_state_cookie, NULL); if (prop && (prop->type != XCB_NONE) && (prop->value_len > 0)) { xcb_atom_t *atoms = xcb_get_property_value (prop); @@ -1734,7 +1736,7 @@ Display_WM_Info (struct wininfo *w) if (atom_count > 0) { printf (" Window state:\n"); - for (i = 0; i < atom_count; i++) + for (int i = 0; i < atom_count; i++) Display_Atom_Name (atoms[i], "_NET_WM_STATE_"); } } @@ -1742,6 +1744,8 @@ Display_WM_Info (struct wininfo *w) } if (atom_net_wm_pid) { + xcb_get_property_reply_t *prop; + printf (" Process id: "); prop = xcb_get_property_reply (dpy, w->wm_pid_cookie, NULL); if (prop && (prop->type == XCB_ATOM_CARDINAL)) { @@ -1763,6 +1767,8 @@ Display_WM_Info (struct wininfo *w) } if (atom_net_frame_extents) { + xcb_get_property_reply_t *prop; + prop = xcb_get_property_reply (dpy, w->frame_extents_cookie, NULL); if (prop && (prop->type == XCB_ATOM_CARDINAL) && (prop->value_len == 4)) { @@ -1836,13 +1842,10 @@ static int is_valid_utf8 (const char *string, size_t len) { unsigned long codepoint; - int rem; - size_t i; - unsigned char c; + int rem = 0; - rem = 0; - for (i = 0; i < len; i++) { - c = (unsigned char) string[i]; + for (size_t i = 0; i < len; i++) { + unsigned char c = (unsigned char) string[i]; /* Order of type check: * - Single byte code point @@ -1911,16 +1914,15 @@ print_utf8 (const char *prefix, const char *u8str, size_t length, const char *su if (iconv_from_utf8 != (iconv_t) -1) { Bool done = True; - ICONV_CONST char *inp = u8str; + ICONV_CONST char *inp = (ICONV_CONST char *) u8str; char convbuf[BUFSIZ]; - int convres; printf ("%s", prefix); do { char *outp = convbuf; size_t outlen = sizeof(convbuf); - convres = iconv (iconv_from_utf8, &inp, &inlen, &outp, &outlen); + int convres = iconv (iconv_from_utf8, &inp, &inlen, &outp, &outlen); if ((convres == -1) && (errno == E2BIG)) { done = False; @@ -1953,7 +1955,7 @@ static char * get_friendly_name (const char *string, const char *prefix) { const char *name_start = string; - char *lowered_name, *n; + char *lowered_name; Bool first = True; size_t prefix_len = strlen (prefix); @@ -1965,7 +1967,7 @@ get_friendly_name (const char *string, const char *prefix) if (lowered_name == NULL) Fatal_Error ("Failed to allocate memory in get_friendly_name"); - for (n = lowered_name ; *n != 0 ; n++) { + for (char *n = lowered_name ; *n != 0 ; n++) { if (*n == '_') { *n = ' '; first = True;