2 dnl Copyright (C) 2005, 2006, 2009, 2010, 2011 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
19 AC_DEFUN([GNASH_PATH_NPAPI],
23 AC_ARG_WITH(npapi_incl, AC_HELP_STRING([--with-npapi-incl], [directory where npapi headers are]), with_npapi_incl=${withval})
24 AC_CACHE_VAL(ac_cv_path_npapi_incl,[
25 if test x"${with_npapi_incl}" != x ; then
26 if test -f ${with_npapi_incl}/npapi.h; then
27 ac_cv_path_npapi_incl="`(cd ${with_npapi_incl}; pwd)`"
29 AC_MSG_ERROR([${with_npapi_incl} directory doesn't contain npapi.h])
35 if test x$cross_compiling = xno; then
36 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_npapi_incl}" = x; then
37 $PKG_CONFIG --exists mozilla-plugin && NPAPI_CFLAGS="`$PKG_CONFIG --cflags mozilla-plugin`"
41 dnl Attempt to find the top level directory, which unfortunately has a
42 dnl version number attached. At least on Debain based systems, this
43 dnl doesn't seem to get a directory that is unversioned.
45 AC_MSG_CHECKING([for npapi.h])
46 if test x"${ac_cv_path_npapi_incl}" = x; then
48 for i in $incllist "/usr/local"; do
49 for j in `ls -dr $i/xulrunner* 2>/dev/null`; do
50 if test -f $j/npapi.h; then
51 ac_cv_path_npapi_incl="${j}"
54 if test -f $j/plugin/npapi.h; then
55 ac_cv_path_npapi_incl="${j}/plugin"
58 if test -f $j/include/npapi.h; then
59 ac_cv_path_npapi_incl="${j}/include"
62 if test -f $j/include/plugin/npapi.h; then
63 ac_cv_path_npapi_incl="${j}/include/plugin"
69 if test x"${ac_cv_path_npapi_incl}" = x -a x"${NPAPI_CFLAGS}" = x; then
70 AC_MSG_RESULT([not found])
72 elif test x"${ac_cv_path_npapi_incl}" = x -a x"${NPAPI_CFLAGS}" != x; then
73 AC_MSG_RESULT([${NPAPI_CFLAGS}])
76 NPAPI_CFLAGS="-I${ac_cv_path_npapi_incl}"
77 if test x"$linux" = x"yes" -o x"$bsd" = x"yes" -o x"$solaris" = x"yes";then
78 NPAPI_CFLAGS="$NPAPI_CFLAGS -DXP_UNIX"
80 AC_MSG_RESULT([${NPAPI_CFLAGS}])
84 if test x"${NPAPI_CFLAGS}" != x; then
86 save_CXXFLAGS="$CXXFLAGS"
87 CXXFLAGS="$CXXFLAGS $NPAPI_CFLAGS"
88 AC_MSG_CHECKING([whether NPString has member UTF8Length])
89 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
91 #include "npruntime.h"
92 int main(int argc, char* argv[]){
94 uint32_t len = str.UTF8Length;
97 [AC_DEFINE([NPAPI_VERSION],[192],[Define that we have NPAPI present in version 1.9.2 and newer])
98 AC_MSG_RESULT([yes])],
99 [AC_MSG_RESULT([no])])
100 CXXFLAGS="$save_CXXFLAGS"
102 AC_MSG_CHECKING([for npupp.h])
103 if test -f "${ac_cv_path_npapi_incl}"/npupp.h -o \
104 -f "${ac_cv_path_npapi_incl}"/plugin/npupp.h -o \
105 -f "`$PKG_CONFIG --variable=includedir mozilla-plugin`"/npupp.h -o \
106 -f "`$PKG_CONFIG --variable=includedir mozilla-plugin`"/stable/npupp.h -o \
107 -f "`$PKG_CONFIG --variable=includedir mozilla-plugin`"/plugin/npupp.h;then
108 AC_DEFINE([NPAPI_VERSION],[190],[Define that we have NPAPI present in version 1.9.0 and maybe older])
115 AC_SUBST(NPAPI_CFLAGS)
121 # indent-tabs-mode: nil