Since it's tagged as Autoconf also, I suggest putting the condition in configure.ac, if that is possible. Similar to so:
AM_CONDITIONAL([CONDITION_NAME], [test x"${SOMEVAR}" != x])
Then, your Makefile.am would contain
if CONDITION_NAME
<conditional code>
else
<else :)>
endif
Update
The problem has to do with
python setup.py --root=$(DESTDIR) --prefix=$(DESTDIR)$(prefix)
being called from somewhere. If DESTDIR
is empty, the prefix may expand to a relative path, which is not what you want. You have confirmed it is being called from your Makefile.am. Then there's two things you can do.
Change the above command to python setup.py --root=${DESTDIR}/// --prefix=${DESTDIR}///$(prefix)
. Triple slashes may be necessary since, AFAIK, POSIX allows for double slashes to have a special meaning, but not for three or more consecutive slashes.
Change the above command to DESTDIR=${DESTDIR:-///} && python setup.py --root=${DESTDIR} --prefix=${DESTDIR}$(prefix)
It may be noteworthy that, in my opinion and limited understanding of the whole picture, none of that should be necessary. Since the original caller of configure
was able to specify exactly which prefix
he really wanted to use. If none is specified, Autoconf already defaults to an absolute path (/usr/local
). So, I guess, I don't quite understand why you run into your problem.