Since it is also marked as Autoconf, I suggest setting the condition in configure.ac, if possible. Similar to this:
AM_CONDITIONAL([CONDITION_NAME], [test x"${SOMEVAR}" != x])
Then your Makefile.am will contain
if CONDITION_NAME <conditional code> else <else :)> endif
Update
The problem is related to
python setup.py --root=$(DESTDIR) --prefix=$(DESTDIR)$(prefix)
called from somewhere. If DESTDIR empty, the prefix can expand to a relative path that you do not want. You have confirmed that it is being called from your Makefile.am. Then you can do two things.
Change the above command to python setup.py --root=${DESTDIR}/// --prefix=${DESTDIR}///$(prefix) . A triple slash may be required because AFAIK, POSIX allows you to use double slashes of 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 can be noted that, in my opinion, and a limited understanding of the whole picture, none of this should be necessary. Since the original configure caller was able to pinpoint exactly which prefix he really wanted to use. If none are specified, Autoconf already by default sets the absolute path ( /usr/local ). So, I think, I do not quite understand why you ran into your problem.
source share