#!/bin/sh
#
# This script (hopefully) fixes linker trouble after calling
#	configure --disable-treemaps
#
# This fixes make rules generated by a Perl script that is a bit too clever:
# All header files in this directory are searched for "Q_OBJECT" and linked to
# the resulting program, completely disregarding all rules in Makefile.am,
# thus the USE_TREEMAP conditionals there.  :-(
#
# Usage: Call "configure" with the options desired, then this script.
# It will figure out automatically from ../config.h what configure options
# you specified and move undesired header files out of the way while
# regenerating the Makefiles.
#
# Call it again if you get weird linker errors.
#
#
# Author: Stefan Hundhammer <sh@suse.de>
#

tmpdir=$$.tmp
treemaps=*treemap.h

if [ -e kdirtreemap.h ]; then
	if grep -q "USE_TREEMAPS 0" ../config.h ; then
		echo "Moving treemap headers out of the way"
		mkdir $tmpdir
		mv *treemap.h $tmpdir
	fi
else
	echo "No treemap sources here - no need to move them out of the way"
fi

echo "Regenerating moc make rules"
make force-reedit

if [ -d $tmpdir ] ; then
	echo "Moving treemap headers back"
	mv $tmpdir/* .
	rmdir $tmpdir
fi


# EOF
