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

2020-11-02 Thread anonymous
URL:
  

 Summary: PATH ignored searching for g++
 Project: Autoconf
Submitted by: None
Submitted on: Mon 02 Nov 2020 01:24:22 PM UTC
Category: None
Priority: 5 - Normal
Severity: 3 - Normal
  Status: None
 Privacy: Public
 Assigned to: None
Originator Email: nat...@acm.org
 Open/Closed: Open
 Discussion Lock: Any
Operating System: GNU/Linux

___

Details:

I have built and installed an uptodate g++ in a local directory, and pointed
my PATH at that set of tools.  The system g++ is too old (and no, I can;t
update it).

the autoconf 2.69c beta seems to ignore that and finds the g++ in /bin.

here's the PATH as printed in the config.log


PATH: /data/users/nathans/tools/bin/
PATH: /home/nathans/my/bin/
PATH: /data/users/nathans/tools/bin/
PATH: /usr/local/bin/
PATH: /bin/
PATH: /usr/bin/
PATH: /usr/local/sbin/
PATH: /usr/sbin/
PATH: /usr/facebook/ops/scripts/
PATH: /usr/facebook/scripts/
PATH: /usr/facebook/scripts/db/

Notice that has /data/users/nathans/tools/bin in there twice.  the second one
is from the shell's PATH var:

devvm293:368>echo $PATH
/home/nathans/my/bin:/data/users/nathans/tools/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/facebook/ops/scripts:/usr/facebook/scripts:/usr/facebook/scripts/db

the first is because the configure script is explicitly putting it there (via
a --with-tools= option)


here's what it says of g++

configure:2348: checking for g++
configure:2369: found /bin/g++
configure:2380: result: g++
configure:2407: checking for C++ compiler version
configure:2416: g++ --version >&5
g++ (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)

Here's my actual g++

devvm293:362>whence -p g++
/data/users/nathans/tools/bin/g++

devvm293:371>g++ --version
g++ (GCC) 10.1.1 20200604


I've not dug further into this.  The project containing all this is
gihub.com/urnathan/joust, I attach the configure.ac and config.m4, shout if
you need more.




___

File Attachments:


---
Date: Mon 02 Nov 2020 01:24:22 PM UTC  Name: configure.ac  Size: 1KiB   By:
None
configure scripts

---
Date: Mon 02 Nov 2020 01:24:22 PM UTC  Name: config.m4  Size: 8KiB   By: None
configure scripts

---
Date: Mon 02 Nov 2020 01:24:22 PM UTC  Name: configure  Size: 139KiB   By:
None
configure scripts


___

Reply to this item at:

  

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




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

2020-11-15 Thread Zack Weinberg
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:

  

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