From 232309cb1e6ed908c51983a648120b7c8f4cd090 Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Tue, 15 Dec 2009 20:46:10 +0000
Subject: [PATCH] configure.in: Change --with-docdir default to make it
 consistent with --docdir option added in autoconf 2.6x (ticket #24).

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@3000 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/CHANGELOG    |  6 ++++++
 smartmontools/INSTALL      | 16 ++++++++++++----
 smartmontools/NEWS         |  1 +
 smartmontools/configure.in | 31 +++++++++++++++++++++++++++++--
 4 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/smartmontools/CHANGELOG b/smartmontools/CHANGELOG
index a2b582899..26a7c3849 100644
--- a/smartmontools/CHANGELOG
+++ b/smartmontools/CHANGELOG
@@ -43,6 +43,12 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [CF] configure.in: Change --with-docdir default from
+       'PREFIX/share/doc/smartmontools-VERSION' to
+       'DATADIR/doc/smartmontools' to make it consistent with
+       --docdir option added in autoconf 2.6x (ticket #24).
+       Autoconf 2.5x is still supported.
+
   [CF] Move drive database entries from 'knowndrives.cpp' to new file
        'drivedb.h'.  This allows to update the drive database from SVN
        if installation was configured with '--enable-drivedb'.
diff --git a/smartmontools/INSTALL b/smartmontools/INSTALL
index 36016c1a7..b97c5cdcf 100644
--- a/smartmontools/INSTALL
+++ b/smartmontools/INSTALL
@@ -242,7 +242,7 @@ Table of contents:
     --sbindir=/usr/local/sbin
     --sysconfdir=/usr/local/etc
     --mandir=/usr/local/share/man
-    --with-docdir=/usr/local/share/doc/smartmontools-VERSION
+    --with-docdir=/usr/local/share/doc/smartmontools
     --with-initscriptdir=/usr/local/etc/rc.d/init.d
     --disable-sample
 
@@ -415,7 +415,7 @@ Same as Red Hat:
               --sysconfdir=/etc                                 \
               --mandir=/usr/share/man                           \
               --with-initscriptdir=/etc/rc.d/init.d             \
-              --with-docdir=/usr/share/doc/smartmontools-VERSION
+              --with-docdir=/usr/share/doc/smartmontools
 
   Using DOS text file type as default for the working directories ("textmode"
   mount option) is not recommended. Building the binaries and man pages using
@@ -655,13 +655,15 @@ OPTIONS              DEFAULT                                      AFFECTS
 --prefix             /usr/local                                   Please see below
 --sbindir            ${prefix}/sbin                               Directory for smartd/smartctl executables;
                                                                   Contents of smartd/smartctl man pages
+--docdir             ${prefix}/share/doc/smartmontools            Location of the documentation
+                                                                  (autoconf >= 2.60 only, see also --with-docdir below)
 --mandir             ${prefix}/share/man                          Directory for smartctl/smartd/smartd.conf man pages
 --sysconfdir         ${prefix}/etc                                Directory for smartd.conf;
                                                                   Contents of smartd executable;
                                                                   Contents of smartd/smartd.conf man pages;
                                                                   Directory for rc.d/init.d/smartd init script
 --with-initscriptdir  ${sysconfdir}/init.d/rc.d                   Location of init scripts
---with-docdir         ${prefix}/share/doc/smartmontools-5.X       Location of the documentation
+--with-docdir         ${prefix}/share/doc/smartmontools           Location of the documentation
 --enable-sample       --disable-sample                            Adds the string '.sample' to the names of the smartd.conf file and the smartd RC file
 --with-os-deps        os_<guessed>.o                              OS dependent module(s)
 --with-selinux        <not set>                                   Enables SELinux support.  If smartmontools has to create the /dev/tw[ae] device
@@ -674,6 +676,12 @@ OPTIONS              DEFAULT                                      AFFECTS
 --enable-attributelog --disable-attributelog                      Enables default smartd attribute log files
 --with-attributelog   ${prefix}/var/lib/smartmontools/attrlog.    Prefix for smartd attribute log files (implies --enable-attributelog)
 
+Please note that in previous versions of smartmontools (<= 5.39) the
+default for --with-docdir was
+  ${prefix}/share/doc/smartmontools-VERSION
+This was changed to make it consistent with the default of the
+new --docdir option added in autoconf 2.60.
+
 Here's an example:
 If you set --prefix=/home/joe and none of the other four
 variables then the different directories that are used would be:
@@ -681,7 +689,7 @@ variables then the different directories that are used would be:
 --mandir              /home/joe/share/man
 --sysconfdir          /home/joe/etc
 --with-initscriptdir  /home/joe/etc/init.d/rc.d
---with-docdir	      /home/joe/doc/smartmontools-5.X
+--with-docdir         /home/joe/doc/smartmontools
 
 This is useful for test installs in a harmless subdirectory somewhere.
 
diff --git a/smartmontools/NEWS b/smartmontools/NEWS
index 7b89f709d..1474c6c78 100644
--- a/smartmontools/NEWS
+++ b/smartmontools/NEWS
@@ -8,6 +8,7 @@ http://smartmontools.svn.sourceforge.net/viewvc/smartmontools/trunk/smartmontool
 Date <Not released yet, please try current SVN>
 Summary: smartmontools release 5.40
 -----------------------------------------------------------
+- configure: New default value for '--with-docdir'.
 - Drive database is in a separate source file 'drivedb.h'
   which can be downloaded from SVN.
 
diff --git a/smartmontools/configure.in b/smartmontools/configure.in
index fd5bf318c..5eba73810 100644
--- a/smartmontools/configure.in
+++ b/smartmontools/configure.in
@@ -157,11 +157,25 @@ AC_SUBST(ASFLAGS)
 
 AC_SUBST([exampledir], ['${docdir}/examplescripts'])
 
-AC_ARG_WITH(initscriptdir,[AC_HELP_STRING([--with-initscriptdir=dir],[Location of init scripts (default is ${sysconfdir}/rc.d/init.d)])],[initddir="$withval"],[initddir='${sysconfdir}/rc.d/init.d'])
+AC_ARG_WITH(initscriptdir,
+  [AC_HELP_STRING([--with-initscriptdir=DIR],[Location of init scripts [SYSCONFDIR/rc.d/init.d]])],
+  [initddir="$withval"],[initddir='${sysconfdir}/rc.d/init.d'])
 AC_SUBST(initddir)
 AM_CONDITIONAL(INSTALL_INITSCRIPT, [test "$with_initscriptdir" != "no"])
 
-AC_ARG_WITH(docdir,[AC_HELP_STRING([--with-docdir=dir],[Location of documentation (default is ${prefix}/share/doc/smartmontools-5.X)])],[docdir="$withval"],[docdir='${prefix}/share/doc/${PACKAGE}-${VERSION}'])
+docdir_is_default=no
+AC_ARG_WITH(docdir,
+  [AC_HELP_STRING([--with-docdir=DIR],[Location of documentation [DATADIR/doc/smartmontools]])],
+  [docdir="$withval"],
+  [ if test -z "$docdir"; then
+      # autoconf 2.5x without '--docdir' support
+      docdir='${datadir}/doc/${PACKAGE}'
+      docdir_is_default=yes
+    elif test "$docdir" = '${datarootdir}/doc/${PACKAGE_TARNAME}'; then
+      # autoconf 2.6x '--docdir' default
+      docdir_is_default=yes
+    fi
+  ])
 AC_SUBST(docdir)
 
 AC_ARG_ENABLE(drivedb, [AC_HELP_STRING([--enable-drivedb],[Enables drive database file])])
@@ -368,3 +382,16 @@ AC_SUBST(CXXFLAGS)
 
 AC_OUTPUT(Makefile examplescripts/Makefile)
 AC_PROG_MAKE_SET
+
+# Print note that the docdir default value has changed
+# TODO: Remove this after next release
+if test "$docdir_is_default" = "yes"; then
+  old_def_docdir='${prefix}/share/doc/${PACKAGE}-${VERSION}'
+  old_def_docdir_eval="`eval eval eval echo $old_def_docdir`"
+  docdir_eval="`eval eval eval echo $docdir`"
+  AC_MSG_NOTICE([********** PLEASE NOTE **********])
+  AC_MSG_NOTICE(['docdir' default has changed])
+  AC_MSG_NOTICE([from: $old_def_docdir_eval])
+  AC_MSG_NOTICE([to:   $docdir_eval])
+  AC_MSG_NOTICE([*********************************])
+fi
-- 
GitLab