#!/usr/bin/make -f
%:
	dh $@

override_dh_auto_clean:
	if [ -f buildsys.mk ]; then				\
		dh_auto_clean;					\
	else							\
		rm -fr aclocal.m4 autom4te.cache config.log;	\
	fi

override_dh_auto_configure:
	# Use clang where available, otherwise gcc (with reduced features).
	# -gdwarf-4 to work around dwz complaining about .debug_addr.
	# -Wl,--as-needed gets automatically added for GCC, but not Clang.
	case "$$DEB_HOST_ARCH" in \
	alpha | hppa | hurd-amd64 | ia64 | m68k | sh4 | x32)	\
		export OBJC=gcc;				\
		;;						\
	*)							\
		export OBJC=clang;				\
		export OBJCFLAGS="${CFLAGS} -gdwarf-4";		\
		export LDFLAGS="${LDFLAGS} -Wl,--as-needed";	\
		;;						\
	esac;							\
								\
	dh_auto_configure -- 					\
		--with-tls=gnutls				\
		--disable-rpath
