diff --git a/.gitignore b/.gitignore index 24fafc3..fb2a4e9 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,8 @@ config_liberasurecode.h.in .deps config_liberasurecode.h stamp-h1 + +# doxygen documentation +^doc/.*\.doxytag +^doc/html +^doc/doxygen.cfg diff --git a/Makefile.am b/Makefile.am index b7ec5dc..6787508 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,8 @@ # Top-level liberasurecode automake configuration ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = src test +SUBDIRS = src test doc + EXTRA_DIST = autogen.sh INCLUDE = -I$(abs_top_builddir)/include \ diff --git a/aclocal.m4 b/aclocal.m4 index 9bbc37a..f338346 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -114,6 +114,46 @@ AC_PREREQ([2.50])dnl am_aux_dir=`cd $ac_aux_dir && pwd` ]) +# AM_COND_IF -*- Autoconf -*- + +# Copyright (C) 2008, 2010 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_COND_IF +# _AM_COND_ELSE +# _AM_COND_ENDIF +# -------------- +# These macros are only used for tracing. +m4_define([_AM_COND_IF]) +m4_define([_AM_COND_ELSE]) +m4_define([_AM_COND_ENDIF]) + + +# AM_COND_IF(COND, [IF-TRUE], [IF-FALSE]) +# --------------------------------------- +# If the shell condition COND is true, execute IF-TRUE, otherwise execute +# IF-FALSE. Allow automake to learn about conditional instantiating macros +# (the AC_CONFIG_FOOS). +AC_DEFUN([AM_COND_IF], +[m4_ifndef([_AM_COND_VALUE_$1], + [m4_fatal([$0: no such condition "$1"])])dnl +_AM_COND_IF([$1])dnl +if test -z "$$1_TRUE"; then : + m4_n([$2])[]dnl +m4_ifval([$3], +[_AM_COND_ELSE([$1])dnl +else + $3 +])dnl +_AM_COND_ENDIF([$1])dnl +fi[]dnl +]) + # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 diff --git a/configure.ac b/configure.ac index 80e1ab4..751e588 100644 --- a/configure.ac +++ b/configure.ac @@ -1,3 +1,6 @@ +################################################################################ +# Standard Stuff +################################################################################ AC_INIT(liberasurecode,0.9.10) AC_GNU_SOURCE @@ -25,13 +28,20 @@ AC_PROG_MAKE_SET AX_EXT() +################################################################################ +# System Headers +################################################################################ dnl Check for C library headers AC_HEADER_STDC -AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h \ - string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h \ - signal.h dlfcn.h pthread.h unistd.h limits.h errno.h syslog.h) +AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h \ + malloc.h memory.h string.h strings.h inttypes.h \ + stdint.h ctype.h math.h iconv.h signal.h dlfcn.h \ + pthread.h unistd.h limits.h errno.h syslog.h) AC_CHECK_FUNCS(malloc calloc realloc free openlog) +################################################################################# +# Debug/coverage Options +################################################################################# AC_ARG_ENABLE([debug], [ --enable-debug Turn on debugging], [case "${enableval}" in @@ -74,15 +84,47 @@ dnl Expand the sources and objects needed to build the library AC_SUBST(ac_aux_dir) AC_SUBST(OBJECTS) +################################################################################# +# Doxygen Documentation +################################################################################# +AC_CHECK_PROG(DOXYGEN, doxygen, true, false) +AM_CONDITIONAL(HAVE_DOXYGEN, $DOXYGEN) +AC_SUBST(HAVE_DOXYGEN) + +dnl Let people disable the doxygen stuff. +AC_ARG_ENABLE(doxygen, [ --enable-doxygen Use doxygen to build documentation (default=auto)], + enable_doxygen="$enableval", + enable_doxygen=auto) + +if test x$enable_doxygen = xauto ; then + if test x$DOXYGEN = xtrue ; then + enable_doxygen=yes + else + enable_doxygen=no + fi +fi + +dnl NOTE: We need to use a separate automake conditional for this +dnl to make this work with the tarballs. +AM_CONDITIONAL(ENABLE_DOXYGEN, test x$enable_doxygen = xyes) + +################################################################################ +# Output Files +################################################################################ AC_CONFIG_FILES([\ src/builtin/null_code/Makefile \ src/builtin/xor_codes/Makefile \ src/Makefile \ test/Makefile \ + doc/Makefile \ Makefile \ erasurecode.pc \ Xorcode.pc ]) +AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"]) +AM_COND_IF([HAVE_DOXYGEN], + [AC_CONFIG_FILES([doc/doxygen.cfg])]) + AC_OUTPUT diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..aea521f --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,36 @@ +DOC_MODULE="liberasurecode" +HTML_DIR=$(datadir)/$(DOC_MODULE)/html +TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) + +all-local: html/index.html + +if ENABLE_DOXYGEN +html/index.html: doxygen.cfg + doxygen doxygen.cfg +else +html/index.html: +endif + +clean-local: + rm -f *~ *.bak + rm -rf html + +install-data-local: html + $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR) + (installfiles=`echo html/*`; \ + if test "$$installfiles" = 'html/*'; \ + then echo '-- Nothing to install' ; \ + else \ + for i in $$installfiles; do \ + echo '-- Installing '$$i ; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \ + done; \ + fi) + +dist-hook: + mkdir $(distdir)/html + mkdir $(distdir)/man + -cp html/* $(distdir)/html + -cp man/* $(distdir)/man + +.PHONY : html latex man diff --git a/doc/Doxyfile b/doc/doxygen.cfg.in similarity index 99% rename from doc/Doxyfile rename to doc/doxygen.cfg.in index 08c0a43..ec2c87d 100644 --- a/doc/Doxyfile +++ b/doc/doxygen.cfg.in @@ -32,13 +32,13 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "liberasurecode" +PROJECT_NAME = @PACKAGE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = +PROJECT_NUMBER = @PACKAGE_VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a @@ -751,8 +751,8 @@ WARN_LOGFILE = # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = ../include/erasurecode/erasurecode.h \ - ../include/erasurecode/erasurecode_backend.h +INPUT = @top_srcdir@/include/erasurecode/erasurecode.h \ + @top_srcdir@/include/erasurecode/erasurecode_backend.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses