--- configure.ac.orig 2009-06-26 06:48:42.585573323 +0300 +++ configure.ac 2009-06-26 06:51:54.724715510 +0300 @@ -17,9 +17,6 @@ PKG_CHECK_MODULES(xmu, xmu, have_xmu=yes, have_xmu=no) PKG_CHECK_MODULES(gconf, gconf-2.0, have_gconf=yes, have_gconf=no) PKG_CHECK_MODULES(webkit, webkit-1.0, have_webkit=yes, have_webkit=no) -PKG_CHECK_MODULES(mozjs, xulrunner-js, have_mozjs=yes, - [PKG_CHECK_MODULES(mozjs, firefox-js, have_mozjs=yes, - [PKG_CHECK_MODULES(mozjs, mozilla-js, have_mozjs=yes, have_mozjs=no)])]) PKG_CHECK_MODULES(NetworkManager, NetworkManager, have_networkmanager=yes, have_networkmanager=no) PKG_CHECK_MODULES(dbus, dbus-1, have_dbus=yes, have_dbus=no) @@ -111,24 +108,38 @@ # Mozilla Javascript AC_ARG_WITH([mozjs], - [AS_HELP_STRING([--with-mozjs], - [build Mozilla JavaScript PAC runner plugin @<:@automatic@:>@])], + [AS_HELP_STRING([--with-mozjs@<:@=xulrunner|firefox|mozilla|seamonkey|no@:>@], + [build Mozilla JavaScript PAC runner plugin (autodetected by default)])], [], - [test x$have_mozjs == xyes && with_mozjs=yes]) -if test x$with_mozjs = xyes; then - if test x$have_mozjs == xyes; then - MOZJS_CFLAGS="$mozjs_CFLAGS" - MOZJS_LIBS="$mozjs_LIBS" - AC_SUBST(MOZJS_CFLAGS) - AC_SUBST(MOZJS_LIBS) - else - echo "Mozilla JavaScript plugin requires: mozjs!" - exit 1 - fi + [with_mozjs=auto]) + +if (test x$with_mozjs = xauto || test x$with_mozjs = xyes); then + PKG_CHECK_MODULES(mozjs, xulrunner-js, with_mozjs=xulrunner, + [PKG_CHECK_MODULES(mozjs, firefox-js, with_mozjs=firefox, + [PKG_CHECK_MODULES(mozjs, mozilla-js, with_mozjs=mozilla, + [PKG_CHECK_MODULES(mozjs, seamonkey-js, with_mozjs=seamonkey, + [test x$with_mozjs = xauto && with_mozjs = no || with_mozjs = error])])])]) +elif test x$with_mozjs != xno; then + PKG_CHECK_MODULES(mozjs, [$with_mozjs[]-js]) +fi + +if test x$with_mozjs = xerror; then + AC_MSG_ERROR([cannot find any mozjs provider]) else - with_mozjs=no + AC_MSG_RESULT([$with_mozjs]) + MOZJS_CFLAGS="$mozjs_CFLAGS" + MOZJS_LIBS="$mozjs_LIBS" + + dnl Temporary workaround for gentoo install dir patch problem + dnl FIXME: This substitution works only in bash + MOZJS_CFLAGS="${MOZJS_CFLAGS/\/stable//unstable}" + dnl workaround END + + AC_SUBST(MOZJS_CFLAGS) + AC_SUBST(MOZJS_LIBS) fi -AM_CONDITIONAL([WITH_MOZJS], [test x$with_mozjs = xyes]) + +AM_CONDITIONAL([WITH_MOZJS], [test x$with_mozjs != xno]) # NetworkManager AC_ARG_WITH([networkmanager],