Commit 42b03d10 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Add sanity check for public headers

parent b6bfe74a
......@@ -371,8 +371,15 @@ misc/revision.c:
###############################################################################
# Unit/regression test
###############################################################################
check_PROGRAMS = test_i18n_atof test_url test_utf8 test_control
dist_check_SCRIPTS = check_symbols
check_PROGRAMS = \
test_i18n_atof \
test_url \
test_utf8 \
test_headers \
test_control \
$(NULL)
dist_check_SCRIPTS = check_symbols check_headers
TESTS = $(check_PROGRAMS) $(dist_check_SCRIPTS)
CFLAGS_tests = `$(VLC_CONFIG) --cflags libvlc`
......@@ -388,10 +395,24 @@ test_utf8_SOURCES = test/utf8.c
test_utf8_LDADD = libvlc.la
test_utf8_CFLAGS = $(CFLAGS_tests)
test_headers_SOURCES = test/headers.c
test_headers_CFLAGS = $(CFLAGS_tests)
test_control_SOURCES = control/testapi.c
test_control_LDADD = libvlc-control.la
test_control_CFLAGS = $(CFLAGS_tests)
check-local:
for h in `echo $(dist_pkginclude_HEADERS) $(pkginclude_HEADERS) | sed -e s,\.\./include/,,g`; \
do \
echo grep - "#include <$$h>" $(srcdir)/test/headers.c ; \
if ! grep -- "#include <$$h>" $(srcdir)/test/headers.c ; \
then \
echo "Header $$h not included in test/headers.c!"; \
exit 1; \
fi ; \
done
FORCE:
@echo "Generated source cannot be phony. Go away." >&2
@exit 1
......
/*****************************************************************************
* headers.c: Test for public headers usability
*****************************************************************************
* Copyright (C) 2007 Rémi Denis-Courmont
* $Id$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/* config.h is NOT installed, headers MUST NOT depend on it.
# include <config.h> */
/* One thing we don't check is the CPPFLAGS - these MUST be exposed publicly,
* e.g. using pkg-config or the broken old vlc-config. */
#include <vlc/vlc.h>
#include <vlc/libvlc.h>
#include <vlc/libvlc_structures.h>
#include <vlc/mediacontrol.h>
#include <vlc/mediacontrol_structures.h>
int main (void)
{
puts ("Public headers can be used for external compilation.");
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment