bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sr #110359] PATH ignored searching for g++


From: Zack Weinberg
Subject: [sr #110359] PATH ignored searching for g++
Date: Sun, 15 Nov 2020 15:54:44 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Update of sr #110359 (project autoconf):

                  Status:                    None => Not Autoconf           
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

I cannot reproduce this problem using only code from autoconf proper, e.g.


AC_INIT([foo], [1])
AC_PROG_CXX
AC_OUTPUT


reliably selects the first g++ to be found in $PATH.

I *can* reproduce this problem with your configure script, but only if I
*don't* give a --with-tools or --with-toolbin option. 

I believe the bug is in your NMS_TOOLS macro, specifically this bit


if test -d $tools/bin ; then
  toolbin=$tools/bin
fi


If control reaches this point with $tools empty, which is what happens when
neither --with-tools or --with-toolbin is used, it will set $toolbin to "/bin"
on any system where /bin exists, and then that directory will be prepended to
$PATH.

I tried this rewrite of NMS_TOOLS and it works for me:


AC_DEFUN([NMS_TOOLS],
[AC_SUBST([tools], [])
AC_SUBST([toolbin], [])
AC_ARG_WITH([tools],
  AS_HELP_STRING([--with-tools=DIR],[tool directory]),
  [AS_CASE([$withval],
    [yes], [AC_MSG_ERROR([--with-tools requires an argument])],
    [no], [:],
    [tools="${withval%/bin}"])])

AC_ARG_WITH([toolbin],
  AS_HELP_STRING([--with-toolbin=DIR],[tool bin directory]),
  [AS_CASE([$withval],
    [yes], [AC_MSG_ERROR([--with-toolbin requires an argument])],
    [no], [:],
    [toolbin="${withval%/bin}/bin"])])

if test -n "$tools" && test -n "$toolbin"; then
  AC_MSG_ERROR([--with-tools and --with-toolbin are mutually exclusive])
fi
if test -n "$tools"; then
  toolbin="$tools/bin"
fi
if test -n "$toolbin"; then
  if test -d "$toolbin"; then
    PATH="$toolbin:$PATH"
    tools="${toolbin%/bin}"
    AC_MSG_NOTICE([Using tools in $tools])
  else
    AC_MSG_ERROR([tool location does not exist])
  fi
fi])


I'm going to go ahead and close this bug report.  Please feel free to reopen
if you can find a problem stemming from code in Autoconf itself.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?110359>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]