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 if $PKG_CONFIG --exists npapi-sdk; then
38 NPAPI_CFLAGS="`$PKG_CONFIG --cflags npapi-sdk`"
39 elif $PKG_CONFIG --exists mozilla-plugin; then
40 NPAPI_CFLAGS="`$PKG_CONFIG --cflags mozilla-plugin`"
45 dnl Attempt to find the top level directory, which unfortunately has a
46 dnl version number attached. At least on Debain based systems, this
47 dnl doesn't seem to get a directory that is unversioned.
49 AC_MSG_CHECKING([for npapi.h])
50 if test x"${ac_cv_path_npapi_incl}" = x; then
52 for i in $incllist "/usr/local"; do
53 for j in `ls -dr $i/xulrunner* 2>/dev/null`; do
54 if test -f $j/npapi.h; then
55 ac_cv_path_npapi_incl="${j}"
58 if test -f $j/plugin/npapi.h; then
59 ac_cv_path_npapi_incl="${j}/plugin"
62 if test -f $j/include/npapi.h; then
63 ac_cv_path_npapi_incl="${j}/include"
66 if test -f $j/include/plugin/npapi.h; then
67 ac_cv_path_npapi_incl="${j}/include/plugin"
73 if test x"${ac_cv_path_npapi_incl}" = x -a x"${NPAPI_CFLAGS}" = x; then
74 AC_MSG_RESULT([not found])
76 elif test x"${ac_cv_path_npapi_incl}" = x -a x"${NPAPI_CFLAGS}" != x; then
77 AC_MSG_RESULT([${NPAPI_CFLAGS}])
80 NPAPI_CFLAGS="-I${ac_cv_path_npapi_incl}"
81 if test x"$linux" = x"yes" -o x"$bsd" = x"yes" -o x"$solaris" = x"yes";then
82 NPAPI_CFLAGS="$NPAPI_CFLAGS -DXP_UNIX"
84 AC_MSG_RESULT([${NPAPI_CFLAGS}])
88 if test x"${NPAPI_CFLAGS}" != x; then
90 save_CXXFLAGS="$CXXFLAGS"
91 CXXFLAGS="$CXXFLAGS $NPAPI_CFLAGS"
92 AC_MSG_CHECKING([whether NPString has member UTF8Length])
93 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
95 #include "npruntime.h"
96 int main(int argc, char** argv){
98 uint32_t len = str.UTF8Length;
101 [AC_DEFINE([NPAPI_VERSION],[192],[Define that we have NPAPI present in version 1.9.2 and newer])
102 AC_MSG_RESULT([yes])],
103 [AC_MSG_RESULT([no])])
104 CXXFLAGS="$save_CXXFLAGS"
106 AC_MSG_CHECKING([for npupp.h])
107 if test -f "${ac_cv_path_npapi_incl}"/npupp.h -o \
108 -f "${ac_cv_path_npapi_incl}"/plugin/npupp.h -o \
109 -f "`$PKG_CONFIG --variable=includedir mozilla-plugin`"/npupp.h -o \
110 -f "`$PKG_CONFIG --variable=includedir mozilla-plugin`"/stable/npupp.h -o \
111 -f "`$PKG_CONFIG --variable=includedir mozilla-plugin`"/plugin/npupp.h;then
112 AC_DEFINE([NPAPI_VERSION],[190],[Define that we have NPAPI present in version 1.9.0 and maybe older])
119 AC_SUBST(NPAPI_CFLAGS)
125 # indent-tabs-mode: nil