Commit ecea190c1129ce417ebd508b0fcfccf9d2b8ba3b

sammy 2008-04-29T23:08:14

* Small C test program. It does not do anything yet, but it's already a good thing to know whether all public headers can be #included from C code.

diff --git a/.gitignore b/.gitignore
index 9f8a15b..a052639 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@ stamp-h1
 *.la
 demo/FTGLDemo
 demo/FTGLMFontDemo
+test/CTest
 test/FTGLTest
 docs/doc-stamp
 docs/html
diff --git a/configure.ac b/configure.ac
index 8cbef81..63c5eb3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,6 +27,7 @@ AC_PROG_INSTALL
 dnl These don't mix with C++
 dnl AC_C_CONST
 dnl AC_C_INLINE
+AM_PROG_CC_C_O
 
 # Checks for header files.
 AC_HEADER_STDC
diff --git a/test/CTest.c b/test/CTest.c
new file mode 100644
index 0000000..b22c7dd
--- /dev/null
+++ b/test/CTest.c
@@ -0,0 +1,20 @@
+/* Small C bindings test program */
+
+#include <ftgl.h>
+
+int main(int argc, char *argv[])
+{
+    FTGLfont *f;
+
+    if(argc < 2)
+        return 1;
+
+    f = ftglCreateBitmapFont(argv[1]);
+    if(f == NULL)
+        return 2;
+
+    ftglDestroyFont(f);
+
+    return 0;
+}
+
diff --git a/test/Makefile.am b/test/Makefile.am
index 7796bb7..a3e62d7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,7 +1,7 @@
 
 if HAVE_CPPUNIT
 if HAVE_GLUT
-noinst_PROGRAMS = FTGLTest
+noinst_PROGRAMS = CTest FTGLTest
 endif
 endif
 
@@ -46,6 +46,19 @@ FTGLTest_CXXFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS)
 FTGLTest_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS) -lcppunit
 FTGLTest_LDADD = ../src/libftgl.la
 
+CTest_SOURCES = \
+    CTest.c \
+    $(NULL)
+CTest_CPPFLAGS = \
+    -I$(top_srcdir)/include \
+    -I$(top_srcdir)/src \
+    -I$(top_srcdir)/src/FTGlyph \
+    -I$(top_srcdir)/src/FTFont \
+    -I$(top_srcdir)/src/FTLayout
+CTest_CFLAGS = $(FT2_CFLAGS) $(GL_CFLAGS)
+CTest_LDFLAGS = $(FT2_LIBS) $(GLUT_LIBS)
+CTest_LDADD = ../src/libftgl.la
+
 DEACTIVATED = \
     FTFont-Test.cpp \
     FTGlyphContainer-Test.cpp \