public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/111325] New: config/acx.m4: <PROG>_FOR_TARGET are not usable at top level
@ 2023-09-07  9:44 pexu@gcc-bugzilla.mail.kapsi.fi
  0 siblings, 0 replies; only message in thread
From: pexu@gcc-bugzilla.mail.kapsi.fi @ 2023-09-07  9:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111325

            Bug ID: 111325
           Summary: config/acx.m4: <PROG>_FOR_TARGET are not usable at top
                    level
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pexu@gcc-bugzilla.mail.kapsi.fi
  Target Milestone: ---

Hi.

`<PROG>_FOR_TARGET' environment variables are not usable if used at top level
configure when build == host and build != target.

The problem is that ACX_CHECK_INSTALLED_TARGET_TOOL first checks for <prog>. 
If cache variable `ac_cv_path_<VAR>' (`VAR'=`<PROG>_FOR_TARGET') is empty,
attempts to use AC_PATH_PROG(VAR, PROG, ...) (defined at
lib/autoconf/programs.m4).  Unfortunately, AC_PATH_PROG always sets `<VAR>' to
cache variable `ac_cv_path_<VAR>' (that we know is potentially empty), i.e.
`<PROG>_FOR_TARGET'=`ac_cv_path_<PROG>_FOR_TARGET'.  If <prog> is not found,
the (empty) cache variable is not touched, thus overwriting any user provided
`<PROG>_FOR_TARGET' value.

Then, NCN_STRICT_CHECK_TARGET_TOOLS tries to look for <target-prefix><prog>. 
If `<PROG>_FOR_TARGET' should be used (<target-prefix><prog> is not available),
it comes up now empty due to earlier AC_PATH_PROG call.

Ultimately, `<PROG>_FOR_TARGET' is set to a default value <target-prefix><prog>
for any subsequent configure runs and the user provided value is not picked up.
 This very likely will not work, given user attempted to override this using
`<PROG>_FOR_TARGET'.

config/acx.m4:
340: AC_DEFUN([ACX_CHECK_INSTALLED_TARGET_TOOL], [
... # NB: Omitted when build == host and build != target.
359: if test -z "$ac_cv_path_$1" && test -n "$gcc_cv_tool_dirs"; then
360:   AC_PATH_PROG([$1], [$2], [], [$gcc_cv_tool_dirs]) # NB:
$1=$ac_cv_path_$1 if $1 is not found from $gcc_cv_tool_dirs.
361: fi
362: if test -z "$ac_cv_path_$1" ; then
363:   NCN_STRICT_CHECK_TARGET_TOOLS([$1], [$2])
364: else
365:   $1=$ac_cv_path_$1
366: fi
367: ]) []dnl # ACX_CHECK_INSTALLED_TARGET_TOOL

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-07  9:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-07  9:44 [Bug bootstrap/111325] New: config/acx.m4: <PROG>_FOR_TARGET are not usable at top level pexu@gcc-bugzilla.mail.kapsi.fi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).