reenable InvalidatedRegions for AGG in a framebuffer
[gnash.git] / macros / npapi.m4
blobe3bde2f0357eb22e92dd7f8bffb5b9746348e22c
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       $PKG_CONFIG --exists mozilla-plugin && NPAPI_CFLAGS="`$PKG_CONFIG --cflags mozilla-plugin`"
38     fi
39   fi
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
47     gnash_npapi_topdir=""
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}"
52           break 2
53         fi
54         if test -f $j/plugin/npapi.h; then
55           ac_cv_path_npapi_incl="${j}/plugin"
56           break 2
57         fi
58         if test -f $j/include/npapi.h; then
59           ac_cv_path_npapi_incl="${j}/include"
60           break 2
61         fi
62         if test -f $j/include/plugin/npapi.h; then
63           ac_cv_path_npapi_incl="${j}/include/plugin"
64           break 2
65         fi
66       done
67     done
68   fi
69   if test x"${ac_cv_path_npapi_incl}" = x -a x"${NPAPI_CFLAGS}" = x; then
70     AC_MSG_RESULT([not found])
71     has_npapi=no
72   elif test x"${ac_cv_path_npapi_incl}" = x -a x"${NPAPI_CFLAGS}" != x; then
73     AC_MSG_RESULT([${NPAPI_CFLAGS}])
74     has_npapi=yes
75   else
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"
79     fi
80     AC_MSG_RESULT([${NPAPI_CFLAGS}])
81     has_npapi=yes
82   fi
84   if test x"${NPAPI_CFLAGS}" != x; then
85     AC_LANG_PUSH(C++)
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([
90                   #include "npapi.h" 
91                   #include "npruntime.h"
92                   int main(int argc, char* argv[]){
93                     NPString str;
94                     uint32_t len = str.UTF8Length;
95                     return 0;
96                   }])],
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"
101     AC_LANG_POP(C++)
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])
109       AC_MSG_RESULT([yes])
110     else
111       AC_MSG_RESULT([no])
112     fi
113   fi
115   AC_SUBST(NPAPI_CFLAGS)
118 # Local Variables:
119 # c-basic-offset: 2
120 # tab-width: 2
121 # indent-tabs-mode: nil
122 # End: