changeset 425:e696a47c3b89

Added the ability to configure (enable/disable/set custom path to) browsers
author Saad Mohammad <smohammad@redhat.com>
date Thu, 07 Jun 2012 11:31:27 -0400
parents 70a30f21de45
children 1ecbf90070ad
files ChangeLog acinclude.m4 configure.ac
diffstat 3 files changed, 52 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jun 07 11:12:03 2012 -0400
+++ b/ChangeLog	Thu Jun 07 11:31:27 2012 -0400
@@ -1,3 +1,11 @@
+2012-06-07  Saad Mohammad  <smohammad@redhat.com>
+
+	Allows the user to configure browser paths and/or disable browsers.
+	* acinclude.m4 (IT_FIND_BROWSER): Checks if the browser is set to be 
+	disabled, or if the path provided is valid. Otherwise, it locates the 
+	default path to the browser if found on the system.
+	* configure.ac: Uses IT_FIND_BROWSER to find/configure browsers.
+
 2012-06-06  Deepak Bhole <dbhole@redhat.com>
 
 	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
--- a/acinclude.m4	Thu Jun 07 11:12:03 2012 -0400
+++ b/acinclude.m4	Thu Jun 07 11:31:27 2012 -0400
@@ -880,3 +880,40 @@
   AC_MSG_RESULT([${FULL_VERSION}])
   AC_SUBST([FULL_VERSION])
 ])
+
+dnl Allows you to configure (enable/disable/set path to) the browser
+dnl REQUIRED Parameters: 
+dnl [browser name, variable to store path, default command to run browser (if not provided, assume it's the same as the browser name]
+AC_DEFUN([IT_FIND_BROWSER],
+[
+  AC_ARG_WITH([$1],
+              [AS_HELP_STRING(--with-$1,specify the location of $1)],
+  [
+   if test "${withval}" = "no" || test "${withval}" = "yes" || test "${withval}" = "" ; then
+    $2=""
+   elif test -f "${withval}" ; then
+    $2="${withval}"
+   else 
+    AC_MSG_CHECKING([for $1])
+    AC_MSG_RESULT([not found])
+    AC_MSG_FAILURE([invalid location specified to $1: ${withval}])
+   fi
+  ],
+  [
+   withval="yes"
+  ])
+
+  if test -f "${$2}"; then
+   AC_MSG_CHECKING([for $1])
+   AC_MSG_RESULT([${$2}])
+  elif test "${withval}" != "no"; then
+   if test $# -gt 2; then
+    AC_PATH_TOOL([$2], [$3], [], [])  
+   else
+    AC_PATH_TOOL([$2], [$1], [], [])
+   fi
+  else
+   AC_MSG_CHECKING([for $1])        
+   AC_MSG_RESULT([no])
+  fi
+])
--- a/configure.ac	Thu Jun 07 11:12:03 2012 -0400
+++ b/configure.ac	Thu Jun 07 11:31:27 2012 -0400
@@ -89,12 +89,13 @@
 
 AC_CHECK_PROGS([XSLTPROC],[xsltproc],[], [])
 # browser to be linked/tested
-AC_CHECK_PROGS([FIREFOX],[firefox],[], [])
-AC_CHECK_PROGS([CHROME],[google-chrome],[], [])
-AC_CHECK_PROGS([CHROMIUM],[chromium-browser],[], [])
-AC_CHECK_PROGS([OPERA],[opera],[], [])
-AC_CHECK_PROGS([MIDORI],[midori],[], [])
-AC_CHECK_PROGS([EPIPHANY],[epiphany],[], [])
+# Example: IT_FIND_BROWSER([browser-name],[variable-to-store-path],[default-run-command-if-different-from-the-browser-name])
+IT_FIND_BROWSER([firefox],[FIREFOX])
+IT_FIND_BROWSER([chrome],[CHROME],[google-chrome])
+IT_FIND_BROWSER([chromium],[CHROMIUM],[chromium-browser])
+IT_FIND_BROWSER([opera],[OPERA])
+IT_FIND_BROWSER([midori],[MIDORI])
+IT_FIND_BROWSER([epiphany],[EPIPHANY])
 
 AM_CONDITIONAL([WITH_XSLTPROC], [test x"$XSLTPROC" != x ])
 IT_FIND_OPTIONAL_JAR([rhino], RHINO,