Add automated test on delayed return value handling in ExternalInterface.call().
[gnash.git] / macros / npapi.m4
blob2e0147a3e65b9c24e89957f03b6993425145021b
1 dnl  
2 dnl    Copyright (C) 2005, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
3 dnl  
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.
8 dnl  
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],
22   dnl Look for npapi.h
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)`"
28       else
29         AC_MSG_ERROR([${with_npapi_incl} directory doesn't contain npapi.h])
30       fi
31     fi
32   ])
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`"
41       fi
42     fi
43   fi
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
51     gnash_npapi_topdir=""
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}"
56           break 2
57         fi
58         if test -f $j/plugin/npapi.h; then
59           ac_cv_path_npapi_incl="${j}/plugin"
60           break 2
61         fi
62         if test -f $j/include/npapi.h; then
63           ac_cv_path_npapi_incl="${j}/include"
64           break 2
65         fi
66         if test -f $j/include/plugin/npapi.h; then
67           ac_cv_path_npapi_incl="${j}/include/plugin"
68           break 2
69         fi
70       done
71     done
72   fi
73   if test x"${ac_cv_path_npapi_incl}" = x -a x"${NPAPI_CFLAGS}" = x; then
74     AC_MSG_RESULT([not found])
75     has_npapi=no
76   elif test x"${ac_cv_path_npapi_incl}" = x -a x"${NPAPI_CFLAGS}" != x; then
77     AC_MSG_RESULT([${NPAPI_CFLAGS}])
78     has_npapi=yes
79   else
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"
83     fi
84     AC_MSG_RESULT([${NPAPI_CFLAGS}])
85     has_npapi=yes
86   fi
88   if test x"${NPAPI_CFLAGS}" != x; then
89     AC_LANG_PUSH(C++)
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([
94                   #include "npapi.h" 
95                   #include "npruntime.h"
96                   int main(int argc, char** argv){
97                     NPString str;
98                     uint32_t len = str.UTF8Length;
99                     return 0;
100                   }])],
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"
105     AC_LANG_POP(C++)
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])
113       AC_MSG_RESULT([yes])
114     else
115       AC_MSG_RESULT([no])
116     fi
117   fi
119   AC_SUBST(NPAPI_CFLAGS)
122 # Local Variables:
123 # c-basic-offset: 2
124 # tab-width: 2
125 # indent-tabs-mode: nil
126 # End: