Commit 745cbcf8a9fcb1e82e81768cd28b499445a50315

sammy 2008-04-04T13:16:45

* Build the documentation the autotools way. If doxygen is not present, then do nothing.

diff --git a/configure.ac b/configure.ac
index 0e99ac4..e1646b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,10 +38,8 @@ AC_CHECK_FUNCS([memset])
 
 AC_PROG_INSTALL
 
-AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen])
-if test -z "$DOXYGEN" ; then
-    DOXYGEN=:
-fi
+AC_PATH_PROG(DOXYGEN, doxygen, no)
+AM_CONDITIONAL(HAVE_DOXYGEN, test "$DOXYGEN" != "no")
 
 AC_CONFIG_FILES([
   ftgl.pc
diff --git a/docs/Makefile.am b/docs/Makefile.am
index dbf2128..8b864cc 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -1,20 +1,32 @@
 
-DOXYFILE = ftgl_dox
-DOCDIRS = html
+if HAVE_DOXYGEN
+htmldocdir = $(datadir)/doc/ftgl/html
+htmldoc_DATA = html/doxygen.css
+endif
 
-all: doc
-
-doc: doc-stamp
-doc-stamp: $(DOXYFILE)
-	sed 's,^INPUT[ 	].*,INPUT=../../src,' $^ | $(DOXYGEN) -
+html/doxygen.css: doc-stamp
+doc-stamp: ftgl_dox
+	$(DOXYGEN) $^
 	touch $@
 
-install-data-local: doc
-	$(INSTALL) -d -m 0755 $(DESTDIR)$(datadir)/doc/$(PACKAGE_NAME)/html
-	$(INSTALL) -m 0644 html/* $(DESTDIR)$(datadir)/doc/$(PACKAGE_NAME)/html/
-
-distclean-local:
-	$(RM) -r $(DOCDIRS)
+clean: clean-local
+clean-local:
+	$(RM) -rf html
 	$(RM) doc-stamp
 
-.PHONY: all doc
+if HAVE_DOXYGEN
+install-data-local: html/doxygen.css
+	$(mkinstalldirs) $(DESTDIR)$(datadir)/doc/$(PACKAGE_NAME)/html
+	$(INSTALL) -m 0644 \
+	  `find html -name '*.html' -o -name '*.gif' -o -name '*.png'` \
+	  $(DESTDIR)$(datadir)/doc/$(PACKAGE_NAME)/html/
+endif
+
+EXTRA_DIST = \
+    ftgl_dox \
+    FTGL.html \
+    FTGL_1_3.gif \
+    images/ftgldemo.jpg \
+    images/metrics.png \
+    html.tar.gz \
+    $(NULL)