[RESEND] Support MinGW & 64-bit libraries/paths in Tcl autoconf scripts

Message ID 20260319195819.29698-2-patrick@monnerat.net
State New
Headers
Series [RESEND] Support MinGW & 64-bit libraries/paths in Tcl autoconf scripts |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Patrick Monnerat March 19, 2026, 7:58 p.m. UTC
  Debian implements directories /usr/lib32 and /usr/lib64, but installs
tclConfig.sh and tkConfig.sh in /usr/lib. Therefore always search in
/usr/lib when the others fail.

Most of these changes were originally submitted by Keith Seitz for
Insight support.
---
 config/tcl.m4 | 64 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 62 insertions(+), 2 deletions(-)
  

Comments

Patrick Monnerat March 28, 2026, 2:25 p.m. UTC | #1
Does anyone wants to comment?

The target file has been synced from gcc in 2015 and never updated since 
then, both in binutils-gdb and gcc.

It needs update for recent Tcl/Tk use within Insight.

@Andrew: the resent patch should apply (initial send suffered from a MUA 
problem, sorry!).


Refs:

https://sourceware.org/pipermail/gdb-patches/2026-March/226096.html

https://sourceware.org/pipermail/insight/2023q1/007050.html


On 3/19/26 8:58 PM, Patrick Monnerat wrote:
> Debian implements directories /usr/lib32 and /usr/lib64, but installs
> tclConfig.sh and tkConfig.sh in /usr/lib. Therefore always search in
> /usr/lib when the others fail.
>
> Most of these changes were originally submitted by Keith Seitz for
> Insight support.
> ---
>   config/tcl.m4 | 64 +++++++++++++++++++++++++++++++++++++++++++++++++--
>   1 file changed, 62 insertions(+), 2 deletions(-)
>
> diff --git a/config/tcl.m4 b/config/tcl.m4
> index 4542a4b23d7..5a16c9cf18a 100644
> --- a/config/tcl.m4
> +++ b/config/tcl.m4
> @@ -33,7 +33,7 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
>   
>   	    # First check to see if --with-tcl was specified.
>   	    case "${host}" in
> -		*-*-cygwin*) platDir="win" ;;
> +		*-*-mingw* | *-*-cygwin*) platDir="win" ;;
>   		*) platDir="unix" ;;
>   	    esac
>   	    if test x"${with_tclconfig}" != x ; then
> @@ -80,6 +80,31 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
>   		done
>   	    fi
>   
> +	    # Check where 32-bit vs 64-bit libraries are stored
> +	    lib32="/usr/lib"
> +	    lib64="/usr/lib"
> +            if test -d /usr/lib32 ; then
> +		lib32="/usr/lib32"
> +	    fi
> +	    if test -d /usr/lib64 ; then
> +		lib64="/usr/lib64"
> +	    fi
> +	    case "${CFLAGS}" in
> +		 *-m32*) force_32=yes ;;
> +		 *) force_32=no ;;
> +	    esac
> +            case "${host}" in
> +                i[3456]*) usrlibdir="${lib32}" ;;
> +                x86_64*)
> +			if test x"${force_32}" = xyes ; then
> +			   usrlibdir="${lib32}"
> +			else
> +			   usrlibdir="${lib64}"
> +			fi
> +			;;
> +                *) usrlibdir="/usr/lib" ;;
> +            esac
> +
>   	    # check in a few common install locations
>   	    if test x"${ac_cv_c_tclconfig}" = x ; then
>   		for i in `ls -d ${libdir} 2>/dev/null` \
> @@ -87,7 +112,12 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
>   			`ls -d ${prefix}/lib 2>/dev/null` \
>   			`ls -d /usr/local/lib 2>/dev/null` \
>   			`ls -d /usr/contrib/lib 2>/dev/null` \
> +			`ls -d ${usrlibdir} 2>/dev/null` \
> +			`ls -d ${usrlibdir}/tcl[[8-9]].[[0-9]] 2>/dev/null` \
> +			`ls -d ${usrlibdir}/tcl[[8-9]].[[0-9]]* 2>/dev/null` \
>   			`ls -d /usr/lib 2>/dev/null` \
> +			`ls -d /usr/lib/tcl[[8-9]].[[0-9]] 2>/dev/null` \
> +			`ls -d /usr/lib/tcl[[8-9]].[[0-9]]* 2>/dev/null` \
>   			; do
>   		    if test -f "$i/tclConfig.sh" ; then
>   			ac_cv_c_tclconfig=`(cd $i; pwd)`
> @@ -165,7 +195,7 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
>   
>   	    # then check for a private Tk library
>   	    case "${host}" in
> -		*-*-cygwin*) platDir="win" ;;
> +		*-*-mingw* | *-*-cygwin*) platDir="win" ;;
>   		*) platDir="unix" ;;
>   	    esac
>   	    if test x"${ac_cv_c_tkconfig}" = x ; then
> @@ -203,6 +233,31 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
>   		done
>   	    fi
>   
> +	    # Check where 32-bit vs 64-bit libraries are stored
> +	    lib32="/usr/lib"
> +	    lib64="/usr/lib"
> +            if test -d /usr/lib32 ; then
> +		lib32="/usr/lib32"
> +	    fi
> +	    if test -d /usr/lib64 ; then
> +		lib64="/usr/lib64"
> +	    fi
> +	    case "${CFLAGS}" in
> +		 *-m32*) force_32=yes ;;
> +		 *) force_32=no ;;
> +	    esac
> +            case "${host}" in
> +                i[3456]*) usrlibdir="${lib32}" ;;
> +                x86_64*)
> +			if test x"${force_32}" = xyes ; then
> +			   usrlibdir="${lib32}"
> +			else
> +			   usrlibdir="${lib64}"
> +			fi
> +			;;
> +                *) usrlibdir="/usr/lib" ;;
> +            esac
> +
>   	    # check in a few common install locations
>   	    if test x"${ac_cv_c_tkconfig}" = x ; then
>   		for i in `ls -d ${libdir} 2>/dev/null` \
> @@ -210,7 +265,12 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
>   			`ls -d ${prefix}/lib 2>/dev/null` \
>   			`ls -d /usr/local/lib 2>/dev/null` \
>   			`ls -d /usr/contrib/lib 2>/dev/null` \
> +			`ls -d ${usrlibdir} 2>/dev/null` \
> +			`ls -d ${usrlibdir}/tk[[8-9]].[[0-9]] 2>/dev/null` \
> +			`ls -d ${usrlibdir}/tk[[8-9]].[[0-9]]* 2>/dev/null` \
>   			`ls -d /usr/lib 2>/dev/null` \
> +			`ls -d /usr/lib/tk[[8-9]].[[0-9]] 2>/dev/null` \
> +			`ls -d /usr/lib/tk[[8-9]].[[0-9]]* 2>/dev/null` \
>   			; do
>   		    if test -f "$i/tkConfig.sh" ; then
>   			ac_cv_c_tkconfig=`(cd $i; pwd)`
  

Patch

diff --git a/config/tcl.m4 b/config/tcl.m4
index 4542a4b23d7..5a16c9cf18a 100644
--- a/config/tcl.m4
+++ b/config/tcl.m4
@@ -33,7 +33,7 @@  AC_DEFUN([SC_PATH_TCLCONFIG], [
 
 	    # First check to see if --with-tcl was specified.
 	    case "${host}" in
-		*-*-cygwin*) platDir="win" ;;
+		*-*-mingw* | *-*-cygwin*) platDir="win" ;;
 		*) platDir="unix" ;;
 	    esac
 	    if test x"${with_tclconfig}" != x ; then
@@ -80,6 +80,31 @@  AC_DEFUN([SC_PATH_TCLCONFIG], [
 		done
 	    fi
 
+	    # Check where 32-bit vs 64-bit libraries are stored
+	    lib32="/usr/lib"
+	    lib64="/usr/lib"
+            if test -d /usr/lib32 ; then
+		lib32="/usr/lib32"
+	    fi
+	    if test -d /usr/lib64 ; then
+		lib64="/usr/lib64"
+	    fi
+	    case "${CFLAGS}" in
+		 *-m32*) force_32=yes ;;
+		 *) force_32=no ;;
+	    esac
+            case "${host}" in
+                i[3456]*) usrlibdir="${lib32}" ;;
+                x86_64*)
+			if test x"${force_32}" = xyes ; then
+			   usrlibdir="${lib32}"
+			else
+			   usrlibdir="${lib64}"
+			fi
+			;;
+                *) usrlibdir="/usr/lib" ;;
+            esac
+
 	    # check in a few common install locations
 	    if test x"${ac_cv_c_tclconfig}" = x ; then
 		for i in `ls -d ${libdir} 2>/dev/null` \
@@ -87,7 +112,12 @@  AC_DEFUN([SC_PATH_TCLCONFIG], [
 			`ls -d ${prefix}/lib 2>/dev/null` \
 			`ls -d /usr/local/lib 2>/dev/null` \
 			`ls -d /usr/contrib/lib 2>/dev/null` \
+			`ls -d ${usrlibdir} 2>/dev/null` \
+			`ls -d ${usrlibdir}/tcl[[8-9]].[[0-9]] 2>/dev/null` \
+			`ls -d ${usrlibdir}/tcl[[8-9]].[[0-9]]* 2>/dev/null` \
 			`ls -d /usr/lib 2>/dev/null` \
+			`ls -d /usr/lib/tcl[[8-9]].[[0-9]] 2>/dev/null` \
+			`ls -d /usr/lib/tcl[[8-9]].[[0-9]]* 2>/dev/null` \
 			; do
 		    if test -f "$i/tclConfig.sh" ; then
 			ac_cv_c_tclconfig=`(cd $i; pwd)`
@@ -165,7 +195,7 @@  AC_DEFUN([SC_PATH_TKCONFIG], [
 
 	    # then check for a private Tk library
 	    case "${host}" in
-		*-*-cygwin*) platDir="win" ;;
+		*-*-mingw* | *-*-cygwin*) platDir="win" ;;
 		*) platDir="unix" ;;
 	    esac
 	    if test x"${ac_cv_c_tkconfig}" = x ; then
@@ -203,6 +233,31 @@  AC_DEFUN([SC_PATH_TKCONFIG], [
 		done
 	    fi
 
+	    # Check where 32-bit vs 64-bit libraries are stored
+	    lib32="/usr/lib"
+	    lib64="/usr/lib"
+            if test -d /usr/lib32 ; then
+		lib32="/usr/lib32"
+	    fi
+	    if test -d /usr/lib64 ; then
+		lib64="/usr/lib64"
+	    fi
+	    case "${CFLAGS}" in
+		 *-m32*) force_32=yes ;;
+		 *) force_32=no ;;
+	    esac
+            case "${host}" in
+                i[3456]*) usrlibdir="${lib32}" ;;
+                x86_64*)
+			if test x"${force_32}" = xyes ; then
+			   usrlibdir="${lib32}"
+			else
+			   usrlibdir="${lib64}"
+			fi
+			;;
+                *) usrlibdir="/usr/lib" ;;
+            esac
+
 	    # check in a few common install locations
 	    if test x"${ac_cv_c_tkconfig}" = x ; then
 		for i in `ls -d ${libdir} 2>/dev/null` \
@@ -210,7 +265,12 @@  AC_DEFUN([SC_PATH_TKCONFIG], [
 			`ls -d ${prefix}/lib 2>/dev/null` \
 			`ls -d /usr/local/lib 2>/dev/null` \
 			`ls -d /usr/contrib/lib 2>/dev/null` \
+			`ls -d ${usrlibdir} 2>/dev/null` \
+			`ls -d ${usrlibdir}/tk[[8-9]].[[0-9]] 2>/dev/null` \
+			`ls -d ${usrlibdir}/tk[[8-9]].[[0-9]]* 2>/dev/null` \
 			`ls -d /usr/lib 2>/dev/null` \
+			`ls -d /usr/lib/tk[[8-9]].[[0-9]] 2>/dev/null` \
+			`ls -d /usr/lib/tk[[8-9]].[[0-9]]* 2>/dev/null` \
 			; do
 		    if test -f "$i/tkConfig.sh" ; then
 			ac_cv_c_tkconfig=`(cd $i; pwd)`