If libjpeg-turbo is configured with a non-default prefix, such as /usr, then use the docdir variable defined by autoconf 2.60 and later, if available.  This will, for instance, install the documentation under /usr/share/doc/libjpeg-turbo by default if prefix=/usr, unless docdir is overridden.  When using earlier versions of autoconf, docdir is set to ${datadir}/doc, as it always has been.


git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.4.x@1535 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/configure.ac b/configure.ac
index 3105e21..f2b8cf2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,6 +39,11 @@
 if test "$DATADIR" = "/opt/libjpeg-turbo/share"; then
   datarootdir='${prefix}'
 fi
+DOCDIR=`eval echo ${docdir}`
+DOCDIR=`eval echo $DOCDIR`
+if test "$DOCDIR" = "/opt/libjpeg-turbo/doc/libjpeg-turbo"; then
+  docdir='${datadir}/doc'
+fi
 
 old_exec_prefix=${exec_prefix}
 if test "x$exec_prefix" = "xNONE"; then
@@ -538,6 +543,11 @@
     ;;
 esac
 
+if test "${docdir}" = ""; then
+  docdir=${datadir}/doc
+  AC_SUBST(docdir)
+fi
+
 AC_SUBST(RPMARCH)
 AC_SUBST(RPM_CONFIG_ARGS)
 AC_SUBST(DEBARCH)