Avoid overriding the check-local rule, hushing automake warning
[gnash.git] / macros / kde4.m4
blob5f866fd29381c233b8b896eeaa6e67757197b216
1 dnl  
2 dnl    Copyright (C) 2005, 2006, 2007, 2009, 2010 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
17 AC_DEFUN([GNASH_PATH_KDE4],
18
19   has_kde4=no
21   dnl setup the various options to custimize paths
22   AC_ARG_WITH(kde4_incl, AC_HELP_STRING([--with-kde4-incl],
23              [directory where KDE 4.x headers are]),
24              with_kde4_incl=${withval})
25   dnl make sure the path is a useable one
26   if test x"${with_kde4_incl}" != x ; then
27     if test ! -f ${with_kde4_incl}/kapplication.h ; then
28       AC_MSG_ERROR([${with_kde4_incl} directory doesn't contain any KDE 4.x headers])
29     fi
30   fi
32   AC_ARG_WITH(kde4_prefix, AC_HELP_STRING([--with-kde4-prefix],
33              [Prefix for KDE plugin, like /usr]),
34              with_kde4_prefix=${withval})
36   AC_ARG_WITH(kde4_lib, AC_HELP_STRING([--with-kde4-lib],
37              [directory where KDE 4.x libraries are]),
38              with_kde4_lib=${withval})
39   dnl make sure the path is a useable one
40   if test x"${with_kde4_lib}" != x ; then 
41     if test ! -f ${with_kde4_lib}/libkdeui.so; then
42       AC_MSG_ERROR([${with_kde4_lib} directory doesn't contain any KDE 4.x libraries!])
43     fi
44   fi
46   dnl Specifiy a custom directory for the kparts plugin
47   AC_ARG_WITH(kde4_plugindir, AC_HELP_STRING([--with-kde4-plugindir=DIR],
48              [Directory to install KDE 4.x plugin in]),
49              with_kde4_plugindir=${withval})
50   if test x"${with_kde4_plugindir}" != x ; then 
51     if test ! -d ${with_kde4_plugindir}/imageformats; then
52       AC_MSG_ERROR([${with_kde4_plugindir} directory doesn't contain any KDE 4.x plugins!])
53     fi
54   fi
56   dnl Specifiy a custom directory for the kde services directory
57   AC_ARG_WITH(kde4_servicesdir, AC_HELP_STRING([--with-kde4-servicesdir=DIR],
58              [Directory to install KDE 4.x plugin in]),
59              with_kde4_servicesdir=${withval})
60   if test x"${with_kde4_servicesdir}" != x ; then 
61     if test ! -d ${with_kde4_servicesdir}; then
62       AC_MSG_ERROR([${with_kde4_} directory doesn't contain any KDE 4.x plugins!])
63     fi
64   fi
66   AC_ARG_WITH(kde4-configdir, AC_HELP_STRING([--with-kde4-configdir=DIR],
67       [Directory to install KDE KDE 4.x configfile in]),
68     [KDE4_CONFIGDIR=${withval}
69   ])
71   AC_ARG_WITH(kde-appsdatadir, AC_HELP_STRING([--with-kde-appsdatadir=DIR],
72       [Directory to install KDE 4.x data in]),
73     [KDE4_APPSDATADIR=${withval}
74   ])
76   dnl Only run these tests if this version was specified by the user, and they
77   dnl haven't spcified a custom path.
78     kde4_prefix=
79     dnl FreeBSD puts kde4-config in /usr/local
80     pathlist="${pathlist}:/usr/local/kde4/bin"
81     AC_PATH_PROG(KDE4_CONFIG, kde4-config, ,[${pathlist}])
82     if test "x$KDE4_CONFIG" != "x" ; then
83       kde4_prefix=`$KDE4_CONFIG --prefix`
84       AC_MSG_NOTICE([KDE4 prefix from kde4-config is ${kde4_prefix}])
85     fi
87     AC_CACHE_VAL(ac_cv_path_kde4_incl,[
88       dnl if the user specified a path, sanity check it and then use it
89       if test x"${with_kde4_incl}" != x ; then
90         if test -f ${with_kde4_incl}/kapplication.h ; then
91           ac_cv_path_kde4_incl="-I`(cd ${with_kde4_incl}; pwd)`"
92         fi
93       fi
94       AC_MSG_CHECKING([for KDE 4.x header path])
95       dnl if the user didn't specify a path, go search a list of
96       dnl likely directories for the header files.
97       if test x"${ac_cv_path_kde4_incl}" = x ; then
98         dnl incllist is inherited from configure.ac, and lives in /macros
99         for i in ${kde4_prefix}/include $incllist; do
100           if test -f $i/kde4/kapplication.h; then          
101             ac_cv_path_kde4_incl="-I$i/kde4"
102             kde4_prefix=`dirname $i`
103             break
104           fi
105           if test -f $i/kde/kapplication.h; then
106             ac_cv_path_kde4_incl="-I$i/kde"
107             kde4_prefix=`dirname $i`
108             break
109           fi
110           if test -f $i/kapplication.h; then
111             ac_cv_path_kde4_incl="-I$i"
112             kde4_prefix=`dirname $i`
113             break
114           fi
115         done
116       fi
117       if test x"${ac_cv_path_kde4_incl}" != x ; then
118         AC_MSG_RESULT(${ac_cv_path_kde4_incl})
119       else
120         AC_MSG_RESULT(no)
121         if test x${cross_compiling} = xno; then
122           dnl if no headers have been found yet, make a last ditch
123           dnl attempt to use the compiler to find them.
124           AC_CHECK_HEADERS(kde4/kapplication.h, [ac_cv_path_kde4_incl=""])
125         fi
126       fi
127     ])                  dnl end of cache ac_cv_path_kde4_incl
129     dnl Look for the libraries
130     AC_CACHE_VAL(ac_cv_path_kde4_lib, [
131       if test x"${with_kde4_lib}" != x ; then
132         if test -f ${with_kde4_lib}/libkdeui.la; then
133                 ac_cv_path_kde4_lib="-L`(cd ${with_kde4_lib}; pwd)`"
134         else
135                 AC_MSG_ERROR([${with_kde4_lib} directory doesn't contain KDE 4.x libraries.])
136         fi
137       fi
138       if test x"${ac_cv_path_kde4_lib}" = x; then
139         AC_MSG_CHECKING([for kdeui library])
140         kde4_topdir=
141         for i in ${kde4_prefix}/lib64 ${kde4_prefix}/lib $libslist /usr/lib/kde4/devel /usr/lib64/kde4/devel; do
142           if test -f $i/libkdeui.${shlibext} -o -f $i/libkdeui.la; then
143             kde4_topdir=$i
144             AC_MSG_RESULT(${kde4_topdir}/libkdeui)
145                   if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
146                     ac_cv_path_kde4_lib="-L$i -lkdeui"
147               break
148             else
149                     ac_cv_path_kde4_lib="-lkdeui"
150                     break
151             fi
152           fi
153         done
154       fi
155       dnl Look for the kdecore library, which is required
156       if test x"${ac_cv_path_kde4_lib}" != x; then
157         AC_MSG_CHECKING([for kdecore library])
158         if test -f ${kde4_topdir}/libkdecore.so; then
159           ac_cv_path_kde4_lib="${ac_cv_path_kde4_lib} -lkdecore"
160           AC_MSG_RESULT(${kde4_topdir}/libkdecore)
161         else
162          AC_MSG_RESULT(no)
163         fi
164       fi
165     ])                  dnl end of cache ac_cv_path_kde4_lib
167   KLASH_PLUGIN=
168   
169   dnl If building the kparts plugin, get the install paths correct.  
170     AC_CACHE_VAL(ac_cv_path_kde4_prefix,[
171       dnl if the user specified a path, sanity check it and then use it
172       if test x"${with_kde4_prefix}" != x; then
173         ac_cv_path_kde4_prefix="`(cd ${with_kde4_prefix}; pwd)`"
174       else
175         ac_cv_path_kde4_prefix=${kde4_prefix}
176       fi
177     ])                  dnl end of cache ac_cv_path_kde4_prefix
179     KDE4_PREFIX="${ac_cv_path_kde4_prefix}"
180     if test x"${PLUGINS_INSTALL_POLICY}" != x; then
181       case "${PLUGINS_INSTALL_POLICY}" in
182         user)
183           KDE4_PREFIX=${HOME}/.kde
184           ;;
185         system)
186           KDE4_PREFIX="${kde4_prefix}"
187           ;;
188         prefix)
189           KDE4_PREFIX="\${prefix}"
190           ;;
191       esac
192     fi
194     if test x"${with_kde4_plugindir}" != x ; then 
195       KDE4_PLUGINDIR="${with_kde4_plugindir}/lib/kde4"
196     else
197       KDE4_PLUGINDIR="${KDE4_PREFIX}/lib/kde4"
198     fi
199     if test x"${with_kde4_servicesdir}" != x ; then 
200       KDE4_SERVICESDIR="${with_kde4_servicesdir}/share/kde4/services"
201     else
202       KDE4_SERVICESDIR="${KDE4_PREFIX}/share/kde4/services"
203     fi
204     if test x"${KDE4_CONFIGDIR}" != x ; then 
205       KDE4_CONFIGDIR="${KDE4_CONFIGDIR}/share/kde4/config"
206     else
207       KDE4_CONFIGDIR="${KDE4_PREFIX}/share/kde4/config"
208     fi
209     if test x"${KDE4_APPSDATADIR}" != x ; then 
210       KDE4_APPSDATADIR="${KDE4_APPSDATADIR}/share/kde4/apps/klash"
211     else
212       KDE4_APPSDATADIR="${KDE4_PREFIX}/share/kde4/apps/klash"
213     fi
215   if test x"${ac_cv_path_kde4_incl}" != x ; then
216     if test x"${ac_cv_path_kde4_incl}" != x"-I/usr/include"; then
217       KDE4_CFLAGS="${ac_cv_path_kde4_incl}"
218     else
219       KDE4_CFLAGS=""
220     fi
221     if test x"${ac_cv_path_kde4_lib}" != x; then
222       KDE4_LIBS="${ac_cv_path_kde4_lib}"
223       AC_DEFINE(HAVE_KDE4, 1,[Have KDE 4.x installed])
224       has_kde4=yes
225     else
226       KDE4_LIBS=""
227       has_kde4=no
228     fi
229   fi
231   AC_SUBST(KLASH_PLUGIN)
232   AC_SUBST(KDE4_CFLAGS)  
233   AC_SUBST(KDE4_LIBS)
235   AC_SUBST(KDE4_PLUGINDIR)
236   AC_SUBST(KDE4_SERVICESDIR)
237   AC_SUBST(KDE4_CONFIGDIR)
238   AC_SUBST(KDE4_APPSDATADIR)
241 # Local Variables:
242 # c-basic-offset: 2
243 # tab-width: 2
244 # indent-tabs-mode: nil
245 # End: