2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl 2011 Free Software Foundation, Inc.
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.
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],
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])
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!])
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}/imageformats; then
53 AC_MSG_ERROR([${with_kde4_plugindir} directory doesn't contain any KDE 4.x plugins!])
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!])
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}
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}
77 dnl Only run these tests if this version was specified by the user, and they
78 dnl haven't spcified a custom path.
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}])
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)`"
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`
106 if test -f $i/kde/kapplication.h; then
107 ac_cv_path_kde4_incl="-I$i/kde"
108 kde4_prefix=`dirname $i`
111 if test -f $i/kapplication.h; then
112 ac_cv_path_kde4_incl="-I$i"
113 kde4_prefix=`dirname $i`
118 if test x"${ac_cv_path_kde4_incl}" != x ; then
119 AC_MSG_RESULT(${ac_cv_path_kde4_incl})
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=""])
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)`"
136 AC_MSG_ERROR([${with_kde4_lib} directory doesn't contain KDE 4.x libraries.])
139 if test x"${ac_cv_path_kde4_lib}" = x; then
140 AC_MSG_CHECKING([for kdeui library])
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
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"
150 ac_cv_path_kde4_lib="-lkdeui"
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)
166 ]) dnl end of cache ac_cv_path_kde4_lib
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)`"
176 ac_cv_path_kde4_prefix=${kde4_prefix}
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
184 KDE4_PREFIX=${HOME}/.kde
187 KDE4_PREFIX="${kde4_prefix}"
190 KDE4_PREFIX="\${prefix}"
195 if test x"${with_kde4_plugindir}" != x ; then
196 KDE4_PLUGINDIR="${with_kde4_plugindir}"
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"
202 KDE4_PLUGINDIR="${KDE4_PREFIX}/lib/kde4"
205 if test x"${with_kde4_servicesdir}" != x ; then
206 KDE4_SERVICESDIR="${with_kde4_servicesdir}"
208 KDE4_SERVICESDIR="${KDE4_PREFIX}/share/kde4/services"
210 if test x"${KDE4_CONFIGDIR}" = x ; then
211 KDE4_CONFIGDIR="${KDE4_PREFIX}/share/kde4/config"
213 if test x"${KDE4_APPSDATADIR}" = x ; then
214 KDE4_APPSDATADIR="${KDE4_PREFIX}/share/kde4/apps/klash"
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}"
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])
233 AC_SUBST(KLASH_PLUGIN)
234 AC_SUBST(KDE4_CFLAGS)
237 AC_SUBST(KDE4_PLUGINDIR)
238 AC_SUBST(KDE4_SERVICESDIR)
239 AC_SUBST(KDE4_CONFIGDIR)
240 AC_SUBST(KDE4_APPSDATADIR)
246 # indent-tabs-mode: nil