From 88f21fffe76d074a1364291372c0833f3eec2884 Mon Sep 17 00:00:00 2001 From: Emmanuel Bouthenot Date: Sun, 7 Jun 2009 18:56:38 +0200 Subject: [PATCH] Fix some bugs in asciidoc detection, add detection of source-highlight (needed by asciidoc to build doc) --- Makefile.am | 2 ++ cmake/FindSourcehighlight.cmake | 35 +++++++++++++++++++++++++++++++++ configure.in | 11 +++++++++-- doc/CMakeLists.txt | 5 +++-- 4 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 cmake/FindSourcehighlight.cmake diff --git a/Makefile.am b/Makefile.am index c93d7ecc4..a4de7d2d5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,6 +45,7 @@ EXTRA_DIST = CMakeLists.txt \ debian/weechat-plugins.install \ debian/weechat.xpm \ cmake/cmake_uninstall.cmake.in \ + cmake/FindAsciidoc.cmake \ cmake/FindAspell.cmake \ cmake/FindGettext.cmake \ cmake/FindGnuTLS.cmake \ @@ -56,6 +57,7 @@ EXTRA_DIST = CMakeLists.txt \ cmake/FindPkgConfig.cmake \ cmake/FindPython.cmake \ cmake/FindRuby.cmake \ + cmake/FindSourcehighlight.cmake \ cmake/FindTCL.cmake \ cmake/makedist.sh.in \ weechat.spec \ diff --git a/cmake/FindSourcehighlight.cmake b/cmake/FindSourcehighlight.cmake new file mode 100644 index 000000000..b5bf9ef7e --- /dev/null +++ b/cmake/FindSourcehighlight.cmake @@ -0,0 +1,35 @@ +# Copyright (c) 2003-2009 FlashCode +# +# 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 3 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, see . +# + +# - Find Source-Highlight +# This module finds if source-highlight is installed. + +IF (SOURCEHIGHLIGHT_FOUND) + # Already in cache, be silent + SET(SOURCEHIGHLIGHT_FIND_QUIETLY TRUE) +ENDIF (SOURCEHIGHLIGHT_FOUND) + +FIND_PROGRAM( + SOURCEHIGHLIGHT_EXECUTABLE source-highlight + PATHS /bin /usr/bin /usr/local/bin /usr/pkg/bin +) + +IF(SOURCEHIGHLIGHT_EXECUTABLE) + SET(SOURCEHIGHLIGHT_FOUND TRUE) + MARK_AS_ADVANCED( + SOURCEHIGHLIGHT_EXECUTABLE + ) +ENDIF(SOURCEHIGHLIGHT_EXECUTABLE) diff --git a/configure.in b/configure.in index e2d28efd9..4f6578314 100644 --- a/configure.in +++ b/configure.in @@ -860,14 +860,15 @@ msg_doc="" if test "x$enable_doc" = "xyes" ; then DOC_ASCIIDOC8="" AC_CHECK_PROGS(ASCIIDOC, [asciidoc]) - if test -n "$ASCIIDOC"; then + AC_CHECK_PROGS(SOURCEHIGHLIGHT, [source-highlight]) + if test -n "$SOURCEHIGHLIGHT" -a -n "$ASCIIDOC"; then AC_MSG_CHECKING([for asciidoc version]) asciidoc_version=`$ASCIIDOC --version 2>/dev/null` case "${asciidoc_version}" in asciidoc' '8*) DOC_ASCIIDOC8="yes" AC_MSG_RESULT([${asciidoc_version}]) - msg_doc="asciidoc $msg_doc" + msg_doc="asciidoc(with source-highlight) $msg_doc" AC_DEFINE(DOC) ;; *) @@ -876,8 +877,14 @@ if test "x$enable_doc" = "xyes" ; then ;; esac else + enable_doc="no" + fi + if test -z "$ASCIIDOC"; then not_found="$not_found asciidoc" fi + if test -z "$SOURCEHIGHLIGHT"; then + not_found="$not_found source-highlight(needed by asciidoc)" + fi AC_SUBST(DOC_ASCIIDOC8) AC_SUBST(ASCIIDOC) else diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index d7699c516..b72335071 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -16,11 +16,12 @@ IF(NOT DISABLE_DOC) + FIND_PACKAGE(Sourcehighlight) FIND_PACKAGE(Asciidoc) - IF(ASCIIDOC_FOUND) + IF(ASCIIDOC_FOUND AND SOURCEHIGHLIGHT_FOUND) ADD_SUBDIRECTORY( en ) ADD_SUBDIRECTORY( fr ) - ENDIF(ASCIIDOC_FOUND) + ENDIF(ASCIIDOC_FOUND AND SOURCEHIGHLIGHT_FOUND) ENDIF(NOT DISABLE_DOC)