docs: Update to generate proper google analytics code

This commit also includes minor doxygen style improvement.

Change-Id: I5ced859c0759a2fd0240068296949067f9ac4c46
diff --git a/docs/conf.py b/docs/conf.py
index 4a4ab93..c261a1d 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -32,6 +32,21 @@
     'sphinx.ext.todo',
 ]
 
+def addExtensionIfExists(extension):
+    try:
+        __import__(extension)
+        extensions.append(extension)
+    except ImportError:
+        sys.stderr.write("Extension '%s' in not available. "
+                         "Some documentation may not build correctly.\n" % extension)
+        sys.stderr.write("To install, use \n"
+                         "  sudo pip install %s\n" % extension.replace('.', '-'))
+
+addExtensionIfExists('sphinxcontrib.doxylink')
+
+if os.getenv('GOOGLE_ANALYTICS', None):
+    addExtensionIfExists('sphinxcontrib.googleanalytics')
+
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
@@ -243,3 +258,11 @@
 
 # If true, show URL addresses after external links.
 #man_show_urls = False
+
+doxylink = {
+  'NFD' : ('NFD.tag', 'doxygen/'),
+}
+
+if os.getenv('GOOGLE_ANALYTICS', None):
+    googleanalytics_id = os.environ['GOOGLE_ANALYTICS']
+    googleanalytics_enabled = True
diff --git a/docs/doxygen.conf.in b/docs/doxygen.conf.in
index 49a9994..cc58aa6 100644
--- a/docs/doxygen.conf.in
+++ b/docs/doxygen.conf.in
@@ -167,7 +167,7 @@
 # description.)
 # The default value is: NO.
 
-JAVADOC_AUTOBRIEF      = NO
+JAVADOC_AUTOBRIEF      = YES
 
 # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
 # line (until the first dot) of a Qt-style comment as the brief description. If
@@ -590,7 +590,7 @@
 # the documentation.
 # The default value is: YES.
 
-GENERATE_DEPRECATEDLIST= NO
+GENERATE_DEPRECATEDLIST= YES
 
 # The ENABLED_SECTIONS tag can be used to enable conditional documentation
 # sections, marked by \if <section_label> ... \endif and \cond <section_label>
@@ -1035,7 +1035,7 @@
 # that doxygen normally uses.
 # This tag requires that the tag GENERATE_HTML is set to YES.
 
-HTML_FOOTER            = ../docs/named_data_theme/named_data_footer.html
+HTML_FOOTER            = @HTML_FOOTER@
 
 # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
 # sheet that is used by each HTML page. It can be used to fine-tune the look of
@@ -1047,7 +1047,7 @@
 # obsolete.
 # This tag requires that the tag GENERATE_HTML is set to YES.
 
-HTML_STYLESHEET        = ../docs/named_data_theme/static/named_data_doxygen.css
+# HTML_STYLESHEET        = ../docs/named_data_theme/static/named_data_doxygen.css
 
 # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
 # defined cascading style sheet that is included after the standard style sheets
@@ -1888,7 +1888,7 @@
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-MACRO_EXPANSION        = NO
+MACRO_EXPANSION        = YES
 
 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
 # the macro expansion is limited to the macros specified with the PREDEFINED and
@@ -1928,7 +1928,10 @@
 # recursively expanded use the := operator instead of the = operator.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-PREDEFINED             =
+PREDEFINED             = NFD_LOG_INIT(x)= \
+                         NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(x,y)= \
+                         NFD_LOG_INCLASS_2TEMPLATE_SPECIALIZATION_DEFINE(x,y,z)= \
+                         BOOST_STATIC_ASSERT(x)=
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
 # tag can be used to specify a list of macro names that should be expanded. The
@@ -1972,7 +1975,7 @@
 # tag file that is based on the input files it reads. See section "Linking to
 # external documentation" for more information about the usage of tag files.
 
-GENERATE_TAGFILE       =
+GENERATE_TAGFILE       = NFD.tag
 
 # If the ALLEXTERNALS tag is set to YES all external class will be listed in the
 # class index. If set to NO only the inherited external classes will be listed.
@@ -2151,7 +2154,7 @@
 # The default value is: NO.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-CALL_GRAPH             = YES
+CALL_GRAPH             = NO
 
 # If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
 # dependency graph for every global function or class method.
@@ -2162,7 +2165,7 @@
 # The default value is: NO.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-CALLER_GRAPH           = YES
+CALLER_GRAPH           = NO
 
 # If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
 # hierarchy of all classes instead of a textual one.
diff --git a/docs/named_data_theme/layout.html b/docs/named_data_theme/layout.html
index 520b853..16ae50f 100644
--- a/docs/named_data_theme/layout.html
+++ b/docs/named_data_theme/layout.html
@@ -79,17 +79,6 @@
             </div>
         </div>
     </div><!--footer info end-->
-
-    <script type="text/javascript">
-    var _gaq = _gaq || [];
-    _gaq.push(['_setAccount', 'UA-22320603-1']);
-    _gaq.push(['_trackPageview']);
-    (function() {
-    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-    })();
-    </script>
 {% endblock %}
 
 {% block relbar1 %}{% endblock %}
diff --git a/docs/named_data_theme/named_data_footer-with-analytics.html.in b/docs/named_data_theme/named_data_footer-with-analytics.html.in
new file mode 100644
index 0000000..68a4a9d
--- /dev/null
+++ b/docs/named_data_theme/named_data_footer-with-analytics.html.in
@@ -0,0 +1,32 @@
+<!-- start footer part -->
+<!--BEGIN GENERATE_TREEVIEW-->
+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
+  <ul>
+    $navpath
+    <li class="footer">$generatedby
+    <a href="http://www.doxygen.org/index.html">
+    <img class="footer" src="$relpath$doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
+  </ul>
+</div>
+<!--END GENERATE_TREEVIEW-->
+<!--BEGIN !GENERATE_TREEVIEW-->
+<hr class="footer"/>
+<address class="footer"><small>
+$generatedby &#160;<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="$relpath$doxygen.png" alt="doxygen"/>
+</a> $doxygenversion
+</small></address>
+<!--END !GENERATE_TREEVIEW-->
+
+<script>
+  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+  ga('create', '@GOOGLE_ANALYTICS@', 'auto');
+  ga('send', 'pageview');
+</script>
+
+</body>
+</html>