[doxygen] Add a few missing variables to the doxygen.cfg.in for external search and cleaned up external_search_map.

llvm-svn: 189523
diff --git a/clang/docs/CMakeLists.txt b/clang/docs/CMakeLists.txt
index 4e4cf43..8528c7a 100644
--- a/clang/docs/CMakeLists.txt
+++ b/clang/docs/CMakeLists.txt
@@ -2,42 +2,37 @@
 if (DOXYGEN_FOUND)
 if (LLVM_ENABLE_DOXYGEN)
   set(abs_srcdir ${CMAKE_CURRENT_SOURCE_DIR})
-  set(abs_builddir ${LLVM_BINARY_DIR})
+  set(abs_builddir ${CMAKE_CURRENT_BINARY_DIR})
 
   if (HAVE_DOT)
     set(DOT ${LLVM_PATH_DOT})
   endif()
 
-  if (DOXYGEN_EXTERNAL_SEARCH)
-    set(SEARCHENGINE "YES")
-    set(SERVER_BASED_SEARCH "YES")
-    set(EXTERNAL_SEARCH "YES")
-
-    set(EXTRA_SEARCH_MAPPINGS "")
-    foreach(NameAndValue ${DOXYGEN_SEARCH_MAPPINGS})
-      # Strip leading spaces
-      string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
-      # Find variable name
-      string(REGEX MATCH "^[^=]+" Name ${NameAndValue})
-      # Find the value
-      string(REPLACE "${Name}=" "" Value ${NameAndValue})
-      # Set the variable
-      if (NOT ${Name} EQUALS clang)
-	set(EXTRA_SEARCH_MAPPINGS "${EXTRA_SEARCH_MAPPINGS} ${LLVM_BINARY_DIR}/${NameAndValue}")
-      endif()
-    endforeach()
+  if (LLVM_DOXYGEN_EXTERNAL_SEARCH)
+    set(enable_searchengine "YES")
+    set(searchengine_url "${LLVM_DOXYGEN_SEARCHENGINE_URL}")
+    set(enable_server_based_search "YES")
+    set(enable_external_search "YES")
+    set(extra_search_mappings "${LLVM_DOXYGEN_SEARCH_MAPPINGS}")
   else()
-    set(SEARCHENGINE "NO")
-    set(SERVER_BASED_SEARCH "NO")
-    set(EXTERNAL_SEARCH "NO")
-    set(EXTRA_SEARCH_MAPPINGS "")
+    set(enable_searchengine "NO")
+    set(searchengine_url "")
+    set(enable_server_based_search "NO")
+    set(enable_external_search "NO")
+    set(extra_search_mappings "")
   endif()
 
   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
     ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
-  set(abs_srcdir)
-  set(abs_builddir)
+
+  set(abs_top_srcdir)
+  set(abs_top_builddir)
   set(DOT)
+  set(enable_searchengine)
+  set(searchengine_url)
+  set(enable_server_based_search)
+  set(enable_external_search)
+  set(extra_search_mappings)
 
   add_custom_target(doxygen-clang
     COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
diff --git a/clang/docs/Makefile b/clang/docs/Makefile
index 0723ac9..5e14fac 100644
--- a/clang/docs/Makefile
+++ b/clang/docs/Makefile
@@ -21,9 +21,10 @@
 	  -e 's/@PACKAGE_VERSION@/mainline/' \
 	  -e 's/@abs_builddir@/./g' \
 	  -e 's/@enable_searchengine@/NO/g' \
-          -e 's/@enable_server_based_search@/NO/g' \
+	  -e 's/@searchengine_url@//g' \
+	  -e 's/@enable_server_based_search@/NO/g' \
 	  -e 's/@enable_external_search@/NO/g' \
-	  -e 's/@extra_search_mappings@/NO/g' > $@
+	  -e 's/@extra_search_mappings@//g' > $@
 endif
 
 include $(CLANG_LEVEL)/Makefile
diff --git a/clang/docs/doxygen.cfg.in b/clang/docs/doxygen.cfg.in
index 497d4bf..61c0bd8 100644
--- a/clang/docs/doxygen.cfg.in
+++ b/clang/docs/doxygen.cfg.in
@@ -1224,10 +1224,27 @@
 # Configuration::additions related to the search engine   
 #---------------------------------------------------------------------------
 
-# The SEARCHENGINE tag specifies whether or not a search engine should be 
-# used. If set to NO the values of all tags below this one will be ignored.
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
 
-SEARCHENGINE           = @enable_server_based_search@
+SEARCHENGINE           = @enable_searchengine@
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = @enable_server_based_search@
+
+SEARCHENGINE_URL       = @searchengine_url@
 
 EXTERNAL_SEARCH        = @enable_external_search@