[gparted] Tidyup Autoconf check for --disable-doc (#734076)



commit 20158f0440f3483f37614f217bb67d3176363d64
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Tue Aug 12 21:36:08 2014 +0100

    Tidyup Autoconf check for --disable-doc (#734076)
    
    Use AC_ARG_ENABLE() and AS_HELP_STRING() macros to improve handling of
    the --disable-doc option.
    
    Change the names, and sence, of the Autoconf and Automake definitions
    used to control building of the help documentation.  Reasons are:
    (1) Switch from negative to positive statements which are more natural
        to comprehend.
    (2) Insert HELP in the names from *_DOC to *_HELP_DOC as they control
        building of the documentation in the help subdirectory, not the
        manual page in the doc directory.
    
    Autoconf: HAVE_DISABLE_DOC -> ENABLE_HELP_DOC
    Automake: DISABLE_DOC      -> BUILD_HELP_DOC
    
    Bug #734076 - Autodetect parted online partition resizing capability

 Makefile.am        |    8 ++++----
 configure.ac       |   31 +++++++++++++++++--------------
 src/Win_GParted.cc |   10 +++++-----
 3 files changed, 26 insertions(+), 23 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 5637528..56d32c0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,8 @@
-### Do not execute make in the help subdirectory if DISABLE_DOC is set
-if DISABLE_DOC
-SUBDIRS = compose data doc include po src
-else
+# Only execute make in the help subdirectory if BUILD_HELP_DOC is set
+if BUILD_HELP_DOC
 SUBDIRS = help compose data doc include po src
+else
+SUBDIRS = compose data doc include po src
 endif
 
 @INTLTOOL_DESKTOP_RULE@
diff --git a/configure.ac b/configure.ac
index 5a97053..e5249ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -236,29 +236,32 @@ PKG_CHECK_EXISTS(
 dnl======================
 dnl check whether to build documentation - Gnome-Doc-Utils
 dnl======================
-AC_ARG_ENABLE([doc],
-  [  --disable-doc           do not build documentation],,)
-if test "x${enable_doc}" = "x" ; then
-       enable_doc=yes
-fi
+AC_ARG_ENABLE(
+       [doc],
+       AS_HELP_STRING(
+               [--disable-doc],
+               dnl Autoconf quadrigraphs '@<:@' = '[' and '@:>@' = ']'
+               [disable building help documentation @<:@default=enabled@:>@]),
+       [enable_doc=$enableval],
+       [enable_doc=yes]
+)
 
-AC_MSG_CHECKING([whether documentation should be built])
-if test ${enable_doc} = no; then
-       AC_MSG_RESULT([no])
-else
+AC_MSG_CHECKING([whether help documentation should be built])
+if test "x$enable_doc" = xyes; then
+       AC_DEFINE([ENABLE_HELP_DOC], [1], [Define to 1 when help documentation is built])
        AC_MSG_RESULT([yes])
+else
+       AC_MSG_RESULT([no])
 fi
 
-if test ${enable_doc} = yes; then
+if test "x$enable_doc" = xyes; then
        GNOME_DOC_INIT
 else
        dnl Do not care if GDU is not found
        GNOME_DOC_INIT(,,[:])
-       dnl Set   #define HAVE_DISABLE_DOC 1   to indicate documentation not wanted
-       AC_DEFINE([HAVE_DISABLE_DOC], [1], [Define to 1 if --disable-doc specified])
 fi
 
-AM_CONDITIONAL([DISABLE_DOC], [test ${enable_doc} = no])
+AM_CONDITIONAL([BUILD_HELP_DOC], [test "x$enable_doc" = xyes])
 
 
 dnl======================
@@ -327,7 +330,7 @@ echo ""
 echo "======================== Final configuration ==========================="
 echo "                         Installing into prefix  :  $prefix"
 echo ""
-echo "                           Build documentation?  :  $enable_doc"
+echo "                      Build help documentation?  :  $enable_doc"
 echo ""
 echo "           Use native libparted dmraid support?  :  $enable_libparted_dmraid"
 echo ""
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 6c3ac52..1cf76e1 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -1442,8 +1442,11 @@ void Win_GParted::show_help_dialog( const Glib::ustring & filename /* E.g., gpar
 
 void Win_GParted::menu_help_contents()
 {
-#ifdef HAVE_DISABLE_DOC
-       //GParted was configured with --disable-doc
+#ifdef ENABLE_HELP_DOC
+       //GParted was built with help documentation
+       show_help_dialog( "gparted", "" );
+#else
+       //GParted was built *without* help documentation using --disable-doc
        Gtk::MessageDialog dialog( *this,
                        _( "Documentation is not available" ),
                        false,
@@ -1457,9 +1460,6 @@ void Win_GParted::menu_help_contents()
        tmp_msg += "http://gparted.org"; ;
        dialog .set_secondary_text( tmp_msg ) ;
        dialog .run() ;
-#else
-       //GParted was configured without --disable-doc
-       show_help_dialog( "gparted", "" );
 #endif
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]