From e351df6bb4c05d2cffa4f3a22688f04e9a83f8f4 Mon Sep 17 00:00:00 2001 From: Tomas Chvatal Date: Wed, 6 Jun 2012 11:03:29 +0200 Subject: [PATCH] Create the manpage conditionaly, and also install it when needed. Signed-off-by: Tomas Chvatal --- Makefile.am | 22 ++++++++++++++++++---- configure.ac | 30 ++++++++++++++++++++++++------ doc/Makefile.am | 4 ---- 3 files changed, 42 insertions(+), 14 deletions(-) delete mode 100644 doc/Makefile.am diff --git a/Makefile.am b/Makefile.am index 36f6f83..27520e0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = src doc +SUBDIRS = src ACLOCAL_AMFLAGS = -I m4 pcfiles = libcmis-@LIBCMIS_API_VERSION@.pc @@ -8,12 +8,26 @@ libcmis-@LIBCMIS_API_VERSION@.pc: libcmis.pc pkgconfig_DATA = $(pcfiles) pkgconfigdir = $(libdir)/pkgconfig +if WITH_LIBCMIS_MAN +cmis-client.1: doc/cmis-client.xml + $(DOCBOOK2X) $< + +install-data-am: cmis-client.1 + mkdir -p $(DESTDIR)$(mandir)/man1/ + $(INSTALL_DATA) cmis-client.1 $(DESTDIR)$(mandir)/man1/ + +uninstall-am: + -rm -rf $(DESTDIR)$(mandir)/man1/ +endif + +dist_man_MANS = doc/cmis-client.xml + EXTRA_DIST = \ libcmis.pc.in \ run-test.sh \ - COPYING.MPL \ - COPYING.GPL \ - COPYING.LGPL \ + COPYING.MPL \ + COPYING.GPL \ + COPYING.LGPL \ src/libcmis/makefile.mk \ doc/cmis-client.xml diff --git a/configure.ac b/configure.ac index b0c94cc..6bfc23c 100644 --- a/configure.ac +++ b/configure.ac @@ -45,10 +45,26 @@ AC_PROG_LIBTOOL AC_LIBTOOL_WIN32_DLL # TODO Check for docbook-to-man -AC_CHECK_PROG(DOCBOOK2X,[docbook-to-man],[docbook2X]) -if test "x$DOCBOOK2X" = "x"; then - AC_MSG_ERROR([docbook-to-man is missing. Install docbook2X package.]) -fi +# ============= +# Documentation +# ============= +AC_ARG_WITH(man, + [AS_HELP_STRING([--without-man], [Do not build manpage])], + [with_man="$withval"], + [with_man=yes] +) +AS_IF([test "x$with_man" != "xno"], [ + build_man=yes + AC_PATH_PROG(DOCBOOK2X,[docbook-to-man]) + AS_IF([test -z "$DOCBOOK2X"], [ + AC_PATH_PROG(DOCBOOK2X,[docbook2man.pl]) + AS_IF([test -z "$DOCBOOK2X"], [ + AC_MSG_ERROR([docbook-to-man is missing. Install docbook2X package.]) + ]) + ]) +], [build_man=no]) +AC_SUBST(DOCBOOK2X) +AM_CONDITIONAL([WITH_LIBCMIS_MAN], [test "x$build_man" != "xno"]) AC_ARG_ENABLE([werror], [AS_HELP_STRING([--disable-werror], [Treat all warnings as errors, usefull for development])], @@ -108,11 +124,12 @@ AC_TYPE_SIZE_T # Checks for library functions. -AC_CONFIG_FILES([Makefile +AC_CONFIG_FILES([ + Makefile libcmis.pc src/Makefile src/libcmis/Makefile - doc/Makefile]) +]) AC_OUTPUT AC_MSG_NOTICE([ @@ -123,4 +140,5 @@ libcmis $VERSION: client: ${enable_client} werror: ${enable_werror} tests: ${enable_tests} + mans: ${build_man} ]) diff --git a/doc/Makefile.am b/doc/Makefile.am deleted file mode 100644 index f311cca..0000000 --- a/doc/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -cmis-client.1: cmis-client.xml - docbook-to-man $< - -dist_man_MANS = cmis-client.1 -- 1.7.10.2