./configure with CC="ccache gcc" doesn't work

Michal Sojka sojkam1 at fel.cvut.cz
Thu Jan 20 06:38:39 PST 2011


On Thu, 20 Jan 2011, Andy Wingo wrote:
> On Thu 20 Jan 2011 10:50, Michal Sojka <sojkam1 at fel.cvut.cz> writes:
> 
> > Hmm, the IFS thing in configure seems annoying in this case. But you can
> > create a little script containing
> >
> >   exec ccache gcc "$@"
> >
> > and set CC to the name of the script, cannot you?
> 
> Sure.  But the ccache thing is fairly common, AFAIK, and IMO notmuch's
> configure should either handle spaces in a non-absolute-path $CC or exit
> with an error in that case.
> 
> And, oddly enough, the $CC does succeed in compiling, modulo this build
> error -- so it seems that the $IFS isn't actually providing any benefit
> in this case.  (If the IFS did its job, I would expect to see an error
> like "ccache gcc: command not found" or something.)

Hmm, after experimenting a bit, it seems that there is no way to
distinguish between the command with space in its name and your case
with ccache.

I tend to think that having IFS without space is not much useful here
because plenty of software use GNU Make and it cannot handle file names
with spaces at all. So many things would be really difficult, if someone
use spaces in the name of his/her binaries such as gcc or xapian-config.

I went through configure in notmuch and it seems that there is only one
place where the value of IFS matters (the call to ldconfig), so we may
want to apply the patch bellow. On the other hand, a brief look at
Makefile reveals that there are many things that wont work if there are
spaces in filanames[1], so I'm not sure whether to care about that
single case at all.

diff --git a/configure b/configure
index c58dd0f..a196962 100755
--- a/configure
+++ b/configure
@@ -1,13 +1,5 @@
 #! /bin/sh
 
-# Removing space from IFS makes it much easier to support filenames
-# with spaces. See http://www.dwheeler.com/essays/filenames-in-shell.html
-# for gory details.
-IFS="$(printf '\n\t')"
-
-# Since we don't have space in IFS we use tab to separate things in lists
-tab="$(printf '\t')"
-
 # Set several defaults (optionally specified by the user in
 # environemnt variables)
 CC=${CC:-gcc}
@@ -303,11 +295,14 @@ elif [ $uname = "Linux" ] ; then
     platform=LINUX
     linker_resolves_library_dependencies=1
     ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
+    OLD_IFS=$IFS
+    IFS="$(printf '\n')" 
     for path in $ldconfig_paths; do
        if [ "$path" = "$libdir_expanded" ]; then
            libdir_in_ldconfig=1
        fi
     done
+    IFS=$OLD_IFS
 else
     printf "Unknown.\n"
     cat <<EOF


Footnotes: 
[1]  For example most commands in install targets contain unquoted
     parameters so if DESTDIR contains a space, it wont work.



More information about the notmuch mailing list