source: trunk/Taper/admin/acinclude.m4.in@ 8816

Last change on this file since 8816 was 4307, checked in by merck, 20 years ago
new project
File size: 142.5 KB
Line 
1## -*- autoconf -*-
2
3dnl This file is part of the KDE libraries/packages
4dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
5dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org)
6
7dnl This file is free software; you can redistribute it and/or
8dnl modify it under the terms of the GNU Library General Public
9dnl License as published by the Free Software Foundation; either
10dnl version 2 of the License, or (at your option) any later version.
11
12dnl This library is distributed in the hope that it will be useful,
13dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15dnl Library General Public License for more details.
16
17dnl You should have received a copy of the GNU Library General Public License
18dnl along with this library; see the file COPYING.LIB. If not, write to
19dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20dnl Boston, MA 02111-1307, USA.
21
22dnl IMPORTANT NOTE:
23dnl Please do not modify this file unless you expect your modifications to be
24dnl carried into every other module in the repository.
25dnl
26dnl Single-module modifications are best placed in configure.in for kdelibs
27dnl and kdebase or configure.in.in if present.
28
29# KDE_PATH_X_DIRECT
30dnl Internal subroutine of AC_PATH_X.
31dnl Set ac_x_includes and/or ac_x_libraries.
32AC_DEFUN([KDE_PATH_X_DIRECT],
33[
34AC_REQUIRE([KDE_CHECK_LIB64])
35
36if test "$ac_x_includes" = NO; then
37 # Guess where to find include files, by looking for this one X11 .h file.
38 test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
39
40 # First, try using that file with no special directory specified.
41AC_TRY_CPP([#include <$x_direct_test_include>],
42[# We can compile using X headers with no special include directory.
43ac_x_includes=],
44[# Look for the header file in a standard set of common directories.
45# Check X11 before X11Rn because it is often a symlink to the current release.
46 for ac_dir in \
47 /usr/X11/include \
48 /usr/X11R6/include \
49 /usr/X11R5/include \
50 /usr/X11R4/include \
51 \
52 /usr/include/X11 \
53 /usr/include/X11R6 \
54 /usr/include/X11R5 \
55 /usr/include/X11R4 \
56 \
57 /usr/local/X11/include \
58 /usr/local/X11R6/include \
59 /usr/local/X11R5/include \
60 /usr/local/X11R4/include \
61 \
62 /usr/local/include/X11 \
63 /usr/local/include/X11R6 \
64 /usr/local/include/X11R5 \
65 /usr/local/include/X11R4 \
66 \
67 /usr/X386/include \
68 /usr/x386/include \
69 /usr/XFree86/include/X11 \
70 \
71 /usr/include \
72 /usr/local/include \
73 /usr/unsupported/include \
74 /usr/athena/include \
75 /usr/local/x11r5/include \
76 /usr/lpp/Xamples/include \
77 \
78 /usr/openwin/include \
79 /usr/openwin/share/include \
80 ; \
81 do
82 if test -r "$ac_dir/$x_direct_test_include"; then
83 ac_x_includes=$ac_dir
84 break
85 fi
86 done])
87fi # $ac_x_includes = NO
88
89if test "$ac_x_libraries" = NO; then
90 # Check for the libraries.
91
92 test -z "$x_direct_test_library" && x_direct_test_library=Xt
93 test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
94
95 # See if we find them without any special options.
96 # Don't add to $LIBS permanently.
97 ac_save_LIBS="$LIBS"
98 LIBS="-l$x_direct_test_library $LIBS"
99AC_TRY_LINK(, [${x_direct_test_function}()],
100[LIBS="$ac_save_LIBS"
101# We can link X programs with no special library path.
102ac_x_libraries=],
103[LIBS="$ac_save_LIBS"
104# First see if replacing the include by lib works.
105# Check X11 before X11Rn because it is often a symlink to the current release.
106for ac_dir in `echo "$ac_x_includes" | sed s/include/lib${kdelibsuff}/` \
107 /usr/X11/lib${kdelibsuff} \
108 /usr/X11R6/lib${kdelibsuff} \
109 /usr/X11R5/lib${kdelibsuff} \
110 /usr/X11R4/lib${kdelibsuff} \
111 \
112 /usr/lib${kdelibsuff}/X11 \
113 /usr/lib${kdelibsuff}/X11R6 \
114 /usr/lib${kdelibsuff}/X11R5 \
115 /usr/lib${kdelibsuff}/X11R4 \
116 \
117 /usr/local/X11/lib${kdelibsuff} \
118 /usr/local/X11R6/lib${kdelibsuff} \
119 /usr/local/X11R5/lib${kdelibsuff} \
120 /usr/local/X11R4/lib${kdelibsuff} \
121 \
122 /usr/local/lib${kdelibsuff}/X11 \
123 /usr/local/lib${kdelibsuff}/X11R6 \
124 /usr/local/lib${kdelibsuff}/X11R5 \
125 /usr/local/lib${kdelibsuff}/X11R4 \
126 \
127 /usr/X386/lib${kdelibsuff} \
128 /usr/x386/lib${kdelibsuff} \
129 /usr/XFree86/lib${kdelibsuff}/X11 \
130 \
131 /usr/lib${kdelibsuff} \
132 /usr/local/lib${kdelibsuff} \
133 /usr/unsupported/lib${kdelibsuff} \
134 /usr/athena/lib${kdelibsuff} \
135 /usr/local/x11r5/lib${kdelibsuff} \
136 /usr/lpp/Xamples/lib${kdelibsuff} \
137 /lib/usr/lib${kdelibsuff}/X11 \
138 \
139 /usr/openwin/lib${kdelibsuff} \
140 /usr/openwin/share/lib${kdelibsuff} \
141 ; \
142do
143dnl Don't even attempt the hair of trying to link an X program!
144 for ac_extension in a so sl; do
145 if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
146 ac_x_libraries=$ac_dir
147 break 2
148 fi
149 done
150done])
151fi # $ac_x_libraries = NO
152])
153
154
155dnl ------------------------------------------------------------------------
156dnl Find a file (or one of more files in a list of dirs)
157dnl ------------------------------------------------------------------------
158dnl
159AC_DEFUN([AC_FIND_FILE],
160[
161$3=NO
162for i in $2;
163do
164 for j in $1;
165 do
166 echo "configure: __oline__: $i/$j" >&AC_FD_CC
167 if test -r "$i/$j"; then
168 echo "taking that" >&AC_FD_CC
169 $3=$i
170 break 2
171 fi
172 done
173done
174])
175
176dnl KDE_FIND_PATH(programm-name, variable-name, list of directories,
177dnl if-not-found, test-parameter)
178AC_DEFUN([KDE_FIND_PATH],
179[
180 AC_MSG_CHECKING([for $1])
181 if test -n "$$2"; then
182 kde_cv_path="$$2";
183 else
184 kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
185
186 AC_CACHE_VAL(kde_cv_path_$kde_cache,
187 [
188 kde_cv_path="NONE"
189 dirs="$3"
190 kde_save_IFS=$IFS
191 IFS=':'
192 for dir in $PATH; do
193 dirs="$dirs $dir"
194 done
195 IFS=$kde_save_IFS
196
197 for dir in $dirs; do
198 if test -x "$dir/$1"; then
199 if test -n "$5"
200 then
201 evalstr="$dir/$1 $5 2>&1 "
202 if eval $evalstr; then
203 kde_cv_path="$dir/$1"
204 break
205 fi
206 else
207 kde_cv_path="$dir/$1"
208 break
209 fi
210 fi
211 done
212
213 eval "kde_cv_path_$kde_cache=$kde_cv_path"
214
215 ])
216
217 eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
218
219 fi
220
221 if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
222 AC_MSG_RESULT(not found)
223 $4
224 else
225 AC_MSG_RESULT($kde_cv_path)
226 $2=$kde_cv_path
227
228 fi
229])
230
231AC_DEFUN([KDE_MOC_ERROR_MESSAGE],
232[
233 AC_MSG_ERROR([No Qt meta object compiler (moc) found!
234Please check whether you installed Qt correctly.
235You need to have a running moc binary.
236configure tried to run $ac_cv_path_moc and the test didn't
237succeed. If configure shouldn't have tried this one, set
238the environment variable MOC to the right one before running
239configure.
240])
241])
242
243AC_DEFUN([KDE_UIC_ERROR_MESSAGE],
244[
245 AC_MSG_WARN([No Qt ui compiler (uic) found!
246Please check whether you installed Qt correctly.
247You need to have a running uic binary.
248configure tried to run $ac_cv_path_uic and the test didn't
249succeed. If configure shouldn't have tried this one, set
250the environment variable UIC to the right one before running
251configure.
252])
253])
254
255
256AC_DEFUN([KDE_CHECK_UIC_FLAG],
257[
258 AC_MSG_CHECKING([whether uic supports -$1 ])
259 kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'`
260 AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache,
261 [
262 cat >conftest.ui <<EOT
263 <!DOCTYPE UI><UI version="3" stdsetdef="1"></UI>
264EOT
265 ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null"
266 if AC_TRY_EVAL(ac_uic_testrun); then
267 eval "kde_cv_prog_uic_$kde_cache=yes"
268 else
269 eval "kde_cv_prog_uic_$kde_cache=no"
270 fi
271 rm -f conftest*
272 ])
273
274 if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then
275 AC_MSG_RESULT([yes])
276 :
277 $3
278 else
279 AC_MSG_RESULT([no])
280 :
281 $4
282 fi
283])
284
285
286dnl ------------------------------------------------------------------------
287dnl Find the meta object compiler and the ui compiler in the PATH,
288dnl in $QTDIR/bin, and some more usual places
289dnl ------------------------------------------------------------------------
290dnl
291AC_DEFUN([AC_PATH_QT_MOC_UIC],
292[
293 AC_REQUIRE([KDE_CHECK_PERL])
294 qt_bindirs=""
295 for dir in $kde_qt_dirs; do
296 qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc"
297 done
298 qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
299 if test ! "$ac_qt_bindir" = "NO"; then
300 qt_bindirs="$ac_qt_bindir $qt_bindirs"
301 fi
302
303 KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE])
304 if test -z "$UIC_NOT_NEEDED"; then
305 KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""])
306 if test -z "$UIC_PATH" ; then
307 KDE_UIC_ERROR_MESSAGE
308 exit 1
309 else
310 UIC=$UIC_PATH
311
312 if test $kde_qtver = 3; then
313 KDE_CHECK_UIC_FLAG(L,[/nonexistent],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no)
314 KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no)
315
316 if test x$ac_uic_supports_libpath = xyes; then
317 UIC="$UIC -L \$(kde_widgetdir)"
318 fi
319 if test x$ac_uic_supports_nounload = xyes; then
320 UIC="$UIC -nounload"
321 fi
322 fi
323 fi
324 else
325 UIC="echo uic not available: "
326 fi
327
328 AC_SUBST(MOC)
329 AC_SUBST(UIC)
330
331 UIC_TR="i18n"
332 if test $kde_qtver = 3; then
333 UIC_TR="tr2i18n"
334 fi
335
336 AC_SUBST(UIC_TR)
337])
338
339AC_DEFUN([KDE_1_CHECK_PATHS],
340[
341 KDE_1_CHECK_PATH_HEADERS
342
343 KDE_TEST_RPATH=
344
345 if test -n "$USE_RPATH"; then
346
347 if test -n "$kde_libraries"; then
348 KDE_TEST_RPATH="-R $kde_libraries"
349 fi
350
351 if test -n "$qt_libraries"; then
352 KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries"
353 fi
354
355 if test -n "$x_libraries"; then
356 KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries"
357 fi
358
359 KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
360 fi
361
362AC_MSG_CHECKING([for KDE libraries installed])
363ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5'
364
365if AC_TRY_EVAL(ac_link) && test -s conftest; then
366 AC_MSG_RESULT(yes)
367else
368 AC_MSG_ERROR([your system fails at linking a small KDE application!
369Check, if your compiler is installed correctly and if you have used the
370same compiler to compile Qt and kdelibs as you did use now.
371For more details about this problem, look at the end of config.log.])
372fi
373
374if eval `KDEDIR= ./conftest 2>&5`; then
375 kde_result=done
376else
377 kde_result=problems
378fi
379
380KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
381kde_have_all_paths=yes
382
383KDE_SET_PATHS($kde_result)
384
385])
386
387AC_DEFUN([KDE_SET_PATHS],
388[
389 kde_cv_all_paths="kde_have_all_paths=\"yes\" \
390 kde_htmldir=\"$kde_htmldir\" \
391 kde_appsdir=\"$kde_appsdir\" \
392 kde_icondir=\"$kde_icondir\" \
393 kde_sounddir=\"$kde_sounddir\" \
394 kde_datadir=\"$kde_datadir\" \
395 kde_locale=\"$kde_locale\" \
396 kde_cgidir=\"$kde_cgidir\" \
397 kde_confdir=\"$kde_confdir\" \
398 kde_kcfgdir=\"$kde_kcfgdir\" \
399 kde_mimedir=\"$kde_mimedir\" \
400 kde_toolbardir=\"$kde_toolbardir\" \
401 kde_wallpaperdir=\"$kde_wallpaperdir\" \
402 kde_templatesdir=\"$kde_templatesdir\" \
403 kde_bindir=\"$kde_bindir\" \
404 kde_servicesdir=\"$kde_servicesdir\" \
405 kde_servicetypesdir=\"$kde_servicetypesdir\" \
406 kde_moduledir=\"$kde_moduledir\" \
407 kde_styledir=\"$kde_styledir\" \
408 kde_widgetdir=\"$kde_widgetdir\" \
409 xdg_appsdir=\"$xdg_appsdir\" \
410 xdg_menudir=\"$xdg_menudir\" \
411 xdg_directorydir=\"$xdg_directorydir\" \
412 kde_result=$1"
413])
414
415AC_DEFUN([KDE_SET_DEFAULT_PATHS],
416[
417if test "$1" = "default"; then
418
419 if test -z "$kde_htmldir"; then
420 kde_htmldir='\${datadir}/doc/HTML'
421 fi
422 if test -z "$kde_appsdir"; then
423 kde_appsdir='\${datadir}/applnk'
424 fi
425 if test -z "$kde_icondir"; then
426 kde_icondir='\${datadir}/icons'
427 fi
428 if test -z "$kde_sounddir"; then
429 kde_sounddir='\${datadir}/sounds'
430 fi
431 if test -z "$kde_datadir"; then
432 kde_datadir='\${datadir}/apps'
433 fi
434 if test -z "$kde_locale"; then
435 kde_locale='\${datadir}/locale'
436 fi
437 if test -z "$kde_cgidir"; then
438 kde_cgidir='\${exec_prefix}/cgi-bin'
439 fi
440 if test -z "$kde_confdir"; then
441 kde_confdir='\${datadir}/config'
442 fi
443 if test -z "$kde_kcfgdir"; then
444 kde_kcfgdir='\${datadir}/config.kcfg'
445 fi
446 if test -z "$kde_mimedir"; then
447 kde_mimedir='\${datadir}/mimelnk'
448 fi
449 if test -z "$kde_toolbardir"; then
450 kde_toolbardir='\${datadir}/toolbar'
451 fi
452 if test -z "$kde_wallpaperdir"; then
453 kde_wallpaperdir='\${datadir}/wallpapers'
454 fi
455 if test -z "$kde_templatesdir"; then
456 kde_templatesdir='\${datadir}/templates'
457 fi
458 if test -z "$kde_bindir"; then
459 kde_bindir='\${exec_prefix}/bin'
460 fi
461 if test -z "$kde_servicesdir"; then
462 kde_servicesdir='\${datadir}/services'
463 fi
464 if test -z "$kde_servicetypesdir"; then
465 kde_servicetypesdir='\${datadir}/servicetypes'
466 fi
467 if test -z "$kde_moduledir"; then
468 if test "$kde_qtver" = "2"; then
469 kde_moduledir='\${libdir}/kde2'
470 else
471 kde_moduledir='\${libdir}/kde3'
472 fi
473 fi
474 if test -z "$kde_styledir"; then
475 kde_styledir='\${libdir}/kde3/plugins/styles'
476 fi
477 if test -z "$kde_widgetdir"; then
478 kde_widgetdir='\${libdir}/kde3/plugins/designer'
479 fi
480 if test -z "$xdg_appsdir"; then
481 xdg_appsdir='\${datadir}/applications/kde'
482 fi
483 if test -z "$xdg_menudir"; then
484 xdg_menudir='\${sysconfdir}/xdg/menus'
485 fi
486 if test -z "$xdg_directorydir"; then
487 xdg_directorydir='\${datadir}/desktop-directories'
488 fi
489
490 KDE_SET_PATHS(defaults)
491
492else
493
494 if test $kde_qtver = 1; then
495 AC_MSG_RESULT([compiling])
496 KDE_1_CHECK_PATHS
497 else
498 AC_MSG_ERROR([path checking not yet supported for KDE 2])
499 fi
500
501fi
502])
503
504AC_DEFUN([KDE_CHECK_PATHS_FOR_COMPLETENESS],
505[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
506 test -z "$kde_icondir" || test -z "$kde_sounddir" ||
507 test -z "$kde_datadir" || test -z "$kde_locale" ||
508 test -z "$kde_cgidir" || test -z "$kde_confdir" ||
509 test -z "$kde_kcfgdir" ||
510 test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
511 test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" ||
512 test -z "$kde_bindir" || test -z "$kde_servicesdir" ||
513 test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" ||
514 test -z "$kde_styledir" || test -z "kde_widgetdir" ||
515 test -z "$xdg_appsdir" || test -z "$xdg_menudir" || test -z "$xdg_directorydir" ||
516 test "x$kde_have_all_paths" != "xyes"; then
517 kde_have_all_paths=no
518 fi
519])
520
521AC_DEFUN([KDE_MISSING_PROG_ERROR],
522[
523 AC_MSG_ERROR([The important program $1 was not found!
524Please check whether you installed KDE correctly.
525])
526])
527
528AC_DEFUN([KDE_MISSING_ARTS_ERROR],
529[
530 AC_MSG_ERROR([The important program $1 was not found!
531Please check whether you installed aRts correctly or use
532--without-arts to compile without aRts support (this will remove functionality).
533])
534])
535
536AC_DEFUN([KDE_SUBST_PROGRAMS],
537[
538 AC_ARG_WITH(arts,
539 AC_HELP_STRING([--without-arts],[build without aRts [default=yes]]),
540 [build_arts=$withval],
541 [build_arts=yes]
542 )
543 AM_CONDITIONAL(include_ARTS, test "$build_arts" != "no")
544
545 kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin"
546 test -n "$KDEDIR" && kde_default_bindirs="$KDEDIR/bin $kde_default_bindirs"
547 if test -n "$KDEDIRS"; then
548 kde_save_IFS=$IFS
549 IFS=:
550 for dir in $KDEDIRS; do
551 kde_default_bindirs="$dir/bin $kde_default_bindirs "
552 done
553 IFS=$kde_save_IFS
554 fi
555 kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs"
556 KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)])
557 KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)])
558 if test "$build_arts" != "no"; then
559 KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)])
560 KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)])
561 fi
562 KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs])
563 KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs])
564
565 kde32ornewer=1
566 if test -n "$kde_qtver" && test "$kde_qtver" -lt 3; then
567 kde32ornewer=
568 else
569 if test "$kde_qtver" = "3" && test "$kde_qtsubver" -le 1; then
570 kde32ornewer=
571 fi
572 fi
573
574 if test -n "$kde32ornewer"; then
575 KDE_FIND_PATH(kconfig_compiler, KCONFIG_COMPILER, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kconfig_compiler)])
576 KDE_FIND_PATH(dcopidlng, DCOPIDLNG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidlng)])
577 fi
578 KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [XMLLINT=""])
579
580 if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then
581 kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share"
582 test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs"
583 AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET)
584 if test "$KDE_XSL_STYLESHEET" = "NO"; then
585 KDE_XSL_STYLESHEET=""
586 else
587 KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl"
588 fi
589 fi
590
591 DCOP_DEPENDENCIES='$(DCOPIDL)'
592 if test -n "$kde32ornewer"; then
593 KCFG_DEPENDENCIES='$(KCONFIG_COMPILER)'
594 DCOP_DEPENDENCIES='$(DCOPIDL) $(DCOPIDLNG)'
595 AC_SUBST(KCONFIG_COMPILER)
596 AC_SUBST(KCFG_DEPENDENCIES)
597 AC_SUBST(DCOPIDLNG)
598 fi
599 AC_SUBST(DCOPIDL)
600 AC_SUBST(DCOPIDL2CPP)
601 AC_SUBST(DCOP_DEPENDENCIES)
602 AC_SUBST(MCOPIDL)
603 AC_SUBST(ARTSCCONFIG)
604 AC_SUBST(KDECONFIG)
605 AC_SUBST(MEINPROC)
606 AC_SUBST(KDE_XSL_STYLESHEET)
607 AC_SUBST(XMLLINT)
608
609 if test -x "$KDECONFIG"; then # it can be "compiled"
610 kde_libs_prefix=`$KDECONFIG --prefix`
611 if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
612 AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs.
613 This means it has been moved since you installed it.
614 This won't work. Please recompile kdelibs for the new prefix.
615 ])
616 fi
617 kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
618 else
619 kde_libs_prefix='$(prefix)'
620 kde_libs_htmldir='$(kde_htmldir)'
621 fi
622 AC_SUBST(kde_libs_prefix)
623 AC_SUBST(kde_libs_htmldir)
624])dnl
625
626AC_DEFUN([AC_CREATE_KFSSTND],
627[
628AC_REQUIRE([AC_CHECK_RPATH])
629
630AC_MSG_CHECKING([for KDE paths])
631kde_result=""
632kde_cached_paths=yes
633AC_CACHE_VAL(kde_cv_all_paths,
634[
635 KDE_SET_DEFAULT_PATHS($1)
636 kde_cached_paths=no
637])
638eval "$kde_cv_all_paths"
639KDE_CHECK_PATHS_FOR_COMPLETENESS
640if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then
641 # wrong values were cached, may be, we can set better ones
642 kde_result=
643 kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir=
644 kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_kcfgdir=
645 kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir=
646 kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir=
647 kde_have_all_paths=
648 kde_styledir=
649 kde_widgetdir=
650 xdg_appsdir = xdg_menudir= xdg_directorydir=
651 KDE_SET_DEFAULT_PATHS($1)
652 eval "$kde_cv_all_paths"
653 KDE_CHECK_PATHS_FOR_COMPLETENESS
654 kde_result="$kde_result (cache overridden)"
655fi
656if test "$kde_have_all_paths" = "no"; then
657 AC_MSG_ERROR([configure could not run a little KDE program to test the environment.
658Since it had compiled and linked before, it must be a strange problem on your system.
659Look at config.log for details. If you are not able to fix this, look at
660http://www.kde.org/faq/installation.html or any www.kde.org mirror.
661(If you're using an egcs version on Linux, you may update binutils!)
662])
663else
664 rm -f conftest*
665 AC_MSG_RESULT($kde_result)
666fi
667
668bindir=$kde_bindir
669
670KDE_SUBST_PROGRAMS
671
672])
673
674AC_DEFUN([AC_SUBST_KFSSTND],
675[
676AC_SUBST(kde_htmldir)
677AC_SUBST(kde_appsdir)
678AC_SUBST(kde_icondir)
679AC_SUBST(kde_sounddir)
680AC_SUBST(kde_datadir)
681AC_SUBST(kde_locale)
682AC_SUBST(kde_confdir)
683AC_SUBST(kde_kcfgdir)
684AC_SUBST(kde_mimedir)
685AC_SUBST(kde_wallpaperdir)
686AC_SUBST(kde_bindir)
687dnl X Desktop Group standards
688AC_SUBST(xdg_appsdir)
689AC_SUBST(xdg_menudir)
690AC_SUBST(xdg_directorydir)
691dnl for KDE 2
692AC_SUBST(kde_templatesdir)
693AC_SUBST(kde_servicesdir)
694AC_SUBST(kde_servicetypesdir)
695AC_SUBST(kde_moduledir)
696AC_SUBST(kdeinitdir, '$(kde_moduledir)')
697AC_SUBST(kde_styledir)
698AC_SUBST(kde_widgetdir)
699if test "$kde_qtver" = 1; then
700 kde_minidir="$kde_icondir/mini"
701else
702# for KDE 1 - this breaks KDE2 apps using minidir, but
703# that's the plan ;-/
704 kde_minidir="/dev/null"
705fi
706dnl AC_SUBST(kde_minidir)
707dnl AC_SUBST(kde_cgidir)
708dnl AC_SUBST(kde_toolbardir)
709])
710
711AC_DEFUN([KDE_MISC_TESTS],
712[
713 dnl Checks for libraries.
714 AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD
715 AC_SUBST(LIBUTIL)
716 AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD
717 AC_SUBST(LIBCOMPAT)
718 kde_have_crypt=
719 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
720 AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
721 AC_MSG_WARN([you have no crypt in either libcrypt or libc.
722You should install libcrypt from another source or configure with PAM
723support])
724 kde_have_crypt=no
725 ]))
726 AC_SUBST(LIBCRYPT)
727 if test $kde_have_crypt = yes; then
728 AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
729 fi
730 AC_CHECK_SOCKLEN_T
731 AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
732 if test $ac_cv_lib_dnet_dnet_ntoa = no; then
733 AC_CHECK_LIB(dnet_stub, dnet_ntoa,
734 [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
735 fi
736 AC_CHECK_FUNC(inet_ntoa)
737 if test $ac_cv_func_inet_ntoa = no; then
738 AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
739 fi
740 AC_CHECK_FUNC(connect)
741 if test $ac_cv_func_connect = no; then
742 AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
743 $X_EXTRA_LIBS)
744 fi
745
746 AC_CHECK_FUNC(remove)
747 if test $ac_cv_func_remove = no; then
748 AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
749 fi
750
751 # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
752 AC_CHECK_FUNC(shmat, ,
753 AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"))
754
755 # more headers that need to be explicitly included on darwin
756 AC_CHECK_HEADERS(sys/types.h stdint.h)
757
758 # darwin requires a poll emulation library
759 AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll")
760
761 # CoreAudio framework
762 AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [
763 AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API])
764 FRAMEWORK_COREAUDIO="-Xlinker -framework -Xlinker CoreAudio"
765 ])
766
767 AC_CHECK_RES_INIT
768 AC_SUBST(LIB_POLL)
769 AC_SUBST(FRAMEWORK_COREAUDIO)
770 LIBSOCKET="$X_EXTRA_LIBS"
771 AC_SUBST(LIBSOCKET)
772 AC_SUBST(X_EXTRA_LIBS)
773 AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
774 AC_SUBST(LIBUCB)
775
776 case $host in dnl this *is* LynxOS specific
777 *-*-lynxos* )
778 AC_MSG_CHECKING([LynxOS header file wrappers])
779 [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
780 AC_MSG_RESULT(disabled)
781 AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
782 ;;
783 esac
784
785 KDE_CHECK_TYPES
786 KDE_CHECK_LIBDL
787 KDE_CHECK_STRLCPY
788
789# darwin needs this to initialize the environment
790AC_CHECK_HEADERS(crt_externs.h)
791AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])])
792
793AH_VERBATIM(_DARWIN_ENVIRON,
794[
795#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
796# include <sys/time.h>
797# include <crt_externs.h>
798# define environ (*_NSGetEnviron())
799#endif
800])
801
802AH_VERBATIM(_AIX_STRINGS_H_BZERO,
803[
804/*
805 * AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
806 * that defines bzero.
807 */
808
809#if defined(_AIX)
810#include <strings.h>
811#endif
812])
813
814AC_CHECK_FUNCS([vsnprintf snprintf])
815
816AH_VERBATIM(_TRU64,[
817/*
818 * On HP-UX, the declaration of vsnprintf() is needed every time !
819 */
820
821#if !defined(HAVE_VSNPRINTF) || defined(hpux)
822#if __STDC__
823#include <stdarg.h>
824#include <stdlib.h>
825#else
826#include <varargs.h>
827#endif
828#ifdef __cplusplus
829extern "C"
830#endif
831int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
832#ifdef __cplusplus
833extern "C"
834#endif
835int snprintf(char *str, size_t n, char const *fmt, ...);
836#endif
837])
838
839])
840
841dnl ------------------------------------------------------------------------
842dnl Find the header files and libraries for X-Windows. Extended the
843dnl macro AC_PATH_X
844dnl ------------------------------------------------------------------------
845dnl
846AC_DEFUN([K_PATH_X],
847[
848AC_REQUIRE([KDE_MISC_TESTS])dnl
849AC_REQUIRE([KDE_CHECK_LIB64])
850
851AC_ARG_ENABLE(
852 embedded,
853 AC_HELP_STRING([--enable-embedded],[link to Qt-embedded, don't use X]),
854 kde_use_qt_emb=$enableval,
855 kde_use_qt_emb=no
856)
857
858AC_ARG_ENABLE(
859 qtopia,
860 AC_HELP_STRING([--enable-qtopia],[link to Qt-embedded, link to the Qtopia Environment]),
861 kde_use_qt_emb_palm=$enableval,
862 kde_use_qt_emb_palm=no
863)
864
865AC_ARG_ENABLE(
866 mac,
867 AC_HELP_STRING([--enable-mac],[link to Qt/Mac (don't use X)]),
868 kde_use_qt_mac=$enableval,
869 kde_use_qt_mac=no
870)
871
872if test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no"; then
873
874AC_MSG_CHECKING(for X)
875
876AC_CACHE_VAL(kde_cv_have_x,
877[# One or both of the vars are not set, and there is no cached value.
878if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
879 kde_x_includes=NO
880else
881 kde_x_includes=$x_includes
882fi
883if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
884 kde_x_libraries=NO
885else
886 kde_x_libraries=$x_libraries
887fi
888
889# below we use the standard autoconf calls
890ac_x_libraries=$kde_x_libraries
891ac_x_includes=$kde_x_includes
892
893KDE_PATH_X_DIRECT
894dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries.
895dnl Unfortunately, if compiling with the N32 ABI, this is not the correct
896dnl location. The correct location is /usr/lib32 or an undefined value
897dnl (the linker is smart enough to pick the correct default library).
898dnl Things work just fine if you use just AC_PATH_X_DIRECT.
899dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to
900dnl /usr/openwin/include, which doesn't work. /usr/include does work, so
901dnl x_includes should be left alone.
902case "$host" in
903mips-sgi-irix6*)
904 ;;
905*-*-solaris*)
906 ;;
907*)
908 _AC_PATH_X_XMKMF
909 if test -z "$ac_x_includes"; then
910 ac_x_includes="."
911 fi
912 if test -z "$ac_x_libraries"; then
913 ac_x_libraries="/usr/lib${kdelibsuff}"
914 fi
915esac
916#from now on we use our own again
917
918# when the user already gave --x-includes, we ignore
919# what the standard autoconf macros told us.
920if test "$kde_x_includes" = NO; then
921 kde_x_includes=$ac_x_includes
922fi
923
924# for --x-libraries too
925if test "$kde_x_libraries" = NO; then
926 kde_x_libraries=$ac_x_libraries
927fi
928
929if test "$kde_x_includes" = NO; then
930 AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
931fi
932
933if test "$kde_x_libraries" = NO; then
934 AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
935fi
936
937# Record where we found X for the cache.
938kde_cv_have_x="have_x=yes \
939 kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries"
940])dnl
941
942eval "$kde_cv_have_x"
943
944if test "$have_x" != yes; then
945 AC_MSG_RESULT($have_x)
946 no_x=yes
947else
948 AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes])
949fi
950
951if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
952 X_INCLUDES=""
953 x_includes="."; dnl better than nothing :-
954 else
955 x_includes=$kde_x_includes
956 X_INCLUDES="-I$x_includes"
957fi
958
959if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then
960 X_LDFLAGS=""
961 x_libraries="/usr/lib"; dnl better than nothing :-
962 else
963 x_libraries=$kde_x_libraries
964 X_LDFLAGS="-L$x_libraries"
965fi
966all_includes="$X_INCLUDES"
967all_libraries="$X_LDFLAGS"
968
969# Check for libraries that X11R6 Xt/Xaw programs need.
970ac_save_LDFLAGS="$LDFLAGS"
971LDFLAGS="$LDFLAGS $X_LDFLAGS"
972# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
973# check for ICE first), but we must link in the order -lSM -lICE or
974# we get undefined symbols. So assume we have SM if we have ICE.
975# These have to be linked with before -lX11, unlike the other
976# libraries we check for below, so use a different variable.
977# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
978AC_CHECK_LIB(ICE, IceConnectionNumber,
979 [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS)
980LDFLAGS="$ac_save_LDFLAGS"
981
982LIB_X11='-lX11 $(LIBSOCKET)'
983
984AC_MSG_CHECKING(for libXext)
985AC_CACHE_VAL(kde_cv_have_libXext,
986[
987kde_ldflags_safe="$LDFLAGS"
988kde_libs_safe="$LIBS"
989
990LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS"
991LIBS="-lXext -lX11 $LIBSOCKET"
992
993AC_TRY_LINK([
994#include <stdio.h>
995#ifdef STDC_HEADERS
996# include <stdlib.h>
997#endif
998],
999[
1000printf("hello Xext\n");
1001],
1002kde_cv_have_libXext=yes,
1003kde_cv_have_libXext=no
1004)
1005
1006LDFLAGS=$kde_ldflags_safe
1007LIBS=$kde_libs_safe
1008])
1009
1010AC_MSG_RESULT($kde_cv_have_libXext)
1011
1012if test "$kde_cv_have_libXext" = "no"; then
1013 AC_MSG_ERROR([We need a working libXext to proceed. Since configure
1014can't find it itself, we stop here assuming that make wouldn't find
1015them either.])
1016fi
1017
1018LIB_XEXT="-lXext"
1019QTE_NORTTI=""
1020
1021elif test "$kde_use_qt_emb" = "yes"; then
1022 dnl We're using QT Embedded
1023 CPPFLAGS=-DQWS
1024 CXXFLAGS="$CXXFLAGS -fno-rtti"
1025 QTE_NORTTI="-fno-rtti -DQWS"
1026 X_PRE_LIBS=""
1027 LIB_X11=""
1028 LIB_XEXT=""
1029 LIB_XRENDER=""
1030 LIBSM=""
1031 X_INCLUDES=""
1032 X_LDFLAGS=""
1033 x_includes=""
1034 x_libraries=""
1035elif test "$kde_use_qt_mac" = "yes"; then
1036 dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to
1037 dnl be included to get the information) --Sam
1038 CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp"
1039 CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp"
1040 X_PRE_LIBS=""
1041 LIB_X11=""
1042 LIB_XEXT=""
1043 LIB_XRENDER=""
1044 LIBSM=""
1045 X_INCLUDES=""
1046 X_LDFLAGS=""
1047 x_includes=""
1048 x_libraries=""
1049fi
1050AC_SUBST(X_PRE_LIBS)
1051AC_SUBST(LIB_X11)
1052AC_SUBST(LIB_XRENDER)
1053AC_SUBST(LIBSM)
1054AC_SUBST(X_INCLUDES)
1055AC_SUBST(X_LDFLAGS)
1056AC_SUBST(x_includes)
1057AC_SUBST(x_libraries)
1058AC_SUBST(QTE_NORTTI)
1059AC_SUBST(LIB_XEXT)
1060
1061])
1062
1063AC_DEFUN([KDE_PRINT_QT_PROGRAM],
1064[
1065AC_REQUIRE([KDE_USE_QT])
1066cat > conftest.$ac_ext <<EOF
1067#include "confdefs.h"
1068#include <qglobal.h>
1069#include <qapplication.h>
1070EOF
1071if test "$kde_qtver" = "2"; then
1072cat >> conftest.$ac_ext <<EOF
1073#include <qevent.h>
1074#include <qstring.h>
1075#include <qstyle.h>
1076EOF
1077
1078if test $kde_qtsubver -gt 0; then
1079cat >> conftest.$ac_ext <<EOF
1080#if QT_VERSION < 210
1081#error 1
1082#endif
1083EOF
1084fi
1085fi
1086
1087if test "$kde_qtver" = "3"; then
1088cat >> conftest.$ac_ext <<EOF
1089#include <qcursor.h>
1090#include <qstylefactory.h>
1091#include <private/qucomextra_p.h>
1092EOF
1093fi
1094
1095echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
1096cat >> conftest.$ac_ext <<EOF
1097#error 1
1098#endif
1099
1100int main() {
1101EOF
1102if test "$kde_qtver" = "2"; then
1103cat >> conftest.$ac_ext <<EOF
1104 QStringList *t = new QStringList();
1105 Q_UNUSED(t);
1106EOF
1107if test $kde_qtsubver -gt 0; then
1108cat >> conftest.$ac_ext <<EOF
1109 QString s;
1110 s.setLatin1("Elvis is alive", 14);
1111EOF
1112fi
1113fi
1114if test "$kde_qtver" = "3"; then
1115cat >> conftest.$ac_ext <<EOF
1116 (void)QStyleFactory::create(QString::null);
1117 QCursor c(Qt::WhatsThisCursor);
1118EOF
1119fi
1120cat >> conftest.$ac_ext <<EOF
1121 return 0;
1122}
1123EOF
1124])
1125
1126AC_DEFUN([KDE_USE_QT],
1127[
1128if test -z "$1"; then
1129 # Current default Qt version: 3.2
1130 kde_qtver=3
1131 kde_qtsubver=2
1132else
1133 kde_qtsubver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'`
1134 # following is the check if subversion isnt found in passed argument
1135 if test "$kde_qtsubver" = "$1"; then
1136 kde_qtsubver=1
1137 fi
1138 kde_qtver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'`
1139 if test "$kde_qtver" = "1"; then
1140 kde_qtsubver=42
1141 fi
1142fi
1143
1144if test -z "$2"; then
1145 if test "$kde_qtver" = "2"; then
1146 if test $kde_qtsubver -gt 0; then
1147 kde_qt_minversion=">= Qt 2.2.2"
1148 else
1149 kde_qt_minversion=">= Qt 2.0.2"
1150 fi
1151 fi
1152 if test "$kde_qtver" = "3"; then
1153 if test $kde_qtsubver -gt 0; then
1154 if test $kde_qtsubver -gt 1; then
1155 kde_qt_minversion=">= Qt 3.2"
1156 else
1157 kde_qt_minversion=">= Qt 3.1 (20021021)"
1158 fi
1159 else
1160 kde_qt_minversion=">= Qt 3.0"
1161 fi
1162 fi
1163 if test "$kde_qtver" = "1"; then
1164 kde_qt_minversion=">= 1.42 and < 2.0"
1165 fi
1166else
1167 kde_qt_minversion="$2"
1168fi
1169
1170if test -z "$3"; then
1171 if test $kde_qtver = 3; then
1172 if test $kde_qtsubver -gt 0; then
1173 kde_qt_verstring="QT_VERSION >= 0x03@VER@00"
1174 qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'`
1175 kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"`
1176 else
1177 kde_qt_verstring="QT_VERSION >= 300"
1178 fi
1179 fi
1180 if test $kde_qtver = 2; then
1181 if test $kde_qtsubver -gt 0; then
1182 kde_qt_verstring="QT_VERSION >= 222"
1183 else
1184 kde_qt_verstring="QT_VERSION >= 200"
1185 fi
1186 fi
1187 if test $kde_qtver = 1; then
1188 kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
1189 fi
1190else
1191 kde_qt_verstring="$3"
1192fi
1193
1194if test $kde_qtver = 3; then
1195 kde_qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt /usr/share/qt3"
1196fi
1197if test $kde_qtver = 2; then
1198 kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
1199fi
1200if test $kde_qtver = 1; then
1201 kde_qt_dirs="$QTDIR /usr/lib/qt"
1202fi
1203])
1204
1205AC_DEFUN([KDE_CHECK_QT_DIRECT],
1206[
1207AC_REQUIRE([KDE_USE_QT])
1208AC_MSG_CHECKING([if Qt compiles without flags])
1209AC_CACHE_VAL(kde_cv_qt_direct,
1210[
1211AC_LANG_SAVE
1212AC_LANG_CPLUSPLUS
1213ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
1214ac_LIBRARY_PATH="$LIBRARY_PATH"
1215ac_cxxflags_safe="$CXXFLAGS"
1216ac_ldflags_safe="$LDFLAGS"
1217ac_libs_safe="$LIBS"
1218
1219CXXFLAGS="$CXXFLAGS -I$qt_includes"
1220LDFLAGS="$LDFLAGS $X_LDFLAGS"
1221if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
1222LIBS="$LIBQT -lXext -lX11 $LIBSOCKET"
1223else
1224LIBS="$LIBQT $LIBSOCKET"
1225fi
1226LD_LIBRARY_PATH=
1227export LD_LIBRARY_PATH
1228LIBRARY_PATH=
1229export LIBRARY_PATH
1230
1231KDE_PRINT_QT_PROGRAM
1232
1233if AC_TRY_EVAL(ac_link) && test -s conftest; then
1234 kde_cv_qt_direct="yes"
1235else
1236 kde_cv_qt_direct="no"
1237 echo "configure: failed program was:" >&AC_FD_CC
1238 cat conftest.$ac_ext >&AC_FD_CC
1239fi
1240
1241rm -f conftest*
1242CXXFLAGS="$ac_cxxflags_safe"
1243LDFLAGS="$ac_ldflags_safe"
1244LIBS="$ac_libs_safe"
1245
1246LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
1247export LD_LIBRARY_PATH
1248LIBRARY_PATH="$ac_LIBRARY_PATH"
1249export LIBRARY_PATH
1250AC_LANG_RESTORE
1251])
1252
1253if test "$kde_cv_qt_direct" = "yes"; then
1254 AC_MSG_RESULT(yes)
1255 $1
1256else
1257 AC_MSG_RESULT(no)
1258 $2
1259fi
1260])
1261
1262dnl ------------------------------------------------------------------------
1263dnl Try to find the Qt headers and libraries.
1264dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
1265dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
1266dnl ------------------------------------------------------------------------
1267dnl
1268AC_DEFUN([AC_PATH_QT_1_3],
1269[
1270AC_REQUIRE([K_PATH_X])
1271AC_REQUIRE([KDE_USE_QT])
1272AC_REQUIRE([KDE_CHECK_LIB64])
1273
1274dnl ------------------------------------------------------------------------
1275dnl Add configure flag to enable linking to MT version of Qt library.
1276dnl ------------------------------------------------------------------------
1277
1278AC_ARG_ENABLE(
1279 mt,
1280 AC_HELP_STRING([--disable-mt],[link to non-threaded Qt (deprecated)]),
1281 kde_use_qt_mt=$enableval,
1282 [
1283 if test $kde_qtver = 3; then
1284 kde_use_qt_mt=yes
1285 else
1286 kde_use_qt_mt=no
1287 fi
1288 ]
1289)
1290
1291USING_QT_MT=""
1292
1293dnl ------------------------------------------------------------------------
1294dnl If we not get --disable-qt-mt then adjust some vars for the host.
1295dnl ------------------------------------------------------------------------
1296
1297KDE_MT_LDFLAGS=
1298KDE_MT_LIBS=
1299if test "x$kde_use_qt_mt" = "xyes"; then
1300 KDE_CHECK_THREADING
1301 if test "x$kde_use_threading" = "xyes"; then
1302 CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS"
1303 KDE_MT_LDFLAGS="$USE_THREADS"
1304 KDE_MT_LIBS="$LIBPTHREAD"
1305 else
1306 kde_use_qt_mt=no
1307 fi
1308fi
1309AC_SUBST(KDE_MT_LDFLAGS)
1310AC_SUBST(KDE_MT_LIBS)
1311
1312kde_qt_was_given=yes
1313
1314dnl ------------------------------------------------------------------------
1315dnl If we haven't been told how to link to Qt, we work it out for ourselves.
1316dnl ------------------------------------------------------------------------
1317if test -z "$LIBQT_GLOB"; then
1318 if test "x$kde_use_qt_emb" = "xyes"; then
1319 LIBQT_GLOB="libqte.*"
1320 else
1321 LIBQT_GLOB="libqt.*"
1322 fi
1323fi
1324
1325if test -z "$LIBQT"; then
1326dnl ------------------------------------------------------------
1327dnl If we got --enable-embedded then adjust the Qt library name.
1328dnl ------------------------------------------------------------
1329 if test "x$kde_use_qt_emb" = "xyes"; then
1330 qtlib="qte"
1331 else
1332 qtlib="qt"
1333 fi
1334
1335 kde_int_qt="-l$qtlib"
1336else
1337 kde_int_qt="$LIBQT"
1338 kde_lib_qt_set=yes
1339fi
1340
1341if test -z "$LIBQPE"; then
1342dnl ------------------------------------------------------------
1343dnl If we got --enable-palmtop then add -lqpe to the link line
1344dnl ------------------------------------------------------------
1345 if test "x$kde_use_qt_emb" = "xyes"; then
1346 if test "x$kde_use_qt_emb_palm" = "xyes"; then
1347 LIB_QPE="-lqpe"
1348 else
1349 LIB_QPE=""
1350 fi
1351 else
1352 LIB_QPE=""
1353 fi
1354fi
1355
1356dnl ------------------------------------------------------------------------
1357dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
1358dnl ------------------------------------------------------------------------
1359
1360if test "x$kde_use_qt_mt" = "xyes"; then
1361 if test -z "$LIBQT"; then
1362 LIBQT="-l$qtlib-mt"
1363 kde_int_qt="-l$qtlib-mt"
1364 else
1365 LIBQT="$qtlib-mt"
1366 kde_int_qt="$qtlib-mt"
1367 fi
1368 LIBQT_GLOB="lib$qtlib-mt.*"
1369 USING_QT_MT="using -mt"
1370else
1371 LIBQT="-l$qtlib"
1372fi
1373
1374if test $kde_qtver != 1; then
1375
1376 AC_REQUIRE([AC_FIND_PNG])
1377 AC_REQUIRE([AC_FIND_JPEG])
1378 LIBQT="$LIBQT $LIBPNG $LIBJPEG"
1379fi
1380
1381if test $kde_qtver = 3; then
1382 AC_REQUIRE([KDE_CHECK_LIBDL])
1383 LIBQT="$LIBQT $LIBDL"
1384fi
1385
1386AC_MSG_CHECKING([for Qt])
1387
1388if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
1389LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
1390fi
1391ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
1392qt_libraries=""
1393qt_includes=""
1394AC_ARG_WITH(qt-dir,
1395 AC_HELP_STRING([--with-qt-dir=DIR],[where the root of Qt is installed ]),
1396 [ ac_qt_includes="$withval"/include
1397 ac_qt_libraries="$withval"/lib${kdelibsuff}
1398 ac_qt_bindir="$withval"/bin
1399 ])
1400
1401AC_ARG_WITH(qt-includes,
1402 AC_HELP_STRING([--with-qt-includes=DIR],[where the Qt includes are. ]),
1403 [
1404 ac_qt_includes="$withval"
1405 ])
1406
1407kde_qt_libs_given=no
1408
1409AC_ARG_WITH(qt-libraries,
1410 AC_HELP_STRING([--with-qt-libraries=DIR],[where the Qt library is installed.]),
1411 [ ac_qt_libraries="$withval"
1412 kde_qt_libs_given=yes
1413 ])
1414
1415AC_CACHE_VAL(ac_cv_have_qt,
1416[#try to guess Qt locations
1417
1418qt_incdirs=""
1419for dir in $kde_qt_dirs; do
1420 qt_incdirs="$qt_incdirs $dir/include $dir"
1421done
1422qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 /usr/include/qt3 $x_includes"
1423if test ! "$ac_qt_includes" = "NO"; then
1424 qt_incdirs="$ac_qt_includes $qt_incdirs"
1425fi
1426
1427if test "$kde_qtver" != "1"; then
1428 kde_qt_header=qstyle.h
1429else
1430 kde_qt_header=qglobal.h
1431fi
1432
1433AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
1434ac_qt_includes="$qt_incdir"
1435
1436qt_libdirs=""
1437for dir in $kde_qt_dirs; do
1438 qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir"
1439done
1440qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
1441if test ! "$ac_qt_libraries" = "NO"; then
1442 qt_libdir=$ac_qt_libraries
1443else
1444 qt_libdirs="$ac_qt_libraries $qt_libdirs"
1445 # if the Qt was given, the chance is too big that libqt.* doesn't exist
1446 qt_libdir=NONE
1447 for dir in $qt_libdirs; do
1448 try="ls -1 $dir/${LIBQT_GLOB}"
1449 if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
1450 done
1451fi
1452for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
1453 if test -e "$a"; then
1454 LIBQT="$LIBQT ${kde_int_qt}_incremental"
1455 break
1456 fi
1457done
1458
1459ac_qt_libraries="$qt_libdir"
1460
1461AC_LANG_SAVE
1462AC_LANG_CPLUSPLUS
1463
1464ac_cxxflags_safe="$CXXFLAGS"
1465ac_ldflags_safe="$LDFLAGS"
1466ac_libs_safe="$LIBS"
1467
1468CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
1469LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
1470LIBS="$LIBS $LIBQT $KDE_MT_LIBS"
1471
1472KDE_PRINT_QT_PROGRAM
1473
1474if AC_TRY_EVAL(ac_link) && test -s conftest; then
1475 rm -f conftest*
1476else
1477 echo "configure: failed program was:" >&AC_FD_CC
1478 cat conftest.$ac_ext >&AC_FD_CC
1479 ac_qt_libraries="NO"
1480fi
1481rm -f conftest*
1482CXXFLAGS="$ac_cxxflags_safe"
1483LDFLAGS="$ac_ldflags_safe"
1484LIBS="$ac_libs_safe"
1485
1486AC_LANG_RESTORE
1487if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
1488 ac_cv_have_qt="have_qt=no"
1489 ac_qt_notfound=""
1490 missing_qt_mt=""
1491 if test "$ac_qt_includes" = NO; then
1492 if test "$ac_qt_libraries" = NO; then
1493 ac_qt_notfound="(headers and libraries)";
1494 else
1495 ac_qt_notfound="(headers)";
1496 fi
1497 else
1498 if test "x$kde_use_qt_mt" = "xyes"; then
1499 missing_qt_mt="
1500Make sure that you have compiled Qt with thread support!"
1501 ac_qt_notfound="(library $qtlib-mt)";
1502 else
1503 ac_qt_notfound="(library $qtlib)";
1504 fi
1505 fi
1506
1507 AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
1508For more details about this problem, look at the end of config.log.$missing_qt_mt])
1509else
1510 have_qt="yes"
1511fi
1512])
1513
1514eval "$ac_cv_have_qt"
1515
1516if test "$have_qt" != yes; then
1517 AC_MSG_RESULT([$have_qt]);
1518else
1519 ac_cv_have_qt="have_qt=yes \
1520 ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
1521 AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT])
1522
1523 qt_libraries="$ac_qt_libraries"
1524 qt_includes="$ac_qt_includes"
1525fi
1526
1527if test ! "$kde_qt_libs_given" = "yes" && test ! "$kde_qtver" = 3; then
1528 KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
1529fi
1530
1531AC_SUBST(qt_libraries)
1532AC_SUBST(qt_includes)
1533
1534if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
1535 QT_INCLUDES=""
1536else
1537 QT_INCLUDES="-I$qt_includes"
1538 all_includes="$QT_INCLUDES $all_includes"
1539fi
1540
1541if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
1542 QT_LDFLAGS=""
1543else
1544 QT_LDFLAGS="-L$qt_libraries"
1545 all_libraries="$all_libraries $QT_LDFLAGS"
1546fi
1547test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS"
1548
1549AC_SUBST(QT_INCLUDES)
1550AC_SUBST(QT_LDFLAGS)
1551AC_PATH_QT_MOC_UIC
1552
1553KDE_CHECK_QT_JPEG
1554
1555if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
1556LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM)'
1557else
1558LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG)'
1559fi
1560test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS"
1561for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
1562 if test -e "$a"; then
1563 LIB_QT="$LIB_QT ${kde_int_qt}_incremental"
1564 break
1565 fi
1566done
1567
1568AC_SUBST(LIB_QT)
1569AC_SUBST(LIB_QPE)
1570
1571AC_SUBST(kde_qtver)
1572])
1573
1574AC_DEFUN([AC_PATH_QT],
1575[
1576AC_PATH_QT_1_3
1577])
1578
1579AC_DEFUN([KDE_CHECK_UIC_PLUGINS],
1580[
1581AC_REQUIRE([AC_PATH_QT_MOC_UIC])
1582
1583if test x$ac_uic_supports_libpath = xyes; then
1584
1585AC_MSG_CHECKING([if UIC has KDE plugins available])
1586AC_CACHE_VAL(kde_cv_uic_plugins,
1587[
1588cat > actest.ui << EOF
1589<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
1590<class>NewConnectionDialog</class>
1591<widget class="QDialog">
1592 <widget class="KLineEdit">
1593 <property name="name">
1594 <cstring>testInput</cstring>
1595 </property>
1596 </widget>
1597</widget>
1598</UI>
1599EOF
1600
1601
1602
1603kde_cv_uic_plugins=no
1604kde_line="$UIC_PATH -L $kde_widgetdir"
1605if test x$ac_uic_supports_nounload = xyes; then
1606 kde_line="$kde_line -nounload"
1607fi
1608kde_line="$kde_line -impl actest.h actest.ui > actest.cpp"
1609if AC_TRY_EVAL(kde_line); then
1610 # if you're trying to debug this check and think it's incorrect,
1611 # better check your installation. The check _is_ correct - your
1612 # installation is not.
1613 if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then
1614 kde_cv_uic_plugins=yes
1615 fi
1616fi
1617rm -f actest.ui actest.cpp
1618])
1619
1620AC_MSG_RESULT([$kde_cv_uic_plugins])
1621if test "$kde_cv_uic_plugins" != yes; then
1622 AC_MSG_ERROR([you need to install kdelibs first.])
1623fi
1624fi
1625])
1626
1627AC_DEFUN([KDE_CHECK_FINAL],
1628[
1629 AC_ARG_ENABLE(final,
1630 AC_HELP_STRING([--enable-final],
1631 [build size optimized apps (experimental - needs lots of memory)]),
1632 kde_use_final=$enableval, kde_use_final=no)
1633
1634 if test "x$kde_use_final" = "xyes"; then
1635 KDE_USE_FINAL_TRUE=""
1636 KDE_USE_FINAL_FALSE="#"
1637 else
1638 KDE_USE_FINAL_TRUE="#"
1639 KDE_USE_FINAL_FALSE=""
1640 fi
1641 AC_SUBST(KDE_USE_FINAL_TRUE)
1642 AC_SUBST(KDE_USE_FINAL_FALSE)
1643])
1644
1645AC_DEFUN([KDE_CHECK_CLOSURE],
1646[
1647 AC_ARG_ENABLE(closure,
1648 AC_HELP_STRING([--enable-closure],[delay template instantiation]),
1649 kde_use_closure=$enableval, kde_use_closure=no)
1650
1651 KDE_NO_UNDEFINED=""
1652 if test "x$kde_use_closure" = "xyes"; then
1653 KDE_USE_CLOSURE_TRUE=""
1654 KDE_USE_CLOSURE_FALSE="#"
1655# CXXFLAGS="$CXXFLAGS $REPO"
1656 else
1657 KDE_USE_CLOSURE_TRUE="#"
1658 KDE_USE_CLOSURE_FALSE=""
1659 KDE_NO_UNDEFINED=""
1660 case $host in
1661 *-*-linux-gnu)
1662 KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined],
1663 [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined],
1664 [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"],
1665 [KDE_NO_UNDEFINED=""])],
1666 [KDE_NO_UNDEFINED=""])
1667 ;;
1668 esac
1669 fi
1670 AC_SUBST(KDE_USE_CLOSURE_TRUE)
1671 AC_SUBST(KDE_USE_CLOSURE_FALSE)
1672 AC_SUBST(KDE_NO_UNDEFINED)
1673])
1674
1675AC_DEFUN([KDE_CHECK_NMCHECK],
1676[
1677 AC_ARG_ENABLE(nmcheck,AC_HELP_STRING([--enable-nmcheck],[enable automatic namespace cleanness check]),
1678 kde_use_nmcheck=$enableval, kde_use_nmcheck=no)
1679
1680 if test "$kde_use_nmcheck" = "yes"; then
1681 KDE_USE_NMCHECK_TRUE=""
1682 KDE_USE_NMCHECK_FALSE="#"
1683 else
1684 KDE_USE_NMCHECK_TRUE="#"
1685 KDE_USE_NMCHECK_FALSE=""
1686 fi
1687 AC_SUBST(KDE_USE_NMCHECK_TRUE)
1688 AC_SUBST(KDE_USE_NMCHECK_FALSE)
1689])
1690
1691AC_DEFUN([KDE_EXPAND_MAKEVAR], [
1692savex=$exec_prefix
1693test "x$exec_prefix" = xNONE && exec_prefix=$prefix
1694tmp=$$2
1695while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done
1696exec_prefix=$savex
1697])
1698
1699dnl ------------------------------------------------------------------------
1700dnl Now, the same with KDE
1701dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
1702dnl and $(kde_includes) will be the kdehdrlocation (if needed)
1703dnl ------------------------------------------------------------------------
1704dnl
1705AC_DEFUN([AC_BASE_PATH_KDE],
1706[
1707AC_REQUIRE([KDE_CHECK_STL])
1708AC_REQUIRE([AC_PATH_QT])dnl
1709AC_REQUIRE([KDE_CHECK_LIB64])
1710
1711AC_CHECK_RPATH
1712AC_MSG_CHECKING([for KDE])
1713
1714if test "${prefix}" != NONE; then
1715 kde_includes=${includedir}
1716 KDE_EXPAND_MAKEVAR(ac_kde_includes, includedir)
1717
1718 kde_libraries=${libdir}
1719 KDE_EXPAND_MAKEVAR(ac_kde_libraries, libdir)
1720
1721else
1722 ac_kde_includes=
1723 ac_kde_libraries=
1724 kde_libraries=""
1725 kde_includes=""
1726fi
1727
1728AC_CACHE_VAL(ac_cv_have_kde,
1729[#try to guess kde locations
1730
1731if test "$kde_qtver" = 1; then
1732 kde_check_header="ksock.h"
1733 kde_check_lib="libkdecore.la"
1734else
1735 kde_check_header="ksharedptr.h"
1736 kde_check_lib="libkio.la"
1737fi
1738
1739if test -z "$1"; then
1740
1741kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes"
1742test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
1743kde_incdirs="$ac_kde_includes $kde_incdirs"
1744AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
1745ac_kde_includes="$kde_incdir"
1746
1747if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
1748 AC_MSG_ERROR([
1749in the prefix, you've chosen, are no KDE headers installed. This will fail.
1750So, check this please and use another prefix!])
1751fi
1752
1753kde_libdirs="/usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}"
1754test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs"
1755kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs"
1756AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
1757ac_kde_libraries="$kde_libdir"
1758
1759kde_widgetdir=NO
1760dnl this might be somewhere else
1761AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir)
1762
1763if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
1764AC_MSG_ERROR([
1765in the prefix, you've chosen, are no KDE libraries installed. This will fail.
1766So, check this please and use another prefix!])
1767fi
1768
1769if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then
1770AC_MSG_ERROR([
1771I can't find the designer plugins. These are required and should have been installed
1772by kdelibs])
1773fi
1774
1775if test -n "$kde_widgetdir"; then
1776 kde_widgetdir="$kde_widgetdir/kde3/plugins/designer"
1777fi
1778
1779
1780if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then
1781 ac_cv_have_kde="have_kde=no"
1782else
1783 ac_cv_have_kde="have_kde=yes \
1784 ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1785fi
1786
1787else dnl test -z $1
1788
1789 ac_cv_have_kde="have_kde=no"
1790
1791fi
1792])dnl
1793
1794eval "$ac_cv_have_kde"
1795
1796if test "$have_kde" != "yes"; then
1797 if test "${prefix}" = NONE; then
1798 ac_kde_prefix="$ac_default_prefix"
1799 else
1800 ac_kde_prefix="$prefix"
1801 fi
1802 if test "$exec_prefix" = NONE; then
1803 ac_kde_exec_prefix="$ac_kde_prefix"
1804 AC_MSG_RESULT([will be installed in $ac_kde_prefix])
1805 else
1806 ac_kde_exec_prefix="$exec_prefix"
1807 AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
1808 fi
1809
1810 kde_libraries="${libdir}"
1811 kde_includes="${includedir}"
1812
1813else
1814 ac_cv_have_kde="have_kde=yes \
1815 ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1816 AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
1817
1818 kde_libraries="$ac_kde_libraries"
1819 kde_includes="$ac_kde_includes"
1820fi
1821AC_SUBST(kde_libraries)
1822AC_SUBST(kde_includes)
1823
1824if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then
1825 KDE_INCLUDES=""
1826else
1827 KDE_INCLUDES="-I$kde_includes"
1828 all_includes="$KDE_INCLUDES $all_includes"
1829fi
1830
1831KDE_DEFAULT_CXXFLAGS="-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION"
1832
1833KDE_LDFLAGS="-L$kde_libraries"
1834if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then
1835 all_libraries="$all_libraries $KDE_LDFLAGS"
1836fi
1837
1838AC_SUBST(KDE_LDFLAGS)
1839AC_SUBST(KDE_INCLUDES)
1840
1841AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1842
1843all_libraries="$all_libraries $USER_LDFLAGS"
1844all_includes="$all_includes $USER_INCLUDES"
1845AC_SUBST(all_includes)
1846AC_SUBST(all_libraries)
1847
1848if test -z "$1"; then
1849KDE_CHECK_UIC_PLUGINS
1850fi
1851
1852ac_kde_libraries="$kde_libdir"
1853
1854AC_SUBST(AUTODIRS)
1855
1856
1857])
1858
1859AC_DEFUN([KDE_CHECK_EXTRA_LIBS],
1860[
1861AC_MSG_CHECKING(for extra includes)
1862AC_ARG_WITH(extra-includes,AC_HELP_STRING([--with-extra-includes=DIR],[adds non standard include paths]),
1863 kde_use_extra_includes="$withval",
1864 kde_use_extra_includes=NONE
1865)
1866kde_extra_includes=
1867if test -n "$kde_use_extra_includes" && \
1868 test "$kde_use_extra_includes" != "NONE"; then
1869
1870 ac_save_ifs=$IFS
1871 IFS=':'
1872 for dir in $kde_use_extra_includes; do
1873 kde_extra_includes="$kde_extra_includes $dir"
1874 USER_INCLUDES="$USER_INCLUDES -I$dir"
1875 done
1876 IFS=$ac_save_ifs
1877 kde_use_extra_includes="added"
1878else
1879 kde_use_extra_includes="no"
1880fi
1881AC_SUBST(USER_INCLUDES)
1882
1883AC_MSG_RESULT($kde_use_extra_includes)
1884
1885kde_extra_libs=
1886AC_MSG_CHECKING(for extra libs)
1887AC_ARG_WITH(extra-libs,AC_HELP_STRING([--with-extra-libs=DIR],[adds non standard library paths]),
1888 kde_use_extra_libs=$withval,
1889 kde_use_extra_libs=NONE
1890)
1891if test -n "$kde_use_extra_libs" && \
1892 test "$kde_use_extra_libs" != "NONE"; then
1893
1894 ac_save_ifs=$IFS
1895 IFS=':'
1896 for dir in $kde_use_extra_libs; do
1897 kde_extra_libs="$kde_extra_libs $dir"
1898 KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
1899 USER_LDFLAGS="$USER_LDFLAGS -L$dir"
1900 done
1901 IFS=$ac_save_ifs
1902 kde_use_extra_libs="added"
1903else
1904 kde_use_extra_libs="no"
1905fi
1906
1907AC_SUBST(USER_LDFLAGS)
1908
1909AC_MSG_RESULT($kde_use_extra_libs)
1910
1911])
1912
1913AC_DEFUN([KDE_1_CHECK_PATH_HEADERS],
1914[
1915 AC_MSG_CHECKING([for KDE headers installed])
1916 AC_LANG_SAVE
1917 AC_LANG_CPLUSPLUS
1918cat > conftest.$ac_ext <<EOF
1919#ifdef STDC_HEADERS
1920# include <stdlib.h>
1921#endif
1922#include <stdio.h>
1923#include "confdefs.h"
1924#include <kapp.h>
1925
1926int main() {
1927 printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
1928 printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
1929 printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
1930 printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
1931 printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
1932 printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
1933 printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
1934 printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
1935 printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
1936 printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
1937 printf("kde_wallpaperdir=\\"%s\\"\n",
1938 KApplication::kde_wallpaperdir().data());
1939 printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
1940 printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
1941 printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
1942 printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
1943 printf("kde_moduledir=\\"/tmp/dummy\\"\n");
1944 printf("kde_styledir=\\"/tmp/dummy\\"\n");
1945 printf("kde_widgetdir=\\"/tmp/dummy\\"\n");
1946 printf("xdg_appsdir=\\"/tmp/dummy\\"\n");
1947 printf("xdg_menudir=\\"/tmp/dummy\\"\n");
1948 printf("xdg_directorydir=\\"/tmp/dummy\\"\n");
1949 printf("kde_kcfgdir=\\"/tmp/dummy\\"\n");
1950 return 0;
1951 }
1952EOF
1953
1954 ac_save_CPPFLAGS=$CPPFLAGS
1955 CPPFLAGS="$all_includes $CPPFLAGS"
1956 if AC_TRY_EVAL(ac_compile); then
1957 AC_MSG_RESULT(yes)
1958 else
1959 AC_MSG_ERROR([your system is not able to compile a small KDE application!
1960Check, if you installed the KDE header files correctly.
1961For more details about this problem, look at the end of config.log.])
1962 fi
1963 CPPFLAGS=$ac_save_CPPFLAGS
1964
1965 AC_LANG_RESTORE
1966])
1967
1968AC_DEFUN([KDE_CHECK_KDEQTADDON],
1969[
1970AC_MSG_CHECKING(for kde-qt-addon)
1971AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
1972[
1973 kde_ldflags_safe="$LDFLAGS"
1974 kde_libs_safe="$LIBS"
1975 kde_cxxflags_safe="$CXXFLAGS"
1976
1977 LIBS="-lkde-qt-addon $LIBQT $LIBS"
1978 CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes"
1979 LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
1980
1981 AC_TRY_LINK([
1982 #include <qdom.h>
1983 ],
1984 [
1985 QDomDocument doc;
1986 ],
1987 kde_cv_have_kdeqtaddon=yes,
1988 kde_cv_have_kdeqtaddon=no
1989 )
1990
1991 LDFLAGS=$kde_ldflags_safe
1992 LIBS=$kde_libs_safe
1993 CXXFLAGS=$kde_cxxflags_safe
1994])
1995
1996AC_MSG_RESULT($kde_cv_have_kdeqtaddon)
1997
1998if test "$kde_cv_have_kdeqtaddon" = "no"; then
1999 AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first.
2000It is a separate package (and CVS module) named kde-qt-addon.])
2001fi
2002])
2003
2004AC_DEFUN([KDE_CREATE_LIBS_ALIASES],
2005[
2006 AC_REQUIRE([KDE_MISC_TESTS])
2007 AC_REQUIRE([KDE_CHECK_LIBDL])
2008 AC_REQUIRE([K_PATH_X])
2009
2010if test $kde_qtver = 3; then
2011 AC_SUBST(LIB_KDECORE, "-lkdecore")
2012 AC_SUBST(LIB_KDEUI, "-lkdeui")
2013 AC_SUBST(LIB_KIO, "-lkio")
2014 AC_SUBST(LIB_SMB, "-lsmb")
2015 AC_SUBST(LIB_KAB, "-lkab")
2016 AC_SUBST(LIB_KABC, "-lkabc")
2017 AC_SUBST(LIB_KHTML, "-lkhtml")
2018 AC_SUBST(LIB_KSPELL, "-lkspell")
2019 AC_SUBST(LIB_KPARTS, "-lkparts")
2020 AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
2021 AC_SUBST(LIB_KUTILS, "-lkutils")
2022 AC_SUBST(LIB_KDEPIM, "-lkdepim")
2023# these are for backward compatibility
2024 AC_SUBST(LIB_KSYCOCA, "-lkio")
2025 AC_SUBST(LIB_KFILE, "-lkio")
2026elif test $kde_qtver = 2; then
2027 AC_SUBST(LIB_KDECORE, "-lkdecore")
2028 AC_SUBST(LIB_KDEUI, "-lkdeui")
2029 AC_SUBST(LIB_KIO, "-lkio")
2030 AC_SUBST(LIB_KSYCOCA, "-lksycoca")
2031 AC_SUBST(LIB_SMB, "-lsmb")
2032 AC_SUBST(LIB_KFILE, "-lkfile")
2033 AC_SUBST(LIB_KAB, "-lkab")
2034 AC_SUBST(LIB_KHTML, "-lkhtml")
2035 AC_SUBST(LIB_KSPELL, "-lkspell")
2036 AC_SUBST(LIB_KPARTS, "-lkparts")
2037 AC_SUBST(LIB_KDEPRINT, "-lkdeprint")
2038else
2039 AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)")
2040 AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)")
2041 AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)")
2042 AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)")
2043 AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)")
2044fi
2045])
2046
2047AC_DEFUN([AC_PATH_KDE],
2048[
2049 AC_BASE_PATH_KDE
2050 AC_ARG_ENABLE(path-check,AC_HELP_STRING([--disable-path-check],[don't try to find out, where to install]),
2051 [
2052 if test "$enableval" = "no";
2053 then ac_use_path_checking="default"
2054 else ac_use_path_checking=""
2055 fi
2056 ],
2057 [
2058 if test "$kde_qtver" = 1;
2059 then ac_use_path_checking=""
2060 else ac_use_path_checking="default"
2061 fi
2062 ]
2063 )
2064
2065 AC_CREATE_KFSSTND($ac_use_path_checking)
2066
2067 AC_SUBST_KFSSTND
2068 KDE_CREATE_LIBS_ALIASES
2069])
2070
2071dnl KDE_CHECK_FUNC_EXT(<func>, [headers], [sample-use], [C prototype], [autoheader define], [call if found])
2072AC_DEFUN([KDE_CHECK_FUNC_EXT],
2073[
2074AC_MSG_CHECKING(for $1)
2075AC_CACHE_VAL(kde_cv_func_$1,
2076[
2077AC_LANG_SAVE
2078AC_LANG_CPLUSPLUS
2079save_CXXFLAGS="$CXXFLAGS"
2080kde_safe_LIBS="$LIBS"
2081LIBS="$LIBS $X_EXTRA_LIBS"
2082if test "$GXX" = "yes"; then
2083CXXFLAGS="$CXXFLAGS -pedantic-errors"
2084fi
2085AC_TRY_COMPILE([
2086$2
2087],
2088[
2089$3
2090],
2091kde_cv_func_$1=yes,
2092kde_cv_func_$1=no)
2093CXXFLAGS="$save_CXXFLAGS"
2094LIBS="$kde_safe_LIBS"
2095AC_LANG_RESTORE
2096])
2097
2098AC_MSG_RESULT($kde_cv_func_$1)
2099
2100AC_MSG_CHECKING([if $1 needs custom prototype])
2101AC_CACHE_VAL(kde_cv_proto_$1,
2102[
2103if test "x$kde_cv_func_$1" = xyes; then
2104 kde_cv_proto_$1=no
2105else
2106 case "$1" in
2107 setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat)
2108 kde_cv_proto_$1="yes - in libkdefakes"
2109 ;;
2110 *)
2111 kde_cv_proto_$1=unknown
2112 ;;
2113 esac
2114fi
2115
2116if test "x$kde_cv_proto_$1" = xunknown; then
2117
2118AC_LANG_SAVE
2119AC_LANG_CPLUSPLUS
2120 kde_safe_libs=$LIBS
2121 LIBS="$LIBS $X_EXTRA_LIBS"
2122 AC_TRY_LINK([
2123$2
2124
2125extern "C" $4;
2126],
2127[
2128$3
2129],
2130[ kde_cv_func_$1=yes
2131 kde_cv_proto_$1=yes ],
2132 [kde_cv_proto_$1="$1 unavailable"]
2133)
2134LIBS=$kde_safe_libs
2135AC_LANG_RESTORE
2136fi
2137])
2138AC_MSG_RESULT($kde_cv_proto_$1)
2139
2140if test "x$kde_cv_func_$1" = xyes; then
2141 AC_DEFINE(HAVE_$5, 1, [Define if you have $1])
2142 $6
2143fi
2144if test "x$kde_cv_proto_$1" = xno; then
2145 AC_DEFINE(HAVE_$5_PROTO, 1,
2146 [Define if you have the $1 prototype])
2147fi
2148
2149AH_VERBATIM([_HAVE_$5_PROTO],
2150[
2151#if !defined(HAVE_$5_PROTO)
2152#ifdef __cplusplus
2153extern "C" {
2154#endif
2155$4;
2156#ifdef __cplusplus
2157}
2158#endif
2159#endif
2160])
2161])
2162
2163AC_DEFUN([AC_CHECK_SETENV],
2164[
2165 KDE_CHECK_FUNC_EXT(setenv, [
2166#include <stdlib.h>
2167],
2168 [setenv("VAR", "VALUE", 1);],
2169 [int setenv (const char *, const char *, int)],
2170 [SETENV])
2171])
2172
2173AC_DEFUN([AC_CHECK_UNSETENV],
2174[
2175 KDE_CHECK_FUNC_EXT(unsetenv, [
2176#include <stdlib.h>
2177],
2178 [unsetenv("VAR");],
2179 [void unsetenv (const char *)],
2180 [UNSETENV])
2181])
2182
2183AC_DEFUN([AC_CHECK_GETDOMAINNAME],
2184[
2185 KDE_CHECK_FUNC_EXT(getdomainname, [
2186#include <stdlib.h>
2187#include <unistd.h>
2188#include <netdb.h>
2189],
2190 [
2191char buffer[200];
2192getdomainname(buffer, 200);
2193],
2194 [#include <sys/types.h>
2195 int getdomainname (char *, size_t)],
2196 [GETDOMAINNAME])
2197])
2198
2199AC_DEFUN([AC_CHECK_GETHOSTNAME],
2200[
2201 KDE_CHECK_FUNC_EXT(gethostname, [
2202#include <stdlib.h>
2203#include <unistd.h>
2204],
2205 [
2206char buffer[200];
2207gethostname(buffer, 200);
2208],
2209 [int gethostname (char *, unsigned int)],
2210 [GETHOSTNAME])
2211])
2212
2213AC_DEFUN([AC_CHECK_USLEEP],
2214[
2215 KDE_CHECK_FUNC_EXT(usleep, [
2216#include <unistd.h>
2217],
2218 [
2219usleep(200);
2220],
2221 [int usleep (unsigned int)],
2222 [USLEEP])
2223])
2224
2225
2226AC_DEFUN([AC_CHECK_RANDOM],
2227[
2228 KDE_CHECK_FUNC_EXT(random, [
2229#include <stdlib.h>
2230],
2231 [
2232random();
2233],
2234 [long int random(void)],
2235 [RANDOM])
2236
2237 KDE_CHECK_FUNC_EXT(srandom, [
2238#include <stdlib.h>
2239],
2240 [
2241srandom(27);
2242],
2243 [void srandom(unsigned int)],
2244 [SRANDOM])
2245
2246])
2247
2248AC_DEFUN([AC_CHECK_INITGROUPS],
2249[
2250 KDE_CHECK_FUNC_EXT(initgroups, [
2251#include <sys/types.h>
2252#include <unistd.h>
2253#include <grp.h>
2254],
2255 [
2256char buffer[200];
2257initgroups(buffer, 27);
2258],
2259 [int initgroups(const char *, gid_t)],
2260 [INITGROUPS])
2261])
2262
2263AC_DEFUN([AC_CHECK_MKSTEMPS],
2264[
2265 KDE_CHECK_FUNC_EXT(mkstemps, [
2266#include <stdlib.h>
2267#include <unistd.h>
2268],
2269 [
2270mkstemps("/tmp/aaaXXXXXX", 6);
2271],
2272 [int mkstemps(char *, int)],
2273 [MKSTEMPS])
2274])
2275
2276AC_DEFUN([AC_CHECK_MKDTEMP],
2277[
2278 KDE_CHECK_FUNC_EXT(mkdtemp, [
2279#include <stdlib.h>
2280#include <unistd.h>
2281],
2282 [
2283mkdtemp("/tmp/aaaXXXXXX");
2284],
2285 [char *mkdtemp(char *)],
2286 [MKDTEMP])
2287])
2288
2289
2290AC_DEFUN([AC_CHECK_RES_INIT],
2291[
2292 AC_MSG_CHECKING([if res_init needs -lresolv])
2293 kde_libs_safe="$LIBS"
2294 LIBS="$LIBS $X_EXTRA_LIBS -lresolv"
2295 AC_TRY_LINK(
2296 [
2297#include <sys/types.h>
2298#include <netinet/in.h>
2299#include <arpa/nameser.h>
2300#include <resolv.h>
2301 ],
2302 [
2303 res_init();
2304 ],
2305 [
2306 LIBRESOLV="-lresolv"
2307 AC_MSG_RESULT(yes)
2308 AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function])
2309 ],
2310 [ AC_MSG_RESULT(no) ]
2311 )
2312 LIBS=$kde_libs_safe
2313 AC_SUBST(LIBRESOLV)
2314
2315 AC_MSG_CHECKING([if res_init is available])
2316 AC_TRY_COMPILE(
2317 [
2318#include <sys/types.h>
2319#include <netinet/in.h>
2320#include <arpa/nameser.h>
2321#include <resolv.h>
2322 ],
2323 [
2324 res_init();
2325 ],
2326 [
2327 AC_MSG_RESULT(yes)
2328 AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function])
2329 ],
2330 [ AC_MSG_RESULT(no) ]
2331 )
2332])
2333
2334AC_DEFUN([AC_CHECK_STRLCPY],
2335[
2336 KDE_CHECK_FUNC_EXT(strlcpy, [
2337#include <string.h>
2338],
2339[ char buf[20];
2340 strlcpy(buf, "KDE function test", sizeof(buf));
2341],
2342 [unsigned long strlcpy(char*, const char*, unsigned long)],
2343 [STRLCPY])
2344])
2345
2346AC_DEFUN([AC_CHECK_STRLCAT],
2347[
2348 KDE_CHECK_FUNC_EXT(strlcat, [
2349#include <string.h>
2350],
2351[ char buf[20];
2352 buf[0]='\0';
2353 strlcat(buf, "KDE function test", sizeof(buf));
2354],
2355 [unsigned long strlcat(char*, const char*, unsigned long)],
2356 [STRLCAT])
2357])
2358
2359AC_DEFUN([AC_FIND_GIF],
2360 [AC_MSG_CHECKING([for giflib])
2361AC_CACHE_VAL(ac_cv_lib_gif,
2362[ac_save_LIBS="$LIBS"
2363if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
2364LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
2365else
2366LIBS="$all_libraries -lgif"
2367fi
2368AC_TRY_LINK(dnl
2369[
2370#ifdef __cplusplus
2371extern "C" {
2372#endif
2373int GifLastError(void);
2374#ifdef __cplusplus
2375}
2376#endif
2377/* We use char because int might match the return type of a gcc2
2378 builtin and then its argument prototype would still apply. */
2379],
2380 [return GifLastError();],
2381 eval "ac_cv_lib_gif=yes",
2382 eval "ac_cv_lib_gif=no")
2383LIBS="$ac_save_LIBS"
2384])dnl
2385if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
2386 AC_MSG_RESULT(yes)
2387 AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
2388else
2389 AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
2390fi
2391])
2392
2393AC_DEFUN([KDE_FIND_JPEG_HELPER],
2394[
2395AC_MSG_CHECKING([for libjpeg$2])
2396AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
2397[
2398ac_save_LIBS="$LIBS"
2399LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"
2400ac_save_CFLAGS="$CFLAGS"
2401CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2402AC_TRY_LINK(
2403[/* Override any gcc2 internal prototype to avoid an error. */
2404struct jpeg_decompress_struct;
2405typedef struct jpeg_decompress_struct * j_decompress_ptr;
2406typedef int size_t;
2407#ifdef __cplusplus
2408extern "C" {
2409#endif
2410 void jpeg_CreateDecompress(j_decompress_ptr cinfo,
2411 int version, size_t structsize);
2412#ifdef __cplusplus
2413}
2414#endif
2415/* We use char because int might match the return type of a gcc2
2416 builtin and then its argument prototype would still apply. */
2417],
2418 [jpeg_CreateDecompress(0L, 0, 0);],
2419 eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
2420 eval "ac_cv_lib_jpeg_$1=no")
2421LIBS="$ac_save_LIBS"
2422CFLAGS="$ac_save_CFLAGS"
2423])
2424
2425if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
2426 LIBJPEG="$ac_cv_lib_jpeg_$1"
2427 AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
2428else
2429 AC_MSG_RESULT(no)
2430 $3
2431fi
2432
2433])
2434
2435AC_DEFUN([AC_FIND_JPEG],
2436[
2437dnl first look for libraries
2438KDE_FIND_JPEG_HELPER(6b, 6b,
2439 KDE_FIND_JPEG_HELPER(normal, [],
2440 [
2441 LIBJPEG=
2442 ]
2443 )
2444)
2445
2446dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
2447dnl requires system dependent includes loaded before it)
2448jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes"
2449AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)
2450test "x$jpeg_incdir" = xNO && jpeg_incdir=
2451
2452dnl if headers _and_ libraries are missing, this is no error, and we
2453dnl continue with a warning (the user will get no jpeg support in khtml)
2454dnl if only one is missing, it means a configuration error, but we still
2455dnl only warn
2456if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then
2457 AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
2458else
2459 if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then
2460 AC_MSG_WARN([
2461There is an installation error in jpeg support. You seem to have only one
2462of either the headers _or_ the libraries installed. You may need to either
2463provide correct --with-extra-... options, or the development package of
2464libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/
2465Disabling JPEG support.
2466])
2467 else
2468 AC_MSG_WARN([libjpeg not found. disable JPEG support.])
2469 fi
2470 jpeg_incdir=
2471 LIBJPEG=
2472fi
2473
2474AC_SUBST(LIBJPEG)
2475AH_VERBATIM(_AC_CHECK_JPEG,
2476[/*
2477 * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
2478 * headers and I'm too lazy to write a configure test as long as only
2479 * unixware is related
2480 */
2481#ifdef _UNIXWARE
2482#define HAVE_BOOLEAN
2483#endif
2484])
2485])
2486
2487AC_DEFUN([KDE_CHECK_QT_JPEG],
2488[
2489if test -n "$LIBJPEG"; then
2490AC_MSG_CHECKING([if Qt needs $LIBJPEG])
2491AC_CACHE_VAL(kde_cv_qt_jpeg,
2492[
2493AC_LANG_SAVE
2494AC_LANG_CPLUSPLUS
2495ac_save_LIBS="$LIBS"
2496LIBS="$all_libraries $USER_LDFLAGS $LIBQT"
2497LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`
2498ac_save_CXXFLAGS="$CXXFLAGS"
2499CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
2500AC_TRY_LINK(
2501[#include <qapplication.h>],
2502 [
2503 int argc;
2504 char** argv;
2505 QApplication app(argc, argv);],
2506 eval "kde_cv_qt_jpeg=no",
2507 eval "kde_cv_qt_jpeg=yes")
2508LIBS="$ac_save_LIBS"
2509CXXFLAGS="$ac_save_CXXFLAGS"
2510AC_LANG_RESTORE
2511fi
2512])
2513
2514if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then
2515 AC_MSG_RESULT(yes)
2516 LIBJPEG_QT='$(LIBJPEG)'
2517else
2518 AC_MSG_RESULT(no)
2519 LIBJPEG_QT=
2520fi
2521
2522])
2523
2524AC_DEFUN([AC_FIND_ZLIB],
2525[
2526AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2527AC_MSG_CHECKING([for libz])
2528AC_CACHE_VAL(ac_cv_lib_z,
2529[
2530kde_save_LIBS="$LIBS"
2531LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
2532kde_save_CFLAGS="$CFLAGS"
2533CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2534AC_TRY_LINK(dnl
2535[
2536#include<zlib.h>
2537],
2538[
2539 char buf[42];
2540 gzFile f = (gzFile) 0;
2541 /* this would segfault.. but we only link, don't run */
2542 (void) gzgets(f, buf, sizeof(buf));
2543
2544 return (zlibVersion() == ZLIB_VERSION);
2545],
2546 eval "ac_cv_lib_z='-lz'",
2547 eval "ac_cv_lib_z=no")
2548LIBS="$kde_save_LIBS"
2549CFLAGS="$kde_save_CFLAGS"
2550])dnl
2551if test ! "$ac_cv_lib_z" = no; then
2552 AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
2553 LIBZ="$ac_cv_lib_z"
2554 AC_MSG_RESULT($ac_cv_lib_z)
2555else
2556 AC_MSG_ERROR(not found.
2557 Possibly configure picks up an outdated version
2558 installed by XFree86. Remove it from your system.
2559
2560 Check your installation and look into config.log)
2561 LIBZ=""
2562fi
2563AC_SUBST(LIBZ)
2564])
2565
2566AC_DEFUN([KDE_TRY_TIFFLIB],
2567[
2568AC_MSG_CHECKING([for libtiff $1])
2569
2570AC_CACHE_VAL(kde_cv_libtiff_$1,
2571[
2572AC_LANG_SAVE
2573AC_LANG_CPLUSPLUS
2574kde_save_LIBS="$LIBS"
2575if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
2576LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
2577else
2578LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm"
2579fi
2580kde_save_CXXFLAGS="$CXXFLAGS"
2581CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
2582
2583AC_TRY_LINK(dnl
2584[
2585#include<tiffio.h>
2586],
2587 [return (TIFFOpen( "", "r") == 0); ],
2588[
2589 kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
2590], [
2591 kde_cv_libtiff_$1=no
2592])
2593
2594LIBS="$kde_save_LIBS"
2595CXXFLAGS="$kde_save_CXXFLAGS"
2596AC_LANG_RESTORE
2597])
2598
2599if test "$kde_cv_libtiff_$1" = "no"; then
2600 AC_MSG_RESULT(no)
2601 LIBTIFF=""
2602 $3
2603else
2604 LIBTIFF="$kde_cv_libtiff_$1"
2605 AC_MSG_RESULT(yes)
2606 AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
2607 $2
2608fi
2609
2610])
2611
2612AC_DEFUN([AC_FIND_TIFF],
2613[
2614AC_REQUIRE([K_PATH_X])
2615AC_REQUIRE([AC_FIND_ZLIB])
2616AC_REQUIRE([AC_FIND_JPEG])
2617AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2618
2619KDE_TRY_TIFFLIB(tiff, [],
2620 KDE_TRY_TIFFLIB(tiff34))
2621
2622AC_SUBST(LIBTIFF)
2623])
2624
2625
2626AC_DEFUN([AC_FIND_PNG],
2627[
2628AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2629AC_REQUIRE([AC_FIND_ZLIB])
2630AC_MSG_CHECKING([for libpng])
2631AC_CACHE_VAL(ac_cv_lib_png,
2632[
2633kde_save_LIBS="$LIBS"
2634if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
2635LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET"
2636else
2637LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm"
2638fi
2639kde_save_CFLAGS="$CFLAGS"
2640CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2641
2642AC_TRY_LINK(dnl
2643 [
2644 #include<png.h>
2645 ],
2646 [
2647 png_structp png_ptr = png_create_read_struct( /* image ptr */
2648 PNG_LIBPNG_VER_STRING, 0, 0, 0 );
2649 return( png_ptr != 0 );
2650 ],
2651 eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
2652 eval "ac_cv_lib_png=no"
2653)
2654LIBS="$kde_save_LIBS"
2655CFLAGS="$kde_save_CFLAGS"
2656])dnl
2657if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
2658 AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
2659 LIBPNG="$ac_cv_lib_png"
2660 AC_SUBST(LIBPNG)
2661 AC_MSG_RESULT($ac_cv_lib_png)
2662else
2663 AC_MSG_RESULT(no)
2664 LIBPNG=""
2665 AC_SUBST(LIBPNG)
2666fi
2667])
2668
2669
2670AC_DEFUN([AC_FIND_JASPER],
2671[
2672AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2673AC_REQUIRE([AC_FIND_JPEG])
2674AC_MSG_CHECKING([for jasper])
2675AC_CACHE_VAL(ac_cv_jasper,
2676[
2677kde_save_LIBS="$LIBS"
2678LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm"
2679kde_save_CFLAGS="$CFLAGS"
2680CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2681
2682AC_TRY_LINK(dnl
2683 [
2684 #include<jasper/jasper.h>
2685 ],
2686 [
2687 return( jas_init() );
2688 ],
2689 eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'",
2690 eval "ac_cv_jasper=no"
2691)
2692LIBS="$kde_save_LIBS"
2693CFLAGS="$kde_save_CFLAGS"
2694])dnl
2695if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then
2696 AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper])
2697 LIB_JASPER="$ac_cv_jasper"
2698 AC_MSG_RESULT($ac_cv_jasper)
2699else
2700 AC_MSG_RESULT(no)
2701 LIB_JASPER=""
2702fi
2703AC_SUBST(LIB_JASPER)
2704])
2705
2706AC_DEFUN([AC_CHECK_BOOL],
2707[
2708 AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool])
2709])
2710
2711AC_DEFUN([AC_CHECK_GNU_EXTENSIONS],
2712[
2713AC_MSG_CHECKING(if you need GNU extensions)
2714AC_CACHE_VAL(ac_cv_gnu_extensions,
2715[
2716cat > conftest.c << EOF
2717#include <features.h>
2718
2719#ifdef __GNU_LIBRARY__
2720yes
2721#endif
2722EOF
2723
2724if (eval "$ac_cpp conftest.c") 2>&5 |
2725 egrep "yes" >/dev/null 2>&1; then
2726 rm -rf conftest*
2727 ac_cv_gnu_extensions=yes
2728else
2729 ac_cv_gnu_extensions=no
2730fi
2731])
2732
2733AC_MSG_RESULT($ac_cv_gnu_extensions)
2734if test "$ac_cv_gnu_extensions" = "yes"; then
2735 AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
2736fi
2737])
2738
2739AC_DEFUN([KDE_CHECK_COMPILER_FLAG],
2740[
2741AC_MSG_CHECKING([whether $CXX supports -$1])
2742kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
2743AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
2744[
2745 AC_LANG_SAVE
2746 AC_LANG_CPLUSPLUS
2747 save_CXXFLAGS="$CXXFLAGS"
2748 CXXFLAGS="$CXXFLAGS -$1"
2749 AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], [])
2750 CXXFLAGS="$save_CXXFLAGS"
2751 AC_LANG_RESTORE
2752])
2753if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
2754 AC_MSG_RESULT(yes)
2755 :
2756 $2
2757else
2758 AC_MSG_RESULT(no)
2759 :
2760 $3
2761fi
2762])
2763
2764dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
2765dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
2766dnl it's all white-space separated
2767AC_DEFUN([AC_REMOVE_FORBIDDEN],
2768[ __val=$$1
2769 __forbid=" $2 "
2770 if test -n "$__val"; then
2771 __new=""
2772 ac_save_IFS=$IFS
2773 IFS=" "
2774 for i in $__val; do
2775 case "$__forbid" in
2776 *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
2777 *) # Careful to not add spaces, where there were none, because otherwise
2778 # libtool gets confused, if we change e.g. CXX
2779 if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
2780 esac
2781 done
2782 IFS=$ac_save_IFS
2783 $1=$__new
2784 fi
2785])
2786
2787dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
2788AC_DEFUN([AC_VALIDIFY_CXXFLAGS],
2789[dnl
2790if test "x$kde_use_qt_emb" != "xyes"; then
2791 AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
2792 AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
2793else
2794 AC_REMOVE_FORBIDDEN(CXX, [-rpath])
2795 AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath])
2796fi
2797])
2798
2799AC_DEFUN([AC_CHECK_COMPILERS],
2800[
2801 AC_ARG_ENABLE(debug,
2802 AC_HELP_STRING([--enable-debug=ARG],[enables debug symbols (yes|no|full) [default=no]]),
2803 [
2804 case $enableval in
2805 yes)
2806 kde_use_debug_code="yes"
2807 kde_use_debug_define=no
2808 ;;
2809 full)
2810 kde_use_debug_code="full"
2811 kde_use_debug_define=no
2812 ;;
2813 *)
2814 kde_use_debug_code="no"
2815 kde_use_debug_define=yes
2816 ;;
2817 esac
2818 ],
2819 [kde_use_debug_code="no"
2820 kde_use_debug_define=no
2821 ])
2822
2823 dnl Just for configure --help
2824 AC_ARG_ENABLE(dummyoption,
2825 AC_HELP_STRING([--disable-debug],
2826 [disables debug output and debug symbols [default=no]]),
2827 [],[])
2828
2829 AC_ARG_ENABLE(strict,
2830 AC_HELP_STRING([--enable-strict],
2831 [compiles with strict compiler options (may not work!)]),
2832 [
2833 if test $enableval = "no"; then
2834 kde_use_strict_options="no"
2835 else
2836 kde_use_strict_options="yes"
2837 fi
2838 ], [kde_use_strict_options="no"])
2839
2840 AC_ARG_ENABLE(warnings,AC_HELP_STRING([--disable-warnings],[disables compilation with -Wall and similiar]),
2841 [
2842 if test $enableval = "no"; then
2843 kde_use_warnings="no"
2844 else
2845 kde_use_warnings="yes"
2846 fi
2847 ], [kde_use_warnings="yes"])
2848
2849 dnl enable warnings for debug build
2850 if test "$kde_use_debug_code" != "no"; then
2851 kde_use_warnings=yes
2852 fi
2853
2854 AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[creates profiling infos [default=no]]),
2855 [kde_use_profiling=$enableval],
2856 [kde_use_profiling="no"]
2857 )
2858
2859 dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
2860 CFLAGS=" $CFLAGS"
2861
2862 AC_PROG_CC
2863
2864 AC_PROG_CPP
2865
2866 if test "$GCC" = "yes"; then
2867 if test "$kde_use_debug_code" != "no"; then
2868 if test $kde_use_debug_code = "full"; then
2869 CFLAGS="-g3 -fno-inline $CFLAGS"
2870 else
2871 CFLAGS="-g -O2 $CFLAGS"
2872 fi
2873 else
2874 CFLAGS="-O2 $CFLAGS"
2875 fi
2876 fi
2877
2878 if test "$kde_use_debug_define" = "yes"; then
2879 CFLAGS="-DNDEBUG $CFLAGS"
2880 fi
2881
2882
2883 case "$host" in
2884 *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";;
2885 *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";;
2886 esac
2887
2888 if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
2889 LDFLAGS=""
2890 fi
2891
2892 CXXFLAGS=" $CXXFLAGS"
2893
2894 AC_PROG_CXX
2895
2896 if test "$GXX" = "yes" || test "$CXX" = "KCC"; then
2897 if test "$kde_use_debug_code" != "no"; then
2898 if test "$CXX" = "KCC"; then
2899 CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wwrite-strings $CXXFLAGS"
2900 else
2901 if test "$kde_use_debug_code" = "full"; then
2902 CXXFLAGS="-g3 -fno-inline $CXXFLAGS"
2903 else
2904 CXXFLAGS="-g -O2 $CXXFLAGS"
2905 fi
2906 fi
2907 KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"])
2908
2909 dnl convenience compiler flags
2910 KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""])
2911 AC_SUBST(WOVERLOADED_VIRTUAL)
2912 else
2913 if test "$CXX" = "KCC"; then
2914 CXXFLAGS="+K3 $CXXFLAGS"
2915 else
2916 CXXFLAGS="-O2 $CXXFLAGS"
2917 fi
2918 fi
2919 fi
2920
2921 if test "$kde_use_debug_define" = "yes"; then
2922 CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS"
2923 fi
2924
2925 if test "$kde_use_profiling" = "yes"; then
2926 KDE_CHECK_COMPILER_FLAG(pg,
2927 [
2928 CFLAGS="-pg $CFLAGS"
2929 CXXFLAGS="-pg $CXXFLAGS"
2930 ])
2931 fi
2932
2933 if test "$kde_use_warnings" = "yes"; then
2934 if test "$GCC" = "yes"; then
2935 case $host in
2936 *-*-linux-gnu)
2937 CFLAGS="-ansi -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS"
2938 CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts $CXXFLAGS"
2939 KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"; CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"])
2940 ;;
2941 esac
2942 CXXFLAGS="-Wall -W -Wpointer-arith -Wwrite-strings $CXXFLAGS"
2943 KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"])
2944 KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"])
2945 KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"])
2946 fi
2947 fi
2948
2949 if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then
2950 CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS"
2951 fi
2952
2953 if test "$GXX" = "yes"; then
2954 KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"])
2955 KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"])
2956 KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"])
2957 KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= )
2958 fi
2959 if test "$CXX" = "KCC"; then
2960 dnl unfortunately we currently cannot disable exception support in KCC
2961 dnl because doing so is binary incompatible and Qt by default links with exceptions :-(
2962 dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"])
2963 dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS= )
2964
2965 AC_ARG_ENABLE(pch,
2966 AC_HELP_STRING([--enable-pch],
2967 [enables precompiled header support (currently only KCC) [default=no]]),
2968 [
2969 kde_use_pch=$enableval
2970 ],[kde_use_pch=no])
2971
2972 if test "$kde_use_pch" = "yes"; then
2973 dnl TODO: support --pch-dir!
2974 KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"])
2975 dnl the below works (but the dir must exist), but it's
2976 dnl useless for a whole package.
2977 dnl The are precompiled headers for each source file, so when compiling
2978 dnl from scratch, it doesn't make a difference, and they take up
2979 dnl around ~5Mb _per_ sourcefile.
2980 dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp,
2981 dnl [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"])
2982 fi
2983 dnl this flag controls inlining. by default KCC inlines in optimisation mode
2984 dnl all implementations that are defined inside the class {} declaration.
2985 dnl because of templates-compatibility with broken gcc compilers, this
2986 dnl can cause excessive inlining. This flag limits it to a sane level
2987 KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"])
2988 KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"])
2989 KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"])
2990 KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"])
2991 dnl Some source files are shared between multiple executables
2992 dnl (or libraries) and some of those need template instantiations.
2993 dnl In that case KCC needs to compile those sources with
2994 dnl --one_instantiation_per_object. To make it easy for us we compile
2995 dnl _all_ objects with that flag (--one_per is a shorthand).
2996 KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"])
2997 fi
2998 AC_SUBST(USE_EXCEPTIONS)
2999 dnl obsolete macro - provided to keep things going
3000 USE_RTTI=
3001 AC_SUBST(USE_RTTI)
3002
3003 case "$host" in
3004 *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;;
3005 *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";;
3006 *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";;
3007 *-*-solaris*)
3008 if test "$GXX" = yes; then
3009 libstdcpp=`$CXX -print-file-name=libstdc++.so`
3010 if test ! -f $libstdcpp; then
3011 AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so])
3012 fi
3013 fi
3014 ;;
3015 esac
3016
3017 AC_VALIDIFY_CXXFLAGS
3018
3019 AC_PROG_CXXCPP
3020
3021 if test "$GCC" = yes; then
3022 NOOPT_CFLAGS=-O0
3023 fi
3024 KDE_CHECK_COMPILER_FLAG(O0,[NOOPT_CXXFLAGS=-O0])
3025
3026 AC_SUBST(NOOPT_CXXFLAGS)
3027 AC_SUBST(NOOPT_CFLAGS)
3028
3029 KDE_CHECK_FINAL
3030 KDE_CHECK_CLOSURE
3031 KDE_CHECK_NMCHECK
3032
3033 ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
3034])
3035
3036AC_DEFUN([KDE_ADD_DEPENDENCIES],
3037[
3038 [A]M_DEPENDENCIES(CC)
3039 [A]M_DEPENDENCIES(CXX)
3040])
3041
3042dnl just a wrapper to clean up configure.in
3043AC_DEFUN([KDE_PROG_LIBTOOL],
3044[
3045AC_REQUIRE([AC_CHECK_COMPILERS])
3046AC_REQUIRE([AC_ENABLE_SHARED])
3047AC_REQUIRE([AC_ENABLE_STATIC])
3048
3049AC_REQUIRE([AC_LIBTOOL_DLOPEN])
3050AC_REQUIRE([KDE_CHECK_LIB64])
3051
3052AC_OBJEXT
3053AC_EXEEXT
3054
3055AM_PROG_LIBTOOL
3056AC_LIBTOOL_CXX
3057
3058LIBTOOL_SHELL="/bin/sh ./libtool"
3059# LIBTOOL="$LIBTOOL --silent"
3060KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)"
3061AC_SUBST(KDE_PLUGIN)
3062
3063# we patch configure quite some so we better keep that consistent for incremental runs
3064AC_SUBST(AUTOCONF,'$(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure')
3065])
3066
3067AC_DEFUN([KDE_CHECK_LIB64],
3068[
3069 kdelibsuff=no
3070 AC_ARG_ENABLE(libsuffix,
3071 AC_HELP_STRING([--enable-libsuffix],
3072 [/lib directory suffix (64,32,none[=default])]),
3073 kdelibsuff=$enableval)
3074 # TODO: add an auto case that compiles a little C app to check
3075 # where the glibc is
3076 if test "$kdelibsuff" = "no"; then
3077 kdelibsuff=
3078 fi
3079 if test -z "$kdelibsuff"; then
3080 AC_MSG_RESULT([not using lib directory suffix])
3081 AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories)
3082 else
3083 if test "$libdir" = '${exec_prefix}/lib'; then
3084 libdir="$libdir${kdelibsuff}"
3085 AC_SUBST([libdir], ["$libdir"]) dnl ugly hack for lib64 platforms
3086 fi
3087 AC_DEFINE_UNQUOTED(KDELIBSUFF, ["\"${kdelibsuff}\""], Suffix for lib directories)
3088 AC_MSG_RESULT([using lib directory suffix $kdelibsuff])
3089 fi
3090])
3091
3092AC_DEFUN([KDE_CHECK_TYPES],
3093[ AC_CHECK_SIZEOF(int, 4)dnl
3094 AC_CHECK_SIZEOF(short)dnl
3095 AC_CHECK_SIZEOF(long, 4)dnl
3096 AC_CHECK_SIZEOF(char *, 4)dnl
3097])dnl
3098
3099AC_DEFUN([KDE_DO_IT_ALL],
3100[
3101AC_CANONICAL_SYSTEM
3102AC_ARG_PROGRAM
3103AM_INIT_AUTOMAKE($1, $2)
3104AM_DISABLE_LIBRARIES
3105AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
3106AC_CHECK_COMPILERS
3107KDE_PROG_LIBTOOL
3108AM_KDE_WITH_NLS
3109AC_PATH_KDE
3110])
3111
3112AC_DEFUN([AC_CHECK_RPATH],
3113[
3114AC_MSG_CHECKING(for rpath)
3115AC_ARG_ENABLE(rpath,
3116 AC_HELP_STRING([--disable-rpath],[do not use the rpath feature of ld]),
3117 USE_RPATH=$enableval, USE_RPATH=yes)
3118
3119if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
3120
3121 KDE_RPATH="-R \$(kde_libraries)"
3122
3123 if test -n "$qt_libraries"; then
3124 KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)"
3125 fi
3126 dnl $x_libraries is set to /usr/lib in case
3127 if test -n "$X_LDFLAGS"; then
3128 X_RPATH="-R \$(x_libraries)"
3129 KDE_RPATH="$KDE_RPATH $X_RPATH"
3130 fi
3131 if test -n "$KDE_EXTRA_RPATH"; then
3132 KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
3133 fi
3134fi
3135AC_SUBST(KDE_EXTRA_RPATH)
3136AC_SUBST(KDE_RPATH)
3137AC_SUBST(X_RPATH)
3138AC_MSG_RESULT($USE_RPATH)
3139])
3140
3141dnl Check for the type of the third argument of getsockname
3142AC_DEFUN([AC_CHECK_SOCKLEN_T], [
3143 AC_MSG_CHECKING(for socklen_t)
3144 AC_CACHE_VAL(ac_cv_socklen_t, [
3145 AC_LANG_SAVE
3146 AC_LANG_CPLUSPLUS
3147 AC_TRY_COMPILE([
3148#include <sys/types.h>
3149#include <sys/socket.h>
3150 ],[
3151socklen_t a=0;
3152getsockname(0,(struct sockaddr*)0, &a);
3153 ],
3154 ac_cv_socklen_t=socklen_t,
3155 AC_TRY_COMPILE([
3156#include <sys/types.h>
3157#include <sys/socket.h>
3158 ],[
3159int a=0;
3160getsockname(0,(struct sockaddr*)0, &a);
3161 ],
3162 ac_cv_socklen_t=int,
3163 ac_cv_socklen_t=size_t
3164 )
3165 )
3166 AC_LANG_RESTORE
3167 ])
3168
3169 AC_MSG_RESULT($ac_cv_socklen_t)
3170 if test "$ac_cv_socklen_t" != "socklen_t"; then
3171 AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t,
3172 [Define the real type of socklen_t])
3173 fi
3174 AC_DEFINE_UNQUOTED(ksize_t, socklen_t, [Compatibility define])
3175
3176])
3177
3178dnl This is a merge of some macros out of the gettext aclocal.m4
3179dnl since we don't need anything, I took the things we need
3180dnl the copyright for them is:
3181dnl >
3182dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
3183dnl This Makefile.in is free software; the Free Software Foundation
3184dnl gives unlimited permission to copy and/or distribute it,
3185dnl with or without modifications, as long as this notice is preserved.
3186
3187dnl This program is distributed in the hope that it will be useful,
3188dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
3189dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
3190dnl PARTICULAR PURPOSE.
3191dnl >
3192dnl for this file it is relicensed under LGPL
3193
3194AC_DEFUN([AM_KDE_WITH_NLS],
3195 [
3196 dnl If we use NLS figure out what method
3197
3198 AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt,
3199 [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
3200 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
3201
3202 if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
3203 AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
3204 GMSGFMT=":"
3205 fi
3206 MSGFMT=$GMSGFMT
3207 AC_SUBST(GMSGFMT)
3208 AC_SUBST(MSGFMT)
3209
3210 AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
3211 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
3212
3213 dnl Test whether we really found GNU xgettext.
3214 if test "$XGETTEXT" != ":"; then
3215 dnl If it is no GNU xgettext we define it as : so that the
3216 dnl Makefiles still can work.
3217 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
3218 : ;
3219 else
3220 AC_MSG_RESULT(
3221 [found xgettext programs is not GNU xgettext; ignore it])
3222 XGETTEXT=":"
3223 fi
3224 fi
3225 AC_SUBST(XGETTEXT)
3226
3227 ])
3228
3229# Search path for a program which passes the given test.
3230# Ulrich Drepper <drepper@cygnus.com>, 1996.
3231
3232# serial 1
3233# Stephan Kulow: I appended a _KDE against name conflicts
3234
3235dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
3236dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
3237AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE],
3238[# Extract the first word of "$2", so it can be a program name with args.
3239set dummy $2; ac_word=[$]2
3240AC_MSG_CHECKING([for $ac_word])
3241AC_CACHE_VAL(ac_cv_path_$1,
3242[case "[$]$1" in
3243 /*)
3244 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
3245 ;;
3246 *)
3247 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
3248 for ac_dir in ifelse([$5], , $PATH, [$5]); do
3249 test -z "$ac_dir" && ac_dir=.
3250 if test -f $ac_dir/$ac_word; then
3251 if [$3]; then
3252 ac_cv_path_$1="$ac_dir/$ac_word"
3253 break
3254 fi
3255 fi
3256 done
3257 IFS="$ac_save_ifs"
3258dnl If no 4th arg is given, leave the cache variable unset,
3259dnl so AC_PATH_PROGS will keep looking.
3260ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
3261])dnl
3262 ;;
3263esac])dnl
3264$1="$ac_cv_path_$1"
3265if test -n "[$]$1"; then
3266 AC_MSG_RESULT([$]$1)
3267else
3268 AC_MSG_RESULT(no)
3269fi
3270AC_SUBST($1)dnl
3271])
3272
3273
3274# Check whether LC_MESSAGES is available in <locale.h>.
3275# Ulrich Drepper <drepper@cygnus.com>, 1995.
3276
3277# serial 1
3278
3279AC_DEFUN([AM_LC_MESSAGES],
3280 [if test $ac_cv_header_locale_h = yes; then
3281 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
3282 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
3283 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
3284 if test $am_cv_val_LC_MESSAGES = yes; then
3285 AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
3286 fi
3287 fi])
3288
3289dnl From Jim Meyering.
3290dnl FIXME: migrate into libit.
3291
3292AC_DEFUN([AM_FUNC_OBSTACK],
3293[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
3294 [AC_TRY_LINK([#include "obstack.h"],
3295 [struct obstack *mem;obstack_free(mem,(char *) 0)],
3296 am_cv_func_obstack=yes,
3297 am_cv_func_obstack=no)])
3298 if test $am_cv_func_obstack = yes; then
3299 AC_DEFINE(HAVE_OBSTACK)
3300 else
3301 LIBOBJS="$LIBOBJS obstack.o"
3302 fi
3303])
3304
3305dnl From Jim Meyering. Use this if you use the GNU error.[ch].
3306dnl FIXME: Migrate into libit
3307
3308AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
3309[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
3310 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
3311 am_cv_lib_error_at_line=yes,
3312 am_cv_lib_error_at_line=no)])
3313 if test $am_cv_lib_error_at_line = no; then
3314 LIBOBJS="$LIBOBJS error.o"
3315 fi
3316 AC_SUBST(LIBOBJS)dnl
3317])
3318
3319# Macro to add for using GNU gettext.
3320# Ulrich Drepper <drepper@cygnus.com>, 1995.
3321
3322# serial 1
3323# Stephan Kulow: I put a KDE in it to avoid name conflicts
3324
3325AC_DEFUN([AM_KDE_GNU_GETTEXT],
3326 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3327 AC_REQUIRE([AC_PROG_RANLIB])dnl
3328 AC_REQUIRE([AC_HEADER_STDC])dnl
3329 AC_REQUIRE([AC_TYPE_OFF_T])dnl
3330 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
3331 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
3332 AC_REQUIRE([AC_FUNC_MMAP])dnl
3333 AC_REQUIRE([AM_KDE_WITH_NLS])dnl
3334 AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h])
3335 AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \
3336__argz_count __argz_stringify __argz_next])
3337
3338 AC_MSG_CHECKING(for stpcpy)
3339 AC_CACHE_VAL(kde_cv_func_stpcpy,
3340 [
3341 kde_safe_cxxflags=$CXXFLAGS
3342 CXXFLAGS="-Werror"
3343 AC_LANG_SAVE
3344 AC_LANG_CPLUSPLUS
3345 AC_TRY_COMPILE([
3346 #include <string.h>
3347 ],
3348 [
3349 char buffer[200];
3350 stpcpy(buffer, buffer);
3351 ],
3352 kde_cv_func_stpcpy=yes,
3353 kde_cv_func_stpcpy=no)
3354 AC_LANG_RESTORE
3355 CXXFLAGS=$kde_safe_cxxflags
3356 ])
3357 AC_MSG_RESULT($kde_cv_func_stpcpy)
3358 if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
3359 AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
3360 fi
3361
3362 AM_LC_MESSAGES
3363
3364 if test "x$CATOBJEXT" != "x"; then
3365 if test "x$ALL_LINGUAS" = "x"; then
3366 LINGUAS=
3367 else
3368 AC_MSG_CHECKING(for catalogs to be installed)
3369 NEW_LINGUAS=
3370 for lang in ${LINGUAS=$ALL_LINGUAS}; do
3371 case "$ALL_LINGUAS" in
3372 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
3373 esac
3374 done
3375 LINGUAS=$NEW_LINGUAS
3376 AC_MSG_RESULT($LINGUAS)
3377 fi
3378
3379 dnl Construct list of names of catalog files to be constructed.
3380 if test -n "$LINGUAS"; then
3381 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
3382 fi
3383 fi
3384
3385 ])
3386
3387AC_DEFUN([AC_HAVE_XPM],
3388 [AC_REQUIRE_CPP()dnl
3389 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3390
3391 test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
3392 test -z "$XPM_INCLUDE" && XPM_INCLUDE=
3393
3394 AC_ARG_WITH(xpm,AC_HELP_STRING([--without-xpm],[disable color pixmap XPM tests]),
3395 xpm_test=$withval, xpm_test="yes")
3396 if test "x$xpm_test" = xno; then
3397 ac_cv_have_xpm=no
3398 else
3399 AC_MSG_CHECKING(for XPM)
3400 AC_CACHE_VAL(ac_cv_have_xpm,
3401 [
3402 ac_save_ldflags="$LDFLAGS"
3403 ac_save_cflags="$CFLAGS"
3404 if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
3405 LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET"
3406 else
3407 LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET"
3408 fi
3409 CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES"
3410 test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
3411 AC_TRY_LINK([#include <X11/xpm.h>],[],
3412 ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
3413 LDFLAGS="$ac_save_ldflags"
3414 CFLAGS="$ac_save_cflags"
3415 ])dnl
3416
3417 if test "$ac_cv_have_xpm" = no; then
3418 AC_MSG_RESULT(no)
3419 XPM_LDFLAGS=""
3420 XPMINC=""
3421 $2
3422 else
3423 AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
3424 if test "$XPM_LDFLAGS" = ""; then
3425 XPMLIB='-lXpm $(LIB_X11)'
3426 else
3427 XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
3428 fi
3429 if test "$XPM_INCLUDE" = ""; then
3430 XPMINC=""
3431 else
3432 XPMINC="-I$XPM_INCLUDE"
3433 fi
3434 AC_MSG_RESULT(yes)
3435 $1
3436 fi
3437 fi
3438 AC_SUBST(XPMINC)
3439 AC_SUBST(XPMLIB)
3440])
3441
3442AC_DEFUN([AC_HAVE_DPMS],
3443 [AC_REQUIRE_CPP()dnl
3444 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3445
3446 test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS=
3447 test -z "$DPMS_INCLUDE" && DPMS_INCLUDE=
3448 DPMS_LIB=
3449
3450 AC_ARG_WITH(dpms,AC_HELP_STRING([--without-dpms],[disable DPMS power saving]),
3451 dpms_test=$withval, dpms_test="yes")
3452 if test "x$dpms_test" = xno; then
3453 ac_cv_have_dpms=no
3454 else
3455 AC_MSG_CHECKING(for DPMS)
3456 dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms.
3457 dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms".
3458 AC_CACHE_VAL(ac_cv_have_dpms,
3459 [
3460 if test "x$kde_use_qt_emb" = "xyes" || test "x$kde_use_qt_mac" = "xyes"; then
3461 AC_MSG_RESULT(no)
3462 ac_cv_have_dpms="no"
3463 else
3464 ac_save_ldflags="$LDFLAGS"
3465 ac_save_cflags="$CFLAGS"
3466 ac_save_libs="$LIBS"
3467 LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
3468 CFLAGS="$CFLAGS $X_INCLUDES"
3469 test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
3470 AC_TRY_LINK([
3471 #include <X11/Xproto.h>
3472 #include <X11/X.h>
3473 #include <X11/Xlib.h>
3474 #include <X11/extensions/dpms.h>
3475 int foo_test_dpms()
3476 { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
3477 ac_cv_have_dpms="yes", [
3478 LDFLAGS="$ac_save_ldflags"
3479 CFLAGS="$ac_save_cflags"
3480 LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
3481 LIBS="$LIBS -lXdpms"
3482 CFLAGS="$CFLAGS $X_INCLUDES"
3483 test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
3484 AC_TRY_LINK([
3485 #include <X11/Xproto.h>
3486 #include <X11/X.h>
3487 #include <X11/Xlib.h>
3488 #include <X11/extensions/dpms.h>
3489 int foo_test_dpms()
3490 { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
3491 [
3492 ac_cv_have_dpms="-lXdpms"
3493 ],ac_cv_have_dpms="no")
3494 ])
3495 LDFLAGS="$ac_save_ldflags"
3496 CFLAGS="$ac_save_cflags"
3497 LIBS="$ac_save_libs"
3498 fi
3499 ])dnl
3500
3501 if test "$ac_cv_have_dpms" = no; then
3502 AC_MSG_RESULT(no)
3503 DPMS_LDFLAGS=""
3504 DPMSINC=""
3505 $2
3506 else
3507 AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support])
3508 if test "$ac_cv_have_dpms" = "-lXdpms"; then
3509 DPMS_LIB="-lXdpms"
3510 fi
3511 if test "$DPMS_LDFLAGS" = ""; then
3512 DPMSLIB="$DPMS_LIB "'$(LIB_X11)'
3513 else
3514 DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)'
3515 fi
3516 if test "$DPMS_INCLUDE" = ""; then
3517 DPMSINC=""
3518 else
3519 DPMSINC="-I$DPMS_INCLUDE"
3520 fi
3521 AC_MSG_RESULT(yes)
3522 $1
3523 fi
3524 fi
3525 ac_save_cflags="$CFLAGS"
3526 CFLAGS="$CFLAGS $X_INCLUDES"
3527 test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
3528 AH_TEMPLATE(HAVE_DPMSCAPABLE_PROTO,
3529 [Define if you have the DPMSCapable prototype in <X11/extensions/dpms.h>])
3530 AC_CHECK_DECL(DPMSCapable,
3531 AC_DEFINE(HAVE_DPMSCAPABLE_PROTO),,
3532 [#include <X11/extensions/dpms.h>])
3533 AH_TEMPLATE(HAVE_DPMSINFO_PROTO,
3534 [Define if you have the DPMSInfo prototype in <X11/extensions/dpms.h>])
3535 AC_CHECK_DECL(DPMSInfo,
3536 AC_DEFINE(HAVE_DPMSINFO_PROTO),,
3537 [#include <X11/extensions/dpms.h>])
3538 CFLAGS="$ac_save_cflags"
3539 AC_SUBST(DPMSINC)
3540 AC_SUBST(DPMSLIB)
3541])
3542
3543AC_DEFUN([AC_HAVE_GL],
3544 [AC_REQUIRE_CPP()dnl
3545 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3546
3547 test -z "$GL_LDFLAGS" && GL_LDFLAGS=
3548 test -z "$GL_INCLUDE" && GL_INCLUDE=
3549
3550 AC_ARG_WITH(gl,AC_HELP_STRING([--without-gl],[disable 3D GL modes]),
3551 gl_test=$withval, gl_test="yes")
3552 if test "x$kde_use_qt_emb" = "xyes"; then
3553 # GL and Qt Embedded is a no-go for now.
3554 ac_cv_have_gl=no
3555 elif test "x$gl_test" = xno; then
3556 ac_cv_have_gl=no
3557 else
3558 AC_MSG_CHECKING(for GL)
3559 AC_CACHE_VAL(ac_cv_have_gl,
3560 [
3561 AC_LANG_SAVE
3562 AC_LANG_CPLUSPLUS
3563 ac_save_ldflags="$LDFLAGS"
3564 ac_save_cxxflags="$CXXFLAGS"
3565 LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU"
3566 test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11"
3567 LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET"
3568 CXXFLAGS="$CFLAGS $X_INCLUDES"
3569 test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
3570 AC_TRY_LINK([#include <GL/gl.h>
3571#include <GL/glu.h>
3572], [],
3573 ac_cv_have_gl="mesa", ac_cv_have_gl="no")
3574 if test "x$ac_cv_have_gl" = "xno"; then
3575 LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGLU -lGL"
3576 test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11"
3577 LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET"
3578 CXXFLAGS="$ac_save_cflags $X_INCLUDES"
3579 test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
3580 AC_TRY_LINK([#include <GL/gl.h>
3581#include <GL/glu.h>
3582], [],
3583 ac_cv_have_gl="yes", ac_cv_have_gl="no")
3584 fi
3585 AC_LANG_RESTORE
3586 LDFLAGS="$ac_save_ldflags"
3587 CXXFLAGS="$ac_save_cxxflags"
3588 ])dnl
3589
3590 if test "$ac_cv_have_gl" = "no"; then
3591 AC_MSG_RESULT(no)
3592 GL_LDFLAGS=""
3593 GLINC=""
3594 $2
3595 else
3596 AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)])
3597 if test "$GL_LDFLAGS" = ""; then
3598 if test "$ac_cv_have_gl" = "mesa"; then
3599 GLLIB='-lMesaGLU -lMesaGL $(LIB_X11)'
3600 else
3601 GLLIB='-lGLU -lGL $(LIB_X11)'
3602 fi
3603 else
3604 if test "$ac_cv_have_gl" = "mesa"; then
3605 GLLIB="$GL_LDFLAGS -lMesaGLU -lMesaGL "'$(LIB_X11)'
3606 else
3607 GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)'
3608 fi
3609 fi
3610 if test "$GL_INCLUDE" = ""; then
3611 GLINC=""
3612 else
3613 GLINC="-I$GL_INCLUDE"
3614 fi
3615 AC_MSG_RESULT($ac_cv_have_gl)
3616 $1
3617 fi
3618 fi
3619 AC_SUBST(GLINC)
3620 AC_SUBST(GLLIB)
3621])
3622
3623
3624 dnl shadow password and PAM magic - maintained by ossi@kde.org
3625
3626AC_DEFUN([KDE_PAM], [
3627 AC_REQUIRE([KDE_CHECK_LIBDL])
3628
3629 want_pam=
3630 AC_ARG_WITH(pam,
3631 AC_HELP_STRING([--with-pam[=ARG]],[enable support for PAM: ARG=[yes|no|service name]]),
3632 [ if test "x$withval" = "xyes"; then
3633 want_pam=yes
3634 pam_service=kde
3635 elif test "x$withval" = "xno"; then
3636 want_pam=no
3637 else
3638 want_pam=yes
3639 pam_service=$withval
3640 fi
3641 ], [ pam_service=kde ])
3642
3643 use_pam=
3644 PAMLIBS=
3645 if test "x$want_pam" != xno; then
3646 AC_CHECK_LIB(pam, pam_start, [
3647 AC_CHECK_HEADER(security/pam_appl.h,
3648 [ pam_header=security/pam_appl.h ],
3649 [ AC_CHECK_HEADER(pam/pam_appl.h,
3650 [ pam_header=pam/pam_appl.h ],
3651 [
3652 AC_MSG_WARN([PAM detected, but no headers found!
3653Make sure you have the necessary development packages installed.])
3654 ]
3655 )
3656 ]
3657 )
3658 ], , $LIBDL)
3659 if test -z "$pam_header"; then
3660 if test "x$want_pam" = xyes; then
3661 AC_MSG_ERROR([--with-pam was specified, but cannot compile with PAM!])
3662 fi
3663 else
3664 AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)])
3665 PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL"
3666 use_pam=yes
3667
3668 dnl darwin claims to be something special
3669 if test "$pam_header" = "pam/pam_appl.h"; then
3670 AC_DEFINE(HAVE_PAM_PAM_APPL_H, 1, [Define if your PAM headers are in pam/ instead of security/])
3671 fi
3672
3673 dnl test whether struct pam_message is const (Linux) or not (Sun)
3674 AC_MSG_CHECKING(for const pam_message)
3675 AC_EGREP_HEADER([struct pam_message], $pam_header,
3676 [ AC_EGREP_HEADER([const struct pam_message], $pam_header,
3677 [AC_MSG_RESULT([const: Linux-type PAM])],
3678 [AC_MSG_RESULT([nonconst: Sun-type PAM])
3679 AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
3680 )],
3681 [AC_MSG_RESULT([not found - assume const, Linux-type PAM])])
3682 fi
3683 fi
3684
3685 AC_SUBST(PAMLIBS)
3686])
3687
3688dnl DEF_PAM_SERVICE(arg name, full name, define name)
3689AC_DEFUN([DEF_PAM_SERVICE], [
3690 AC_ARG_WITH($1-pam,
3691 AC_HELP_STRING([--with-$1-pam=[val]],[override PAM service from --with-pam for $2]),
3692 [ if test "x$use_pam" = xyes; then
3693 $3_PAM_SERVICE=$withval
3694 else
3695 AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected.
3696You may want to enforce it by using --with-pam.])
3697 fi
3698 ],
3699 [ if test "x$use_pam" = xyes; then
3700 $3_PAM_SERVICE="$pam_service"
3701 fi
3702 ])
3703 if test -n "$$3_PAM_SERVICE"; then
3704 AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE])
3705 AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2])
3706 fi
3707 AC_SUBST($3_PAM_SERVICE)
3708])
3709
3710AC_DEFUN([KDE_SHADOWPASSWD], [
3711 AC_REQUIRE([KDE_PAM])
3712
3713 AC_CHECK_LIB(shadow, getspent,
3714 [ LIBSHADOW="-lshadow"
3715 ac_use_shadow=yes
3716 ],
3717 [ dnl for UnixWare
3718 AC_CHECK_LIB(gen, getspent,
3719 [ LIBGEN="-lgen"
3720 ac_use_shadow=yes
3721 ],
3722 [ AC_CHECK_FUNC(getspent,
3723 [ ac_use_shadow=yes ],
3724 [ ac_use_shadow=no ])
3725 ])
3726 ])
3727 AC_SUBST(LIBSHADOW)
3728 AC_SUBST(LIBGEN)
3729
3730 AC_MSG_CHECKING([for shadow passwords])
3731
3732 AC_ARG_WITH(shadow,
3733 AC_HELP_STRING([--with-shadow],[If you want shadow password support]),
3734 [ if test "x$withval" != "xno"; then
3735 use_shadow=yes
3736 else
3737 use_shadow=no
3738 fi
3739 ], [
3740 use_shadow="$ac_use_shadow"
3741 ])
3742
3743 if test "x$use_shadow" = xyes; then
3744 AC_MSG_RESULT(yes)
3745 AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords])
3746 else
3747 AC_MSG_RESULT(no)
3748 LIBSHADOW=
3749 LIBGEN=
3750 fi
3751
3752 dnl finally make the relevant binaries setuid root, if we have shadow passwds.
3753 dnl this still applies, if we could use it indirectly through pam.
3754 if test "x$use_shadow" = xyes ||
3755 ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then
3756 case $host in
3757 *-*-freebsd* | *-*-netbsd* | *-*-openbsd*)
3758 SETUIDFLAGS="-m 4755 -o root";;
3759 *)
3760 SETUIDFLAGS="-m 4755";;
3761 esac
3762 fi
3763 AC_SUBST(SETUIDFLAGS)
3764
3765])
3766
3767AC_DEFUN([KDE_PASSWDLIBS], [
3768 AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT
3769 AC_REQUIRE([KDE_PAM])
3770 AC_REQUIRE([KDE_SHADOWPASSWD])
3771
3772 if test "x$use_pam" = "xyes"; then
3773 PASSWDLIBS="$PAMLIBS"
3774 else
3775 PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN"
3776 fi
3777
3778 dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but
3779 dnl /etc/master.passwd holds the actual passwords. /etc/master.passwd requires
3780 dnl root to read, so kcheckpass needs to be root (even when using pam, since pam
3781 dnl may need to read /etc/master.passwd).
3782 case $host in
3783 *-*-freebsd*)
3784 SETUIDFLAGS="-m 4755 -o root"
3785 ;;
3786 *)
3787 ;;
3788 esac
3789
3790 AC_SUBST(PASSWDLIBS)
3791])
3792
3793AC_DEFUN([KDE_CHECK_LIBDL],
3794[
3795AC_CHECK_LIB(dl, dlopen, [
3796LIBDL="-ldl"
3797ac_cv_have_dlfcn=yes
3798])
3799
3800AC_CHECK_LIB(dld, shl_unload, [
3801LIBDL="-ldld"
3802ac_cv_have_shload=yes
3803])
3804
3805AC_SUBST(LIBDL)
3806])
3807
3808AC_DEFUN([KDE_CHECK_DLOPEN],
3809[
3810KDE_CHECK_LIBDL
3811AC_CHECK_HEADERS(dlfcn.h dl.h)
3812if test "$ac_cv_header_dlfcn_h" = "no"; then
3813 ac_cv_have_dlfcn=no
3814fi
3815
3816if test "$ac_cv_header_dl_h" = "no"; then
3817 ac_cv_have_shload=no
3818fi
3819
3820dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE
3821dnl (MM)
3822AC_ARG_ENABLE(dlopen,
3823AC_HELP_STRING([--disable-dlopen],[link statically [default=no]]),
3824enable_dlopen=$enableval,
3825enable_dlopen=yes)
3826
3827# override the user's opinion, if we know it better ;)
3828if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
3829 enable_dlopen=no
3830fi
3831
3832if test "$ac_cv_have_dlfcn" = "yes"; then
3833 AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn])
3834fi
3835
3836if test "$ac_cv_have_shload" = "yes"; then
3837 AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload])
3838fi
3839
3840if test "$enable_dlopen" = no ; then
3841 test -n "$1" && eval $1
3842else
3843 test -n "$2" && eval $2
3844fi
3845
3846])
3847
3848AC_DEFUN([KDE_CHECK_DYNAMIC_LOADING],
3849[
3850KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no)
3851KDE_PROG_LIBTOOL
3852AC_MSG_CHECKING([dynamic loading])
3853eval "`egrep '^build_libtool_libs=' libtool`"
3854if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
3855 dynamic_loading=yes
3856 AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
3857else
3858 dynamic_loading=no
3859fi
3860AC_MSG_RESULT($dynamic_loading)
3861if test "$dynamic_loading" = "yes"; then
3862 $1
3863else
3864 $2
3865fi
3866])
3867
3868AC_DEFUN([KDE_ADD_INCLUDES],
3869[
3870if test -z "$1"; then
3871 test_include="Pix.h"
3872else
3873 test_include="$1"
3874fi
3875
3876AC_MSG_CHECKING([for libg++ ($test_include)])
3877
3878AC_CACHE_VAL(kde_cv_libgpp_includes,
3879[
3880kde_cv_libgpp_includes=no
3881
3882 for ac_dir in \
3883 \
3884 /usr/include/g++ \
3885 /usr/include \
3886 /usr/unsupported/include \
3887 /opt/include \
3888 $extra_include \
3889 ; \
3890 do
3891 if test -r "$ac_dir/$test_include"; then
3892 kde_cv_libgpp_includes=$ac_dir
3893 break
3894 fi
3895 done
3896])
3897
3898AC_MSG_RESULT($kde_cv_libgpp_includes)
3899if test "$kde_cv_libgpp_includes" != "no"; then
3900 all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES"
3901fi
3902])
3903])
3904
3905AC_DEFUN([KDE_CHECK_LIBPTHREAD],
3906[
3907 LIBPTHREAD=""
3908
3909 if test -n "$PTHREAD_LIBS"; then
3910 PTHREAD_LIBS_save="$PTHREAD_LIBS"
3911 PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'`
3912 KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [LIBPTHREAD="$PTHREAD_LIBS_save"] )
3913 PTHREAD_LIBS="$PTHREAD_LIBS_save"
3914 fi
3915
3916 if test -z "$LIBPTHREAD"; then
3917 AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] )
3918 fi
3919
3920 AC_SUBST(LIBPTHREAD)
3921])
3922
3923AC_DEFUN([KDE_CHECK_PTHREAD_OPTION],
3924[
3925 USE_THREADS=""
3926 if test -z "$LIBPTHREAD"; then
3927 KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-D_THREAD_SAFE -pthread"])
3928 fi
3929
3930 AH_VERBATIM(__svr_define, [
3931#if defined(__SVR4) && !defined(__svr4__)
3932#define __svr4__ 1
3933#endif
3934])
3935 case $host_os in
3936 solaris*)
3937 KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
3938 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4"
3939 ;;
3940 freebsd*)
3941 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE $PTHREAD_CFLAGS"
3942 ;;
3943 aix*)
3944 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
3945 LIBPTHREAD="$LIBPTHREAD -lc_r"
3946 ;;
3947 linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT"
3948 if test "$CXX" = "KCC"; then
3949 CXXFLAGS="$CXXFLAGS --thread_safe"
3950 NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe"
3951 fi
3952 ;;
3953 *)
3954 ;;
3955 esac
3956 AC_SUBST(USE_THREADS)
3957 AC_SUBST(LIBPTHREAD)
3958])
3959
3960AC_DEFUN([KDE_CHECK_THREADING],
3961[
3962 AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
3963 AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
3964 dnl default is yes if libpthread is found and no if no libpthread is available
3965 if test -z "$LIBPTHREAD"; then
3966 if test -z "$USE_THREADS"; then
3967 kde_check_threading_default=no
3968 else
3969 kde_check_threading_default=yes
3970 fi
3971 else
3972 kde_check_threading_default=yes
3973 fi
3974 AC_ARG_ENABLE(threading,AC_HELP_STRING([--disable-threading],[disables threading even if libpthread found]),
3975 kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
3976 if test "x$kde_use_threading" = "xyes"; then
3977 AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
3978 fi
3979])
3980
3981AC_DEFUN([KDE_TRY_LINK_PYTHON],
3982[
3983if test "$kde_python_link_found" = no; then
3984
3985if test "$1" = normal; then
3986 AC_MSG_CHECKING(if a Python application links)
3987else
3988 AC_MSG_CHECKING(if Python depends on $2)
3989fi
3990
3991AC_CACHE_VAL(kde_cv_try_link_python_$1,
3992[
3993kde_save_cflags="$CFLAGS"
3994CFLAGS="$CFLAGS $PYTHONINC"
3995kde_save_libs="$LIBS"
3996LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
3997kde_save_ldflags="$LDFLAGS"
3998LDFLAGS="$LDFLAGS $PYTHONLIB"
3999
4000AC_TRY_LINK(
4001[
4002#include <Python.h>
4003],[
4004 PySys_SetArgv(1, 0);
4005],
4006 [kde_cv_try_link_python_$1=yes],
4007 [kde_cv_try_link_python_$1=no]
4008)
4009CFLAGS="$kde_save_cflags"
4010LIBS="$kde_save_libs"
4011LDFLAGS="$kde_save_ldflags"
4012])
4013
4014if test "$kde_cv_try_link_python_$1" = "yes"; then
4015 AC_MSG_RESULT(yes)
4016 kde_python_link_found=yes
4017 if test ! "$1" = normal; then
4018 LIBPYTHON="$LIBPYTHON $2"
4019 fi
4020 $3
4021else
4022 AC_MSG_RESULT(no)
4023 $4
4024fi
4025
4026fi
4027
4028])
4029
4030AC_DEFUN([KDE_CHECK_PYTHON_DIR],
4031[
4032AC_MSG_CHECKING([for Python directory])
4033
4034AC_CACHE_VAL(kde_cv_pythondir,
4035[
4036 if test -z "$PYTHONDIR"; then
4037 kde_cv_pythondir=/usr/local
4038 else
4039 kde_cv_pythondir="$PYTHONDIR"
4040 fi
4041])
4042
4043AC_ARG_WITH(pythondir,
4044AC_HELP_STRING([--with-pythondir=pythondir],[use python installed in pythondir]),
4045[
4046 ac_python_dir=$withval
4047], ac_python_dir=$kde_cv_pythondir
4048)
4049
4050AC_MSG_RESULT($ac_python_dir)
4051])
4052
4053AC_DEFUN([KDE_CHECK_PYTHON_INTERN],
4054[
4055AC_REQUIRE([KDE_CHECK_LIBDL])
4056AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
4057AC_REQUIRE([KDE_CHECK_PYTHON_DIR])
4058
4059if test -z "$1"; then
4060 version="1.5"
4061else
4062 version="$1"
4063fi
4064
4065AC_MSG_CHECKING([for Python$version])
4066
4067python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes"
4068AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
4069if test ! -r $python_incdir/Python.h; then
4070 AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir)
4071 python_incdir=$python_incdir/python$version
4072 if test ! -r $python_incdir/Python.h; then
4073 python_incdir=no
4074 fi
4075fi
4076
4077PYTHONINC=-I$python_incdir
4078
4079python_libdirs="$ac_python_dir/lib$kdelibsuff /usr/lib$kdelibsuff /usr/local /usr/lib$kdelibsuff $kde_extra_libs"
4080AC_FIND_FILE(libpython$version.so, $python_libdirs, python_libdir)
4081if test ! -r $python_libdir/libpython$version.so; then
4082 AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
4083 if test ! -r $python_libdir/libpython$version.a; then
4084 AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir)
4085 python_libdir=$python_libdir/python$version/config
4086 if test ! -r $python_libdir/libpython$version.a; then
4087 python_libdir=no
4088 fi
4089 fi
4090fi
4091
4092PYTHONLIB=-L$python_libdir
4093kde_orig_LIBPYTHON=$LIBPYTHON
4094if test -z "$LIBPYTHON"; then
4095 LIBPYTHON=-lpython$version
4096fi
4097
4098AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir)
4099python_moddir=$python_moddir/python$version
4100if test ! -r $python_moddir/copy.py; then
4101 python_moddir=no
4102fi
4103
4104PYTHONMODDIR=$python_moddir
4105
4106AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir)
4107
4108if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then
4109 LIBPYTHON=$kde_orig_LIBPYTHON
4110 test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB=""
4111 test "x$PYTHONINC" = "x-Ino" && PYTHONINC=""
4112 $2
4113else
4114 dnl Note: this test is very weak
4115 kde_python_link_found=no
4116 KDE_TRY_LINK_PYTHON(normal)
4117 KDE_TRY_LINK_PYTHON(m, -lm)
4118 KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
4119 KDE_TRY_LINK_PYTHON(tcl, -ltcl)
4120 KDE_TRY_LINK_PYTHON(db2, -ldb2)
4121 KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm])
4122 KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil])
4123 KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil])
4124 KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3])
4125 KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil])
4126 KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm])
4127 KDE_TRY_LINK_PYTHON(pthread_and_panel_curses, [$LIBPTHREAD $LIBDL -lm -lpanel -lcurses])
4128 KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [],
4129 [AC_MSG_WARN([it seems, Python depends on another library.
4130 Please set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this
4131 and contact the authors to let them know about this problem])
4132 ])
4133
4134 LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
4135 AC_SUBST(PYTHONINC)
4136 AC_SUBST(PYTHONLIB)
4137 AC_SUBST(LIBPYTHON)
4138 AC_SUBST(PYTHONMODDIR)
4139 AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python])
4140fi
4141
4142])
4143
4144
4145AC_DEFUN([KDE_CHECK_PYTHON],
4146[
4147 KDE_CHECK_PYTHON_INTERN("2.3",
4148 [KDE_CHECK_PYTHON_INTERN("2.2",
4149 [KDE_CHECK_PYTHON_INTERN("2.1",
4150 [KDE_CHECK_PYTHON_INTERN("2.0",
4151 [KDE_CHECK_PYTHON_INTERN($1, $2) ])
4152 ])
4153 ])
4154 ])
4155])
4156
4157AC_DEFUN([KDE_CHECK_STL],
4158[
4159 AC_LANG_SAVE
4160 AC_LANG_CPLUSPLUS
4161 ac_save_CXXFLAGS="$CXXFLAGS"
4162 CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`"
4163
4164 AC_MSG_CHECKING([if C++ programs can be compiled])
4165 AC_CACHE_VAL(kde_cv_stl_works,
4166 [
4167 AC_TRY_COMPILE([
4168#include <string>
4169using namespace std;
4170],[
4171 string astring="Hallo Welt.";
4172 astring.erase(0, 6); // now astring is "Welt"
4173 return 0;
4174], kde_cv_stl_works=yes,
4175 kde_cv_stl_works=no)
4176])
4177
4178 AC_MSG_RESULT($kde_cv_stl_works)
4179
4180 if test "$kde_cv_stl_works" = "yes"; then
4181 # back compatible
4182 AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI])
4183 else
4184 AC_MSG_ERROR([Your Installation isn't able to compile simple C++ programs.
4185Check config.log for details - if you're using a Linux distribution you might miss
4186a package named similiar to libstd++-dev.])
4187 fi
4188
4189 CXXFLAGS="$ac_save_CXXFLAGS"
4190 AC_LANG_RESTORE
4191])
4192
4193AC_DEFUN([AC_FIND_QIMGIO],
4194 [AC_REQUIRE([AC_FIND_JPEG])
4195AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
4196AC_MSG_CHECKING([for qimgio])
4197AC_CACHE_VAL(ac_cv_lib_qimgio,
4198[
4199AC_LANG_SAVE
4200AC_LANG_CPLUSPLUS
4201ac_save_LIBS="$LIBS"
4202ac_save_CXXFLAGS="$CXXFLAGS"
4203LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
4204CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
4205AC_TRY_RUN(dnl
4206[
4207#include <qimageio.h>
4208#include <qstring.h>
4209int main() {
4210 QString t = "hallo";
4211 t.fill('t');
4212 qInitImageIO();
4213}
4214],
4215 ac_cv_lib_qimgio=yes,
4216 ac_cv_lib_qimgio=no,
4217 ac_cv_lib_qimgio=no)
4218LIBS="$ac_save_LIBS"
4219CXXFLAGS="$ac_save_CXXFLAGS"
4220AC_LANG_RESTORE
4221])dnl
4222if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
4223 LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
4224 AC_MSG_RESULT(yes)
4225 AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
4226 AC_SUBST(LIBQIMGIO)
4227else
4228 AC_MSG_RESULT(not found)
4229fi
4230])
4231
4232AC_DEFUN([AM_DISABLE_LIBRARIES],
4233[
4234 AC_PROVIDE([AM_ENABLE_STATIC])
4235 AC_PROVIDE([AM_ENABLE_SHARED])
4236 enable_static=no
4237 enable_shared=yes
4238])
4239
4240
4241AC_DEFUN([AC_CHECK_UTMP_FILE],
4242[
4243 AC_MSG_CHECKING([for utmp file])
4244
4245 AC_CACHE_VAL(kde_cv_utmp_file,
4246 [
4247 kde_cv_utmp_file=no
4248
4249 for ac_file in \
4250 \
4251 /var/run/utmp \
4252 /var/adm/utmp \
4253 /etc/utmp \
4254 ; \
4255 do
4256 if test -r "$ac_file"; then
4257 kde_cv_utmp_file=$ac_file
4258 break
4259 fi
4260 done
4261 ])
4262
4263 if test "$kde_cv_utmp_file" != "no"; then
4264 AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries])
4265 $1
4266 AC_MSG_RESULT($kde_cv_utmp_file)
4267 else
4268 $2
4269 AC_MSG_RESULT([non found])
4270 fi
4271])
4272
4273
4274AC_DEFUN([KDE_CREATE_SUBDIRSLIST],
4275[
4276
4277DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
4278
4279if test ! -s $srcdir/subdirs; then
4280 dnl Note: Makefile.common creates subdirs, so this is just a fallback
4281 TOPSUBDIRS=""
4282 files=`cd $srcdir && ls -1`
4283 dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
4284 for i in $dirs; do
4285 echo $i >> $srcdir/subdirs
4286 done
4287fi
4288
4289ac_topsubdirs=
4290if test -s $srcdir/inst-apps; then
4291 ac_topsubdirs="`cat $srcdir/inst-apps`"
4292elif test -s $srcdir/subdirs; then
4293 ac_topsubdirs="`cat $srcdir/subdirs`"
4294fi
4295
4296for i in $ac_topsubdirs; do
4297 AC_MSG_CHECKING([if $i should be compiled])
4298 if test -d $srcdir/$i; then
4299 install_it="yes"
4300 for j in $DO_NOT_COMPILE; do
4301 if test $i = $j; then
4302 install_it="no"
4303 fi
4304 done
4305 else
4306 install_it="no"
4307 fi
4308 AC_MSG_RESULT($install_it)
4309 vari=`echo $i | sed -e 's,[[-+.]],_,g'`
4310 if test $install_it = "yes"; then
4311 TOPSUBDIRS="$TOPSUBDIRS $i"
4312 eval "$vari""_SUBDIR_included=yes"
4313 else
4314 eval "$vari""_SUBDIR_included=no"
4315 fi
4316done
4317
4318AC_SUBST(TOPSUBDIRS)
4319])
4320
4321AC_DEFUN([KDE_CHECK_NAMESPACES],
4322[
4323AC_MSG_CHECKING(whether C++ compiler supports namespaces)
4324AC_LANG_SAVE
4325AC_LANG_CPLUSPLUS
4326AC_TRY_COMPILE([
4327],
4328[
4329namespace Foo {
4330 extern int i;
4331 namespace Bar {
4332 extern int i;
4333 }
4334}
4335
4336int Foo::i = 0;
4337int Foo::Bar::i = 1;
4338],[
4339 AC_MSG_RESULT(yes)
4340 AC_DEFINE(HAVE_NAMESPACES)
4341], [
4342AC_MSG_RESULT(no)
4343])
4344AC_LANG_RESTORE
4345])
4346
4347dnl ------------------------------------------------------------------------
4348dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
4349dnl ------------------------------------------------------------------------
4350dnl
4351AC_DEFUN([AC_CHECK_S_ISSOCK],
4352[
4353AC_MSG_CHECKING(for S_ISSOCK)
4354AC_CACHE_VAL(ac_cv_have_s_issock,
4355[
4356AC_TRY_LINK(
4357[
4358#include <sys/stat.h>
4359],
4360[
4361struct stat buff;
4362int b = S_ISSOCK( buff.st_mode );
4363],
4364ac_cv_have_s_issock=yes,
4365ac_cv_have_s_issock=no)
4366])
4367AC_MSG_RESULT($ac_cv_have_s_issock)
4368if test "$ac_cv_have_s_issock" = "yes"; then
4369 AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
4370fi
4371
4372AH_VERBATIM(_ISSOCK,
4373[
4374#ifndef HAVE_S_ISSOCK
4375#define HAVE_S_ISSOCK
4376#define S_ISSOCK(mode) (1==0)
4377#endif
4378])
4379
4380])
4381
4382dnl ------------------------------------------------------------------------
4383dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
4384dnl ------------------------------------------------------------------------
4385dnl
4386AC_DEFUN([AC_CHECK_KDEMAXPATHLEN],
4387[
4388AC_MSG_CHECKING(for MAXPATHLEN)
4389AC_CACHE_VAL(ac_cv_maxpathlen,
4390[
4391cat > conftest.$ac_ext <<EOF
4392#ifdef STDC_HEADERS
4393# include <stdlib.h>
4394#endif
4395#include <stdio.h>
4396#include <sys/param.h>
4397#ifndef MAXPATHLEN
4398#define MAXPATHLEN 1024
4399#endif
4400
4401KDE_HELLO MAXPATHLEN
4402
4403EOF
4404
4405ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
4406
4407if AC_TRY_EVAL(ac_try) && test -s conftest.out; then
4408 ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
4409else
4410 ac_cv_maxpathlen=1024
4411fi
4412
4413rm conftest.*
4414
4415])
4416AC_MSG_RESULT($ac_cv_maxpathlen)
4417AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] )
4418])
4419
4420AC_DEFUN([KDE_CHECK_HEADER],
4421[
4422 AC_LANG_SAVE
4423 kde_safe_cppflags=$CPPFLAGS
4424 CPPFLAGS="$CPPFLAGS $all_includes"
4425 AC_LANG_CPLUSPLUS
4426 AC_CHECK_HEADER([$1], [$2], [$3], [$4])
4427 CPPFLAGS=$kde_safe_cppflags
4428 AC_LANG_RESTORE
4429])
4430
4431AC_DEFUN([KDE_CHECK_HEADERS],
4432[
4433 AH_CHECK_HEADERS([$1])
4434 AC_LANG_SAVE
4435 kde_safe_cppflags=$CPPFLAGS
4436 CPPFLAGS="$CPPFLAGS $all_includes"
4437 AC_LANG_CPLUSPLUS
4438 AC_CHECK_HEADERS([$1], [$2], [$3], [$4])
4439 CPPFLAGS=$kde_safe_cppflags
4440 AC_LANG_RESTORE
4441])
4442
4443AC_DEFUN([KDE_FAST_CONFIGURE],
4444[
4445 dnl makes configure fast (needs perl)
4446 AC_ARG_ENABLE(fast-perl, AC_HELP_STRING([--disable-fast-perl],[disable fast Makefile generation (needs perl)]),
4447 with_fast_perl=$enableval, with_fast_perl=yes)
4448])
4449
4450AC_DEFUN([KDE_CONF_FILES],
4451[
4452 val=
4453 if test -f $srcdir/configure.files ; then
4454 val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files`
4455 fi
4456 CONF_FILES=
4457 if test -n "$val" ; then
4458 for i in $val ; do
4459 CONF_FILES="$CONF_FILES $i"
4460 done
4461 fi
4462 AC_SUBST(CONF_FILES)
4463])dnl
4464
4465AC_DEFUN([KDE_SET_PREFIX],
4466[
4467 unset CDPATH
4468 dnl make $KDEDIR the default for the installation
4469 AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
4470
4471 if test "x$prefix" = "xNONE"; then
4472 prefix=$ac_default_prefix
4473 ac_configure_args="$ac_configure_args --prefix=$prefix"
4474 fi
4475 # And delete superfluous '/' to make compares easier
4476 prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
4477 exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
4478 KDE_FAST_CONFIGURE
4479 KDE_CONF_FILES
4480])
4481
4482pushdef([AC_PROG_INSTALL],
4483[
4484 dnl our own version, testing for a -p flag
4485 popdef([AC_PROG_INSTALL])
4486 dnl as AC_PROG_INSTALL works as it works we first have
4487 dnl to save if the user didn't specify INSTALL, as the
4488 dnl autoconf one overwrites INSTALL and we have no chance to find
4489 dnl out afterwards
4490 test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL
4491 test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM
4492 test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT
4493 AC_PROG_INSTALL
4494
4495 if test -z "$kde_save_INSTALL_given" ; then
4496 # OK, user hasn't given any INSTALL, autoconf found one for us
4497 # now we test, if it supports the -p flag
4498 AC_MSG_CHECKING(for -p flag to install)
4499 rm -f confinst.$$.* > /dev/null 2>&1
4500 echo "Testtest" > confinst.$$.orig
4501 ac_res=no
4502 if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
4503 if test -f confinst.$$.new ; then
4504 # OK, -p seems to do no harm to install
4505 INSTALL="${INSTALL} -p"
4506 ac_res=yes
4507 fi
4508 fi
4509 rm -f confinst.$$.*
4510 AC_MSG_RESULT($ac_res)
4511 fi
4512 dnl the following tries to resolve some signs and wonders coming up
4513 dnl with different autoconf/automake versions
4514 dnl e.g.:
4515 dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
4516 dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
4517 dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
4518 dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
4519 dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
4520 dnl install-@DIR@PROGRAMS targets to explicitly use that flag
4521 dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
4522 dnl INSTALL_SCRIPT, which breaks with automake <= 1.4
4523 dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure
4524 dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from
4525 dnl automake (due to broken Makefile.am or whatever) to install programs,
4526 dnl and so does not see the -s flag in automake > 1.4
4527 dnl to clean up that mess we:
4528 dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
4529 dnl which cleans KDE's program with automake > 1.4;
4530 dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
4531 dnl with automake<=1.4
4532 dnl note that dues to this sometimes two '-s' flags are used (if KDE
4533 dnl properly uses install-@DIR@PROGRAMS, but I don't care
4534 dnl
4535 dnl And to all this comes, that I even can't write in comments variable
4536 dnl names used by automake, because it is so stupid to think I wanted to
4537 dnl _use_ them, therefor I have written A_M_... instead of AM_
4538 dnl hmm, I wanted to say something ... ahh yes: Arghhh.
4539
4540 if test -z "$kde_save_INSTALL_PROGRAM_given" ; then
4541 INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
4542 fi
4543 if test -z "$kde_save_INSTALL_SCRIPT_given" ; then
4544 INSTALL_SCRIPT='${INSTALL}'
4545 fi
4546])dnl
4547
4548AC_DEFUN([KDE_LANG_CPLUSPLUS],
4549[AC_LANG_CPLUSPLUS
4550ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
4551pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
4552])
4553
4554pushdef([AC_LANG_CPLUSPLUS],
4555[popdef([AC_LANG_CPLUSPLUS])
4556KDE_LANG_CPLUSPLUS
4557])
4558
4559AC_DEFUN([KDE_CHECK_LONG_LONG],
4560[
4561AC_MSG_CHECKING(for long long)
4562AC_CACHE_VAL(kde_cv_c_long_long,
4563[
4564 AC_LANG_SAVE
4565 AC_LANG_CPLUSPLUS
4566 AC_TRY_LINK([], [
4567 long long foo = 0;
4568 foo = foo+1;
4569 ],
4570 kde_cv_c_long_long=yes, kde_cv_c_long_long=no)
4571 AC_LANG_RESTORE
4572])
4573AC_MSG_RESULT($kde_cv_c_long_long)
4574if test "$kde_cv_c_long_long" = yes; then
4575 AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype])
4576fi
4577])
4578
4579AC_DEFUN([KDE_CHECK_LIB],
4580[
4581 kde_save_LDFLAGS="$LDFLAGS"
4582 dnl AC_CHECK_LIB modifies LIBS, so save it here
4583 kde_save_LIBS="$LIBS"
4584 LDFLAGS="$LDFLAGS $all_libraries"
4585 case $host_os in
4586 aix*) LDFLAGS="-brtl $LDFLAGS"
4587 test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS"
4588 ;;
4589 esac
4590 AC_CHECK_LIB($1, $2, $3, $4, $5)
4591 LDFLAGS="$kde_save_LDFLAGS"
4592 LIBS="$kde_save_LIBS"
4593])
4594
4595AC_DEFUN([KDE_JAVA_PREFIX],
4596[
4597 dir=`dirname "$1"`
4598 base=`basename "$1"`
4599 list=`ls -1 $dir 2> /dev/null`
4600 for entry in $list; do
4601 if test -d $dir/$entry/bin; then
4602 case $entry in
4603 $base)
4604 javadirs="$javadirs $dir/$entry/bin"
4605 ;;
4606 esac
4607 elif test -d $dir/$entry/jre/bin; then
4608 case $entry in
4609 $base)
4610 javadirs="$javadirs $dir/$entry/jre/bin"
4611 ;;
4612 esac
4613 fi
4614 done
4615])
4616
4617dnl KDE_CHEC_JAVA_DIR(onlyjre)
4618AC_DEFUN([KDE_CHECK_JAVA_DIR],
4619[
4620
4621AC_ARG_WITH(java,
4622AC_HELP_STRING([--with-java=javadir],[use java installed in javadir, --without-java disables]),
4623[ ac_java_dir=$withval
4624], ac_java_dir=""
4625)
4626
4627AC_MSG_CHECKING([for Java])
4628
4629dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH
4630if test "x$ac_java_dir" = "xno"; then
4631 kde_java_bindir=no
4632 kde_java_includedir=no
4633 kde_java_libjvmdir=no
4634 kde_java_libgcjdir=no
4635 kde_java_libhpidir=no
4636else
4637 if test "x$ac_java_dir" = "x"; then
4638
4639
4640 dnl No option set -> collect list of candidate paths
4641 if test -n "$JAVA_HOME"; then
4642 KDE_JAVA_PREFIX($JAVA_HOME)
4643 fi
4644 KDE_JAVA_PREFIX(/usr/j2se)
4645 KDE_JAVA_PREFIX(/usr/lib/j2se)
4646 KDE_JAVA_PREFIX(/usr/j*dk*)
4647 KDE_JAVA_PREFIX(/usr/lib/j*dk*)
4648 KDE_JAVA_PREFIX(/opt/j*sdk*)
4649 KDE_JAVA_PREFIX(/usr/lib/java*)
4650 KDE_JAVA_PREFIX(/usr/java*)
4651 KDE_JAVA_PREFIX(/usr/java/j*dk*)
4652 KDE_JAVA_PREFIX(/usr/java/j*re*)
4653 KDE_JAVA_PREFIX(/usr/lib/SunJava2*)
4654 KDE_JAVA_PREFIX(/usr/lib/SunJava*)
4655 KDE_JAVA_PREFIX(/usr/lib/IBMJava2*)
4656 KDE_JAVA_PREFIX(/usr/lib/IBMJava*)
4657 KDE_JAVA_PREFIX(/opt/java*)
4658
4659 kde_cv_path="NONE"
4660 kde_save_IFS=$IFS
4661 IFS=':'
4662 for dir in $PATH; do
4663 if test -d "$dir"; then
4664 javadirs="$javadirs $dir"
4665 fi
4666 done
4667 IFS=$kde_save_IFS
4668 jredirs=
4669
4670 dnl Now javadirs contains a list of paths that exist, all ending with bin/
4671 for dir in $javadirs; do
4672 dnl Check for the java executable
4673 if test -x "$dir/java"; then
4674 dnl And also check for a libjvm.so somewhere under there
4675 dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big.
4676 if test "$dir" != "/usr/bin"; then
4677 libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
4678 if test ! -f $libjvmdir/libjvm.so; then continue; fi
4679 jredirs="$jredirs $dir"
4680 fi
4681 fi
4682 done
4683
4684 dnl Now jredirs contains a reduced list, of paths where both java and ../**/libjvm.so was found
4685 JAVAC=
4686 JAVA=
4687 kde_java_bindir=no
4688 for dir in $jredirs; do
4689 JAVA="$dir/java"
4690 kde_java_bindir=$dir
4691 if test -x "$dir/javac"; then
4692 JAVAC="$dir/javac"
4693 break
4694 fi
4695 done
4696
4697 if test -n "$JAVAC"; then
4698 dnl this substitution might not work - well, we test for jni.h below
4699 kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'`
4700 else
4701 kde_java_includedir=no
4702 fi
4703 else
4704 dnl config option set
4705 kde_java_bindir=$ac_java_dir/bin
4706 if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then
4707 kde_java_includedir=no
4708 else
4709 kde_java_includedir=$ac_java_dir/include
4710 fi
4711 fi
4712fi
4713
4714dnl At this point kde_java_bindir and kde_java_includedir are either set or "no"
4715if test "x$kde_java_bindir" != "xno"; then
4716
4717 dnl Look for libjvm.so
4718 kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
4719 dnl Look for libgcj.so
4720 kde_java_libgcjdir=`find $kde_java_bindir/.. -name libgcj.so | sed 's,libgcj.so,,'|head -n 1`
4721 dnl Look for libhpi.so and avoid green threads
4722 kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1`
4723
4724 dnl Now check everything's fine under there
4725 dnl the include dir is our flag for having the JDK
4726 if test -d "$kde_java_includedir"; then
4727 if test ! -x "$kde_java_bindir/javac"; then
4728 AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.])
4729 fi
4730 if test ! -x "$kde_java_bindir/javah"; then
4731 AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
4732 fi
4733 if test ! -x "$kde_java_bindir/jar"; then
4734 AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
4735 fi
4736 if test ! -r "$kde_java_includedir/jni.h"; then
4737 AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.])
4738 fi
4739
4740 jni_includes="-I$kde_java_includedir"
4741 dnl Strange thing, jni.h requires jni_md.h which is under genunix here..
4742 dnl and under linux here..
4743
4744 dnl not needed for gcj
4745
4746 if test "x$kde_java_libgcjdir" = "x"; then
4747 test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux"
4748 test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris"
4749 test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix"
4750 fi
4751
4752 else
4753 JAVAC=
4754 jni_includes=
4755 fi
4756
4757 if test "x$kde_java_libgcjdir" = "x"; then
4758 if test ! -r "$kde_java_libjvmdir/libjvm.so"; then
4759 AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.])
4760 fi
4761 else
4762 if test ! -r "$kde_java_libgcjdir/libgcj.so"; then
4763 AC_MSG_ERROR([libgcj.so not found under $kde_java_libgcjdir. Use --without-java.])
4764 fi
4765 fi
4766
4767 if test ! -x "$kde_java_bindir/java"; then
4768 AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
4769 fi
4770
4771 dnl not needed for gcj compile
4772
4773 if test "x$kde_java_libgcjdir" = "x"; then
4774 if test ! -r "$kde_java_libhpidir/libhpi.so"; then
4775 AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.])
4776 fi
4777 fi
4778
4779 if test -n "$jni_includes"; then
4780 dnl Check for JNI version
4781 AC_LANG_SAVE
4782 AC_LANG_CPLUSPLUS
4783 ac_cxxflags_safe="$CXXFLAGS"
4784 CXXFLAGS="$CXXFLAGS $all_includes $jni_includes"
4785
4786 AC_TRY_COMPILE([
4787 #include <jni.h>
4788 ],
4789 [
4790 #ifndef JNI_VERSION_1_2
4791 Syntax Error
4792 #endif
4793 ],[ kde_jni_works=yes ],
4794 [ kde_jni_works=no ])
4795
4796 if test $kde_jni_works = no; then
4797 AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h.
4798 You need to have Java Development Kit (JDK) version 1.2.
4799
4800 Use --with-java to specify another location.
4801 Use --without-java to configure without java support.
4802 Or download a newer JDK and try again.
4803 See e.g. http://java.sun.com/products/jdk/1.2 ])
4804 fi
4805
4806 CXXFLAGS="$ac_cxxflags_safe"
4807 AC_LANG_RESTORE
4808
4809 dnl All tests ok, inform and subst the variables
4810
4811 JAVAC=$kde_java_bindir/javac
4812 JAVAH=$kde_java_bindir/javah
4813 JAR=$kde_java_bindir/jar
4814 AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
4815 if test "x$kde_java_libgcjdir" = "x"; then
4816 JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi"
4817 else
4818 JVMLIBS="-L$kde_java_libgcjdir -lgcj"
4819 fi
4820 AC_MSG_RESULT([java JDK in $kde_java_bindir])
4821
4822 else
4823 AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
4824 AC_MSG_RESULT([java JRE in $kde_java_bindir])
4825 fi
4826elif test -d "/Library/Java/Home"; then
4827 kde_java_bindir="/Library/Java/Home/bin"
4828 jni_includes="-I/Library/Java/Home/include"
4829
4830 JAVAC=$kde_java_bindir/javac
4831 JAVAH=$kde_java_bindir/javah
4832 JAR=$kde_java_bindir/jar
4833 JVMLIBS="-Xlinker -framework -Xlinker JavaVM"
4834
4835 AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
4836 AC_MSG_RESULT([Apple Java Framework])
4837else
4838 AC_MSG_RESULT([none found])
4839fi
4840
4841AC_SUBST(JAVAC)
4842AC_SUBST(JAVAH)
4843AC_SUBST(JAR)
4844AC_SUBST(JVMLIBS)
4845AC_SUBST(jni_includes)
4846
4847# for backward compat
4848kde_cv_java_includedir=$kde_java_includedir
4849kde_cv_java_bindir=$kde_java_bindir
4850])
4851
4852dnl this is a redefinition of autoconf 2.5x's AC_FOREACH.
4853dnl When the argument list becomes big, as in KDE for AC_OUTPUT in
4854dnl big packages, m4_foreach is dog-slow. So use our own version of
4855dnl it. (matz@kde.org)
4856m4_define([mm_foreach],
4857[m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])])
4858m4_define([mm_car], [[$1]])
4859m4_define([mm_car2], [[$@]])
4860m4_define([_mm_foreach],
4861[m4_if(m4_quote($2), [], [],
4862 [m4_define([$1], mm_car($2))$3[]_mm_foreach([$1],
4863 mm_car2(m4_shift($2)),
4864 [$3])])])
4865m4_define([AC_FOREACH],
4866[mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])])
4867
4868AC_DEFUN([KDE_NEED_FLEX],
4869[
4870kde_libs_safe=$LIBS
4871LIBS="$LIBS $USER_LDFLAGS"
4872AM_PROG_LEX
4873LIBS=$kde_libs_safe
4874if test -z "$LEXLIB"; then
4875 AC_MSG_ERROR([You need to have flex installed.])
4876fi
4877AC_SUBST(LEXLIB)
4878])
4879
4880AC_DEFUN([AC_PATH_QTOPIA],
4881[
4882 dnl TODO: use AC_CACHE_VAL
4883
4884 if test -z "$1"; then
4885 qtopia_minver_maj=1
4886 qtopia_minver_min=5
4887 qtopia_minver_pat=0
4888 else
4889 qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"`
4890 qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"`
4891 qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"`
4892 fi
4893
4894 qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat"
4895 qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat"
4896
4897 AC_REQUIRE([AC_PATH_QT])
4898
4899 AC_MSG_CHECKING([for Qtopia])
4900
4901 LIB_QTOPIA="-lqpe"
4902 AC_SUBST(LIB_QTOPIA)
4903
4904 kde_qtopia_dirs="$QPEDIR /opt/Qtopia"
4905
4906 ac_qtopia_incdir=NO
4907
4908 AC_ARG_WITH(qtopia-dir,
4909 AC_HELP_STRING([--with-qtopia-dir=DIR],[where the root of Qtopia is installed]),
4910 [ ac_qtopia_incdir="$withval"/include] )
4911
4912 qtopia_incdirs=""
4913 for dir in $kde_qtopia_dirs; do
4914 qtopia_incdirs="$qtopia_incdirs $dir/include"
4915 done
4916
4917 if test ! "$ac_qtopia_incdir" = "NO"; then
4918 qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs"
4919 fi
4920
4921 qtopia_incdir=""
4922 AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir)
4923 ac_qtopia_incdir="$qtopia_incdir"
4924
4925 if test -z "$qtopia_incdir"; then
4926 AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.])
4927 fi
4928
4929 qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`;
4930 qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`;
4931 qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`;
4932
4933 qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat"
4934 qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat"
4935 if test "$qtopia_ver" -lt "$qtopia_minver"; then
4936 AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr
4937is required.])
4938 fi
4939
4940 AC_LANG_SAVE
4941 AC_LANG_CPLUSPLUS
4942
4943 ac_cxxflags_safe="$CXXFLAGS"
4944 ac_ldflags_safe="$LDFLAGS"
4945 ac_libs_safe="$LIBS"
4946
4947 CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes"
4948 LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
4949 LIBS="$LIBS $LIB_QTOPIA $LIBQT"
4950
4951 cat > conftest.$ac_ext <<EOF
4952#include "confdefs.h"
4953#include <qpe/qpeapplication.h>
4954#include <qpe/version.h>
4955
4956int main( int argc, char **argv )
4957{
4958 QPEApplication app( argc, argv );
4959 return 0;
4960}
4961EOF
4962
4963 if AC_TRY_EVAL(ac_link) && test -s conftest; then
4964 rm -f conftest*
4965 else
4966 rm -f conftest*
4967 AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at
4968the end of config.log])
4969 fi
4970
4971 CXXFLAGS="$ac_cxxflags_safe"
4972 LDFLAGS="$ac_ldflags_safe"
4973 LIBS="$ac_libs_safe"
4974
4975 AC_LANG_RESTORE
4976
4977 QTOPIA_INCLUDES="-I$qtopia_incdir"
4978 AC_SUBST(QTOPIA_INCLUDES)
4979
4980 AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir])
4981])
4982
4983
4984AC_DEFUN([KDE_INIT_DOXYGEN],
4985[
4986AC_MSG_CHECKING([for Qt docs])
4987kde_qtdir=
4988if test "${with_qt_dir+set}" = set; then
4989 kde_qtdir="$with_qt_dir"
4990fi
4991
4992AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR)
4993AC_MSG_RESULT($QTDOCDIR)
4994
4995AC_SUBST(QTDOCDIR)
4996
4997KDE_FIND_PATH(dot, DOT, [], [])
4998if test -n "$DOT"; then
4999 KDE_HAVE_DOT="YES"
5000else
5001 KDE_HAVE_DOT="NO"
5002fi
5003AC_SUBST(KDE_HAVE_DOT)
5004KDE_FIND_PATH(doxygen, DOXYGEN, [], [])
5005AC_SUBST(DOXYGEN)
5006
5007DOXYGEN_PROJECT_NAME="$1"
5008DOXYGEN_PROJECT_NUMBER="$2"
5009AC_SUBST(DOXYGEN_PROJECT_NAME)
5010AC_SUBST(DOXYGEN_PROJECT_NUMBER)
5011
5012KDE_HAS_DOXYGEN=no
5013if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then
5014 KDE_HAS_DOXYGEN=yes
5015fi
5016AC_SUBST(KDE_HAS_DOXYGEN)
5017
5018])
5019
5020
5021AC_DEFUN([AC_FIND_BZIP2],
5022[
5023AC_MSG_CHECKING([for bzDecompress in libbz2])
5024AC_CACHE_VAL(ac_cv_lib_bzip2,
5025[
5026AC_LANG_SAVE
5027AC_LANG_CPLUSPLUS
5028kde_save_LIBS="$LIBS"
5029LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET"
5030kde_save_CXXFLAGS="$CXXFLAGS"
5031CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
5032AC_TRY_LINK(dnl
5033[
5034#define BZ_NO_STDIO
5035#include<bzlib.h>
5036],
5037 [ bz_stream s; (void) bzDecompress(&s); ],
5038 eval "ac_cv_lib_bzip2='-lbz2'",
5039 eval "ac_cv_lib_bzip2=no")
5040LIBS="$kde_save_LIBS"
5041CXXFLAGS="$kde_save_CXXFLAGS"
5042AC_LANG_RESTORE
5043])dnl
5044AC_MSG_RESULT($ac_cv_lib_bzip2)
5045
5046if test ! "$ac_cv_lib_bzip2" = no; then
5047 BZIP2DIR=bzip2
5048
5049 LIBBZ2="$ac_cv_lib_bzip2"
5050 AC_SUBST(LIBBZ2)
5051
5052else
5053
5054 cxx_shared_flag=
5055 ld_shared_flag=
5056 KDE_CHECK_COMPILER_FLAG(shared, [
5057 ld_shared_flag="-shared"
5058 ])
5059 KDE_CHECK_COMPILER_FLAG(fPIC, [
5060 cxx_shared_flag="-fPIC"
5061 ])
5062
5063 AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2])
5064 AC_CACHE_VAL(ac_cv_lib_bzip2_prefix,
5065 [
5066 AC_LANG_SAVE
5067 AC_LANG_CPLUSPLUS
5068 kde_save_LIBS="$LIBS"
5069 LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET"
5070 kde_save_CXXFLAGS="$CXXFLAGS"
5071 CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES"
5072
5073 AC_TRY_LINK(dnl
5074 [
5075 #define BZ_NO_STDIO
5076 #include<bzlib.h>
5077 ],
5078 [ bz_stream s; (void) BZ2_bzDecompress(&s); ],
5079 eval "ac_cv_lib_bzip2_prefix='-lbz2'",
5080 eval "ac_cv_lib_bzip2_prefix=no")
5081 LIBS="$kde_save_LIBS"
5082 CXXFLAGS="$kde_save_CXXFLAGS"
5083 AC_LANG_RESTORE
5084 ])dnl
5085
5086 AC_MSG_RESULT($ac_cv_lib_bzip2_prefix)
5087
5088 if test ! "$ac_cv_lib_bzip2_prefix" = no; then
5089 BZIP2DIR=bzip2
5090
5091 LIBBZ2="$ac_cv_lib_bzip2_prefix"
5092 AC_SUBST(LIBBZ2)
5093
5094 AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix])
5095 dnl else, we just ignore this
5096 fi
5097
5098fi
5099AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR")
5100])
5101
5102dnl ------------------------------------------------------------------------
5103dnl Try to find the SSL headers and libraries.
5104dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed)
5105dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed)
5106dnl ------------------------------------------------------------------------
5107dnl
5108AC_DEFUN([KDE_CHECK_SSL],
5109[
5110LIBSSL="-lssl -lcrypto"
5111AC_REQUIRE([KDE_CHECK_LIB64])
5112
5113ac_ssl_includes=NO ac_ssl_libraries=NO
5114ssl_libraries=""
5115ssl_includes=""
5116AC_ARG_WITH(ssl-dir,
5117 AC_HELP_STRING([--with-ssl-dir=DIR],[where the root of OpenSSL is installed]),
5118 [ ac_ssl_includes="$withval"/include
5119 ac_ssl_libraries="$withval"/lib$kdelibsuff
5120 ])
5121
5122want_ssl=yes
5123AC_ARG_WITH(ssl,
5124 AC_HELP_STRING([--without-ssl],[disable SSL checks]),
5125 [want_ssl=$withval])
5126
5127if test $want_ssl = yes; then
5128
5129AC_MSG_CHECKING(for OpenSSL)
5130
5131AC_CACHE_VAL(ac_cv_have_ssl,
5132[#try to guess OpenSSL locations
5133
5134 ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes"
5135 ssl_incdirs="$ac_ssl_includes $ssl_incdirs"
5136 AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir)
5137 ac_ssl_includes="$ssl_incdir"
5138
5139 ssl_libdirs="/usr/lib$kdelibsuff /usr/local/lib$kdelibsuff /usr/ssl/lib$kdelibsuff /usr/local/ssl/lib$kdelibsuff $libdir $prefix/lib$kdelibsuff $exec_prefix/lib$kdelibsuff $kde_extra_libs"
5140 if test ! "$ac_ssl_libraries" = "NO"; then
5141 ssl_libdirs="$ac_ssl_libraries $ssl_libdirs"
5142 fi
5143
5144 test=NONE
5145 ssl_libdir=NONE
5146 for dir in $ssl_libdirs; do
5147 try="ls -1 $dir/libssl*"
5148 if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
5149 done
5150
5151 ac_ssl_libraries="$ssl_libdir"
5152
5153 ac_ldflags_safe="$LDFLAGS"
5154 ac_libs_safe="$LIBS"
5155
5156 LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries"
5157 LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref"
5158
5159 AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();,
5160 ac_ssl_rsaref="yes"
5161 ,
5162 ac_ssl_rsaref="no"
5163 )
5164
5165 LDFLAGS="$ac_ldflags_safe"
5166 LIBS="$ac_libs_safe"
5167
5168 if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then
5169 have_ssl=no
5170 else
5171 have_ssl=yes;
5172 fi
5173
5174 ])
5175
5176 eval "$ac_cv_have_ssl"
5177
5178 AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes])
5179
5180 AC_MSG_CHECKING([whether OpenSSL uses rsaref])
5181 AC_MSG_RESULT($ac_ssl_rsaref)
5182
5183 AC_MSG_CHECKING([for easter eggs])
5184 AC_MSG_RESULT([none found])
5185
5186else
5187 have_ssl=no
5188fi
5189
5190if test "$have_ssl" = yes; then
5191 AC_MSG_CHECKING(for OpenSSL version)
5192 dnl Check for SSL version
5193 AC_CACHE_VAL(ac_cv_ssl_version,
5194 [
5195
5196 cat >conftest.$ac_ext <<EOF
5197#include <openssl/opensslv.h>
5198#include <stdio.h>
5199 int main() {
5200
5201#ifndef OPENSSL_VERSION_NUMBER
5202 printf("ssl_version=\\"error\\"\n");
5203#else
5204 if (OPENSSL_VERSION_NUMBER < 0x00906000)
5205 printf("ssl_version=\\"old\\"\n");
5206 else
5207 printf("ssl_version=\\"ok\\"\n");
5208#endif
5209 return (0);
5210 }
5211EOF
5212
5213 ac_save_CPPFLAGS=$CPPFLAGS
5214 if test "$ac_ssl_includes" != "/usr/include"; then
5215 CPPFLAGS="$CPPFLAGS -I$ac_ssl_includes"
5216 fi
5217
5218 if AC_TRY_EVAL(ac_link); then
5219
5220 if eval `./conftest 2>&5`; then
5221 if test $ssl_version = error; then
5222 AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !])
5223 else
5224 if test $ssl_version = old; then
5225 AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.])
5226 have_ssl=no
5227 fi
5228 fi
5229 ac_cv_ssl_version="ssl_version=$ssl_version"
5230 else
5231 AC_MSG_ERROR([Your system couldn't run a small SSL test program.
5232 Check config.log, and if you can't figure it out, send a mail to
5233 David Faure <faure@kde.org>, attaching your config.log])
5234 fi
5235
5236 else
5237 AC_MSG_ERROR([Your system couldn't link a small SSL test program.
5238 Check config.log, and if you can't figure it out, send a mail to
5239 David Faure <faure@kde.org>, attaching your config.log])
5240 fi
5241 CPPFLAGS=$ac_save_CPPFLAGS
5242
5243 ])
5244
5245 eval "$ac_cv_ssl_version"
5246 AC_MSG_RESULT($ssl_version)
5247fi
5248
5249if test "$have_ssl" != yes; then
5250 LIBSSL="";
5251else
5252 AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL])
5253 ac_cv_have_ssl="have_ssl=yes \
5254 ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref"
5255
5256
5257 ssl_libraries="$ac_ssl_libraries"
5258 ssl_includes="$ac_ssl_includes"
5259
5260 if test "$ac_ssl_rsaref" = yes; then
5261 LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref"
5262 fi
5263
5264 if test $ssl_version = "old"; then
5265 AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6])
5266 fi
5267fi
5268
5269SSL_INCLUDES=
5270
5271if test "$ssl_includes" = "/usr/include"; then
5272 if test -f /usr/kerberos/include/krb5.h; then
5273 SSL_INCLUDES="-I/usr/kerberos/include"
5274 fi
5275elif test "$ssl_includes" != "/usr/local/include" && test -n "$ssl_includes"; then
5276 SSL_INCLUDES="-I$ssl_includes"
5277fi
5278
5279if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries" || test "$ssl_libraries" = "NONE"; then
5280 SSL_LDFLAGS=""
5281else
5282 SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries"
5283fi
5284
5285AC_SUBST(SSL_INCLUDES)
5286AC_SUBST(SSL_LDFLAGS)
5287AC_SUBST(LIBSSL)
5288])
5289
5290AC_DEFUN([KDE_CHECK_STRLCPY],
5291[
5292 AC_REQUIRE([AC_CHECK_STRLCAT])
5293 AC_REQUIRE([AC_CHECK_STRLCPY])
5294 AC_CHECK_SIZEOF(size_t)
5295 AC_CHECK_SIZEOF(unsigned long)
5296
5297 AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long])
5298 AC_TRY_COMPILE(,[
5299 #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG
5300 choke me
5301 #endif
5302 ],AC_MSG_RESULT([yes]),[
5303 AC_MSG_RESULT(no)
5304 AC_MSG_ERROR([
5305 Apparently on your system our assumption sizeof size_t == sizeof unsigned long
5306 does not apply. Please mail kde-devel@kde.org with a description of your system!
5307 ])
5308 ])
5309])
5310
5311AC_DEFUN([KDE_CHECK_BINUTILS],
5312[
5313 AC_MSG_CHECKING([if ld supports unversioned version maps])
5314
5315 kde_save_LDFLAGS="$LDFLAGS"
5316 LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
5317 echo "{ local: extern \"C++\" { foo }; };" > conftest.map
5318 AC_TRY_LINK([int foo;],
5319[
5320#ifdef __INTEL_COMPILER
5321icc apparently does not support libtools version-info and version-script
5322at the same time. Dunno where the bug is, but until somebody figured out,
5323better disable the optional version scripts.
5324#endif
5325
5326 foo = 42;
5327], kde_supports_versionmaps=yes, kde_supports_versionmaps=no)
5328 LDFLAGS="$kde_save_LDFLAGS"
5329 rm -f conftest.map
5330 AM_CONDITIONAL(include_VERSION_SCRIPT,
5331 [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"])
5332
5333 AC_MSG_RESULT($kde_supports_versionmaps)
5334])
5335
5336AC_DEFUN([AM_PROG_OBJC],[
5337AC_CHECK_PROGS(OBJC, gcc, gcc)
5338test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH])
5339if test "x${OBJCFLAGS-unset}" = xunset; then
5340 OBJCFLAGS="-g -O2"
5341fi
5342AC_SUBST(OBJCFLAGS)
5343_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)])
5344])
5345
5346AC_DEFUN([KDE_CHECK_PERL],
5347[
5348 KDE_FIND_PATH(perl, PERL, [$bindir $exec_prefix/bin $prefix/bin], [
5349 AC_MSG_ERROR([No Perl found in your $PATH.
5350We need perl to generate some code.])
5351 ])
5352 AC_SUBST(PERL)
5353])
Note: See TracBrowser for help on using the repository browser.