2 dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
4 dnl This program is free software; you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
13 dnl You should have received a copy of the GNU General Public License
14 dnl along with this program; if not, write to the Free Software
15 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 dnl Configure paths for Firefox. We used to run firefox-config, but that
18 dnl got too messy. Then with a little experimentation we determined
19 dnl most of the options weren't actually needed... so now the handful
20 dnl of critical headers are part of the plugin/mozilla-sdk sources
21 dnl copied out of a current Firefox release. This greatly simplified
22 dnl both the configuration and compilation processes.
23 AC_DEFUN([GNASH_PATH_XPCOM],
28 AC_HELP_STRING([--enable-xpcom],[Enable xpcom support in NPAPI plugin]),
29 [case "${enableval}" in
32 *) AC_MSG_ERROR([bad value ${enableval} for --enable-xpcom option]) ;;
35 dnl Look for the header
36 AC_ARG_WITH(xpcom-incl, AC_HELP_STRING([--with-xpcom-incl], [directory where XPCOM headers are]), with_xpcom_incl=${withval})
37 AC_CACHE_VAL(ac_cv_path_xpcom_incl, [
38 if test x"${with_xpcom_incl}" != x ; then
39 if test -f ${with_xpcom_incl}/mozilla-config.h ; then
40 ac_cv_path_xpcom_incl="-I`(cd ${with_xpcom_incl}; pwd)`"
42 AC_MSG_ERROR([${with_xpcom_incl} directory doesn't contain mozilla-config.h!])
47 dnl Look for the library
48 AC_ARG_WITH(xpcom-sdk-dir, AC_HELP_STRING([--with-xpcom-sdk-dir], [directory where XPCOM SDK is]), with_xpcom_sdk_dir=${withval})
49 AC_CACHE_VAL(ac_cv_path_xpcom_sdk_dir, [
50 if test x"${with_xpcom_sdk_dir}" != x ; then
51 if test -f ${with_xpcom_sdk_dir}/libxpcomglue_s.a; then
52 ac_cv_path_xpcom_sdk_dir="-L`(cd ${with_xpcom_sdk_dir}; pwd)` -lxpcomglue_s -lnspr4 -lplds4"
54 AC_MSG_ERROR([${with_xpcom_sdk_dir} directory doesn't contain libxpcomglue_s.a!])
59 if test x$xpcom = xyes; then
60 if test x$cross_compiling = xno; then
62 # Look for libxpcomglue_s.a (version 1.8 !!) if not explicitly given
63 if test x$ac_cv_path_xpcom_sdk_dir = x; then
64 for i in /usr/lib/iceape; do
65 # TODO: check version ! we do NOT want to use 1.9 here !!!
66 # TODO: check availability of nspr4 and plds4 (may be in /usr/lib too)
67 if test -e "${i}/libxpcomglue_s.a"; then
68 ac_cv_path_xpcom_sdk_dir="-L${i} -lxpcomglue_s -lnspr4 -lplds4"
74 # Look for xpcom headers (version 1.8 !!) if not explicitly given
75 if test x$ac_cv_path_xpcom_incl = x; then
76 # Prefer libxul-unstable for cflags.
77 if $PKG_CONFIG --exists libxul-unstable; then
78 ac_cv_path_xpcom_incl="`$PKG_CONFIG --cflags-only-I libxul-unstable`"
80 if $PKG_CONFIG --exists libxul; then
81 ac_cv_path_xpcom_incl="`$PKG_CONFIG --cflags-only-I libxul`"
86 # hack, hack, broken .pc files in F9's xulrunner-devel
87 # they fail to include the include subdirectories
88 if test x"${ac_cv_path_xpcom_incl}" = x"-I/usr/include/xulrunner-sdk-1.9/stable -I/usr/include/nspr4 "; then
89 ac_cv_path_xpcom_incl="-I/usr/include/xulrunner-sdk-1.9/stable -I/usr/include/xulrunner-sdk-1.9/extensions -I/usr/include/xulrunner-sdk-1.9/necko -I/usr/include/nspr4"
92 # Look for libxul. TODO: needed at all ?
93 if $PKG_CONFIG --exists libxul; then
94 if test x$ac_cv_path_xpcom_sdk_dir = x; then
95 ac_cv_path_xpcom_sdk_dir="`$PKG_CONFIG --libs libxul`"
97 ac_cv_path_xpidl="`$PKG_CONFIG --libs-only-L libxul`"
103 if test x"${ac_cv_path_xpcom_incl}" != x; then
104 XPCOM_CFLAGS="${ac_cv_path_xpcom_incl}"
105 XPCOM_IDL_CFLAGS=`echo $XPCOM_CFLAGS | sed -e 's:include:share/idl:'`
106 XPIDL=`echo ${ac_cv_path_xpidl} | sed -e 's:-L::' -e 's:sdk-::' -e 's:sdk/lib::' -e 's:-devel::' -e 's:lib$::'`
107 XPIDL="${XPIDL}xpidl"
108 AC_DEFINE([HAVE_XPCOM], [1], [Use XPCOM in the NPAPI plugin])
114 if test x"${ac_cv_path_xpcom_sdk_dir}" != x ; then
115 XPCOM_LIBS="${ac_cv_path_xpcom_sdk_dir}"
122 AC_SUBST(XPCOM_CFLAGS)
123 AC_SUBST(XPCOM_IDL_CFLAGS)
127 dnl end of GNASH_PATH_XPCOM
131 # indent-tabs-mode: nil