diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-06-04 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 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-04 Adam Domurad <adomurad@redhat.com> Added self to AUTHORS. diff --git a/acinclude.m4 b/acinclude.m4 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -880,3 +880,29 @@ AC_MSG_RESULT([${FULL_VERSION}]) AC_SUBST([FULL_VERSION]) ]) + +dnl REQUIRED Parameters: +dnl [browser name, variable to store path, default terminal command to run browser (if installed)] +AC_DEFUN([IT_FIND_BROWSER], +[ + AC_MSG_CHECKING([for $1]) + AC_ARG_WITH([$1], + [AS_HELP_STRING(--with-$1,specify the location of $1 or use 'no' as value to disable browser)], + [ + if test "${withval}" = "no" ; then + $2="" + elif test -a "${withval}" ; then + $2=${withval} + else + AC_MSG_FAILURE([invalid location specified to $1: ${withval}]) + fi + ], + [ + $2=$(which $3 2> /dev/null) + ]) + if test -a "${$2}"; then + AC_MSG_RESULT([${$2}]) + else + AC_MSG_RESULT([no]) + fi +]) diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -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]) +IT_FIND_BROWSER([firefox],[FIREFOX],[firefox]) +IT_FIND_BROWSER([chrome],[CHROME],[google-chrome]) +IT_FIND_BROWSER([chromium],[CHROMIUM],[chromium-browser]) +IT_FIND_BROWSER([opera],[OPERA],[opera]) +IT_FIND_BROWSER([midori],[MIDORI],[midori]) +IT_FIND_BROWSER([epiphany],[EPIPHANY],[epiphany]) AM_CONDITIONAL([WITH_XSLTPROC], [test x"$XSLTPROC" != x ]) IT_FIND_OPTIONAL_JAR([rhino], RHINO,