2 dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 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
17 AC_DEFUN([GNASH_PATH_KDE4],
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])
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!])
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!])
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!])
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}
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}
76 dnl Only run these tests if this version was specified by the user, and they
77 dnl haven't spcified a custom path.
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}])
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)`"
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`
105 if test -f $i/kde/kapplication.h; then
106 ac_cv_path_kde4_incl="-I$i/kde"
107 kde4_prefix=`dirname $i`
110 if test -f $i/kapplication.h; then
111 ac_cv_path_kde4_incl="-I$i"
112 kde4_prefix=`dirname $i`
117 if test x"${ac_cv_path_kde4_incl}" != x ; then
118 AC_MSG_RESULT(${ac_cv_path_kde4_incl})
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=""])
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)`"
135 AC_MSG_ERROR([${with_kde4_lib} directory doesn't contain KDE 4.x libraries.])
138 if test x"${ac_cv_path_kde4_lib}" = x; then
139 AC_MSG_CHECKING([for kdeui library])
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
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"
149 ac_cv_path_kde4_lib="-lkdeui"
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)
165 ]) dnl end of cache ac_cv_path_kde4_lib
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)`"
175 ac_cv_path_kde4_prefix=${kde4_prefix}
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
183 KDE4_PREFIX=${HOME}/.kde
186 KDE4_PREFIX="${kde4_prefix}"
189 KDE4_PREFIX="\${prefix}"
194 if test x"${with_kde4_plugindir}" != x ; then
195 KDE4_PLUGINDIR="${with_kde4_plugindir}/lib/kde4"
197 KDE4_PLUGINDIR="${KDE4_PREFIX}/lib/kde4"
199 if test x"${with_kde4_servicesdir}" != x ; then
200 KDE4_SERVICESDIR="${with_kde4_servicesdir}/share/kde4/services"
202 KDE4_SERVICESDIR="${KDE4_PREFIX}/share/kde4/services"
204 if test x"${KDE4_CONFIGDIR}" != x ; then
205 KDE4_CONFIGDIR="${KDE4_CONFIGDIR}/share/kde4/config"
207 KDE4_CONFIGDIR="${KDE4_PREFIX}/share/kde4/config"
209 if test x"${KDE4_APPSDATADIR}" != x ; then
210 KDE4_APPSDATADIR="${KDE4_APPSDATADIR}/share/kde4/apps/klash"
212 KDE4_APPSDATADIR="${KDE4_PREFIX}/share/kde4/apps/klash"
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}"
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])
231 AC_SUBST(KLASH_PLUGIN)
232 AC_SUBST(KDE4_CFLAGS)
235 AC_SUBST(KDE4_PLUGINDIR)
236 AC_SUBST(KDE4_SERVICESDIR)
237 AC_SUBST(KDE4_CONFIGDIR)
238 AC_SUBST(KDE4_APPSDATADIR)
244 # indent-tabs-mode: nil