#5 Unexpanded shell var breaks tclConfig.sh detection
Opened 5 years ago by dmacks. Modified 4 years ago

In configure.ac:

  if test x"${ac_cv_c_tclconfig}" = x ; then
    for i in `ls -d ${libdir} 2>/dev/null` \
      `ls -d /usr/lib 2>/dev/null` \
[...]
      if test -f "$i/tclConfig.sh" ; then
        ac_cv_c_tclconfig=`(cd $i; pwd)`
        break
      fi
    done
  fi

First, that set of 'ls' seems unusual, since the only function in the loop is to test if a file exists. All the shell calls do is avoid running the loop for dirs that don't exist. Doesn't -f suffice, meaning you could just pass the list of dirs as strings without bothering to test if they exist?

But the current loop also has a functional bug for the first entry: the default value of ${libdir} is a string that contains another shell variable:

libdir='${exec_prefix}/lib'

but the ls construct does not expand it. That is, it literally tests whether ${exec_prefix}/lib/tclConfig.sh exists, not interpolating the value of ${exec_prefix}.

Luckily, I can pre-set $ac_cv_c_tclconfig to the dir I want, but having to use an autoconf cache variable instead of being able to pass a normal ./configure flag is also clunky (but at least it equally allows me to declare that tcl is somewhere other than where configure.ac arbitrarily hardcodes it to possibly be (including possibly tcl8.6!)


Hm, yes, this is weird. I'm not sure what would be the best way to expand the libdir variable.

Actually, it doesn't look like it's possible to expand correctly $libdir in that check. Its default value is "NONE" and it's set to ${exec_prefix}/lib only later in the script.

Login to comment on this ticket.

Metadata