From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by sourceware.org (Postfix) with ESMTPS id 420E0387084B for ; Sat, 15 Jun 2024 04:03:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 420E0387084B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 420E0387084B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1029 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718424233; cv=none; b=OIA2GklJNzjCLbUZmcFqZCUXm/i49dEX4OqbERsbk5ZMJKg1dKlufcRJ1lMvMrKRa254K5a6WXfgnjZMzXt3BlDEz8vqi03SaYJ46xp94k2QzEFSTifu8dDvHsdLlFE+lYfJwxJwgT0a0sbfhbGpewdM7K15svBd+kJKGac/+ps= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718424233; c=relaxed/simple; bh=I85r0T5nLLonblMwS1hYFn1LCv+09m5hXWQe7qmUMRQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=WBYSi8nXSbBGhUsJZR+IRIInLOjmDkFYtQ5ABd6OPtJSwaB8BPcMySbP1TYc/Ob5rV6YCd0KtRUdkiJXOmAZGSduwK8sP31FLDzgpNyYn827ic/NKae++tn9S3YvxGebvLbNe1/3/d0Jw0dvP5uFIk32rLWBQdhcUG+1MlO7yEM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2c2c9199568so2537808a91.0 for ; Fri, 14 Jun 2024 21:03:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718424229; x=1719029029; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Q3kFOV/bLo/PI08T/Mci8HJh/rkEAb+Hfvl6PJUNSic=; b=UAkrD3xYGcrIah5TYasRyEK+AbRk/uvP+d7jgcaywbCnYMNtvyICZbo4XTLX3g7qva YRSwl/K2KXpzDg0UZinN9XyypbVk6FSqIxpOER7MCsxNsELIVyKS4+te93ieDoy/ujLN WoQ9nQJ6SuCKnQ39HDanLszifIzOK+m3Z3hQ8BvCrFvJMSrmhOyc4tzQf8n+UlNnCRSF y1ooRtP25UV070hi4rF8k3gY7V9VXJCWuxM6kKe5+i4VTqYV8+/Yd25c9+w7PmAPIW9i +mSNzgW9Gky/FgtIkVsHOTTf2yK7np4SEp6inqxtTsEiQEhYYlurLe4eA6cG4Ff9D2Um c06Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718424229; x=1719029029; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Q3kFOV/bLo/PI08T/Mci8HJh/rkEAb+Hfvl6PJUNSic=; b=qLLSdW4Li4IXuDGusydG5ISWhcI9z+ha/9DOWcB3VI2zv+6jiMV4mCZ62+rrFlTirh l9Yj814FXSBww9EnQLNIhs4VKKi5dsj3gk/nglDYK8+roI4DKK3PAFzrHvJAEduLn8ky RVtRwI7oDhbwbZUDPE059ohnbpzrO8GAQae7Jl9PMEv5cBLmTODuT2H3OmojlEtFW6Up cK4fwKjG3hrrinOyuZIAYq1e0URsyXysAZ411r6YUzOTH2FhPN6C2BkUmcGJRgeOKkQc Q67jEgvH7TLe6/OGpMIhq95Hpp7/yx0QhfX0UHjTMf4MAOyCpSIFiA7qP0mmlDKymx6S vmhg== X-Gm-Message-State: AOJu0YyIkmo8g/nsZXnJvKwbATqgnoVq+rJYpXXRq0aDwoQ76gQZjp2V UCk52/886f/TwXTvC/SOA4wIpYJTETeH6jvVgHryqnzKr/YUCoSecJfE0wtaIGKeJFzyNRnP6uN U X-Google-Smtp-Source: AGHT+IFAgTQ9ky/amIDsR3TaSFSMsR4QMATpbj54la+bHYgB3HydG7h4HPTIyflH8W0B7AhJsK5BpQ== X-Received: by 2002:a17:90b:30cb:b0:2c1:a9d9:67be with SMTP id 98e67ed59e1d1-2c4db24bcdemr4544942a91.13.1718424229001; Fri, 14 Jun 2024 21:03:49 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:71fc:a875:5503:8c5c]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c4a75d1d40sm7048841a91.9.2024.06.14.21.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 21:03:48 -0700 (PDT) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Cc: Eli Zaretskii , Andrew Burgess Subject: [PATCH v2] gdb/configure.ac: Fix AC_DEFINE_DIR to work with Windows path separator Date: Sat, 15 Jun 2024 01:03:45 -0300 Message-ID: <20240615040345.1824744-1-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Both --with-auto-load-dir and --with-auto-load-safe-path accept a list of directories, which are separated by ':' on Unix and ';' on Windows. However, as mentioned in PR 18898 this doesn't work on the latter OS. This is because the AC_DEFINE_DIR macro calls eval twice on the value provided via these configure options, causing the ';' to be interpreted by the shell. E.g., $ ~/src/binutils-gdb/configure \ --disable-{binutils,ld,gold,gas,sim,gprof,gprofng} \ --with-auto-load-dir='foo;bar' && make ⋮ checking for default auto-load directory... /home/bauermann/src/binutils-gdb/gdb/configure: line 18004: bar: command not found foo;bar checking for default auto-load safe-path... /home/bauermann/src/binutils-gdb/gdb/configure: line 18031: bar: command not found foo;bar Line 18004 is: ac_define_dir=`eval echo $escape_dir` Line 18031 is identical. AC_DEFINE_DIR originally came from autoconf-archive. It was since removed from there, but we ship it in gdb/include.m4. Andrew noticed that the last version of the macro had improvements around quoting. And indeed, adopting the latest version does fix the problem: $ ~/src/binutils-gdb/configure \ --disable-{binutils,ld,gold,gas,sim,gprof,gprofng} \ --with-auto-load-dir='foo;bar' && make ⋮ checking for default auto-load directory... foo;bar checking for default auto-load safe-path... foo;bar ⋮ $ grep AUTO_LOAD gdb/config.h #define AUTO_LOAD_DIR "foo;bar" #define AUTO_LOAD_SAFE_PATH "foo;bar" Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18898 Suggested-by: Andrew Burgess --- Hello, This is a different approach to solve PR 18898. v1 used the approach of adding a MinGW special case in the definitions of --with-auto-load-dir and --with-auto-load-safe-path to escape the ';' in them. Andrew Burgess noticed that there was a newer definition of the AC_DEFINE_DIR macro in autoconf-archive and suggested that it could fix the problem. I tested it, and indeed it does! Though for completeness it would be nice if Eli could confirm that it also solves the problem for him. So v2's approach is to update our definition of AC_DEFINE_DIR. Changes since v1: - Everything. gdb/acinclude.m4 | 19 +++--- gdb/configure | 148 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 118 insertions(+), 49 deletions(-) diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index 915082056dd9..61f9d9fb5052 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -60,13 +60,18 @@ dnl Version 1.3 (2001/03/02) dnl source http://www.gnu.org/software/ac-archive/Miscellaneous/ac_define_dir.html AC_DEFUN([AC_DEFINE_DIR], [ - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo [$]$2` - ac_define_dir=`eval echo [$]ac_define_dir` - ifelse($3, , - AC_DEFINE_UNQUOTED($1, "$ac_define_dir"), - AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3)) + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix +dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn +dnl refers to ${prefix}. Thus we have to use `eval' twice. + eval ac_define_dir="\"[$]$2\"" + eval ac_define_dir="\"$ac_define_dir\"" + AC_SUBST($1, "$ac_define_dir") + AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3]) + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE ]) dnl See whether we need a declaration for a function. diff --git a/gdb/configure b/gdb/configure index 15ececfefa26..8cb95e14a9a1 100755 --- a/gdb/configure +++ b/gdb/configure @@ -763,7 +763,11 @@ AMD_DBGAPI_CFLAGS ENABLE_BFD_64_BIT_FALSE ENABLE_BFD_64_BIT_TRUE subdirs +AUTO_LOAD_SAFE_PATH +AUTO_LOAD_DIR +RELOC_SRCDIR GDB_DATADIR +BINDIR DEBUGDIR MAKEINFO_EXTRA_FLAGS MAKEINFOFLAGS @@ -11499,7 +11503,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11502 "configure" +#line 11506 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11605,7 +11609,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11608 "configure" +#line 11612 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -24620,15 +24624,21 @@ else fi - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $DEBUGDIR` - ac_define_dir=`eval echo $ac_define_dir` + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$DEBUGDIR\"" + eval ac_define_dir="\"$ac_define_dir\"" + DEBUGDIR="$ac_define_dir" + cat >>confdefs.h <<_ACEOF #define DEBUGDIR "$ac_define_dir" _ACEOF + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE @@ -24674,15 +24684,21 @@ fi # This breaks GDB's relocatable path conversions since paths passed in # config.h would not get so translated, the path prefixes no longer match. - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $bindir` - ac_define_dir=`eval echo $ac_define_dir` + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$bindir\"" + eval ac_define_dir="\"$ac_define_dir\"" + BINDIR="$ac_define_dir" + cat >>confdefs.h <<_ACEOF #define BINDIR "$ac_define_dir" _ACEOF + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE # GDB's datadir relocation @@ -24698,15 +24714,21 @@ else fi - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $GDB_DATADIR` - ac_define_dir=`eval echo $ac_define_dir` + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$GDB_DATADIR\"" + eval ac_define_dir="\"$ac_define_dir\"" + GDB_DATADIR="$ac_define_dir" + cat >>confdefs.h <<_ACEOF #define GDB_DATADIR "$ac_define_dir" _ACEOF + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE @@ -24739,15 +24761,21 @@ _ACEOF if test "${with_relocated_sources+set}" = set; then : withval=$with_relocated_sources; reloc_srcdir="${withval}" - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $reloc_srcdir` - ac_define_dir=`eval echo $ac_define_dir` + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$reloc_srcdir\"" + eval ac_define_dir="\"$ac_define_dir\"" + RELOC_SRCDIR="$ac_define_dir" + cat >>confdefs.h <<_ACEOF #define RELOC_SRCDIR "$ac_define_dir" _ACEOF + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE fi @@ -24765,15 +24793,21 @@ fi escape_dir=`echo $with_auto_load_dir | sed -e 's/[$]datadir\>/\\\\\\\\\\\\&/g' -e 's/[$]debugdir\>/\\\\\\\\\\\\&/g'` - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $escape_dir` - ac_define_dir=`eval echo $ac_define_dir` + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$escape_dir\"" + eval ac_define_dir="\"$ac_define_dir\"" + AUTO_LOAD_DIR="$ac_define_dir" + cat >>confdefs.h <<_ACEOF #define AUTO_LOAD_DIR "$ac_define_dir" _ACEOF + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_dir" >&5 $as_echo "$with_auto_load_dir" >&6; } @@ -24792,15 +24826,21 @@ fi escape_dir=`echo $with_auto_load_safe_path | sed -e 's/[$]datadir\>/\\\\\\\\\\\\&/g' -e 's/[$]debugdir\>/\\\\\\\\\\\\&/g'` - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $escape_dir` - ac_define_dir=`eval echo $ac_define_dir` + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$escape_dir\"" + eval ac_define_dir="\"$ac_define_dir\"" + AUTO_LOAD_SAFE_PATH="$ac_define_dir" + cat >>confdefs.h <<_ACEOF #define AUTO_LOAD_SAFE_PATH "$ac_define_dir" _ACEOF + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 $as_echo "$with_auto_load_safe_path" >&6; } @@ -27343,15 +27383,21 @@ else fi - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $JIT_READER_DIR` - ac_define_dir=`eval echo $ac_define_dir` + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$JIT_READER_DIR\"" + eval ac_define_dir="\"$ac_define_dir\"" + JIT_READER_DIR="$ac_define_dir" + cat >>confdefs.h <<_ACEOF #define JIT_READER_DIR "$ac_define_dir" _ACEOF + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE @@ -30964,15 +31010,21 @@ else fi - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $TARGET_SYSTEM_ROOT` - ac_define_dir=`eval echo $ac_define_dir` + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$TARGET_SYSTEM_ROOT\"" + eval ac_define_dir="\"$ac_define_dir\"" + TARGET_SYSTEM_ROOT="$ac_define_dir" + cat >>confdefs.h <<_ACEOF #define TARGET_SYSTEM_ROOT "$ac_define_dir" _ACEOF + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE @@ -31010,15 +31062,21 @@ else fi - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $SYSTEM_GDBINIT` - ac_define_dir=`eval echo $ac_define_dir` + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$SYSTEM_GDBINIT\"" + eval ac_define_dir="\"$ac_define_dir\"" + SYSTEM_GDBINIT="$ac_define_dir" + cat >>confdefs.h <<_ACEOF #define SYSTEM_GDBINIT "$ac_define_dir" _ACEOF + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE @@ -31056,15 +31114,21 @@ else fi - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - ac_define_dir=`eval echo $SYSTEM_GDBINIT_DIR` - ac_define_dir=`eval echo $ac_define_dir` + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix + eval ac_define_dir="\"$SYSTEM_GDBINIT_DIR\"" + eval ac_define_dir="\"$ac_define_dir\"" + SYSTEM_GDBINIT_DIR="$ac_define_dir" + cat >>confdefs.h <<_ACEOF #define SYSTEM_GDBINIT_DIR "$ac_define_dir" _ACEOF + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE