commit:     3c2b1c4ef1121bc8fa1a3b18ad3bbb0a22d5e0c1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 01:14:30 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 01:14:30 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c2b1c4e

dev-tcltk/tclx: fix configure w/ clang 16

Bug: https://bugs.gentoo.org/881713
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/tclx-8.4.4-configure-clang16-deux.patch  | 82 ++++++++++++++++++++++
 .../tclx/files/tclx-8.4.4-configure-clang16.patch  | 32 +++++++++
 .../{tclx-8.4.4.ebuild => tclx-8.4.4-r1.ebuild}    |  4 +-
 3 files changed, 117 insertions(+), 1 deletion(-)

diff --git a/dev-tcltk/tclx/files/tclx-8.4.4-configure-clang16-deux.patch 
b/dev-tcltk/tclx/files/tclx-8.4.4-configure-clang16-deux.patch
new file mode 100644
index 000000000000..da4d5c399aee
--- /dev/null
+++ b/dev-tcltk/tclx/files/tclx-8.4.4-configure-clang16-deux.patch
@@ -0,0 +1,82 @@
+https://github.com/flightaware/tclx/pull/15
+
+From a65705e6cba4fe395afbdc8c903b8b819d7e6962 Mon Sep 17 00:00:00 2001
+From: Sam James <[email protected]>
+Date: Fri, 18 Nov 2022 01:12:17 +0000
+Subject: [PATCH] Fix configure.ac compatibility with Clang 16
+
+Clang 16 makes -Wimplicit-function-declaration and -Wimplicit-int errors by 
default.
+
+Unfortunately, this can lead to misconfiguration or miscompilation of software 
as configure
+tests may then return the wrong result.
+
+We also fix -Wstrict-prototypes while here as it's easy to do and it prepares
+us for C23.
+
+For more information, see LWN.net [0] or LLVM's Discourse [1], the Gentoo wiki 
[2],
+or the (new) c-std-porting mailing list [3].
+
+[0] https://lwn.net/Articles/913505/
+[1] 
https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213
+[2] https://wiki.gentoo.org/wiki/Modern_C_porting
+[3] hosted at lists.linux.dev.
+
+Bug: https://bugs.gentoo.org/881713
+Signed-off-by: Sam James <[email protected]>
+--- a/configure.in
++++ b/configure.in
+@@ -193,10 +193,11 @@ WIFEXITED(x);    /* Generates compiler error if 
WIFEXITED uses an int. */
+     
+     AC_MSG_CHECKING(checking to see what 'times' returns)
+     AC_TRY_RUN([
++#include <stdlib.h>
+ #include <sys/types.h>
+ #include <sys/times.h>
+ #include <unistd.h>
+-main() {
++int main(void) {
+     struct tms cpu;
+     times(&cpu);
+     sleep(2);
+@@ -269,7 +270,8 @@ main() {
+     
+     AC_CHECK_FUNC(catgets,
+       [AC_MSG_CHECKING([catclose return value])
+-       AC_TRY_COMPILE([#include <nl_types.h>], [
++       AC_TRY_COMPILE([#include <stdlib.h>
++         #include <nl_types.h>], [
+           if (catclose ((nl_catd) 0) == 0) exit (0);],
+           AC_MSG_RESULT(ok), [
+           AC_MSG_RESULT([broken catclose return type])
+--- a/tclconfig/tcl.m4
++++ b/tclconfig/tcl.m4
+@@ -2525,7 +2525,8 @@ AC_DEFUN([TEA_TIME_HANDLER], [
+     # (like convex) have timezone functions, etc.
+     #
+     AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
+-      AC_TRY_COMPILE([#include <time.h>],
++      AC_TRY_COMPILE([#include <stdlib.h>
++            #include <time.h>],
+           [extern long timezone;
+           timezone += 1;
+           exit (0);],
+@@ -2537,7 +2538,8 @@ AC_DEFUN([TEA_TIME_HANDLER], [
+       # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
+       #
+       AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
+-          AC_TRY_COMPILE([#include <time.h>],
++          AC_TRY_COMPILE([#include <stdlib.h>
++                #include <time.h>],
+               [extern time_t timezone;
+               timezone += 1;
+               exit (0);],
+@@ -2574,7 +2576,7 @@ AC_DEFUN([TEA_BUGGY_STRTOD], [
+           AC_TRY_RUN([
+               #include <stdlib.h>
+               extern double strtod();
+-              int main() {
++              int main(void) {
+                   char *infString="Inf", *nanString="NaN", *spaceString=" ";
+                   char *term;
+                   double value;
+

diff --git a/dev-tcltk/tclx/files/tclx-8.4.4-configure-clang16.patch 
b/dev-tcltk/tclx/files/tclx-8.4.4-configure-clang16.patch
new file mode 100644
index 000000000000..89f90363246a
--- /dev/null
+++ b/dev-tcltk/tclx/files/tclx-8.4.4-configure-clang16.patch
@@ -0,0 +1,32 @@
+https://github.com/flightaware/tclx/commit/dfd54117ca500c9422ff2e11940219d19cedb906
+https://bugs.gentoo.org/881713
+
+From dfd54117ca500c9422ff2e11940219d19cedb906 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston Sequoia <[email protected]>
+Date: Tue, 23 Jun 2020 22:44:30 -0700
+Subject: [PATCH] Add missing #includes during configure tests
+
+These lead to failures when configuring on macOS on Apple Silicon
+
+Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
+--- a/configure.in
++++ b/configure.in
+@@ -195,6 +195,7 @@ WIFEXITED(x);      /* Generates compiler error if 
WIFEXITED uses an int. */
+     AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <sys/times.h>
++#include <unistd.h>
+ main() {
+     struct tms cpu;
+     times(&cpu);
+--- a/tclconfig/tcl.m4
++++ b/tclconfig/tcl.m4
+@@ -2572,6 +2572,7 @@ AC_DEFUN([TEA_BUGGY_STRTOD], [
+     if test "$tcl_strtod" = 1; then
+       AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
+           AC_TRY_RUN([
++              #include <stdlib.h>
+               extern double strtod();
+               int main() {
+                   char *infString="Inf", *nanString="NaN", *spaceString=" ";
+

diff --git a/dev-tcltk/tclx/tclx-8.4.4.ebuild 
b/dev-tcltk/tclx/tclx-8.4.4-r1.ebuild
similarity index 88%
rename from dev-tcltk/tclx/tclx-8.4.4.ebuild
rename to dev-tcltk/tclx/tclx-8.4.4-r1.ebuild
index b0be6efad919..34d1fe02ea60 100644
--- a/dev-tcltk/tclx/tclx-8.4.4.ebuild
+++ b/dev-tcltk/tclx/tclx-8.4.4-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -22,6 +22,8 @@ RESTRICT="test"
 PATCHES=(
        "${FILESDIR}"/${PN}-8.4-varinit.patch
        "${FILESDIR}"/${PN}-8.4-ldflags.patch
+       "${FILESDIR}"/${P}-configure-clang16.patch
+       "${FILESDIR}"/${P}-configure-clang16-deux.patch
 )
 
 src_prepare() {

Reply via email to