#!/bin/sh
#
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.

abs_top_srcdir=@abs_top_srcdir@
prefix=@prefix@
includedir=@includedir@

headers_to_install() {
	find "${abs_top_srcdir}/lib" -name "*.h" -or -name "*.h.in" |
		grep -v -F /win32/ |
		sed -n \
		    -e "s|\.h\.in$|\.h|" \
		    -e "s|.*include/|${DESTDIR}${includedir}/|p" |
		sort -u
}

status=0

for header in $(headers_to_install); do
	if [ ! -f "${header}" ]; then
		echo "Missing $header"
		status=1
	fi
done

exit $status
