Add automated test on delayed return value handling in ExternalInterface.call().
[gnash.git] / macros / kde4.m4
blobba3db4af1cb3c98add39fab3c25d6fa56f41bf5f
1 dnl  
2 dnl  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl  2011 Free Software Foundation, Inc.
4 dnl  
5 dnl  This program is free software; you can redistribute it and/or modify
6 dnl  it under the terms of the GNU General Public License as published by
7 dnl  the Free Software Foundation; either version 3 of the License, or
8 dnl  (at your option) any later version.
9 dnl  
10 dnl  This program is distributed in the hope that it will be useful,
11 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl  GNU General Public License for more details.
14 dnl  You should have received a copy of the GNU General Public License
15 dnl  along with this program; if not, write to the Free Software
16 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 AC_DEFUN([GNASH_PATH_KDE4],
19
20   has_kde4=no
22   dnl setup the various options to custimize paths
23   AC_ARG_WITH(kde4_incl, AC_HELP_STRING([--with-kde4-incl],
24              [directory where KDE 4.x headers are]),
25              with_kde4_incl=${withval})
26   dnl make sure the path is a useable one
27   if test x"${with_kde4_incl}" != x ; then
28     if test ! -f ${with_kde4_incl}/kapplication.h ; then
29       AC_MSG_ERROR([${with_kde4_incl} directory doesn't contain any KDE 4.x headers])
30     fi
31   fi
33   AC_ARG_WITH(kde4_prefix, AC_HELP_STRING([--with-kde4-prefix],
34              [Prefix for KDE plugin, like /usr]),
35              with_kde4_prefix=${withval})
37   AC_ARG_WITH(kde4_lib, AC_HELP_STRING([--with-kde4-lib],
38              [directory where KDE 4.x libraries are]),
39              with_kde4_lib=${withval})
40   dnl make sure the path is a useable one
41   if test x"${with_kde4_lib}" != x ; then 
42     if test ! -f ${with_kde4_lib}/libkdeui.so; then
43       AC_MSG_ERROR([${with_kde4_lib} directory doesn't contain any KDE 4.x libraries!])
44     fi
45   fi
47   dnl Specifiy a custom directory for the kparts plugin
48   AC_ARG_WITH(kde4_plugindir, AC_HELP_STRING([--with-kde4-plugindir=DIR],
49              [Directory to install KDE 4.x plugin in]),
50              with_kde4_plugindir=${withval})
51   if test x"${with_kde4_plugindir}" != x ; then 
52     if test ! -d ${with_kde4_plugindir}/plugins; then
53       AC_MSG_ERROR([${with_kde4_plugindir} directory doesn't contain any KDE 4.x plugins!])
54     fi
55   fi
57   dnl Specifiy a custom directory for the kde services directory
58   AC_ARG_WITH(kde4_servicesdir, AC_HELP_STRING([--with-kde4-servicesdir=DIR],
59              [Directory to install KDE 4.x plugin in]),
60              with_kde4_servicesdir=${withval})
61   if test x"${with_kde4_servicesdir}" != x ; then 
62     if test ! -d ${with_kde4_servicesdir}; then
63       AC_MSG_ERROR([${with_kde4_} directory doesn't contain any KDE 4.x plugins!])
64     fi
65   fi
67   AC_ARG_WITH(kde4-configdir, AC_HELP_STRING([--with-kde4-configdir=DIR],
68       [Directory to install KDE KDE 4.x configfile in]),
69     [KDE4_CONFIGDIR=${withval}
70   ])
72   AC_ARG_WITH(kde-appsdatadir, AC_HELP_STRING([--with-kde-appsdatadir=DIR],
73       [Directory to install KDE 4.x data in]),
74     [KDE4_APPSDATADIR=${withval}
75   ])
77   dnl Only run these tests if this version was specified by the user, and they
78   dnl haven't spcified a custom path.
79     kde4_prefix=
80     dnl FreeBSD puts kde4-config in /usr/local
81     pathlist="${pathlist}:/usr/local/kde4/bin"
82     AC_PATH_PROG(KDE4_CONFIG, kde4-config, ,[${pathlist}])
83     if test "x$KDE4_CONFIG" != "x" ; then
84       kde4_prefix=`$KDE4_CONFIG --prefix`
85       AC_MSG_NOTICE([KDE4 prefix from kde4-config is ${kde4_prefix}])
86     fi
88     AC_CACHE_VAL(ac_cv_path_kde4_incl,[
89       dnl if the user specified a path, sanity check it and then use it
90       if test x"${with_kde4_incl}" != x ; then
91         if test -f ${with_kde4_incl}/kapplication.h ; then
92           ac_cv_path_kde4_incl="-I`(cd ${with_kde4_incl}; pwd)`"
93         fi
94       fi
95       AC_MSG_CHECKING([for KDE 4.x header path])
96       dnl if the user didn't specify a path, go search a list of
97       dnl likely directories for the header files.
98       if test x"${ac_cv_path_kde4_incl}" = x ; then
99         dnl incllist is inherited from configure.ac, and lives in /macros
100         for i in ${kde4_prefix}/include $incllist; do
101           if test -f $i/kde4/kapplication.h; then          
102             ac_cv_path_kde4_incl="-I$i/kde4"
103             kde4_prefix=`dirname $i`
104             break
105           fi
106           if test -f $i/kde/kapplication.h; then
107             ac_cv_path_kde4_incl="-I$i/kde"
108             kde4_prefix=`dirname $i`
109             break
110           fi
111           if test -f $i/kapplication.h; then
112             ac_cv_path_kde4_incl="-I$i"
113             kde4_prefix=`dirname $i`
114             break
115           fi
116         done
117       fi
118       if test x"${ac_cv_path_kde4_incl}" != x ; then
119         AC_MSG_RESULT(${ac_cv_path_kde4_incl})
120       else
121         AC_MSG_RESULT(no)
122         if test x${cross_compiling} = xno; then
123           dnl if no headers have been found yet, make a last ditch
124           dnl attempt to use the compiler to find them.
125           AC_CHECK_HEADERS(kde4/kapplication.h, [ac_cv_path_kde4_incl=""])
126         fi
127       fi
128     ])                  dnl end of cache ac_cv_path_kde4_incl
130     dnl Look for the libraries
131     AC_CACHE_VAL(ac_cv_path_kde4_lib, [
132       if test x"${with_kde4_lib}" != x ; then
133         if test -f ${with_kde4_lib}/libkdeui.la -o -f ${with_kde4_lib}/libkdeui.${shlibext}; then
134                 ac_cv_path_kde4_lib="-L`(cd ${with_kde4_lib}; pwd)`"
135         else
136                 AC_MSG_ERROR([${with_kde4_lib} directory doesn't contain KDE 4.x libraries.])
137         fi
138       fi
139       if test x"${ac_cv_path_kde4_lib}" = x; then
140         AC_MSG_CHECKING([for kdeui library])
141         kde4_topdir=
142         for i in ${kde4_prefix}/lib64 ${kde4_prefix}/lib $libslist /usr/lib/kde4/devel /usr/lib64/kde4/devel; do
143           if test -f $i/libkdeui.${shlibext} -o -f $i/libkdeui.a; then
144             kde4_topdir=$i
145             AC_MSG_RESULT(${kde4_topdir}/libkdeui)
146                   if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
147                     ac_cv_path_kde4_lib="-L$i -lkdeui"
148               break
149             else
150                     ac_cv_path_kde4_lib="-lkdeui"
151                     break
152             fi
153           fi
154         done
155       fi
156       dnl Look for the kdecore library, which is required
157       if test x"${ac_cv_path_kde4_lib}" != x; then
158         AC_MSG_CHECKING([for kdecore library])
159         if test -f ${kde4_topdir}/libkdecore.so; then
160           ac_cv_path_kde4_lib="${ac_cv_path_kde4_lib} -lkdecore"
161           AC_MSG_RESULT(${kde4_topdir}/libkdecore)
162         else
163          AC_MSG_RESULT(no)
164         fi
165       fi
166     ])                  dnl end of cache ac_cv_path_kde4_lib
168   KLASH_PLUGIN=
169   
170   dnl If building the kparts plugin, get the install paths correct.  
171     AC_CACHE_VAL(ac_cv_path_kde4_prefix,[
172       dnl if the user specified a path, sanity check it and then use it
173       if test x"${with_kde4_prefix}" != x; then
174         ac_cv_path_kde4_prefix="`(cd ${with_kde4_prefix}; pwd)`"
175       else
176         ac_cv_path_kde4_prefix=${kde4_prefix}
177       fi
178     ])                  dnl end of cache ac_cv_path_kde4_prefix
180     KDE4_PREFIX="${ac_cv_path_kde4_prefix}"
181     if test x"${PLUGINS_INSTALL_POLICY}" != x; then
182       case "${PLUGINS_INSTALL_POLICY}" in
183         user)
184           KDE4_PREFIX=${HOME}/.kde
185           ;;
186         system)
187           KDE4_PREFIX="${kde4_prefix}"
188           ;;
189         prefix)
190           KDE4_PREFIX="\${prefix}"
191           ;;
192       esac
193     fi
195     if test x"${with_kde4_plugindir}" != x ; then 
196       KDE4_PLUGINDIR="${with_kde4_plugindir}"
197     else
198       if test -d ${KDE4_PREFIX}/lib64 -a -f /etc/redhat-release || \
199          test -d ${KDE4_PREFIX}/lib64 -a -f /usr/lib/rpm/suse_macros; then
200         KDE4_PLUGINDIR="${KDE4_PREFIX}/lib64/kde4"
201       else
202         KDE4_PLUGINDIR="${KDE4_PREFIX}/lib/kde4"
203       fi
204     fi
205     if test x"${with_kde4_servicesdir}" != x ; then 
206       KDE4_SERVICESDIR="${with_kde4_servicesdir}"
207     else
208       KDE4_SERVICESDIR="${KDE4_PREFIX}/share/kde4/services"
209     fi
210     if test x"${KDE4_CONFIGDIR}" = x ; then 
211       KDE4_CONFIGDIR="${KDE4_PREFIX}/share/kde4/config"
212     fi
213     if test x"${KDE4_APPSDATADIR}" = x ; then 
214       KDE4_APPSDATADIR="${KDE4_PREFIX}/share/kde4/apps/klash"
215     fi
217   if test x"${ac_cv_path_kde4_incl}" != x ; then
218     if test x"${ac_cv_path_kde4_incl}" != x"-I/usr/include"; then
219       KDE4_CFLAGS="${ac_cv_path_kde4_incl}"
220     else
221       KDE4_CFLAGS=""
222     fi
223     if test x"${ac_cv_path_kde4_lib}" != x; then
224       KDE4_LIBS="${ac_cv_path_kde4_lib}"
225       AC_DEFINE(HAVE_KDE4, 1,[Have KDE 4.x installed])
226       has_kde4=yes
227     else
228       KDE4_LIBS=""
229       has_kde4=no
230     fi
231   fi
233   AC_SUBST(KLASH_PLUGIN)
234   AC_SUBST(KDE4_CFLAGS)  
235   AC_SUBST(KDE4_LIBS)
237   AC_SUBST(KDE4_PLUGINDIR)
238   AC_SUBST(KDE4_SERVICESDIR)
239   AC_SUBST(KDE4_CONFIGDIR)
240   AC_SUBST(KDE4_APPSDATADIR)
243 # Local Variables:
244 # c-basic-offset: 2
245 # tab-width: 2
246 # indent-tabs-mode: nil
247 # End: