source: trunk/MagicSoft/AMC/activemirrorcontrol/admin/acinclude.m4.in@ 9029

Last change on this file since 9029 was 3403, checked in by merck, 21 years ago
initial check-in of AMC software
File size: 102.2 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. If you decide that you
25dnl really want to modify it, contact coolo@kde.org mentioning that you have
26dnl and that the modified file should be committed to every module.
27dnl
28dnl Single-module modifications are best placed in configure.in for kdelibs
29dnl and kdebase or configure.in.in if present.
30
31
32dnl ------------------------------------------------------------------------
33dnl Find a file (or one of more files in a list of dirs)
34dnl ------------------------------------------------------------------------
35dnl
36AC_DEFUN(AC_FIND_FILE,
37[
38$3=NO
39for i in $2;
40do
41 for j in $1;
42 do
43 if test -r "$i/$j"; then
44 $3=$i
45 break 2
46 fi
47 done
48done
49])
50
51dnl KDE_FIND_PATH(programm-name, variable-name, list of directories,
52dnl if-not-found, test-parameter)
53AC_DEFUN(KDE_FIND_PATH,
54[
55 AC_MSG_CHECKING([for $1])
56 if test -n "$$2"; then
57 kde_cv_path="$$2";
58 else
59 kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
60
61 AC_CACHE_VAL(kde_cv_path_$kde_cache,
62 [
63 kde_cv_path="NONE"
64 dirs="$3"
65 kde_save_IFS=$IFS
66 IFS=':'
67 for dir in $PATH; do
68 dirs="$dirs $dir"
69 done
70 IFS=$kde_save_IFS
71
72 for dir in $dirs; do
73 if test -x "$dir/$1"; then
74 if test -n "$5"
75 then
76 evalstr="$dir/$1 $5 2>&1 "
77 if eval $evalstr; then
78 kde_cv_path="$dir/$1"
79 break
80 fi
81 else
82 kde_cv_path="$dir/$1"
83 break
84 fi
85 fi
86 done
87
88 eval "kde_cv_path_$kde_cache=$kde_cv_path"
89
90 ])
91
92 eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
93
94 fi
95
96 if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
97 AC_MSG_RESULT(not found)
98 $4
99 else
100 AC_MSG_RESULT($kde_cv_path)
101 $2=$kde_cv_path
102
103 fi
104])
105
106AC_DEFUN(KDE_MOC_ERROR_MESSAGE,
107[
108 AC_MSG_ERROR([No Qt meta object compiler (moc) found!
109Please check whether you installed Qt correctly.
110You need to have a running moc binary.
111configure tried to run $ac_cv_path_moc and the test didn't
112succeed. If configure shouldn't have tried this one, set
113the environment variable MOC to the right one before running
114configure.
115])
116])
117
118AC_DEFUN(KDE_UIC_ERROR_MESSAGE,
119[
120 AC_MSG_WARN([No Qt ui compiler (uic) found!
121Please check whether you installed Qt correctly.
122You need to have a running uic binary.
123configure tried to run $ac_cv_path_uic and the test didn't
124succeed. If configure shouldn't have tried this one, set
125the environment variable UIC to the right one before running
126configure.
127])
128])
129
130dnl ------------------------------------------------------------------------
131dnl Find the meta object compiler and the ui compiler in the PATH,
132dnl in $QTDIR/bin, and some more usual places
133dnl ------------------------------------------------------------------------
134dnl
135AC_DEFUN(AC_PATH_QT_MOC_UIC,
136[
137 qt_bindirs=""
138 for dir in $kde_qt_dirs; do
139 qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc"
140 done
141 qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
142 if test ! "$ac_qt_bindir" = "NO"; then
143 qt_bindirs="$ac_qt_bindir $qt_bindirs"
144 fi
145
146 KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE])
147 KDE_FIND_PATH(uic, UIC, [$qt_bindirs], [UIC="" ; KDE_UIC_ERROR_MESSAGE])
148 if test -z "$UIC" ; then
149 if test -z "$UIC_NOT_NEEDED" ; then
150 exit 1
151 else
152 UIC="echo uic not available: "
153 fi
154 fi
155 AC_SUBST(MOC)
156 AC_SUBST(UIC)
157])
158
159AC_DEFUN(KDE_1_CHECK_PATHS,
160[
161 KDE_1_CHECK_PATH_HEADERS
162
163 KDE_TEST_RPATH=
164
165 if test -n "$USE_RPATH"; then
166
167 if test -n "$kde_libraries"; then
168 KDE_TEST_RPATH="-R $kde_libraries"
169 fi
170
171 if test -n "$qt_libraries"; then
172 KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries"
173 fi
174
175 if test -n "$x_libraries"; then
176 KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries"
177 fi
178
179 KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
180 fi
181
182AC_MSG_CHECKING([for KDE libraries installed])
183ac_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'
184
185if AC_TRY_EVAL(ac_link) && test -s conftest; then
186 AC_MSG_RESULT(yes)
187else
188 AC_MSG_ERROR([your system fails at linking a small KDE application!
189Check, if your compiler is installed correctly and if you have used the
190same compiler to compile Qt and kdelibs as you did use now.
191For more details about this problem, look at the end of config.log.])
192fi
193
194if eval `KDEDIR= ./conftest 2>&5`; then
195 kde_result=done
196else
197 kde_result=problems
198fi
199
200KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
201kde_have_all_paths=yes
202
203KDE_SET_PATHS($kde_result)
204
205])
206
207AC_DEFUN(KDE_SET_PATHS,
208[
209 kde_cv_all_paths="kde_have_all_paths=\"yes\" \
210 kde_htmldir=\"$kde_htmldir\" \
211 kde_appsdir=\"$kde_appsdir\" \
212 kde_icondir=\"$kde_icondir\" \
213 kde_sounddir=\"$kde_sounddir\" \
214 kde_datadir=\"$kde_datadir\" \
215 kde_locale=\"$kde_locale\" \
216 kde_cgidir=\"$kde_cgidir\" \
217 kde_confdir=\"$kde_confdir\" \
218 kde_mimedir=\"$kde_mimedir\" \
219 kde_toolbardir=\"$kde_toolbardir\" \
220 kde_wallpaperdir=\"$kde_wallpaperdir\" \
221 kde_templatesdir=\"$kde_templatesdir\" \
222 kde_bindir=\"$kde_bindir\" \
223 kde_servicesdir=\"$kde_servicesdir\" \
224 kde_servicetypesdir=\"$kde_servicetypesdir\" \
225 kde_moduledir=\"$kde_moduledir\" \
226 kde_result=$1"
227])
228
229AC_DEFUN(KDE_SET_DEFAULT_PATHS,
230[
231if test "$1" = "default"; then
232
233 if test -z "$kde_htmldir"; then
234 kde_htmldir='\${prefix}/share/doc/HTML'
235 fi
236 if test -z "$kde_appsdir"; then
237 kde_appsdir='\${prefix}/share/applnk'
238 fi
239 if test -z "$kde_icondir"; then
240 kde_icondir='\${prefix}/share/icons'
241 fi
242 if test -z "$kde_sounddir"; then
243 kde_sounddir='\${prefix}/share/sounds'
244 fi
245 if test -z "$kde_datadir"; then
246 kde_datadir='\${prefix}/share/apps'
247 fi
248 if test -z "$kde_locale"; then
249 kde_locale='\${prefix}/share/locale'
250 fi
251 if test -z "$kde_cgidir"; then
252 kde_cgidir='\${exec_prefix}/cgi-bin'
253 fi
254 if test -z "$kde_confdir"; then
255 kde_confdir='\${prefix}/share/config'
256 fi
257 if test -z "$kde_mimedir"; then
258 kde_mimedir='\${prefix}/share/mimelnk'
259 fi
260 if test -z "$kde_toolbardir"; then
261 kde_toolbardir='\${prefix}/share/toolbar'
262 fi
263 if test -z "$kde_wallpaperdir"; then
264 kde_wallpaperdir='\${prefix}/share/wallpapers'
265 fi
266 if test -z "$kde_templatesdir"; then
267 kde_templatesdir='\${prefix}/share/templates'
268 fi
269 if test -z "$kde_bindir"; then
270 kde_bindir='\${exec_prefix}/bin'
271 fi
272 if test -z "$kde_servicesdir"; then
273 kde_servicesdir='\${prefix}/share/services'
274 fi
275 if test -z "$kde_servicetypesdir"; then
276 kde_servicetypesdir='\${prefix}/share/servicetypes'
277 fi
278 if test -z "$kde_moduledir"; then
279 kde_moduledir='\${prefix}/lib/kde2'
280 fi
281
282 KDE_SET_PATHS(defaults)
283
284else
285
286 if test $kde_qtver = 1; then
287 AC_MSG_RESULT([compiling])
288 KDE_1_CHECK_PATHS
289 else
290 AC_MSG_ERROR([path checking not yet supported for KDE 2])
291 fi
292
293fi
294])
295
296AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS,
297[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
298 test -z "$kde_icondir" || test -z "$kde_sounddir" ||
299 test -z "$kde_datadir" || test -z "$kde_locale" ||
300 test -z "$kde_cgidir" || test -z "$kde_confdir" ||
301 test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
302 test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" ||
303 test -z "$kde_bindir" || test -z "$kde_servicesdir" ||
304 test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" ||
305 test "$kde_have_all_paths" != "yes"; then
306 kde_have_all_paths=no
307 fi
308])
309
310AC_DEFUN(KDE_MISSING_PROG_ERROR,
311[
312 AC_MSG_ERROR([The important program $1 was not found!
313Please check whether you installed KDE correctly.
314])
315])
316
317AC_DEFUN(KDE_SUBST_PROGRAMS,
318[AC_REQUIRE([AC_CREATE_KFSSTND])dnl
319
320 kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde2/bin /usr/kde/bin /usr/local/kde/bin"
321 if test -n "$KDEDIRS"; then
322 kde_save_IFS=$IFS
323 IFS=:
324 for dir in $KDEDIRS; do
325 kde_default_bindirs="$dir/bin $kde_default_bindirs "
326 done
327 IFS=$kde_save_IFS
328 fi
329 kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs"
330 KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)])
331 KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)])
332 KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(mcopidl)])
333 KDE_FIND_PATH(kdb2html, KDB2HTML, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kdb2html)])
334 KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(artsc-config)])
335 KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kde-config)])
336
337 DCOP_DEPENDENCIES='$(DCOPIDL)'
338 AC_SUBST(DCOPIDL)
339 AC_SUBST(DCOPIDL2CPP)
340 AC_SUBST(DCOP_DEPENDENCIES)
341 AC_SUBST(MCOPIDL)
342 AC_SUBST(KDB2HTML)
343 AC_SUBST(ARTSCCONFIG)
344 AC_SUBST(KDECONFIG)
345
346 if test -x "$KDECONFIG"; then # it can be "compiled"
347 kde_libs_prefix=`$KDECONFIG --prefix`
348 if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
349 AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs.
350 This means it has been moved since you installed it.
351 This won't work. Please recompile kdelibs for the new prefix.
352 ])
353 fi
354 kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
355 else
356 kde_libs_prefix='$(prefix)'
357 kde_libs_htmldir='$(kde_htmldir)'
358 fi
359 AC_SUBST(kde_libs_prefix)
360 AC_SUBST(kde_libs_htmldir)
361])dnl
362
363AC_DEFUN(AC_CREATE_KFSSTND,
364[
365AC_REQUIRE([AC_CHECK_RPATH])
366
367AC_MSG_CHECKING([for KDE paths])
368kde_result=""
369kde_cached_paths=yes
370AC_CACHE_VAL(kde_cv_all_paths,
371[
372 KDE_SET_DEFAULT_PATHS($1)
373 kde_cached_paths=no
374])
375eval "$kde_cv_all_paths"
376KDE_CHECK_PATHS_FOR_COMPLETENESS
377if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then
378 # wrong values were cached, may be, we can set better ones
379 kde_result=
380 kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir=
381 kde_datadir= kde_locale= kde_cgidir= kde_confdir=
382 kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir=
383 kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir=
384 kde_have_all_paths=
385 KDE_SET_DEFAULT_PATHS($1)
386 eval "$kde_cv_all_paths"
387 KDE_CHECK_PATHS_FOR_COMPLETENESS
388 kde_result="$kde_result (cache overridden)"
389fi
390if test "$kde_have_all_paths" = "no"; then
391 AC_MSG_ERROR([configure could not run a little KDE program to test the environment.
392Since it had compiled and linked before, it must be a strange problem on your system.
393Look at config.log for details. If you are not able to fix this, look at
394http://www.kde.org/faq/installation.html or any www.kde.org mirror.
395(If you're using an egcs version on Linux, you may update binutils!)
396])
397else
398 rm -f conftest*
399 AC_MSG_RESULT($kde_result)
400fi
401
402bindir=$kde_bindir
403
404KDE_SUBST_PROGRAMS
405
406])
407
408AC_DEFUN(AC_SUBST_KFSSTND,
409[
410AC_SUBST(kde_htmldir)
411AC_SUBST(kde_appsdir)
412AC_SUBST(kde_icondir)
413AC_SUBST(kde_sounddir)
414AC_SUBST(kde_datadir)
415AC_SUBST(kde_locale)
416AC_SUBST(kde_confdir)
417AC_SUBST(kde_mimedir)
418AC_SUBST(kde_wallpaperdir)
419AC_SUBST(kde_bindir)
420dnl for KDE 2
421AC_SUBST(kde_templatesdir)
422AC_SUBST(kde_servicesdir)
423AC_SUBST(kde_servicetypesdir)
424AC_SUBST(kde_moduledir)
425if test "$kde_qtver" = 1; then
426 kde_minidir="$kde_icondir/mini"
427else
428# for KDE 1 - this breaks KDE2 apps using minidir, but
429# that's the plan ;-/
430 kde_minidir="/dev/null"
431fi
432dnl AC_SUBST(kde_minidir)
433dnl AC_SUBST(kde_cgidir)
434dnl AC_SUBST(kde_toolbardir)
435])
436
437AC_DEFUN(KDE_MISC_TESTS,
438[
439 AC_LANG_C
440 dnl Checks for libraries.
441 AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
442 AC_SUBST(LIBCOMPAT)
443 kde_have_crypt=
444 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
445 AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
446 AC_MSG_WARN([you have no crypt in either libcrypt or libc.
447You should install libcrypt from another source or configure with PAM
448support])
449 kde_have_crypt=no
450 ]))
451 AC_SUBST(LIBCRYPT)
452 if test $kde_have_crypt = yes; then
453 AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
454 fi
455 AC_CHECK_KSIZE_T
456 AC_LANG_C
457 AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
458 if test $ac_cv_lib_dnet_dnet_ntoa = no; then
459 AC_CHECK_LIB(dnet_stub, dnet_ntoa,
460 [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
461 fi
462 AC_CHECK_FUNC(inet_ntoa)
463 if test $ac_cv_func_inet_ntoa = no; then
464 AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
465 fi
466 AC_CHECK_FUNC(connect)
467 if test $ac_cv_func_connect = no; then
468 AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
469 $X_EXTRA_LIBS)
470 fi
471
472 AC_CHECK_FUNC(remove)
473 if test $ac_cv_func_remove = no; then
474 AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
475 fi
476
477 # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
478 AC_CHECK_FUNC(shmat, ,
479 AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"))
480
481 # Solaris 2.6 needs -lresolv for res_init
482 AC_CHECK_FUNC(res_init, ,
483 AC_CHECK_LIB(resolv, res_init, X_EXTRA_LIBS="$X_EXTRA_LIBS -lresolv"))
484
485 LIBSOCKET="$X_EXTRA_LIBS"
486 AC_SUBST(LIBSOCKET)
487 AC_SUBST(X_EXTRA_LIBS)
488 AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
489 AC_SUBST(LIBUCB)
490
491 case $host in dnl this *is* LynxOS specific
492 *-*-lynxos* )
493 AC_MSG_CHECKING([LynxOS header file wrappers])
494 [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
495 AC_MSG_RESULT(disabled)
496 AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
497 ;;
498 esac
499
500 KDE_CHECK_TYPES
501 KDE_CHECK_LIBDL
502])
503
504dnl ------------------------------------------------------------------------
505dnl Find the header files and libraries for X-Windows. Extended the
506dnl macro AC_PATH_X
507dnl ------------------------------------------------------------------------
508dnl
509AC_DEFUN(K_PATH_X,
510[
511AC_REQUIRE([AC_PROG_CPP])dnl
512AC_REQUIRE([KDE_MISC_TESTS])dnl
513AC_MSG_CHECKING(for X)
514AC_LANG_SAVE
515AC_LANG_C
516AC_CACHE_VAL(kde_cv_have_x,
517[# One or both of the vars are not set, and there is no cached value.
518if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
519 kde_x_includes=NO
520else
521 kde_x_includes=$x_includes
522fi
523if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
524 kde_x_libraries=NO
525else
526 kde_x_libraries=$x_libraries
527fi
528
529# below we use the standard autoconf calls
530ac_x_libraries=$kde_x_libraries
531ac_x_includes=$kde_x_includes
532
533AC_PATH_X_DIRECT
534dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries.
535dnl Unfortunately, if compiling with the N32 ABI, this is not the correct
536dnl location. The correct location is /usr/lib32 or an undefined value
537dnl (the linker is smart enough to pick the correct default library).
538dnl Things work just fine if you use just AC_PATH_X_DIRECT.
539case "$host" in
540mips-sgi-irix6*)
541 ;;
542*)
543 AC_PATH_X_XMKMF
544 if test -z "$ac_x_includes"; then
545 ac_x_includes="."
546 fi
547 if test -z "$ac_x_libraries"; then
548 ac_x_libraries="/usr/lib"
549 fi
550esac
551#from now on we use our own again
552
553# when the user already gave --x-includes, we ignore
554# what the standard autoconf macros told us.
555if test "$kde_x_includes" = NO; then
556 kde_x_includes=$ac_x_includes
557fi
558
559# for --x-libraries too
560if test "$kde_x_libraries" = NO; then
561 kde_x_libraries=$ac_x_libraries
562fi
563
564if test "$kde_x_includes" = NO; then
565 AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
566fi
567
568if test "$kde_x_libraries" = NO; then
569 AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
570fi
571
572# Record where we found X for the cache.
573kde_cv_have_x="have_x=yes \
574 kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries"
575])dnl
576eval "$kde_cv_have_x"
577
578if test "$have_x" != yes; then
579 AC_MSG_RESULT($have_x)
580 no_x=yes
581else
582 AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes])
583fi
584
585if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
586 X_INCLUDES=""
587 x_includes="."; dnl better than nothing :-
588 else
589 x_includes=$kde_x_includes
590 X_INCLUDES="-I$x_includes"
591fi
592
593if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then
594 X_LDFLAGS=""
595 x_libraries="/usr/lib"; dnl better than nothing :-
596 else
597 x_libraries=$kde_x_libraries
598 X_LDFLAGS="-L$x_libraries"
599fi
600all_includes="$X_INCLUDES"
601all_libraries="$X_LDFLAGS"
602
603AC_SUBST(X_INCLUDES)
604AC_SUBST(X_LDFLAGS)
605AC_SUBST(x_libraries)
606AC_SUBST(x_includes)
607
608# Check for libraries that X11R6 Xt/Xaw programs need.
609ac_save_LDFLAGS="$LDFLAGS"
610LDFLAGS="$LDFLAGS $X_LDFLAGS"
611# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
612# check for ICE first), but we must link in the order -lSM -lICE or
613# we get undefined symbols. So assume we have SM if we have ICE.
614# These have to be linked with before -lX11, unlike the other
615# libraries we check for below, so use a different variable.
616# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
617AC_CHECK_LIB(ICE, IceConnectionNumber,
618 [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS)
619AC_SUBST(LIBSM)
620LDFLAGS="$ac_save_LDFLAGS"
621
622AC_SUBST(X_PRE_LIBS)
623
624LIB_X11='-lX11 $(LIBSOCKET)'
625AC_SUBST(LIB_X11)
626
627AC_MSG_CHECKING(for libXext)
628AC_CACHE_VAL(kde_cv_have_libXext,
629[
630kde_ldflags_safe="$LDFLAGS"
631kde_libs_safe="$LIBS"
632
633LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS"
634LIBS="-lXext -lX11 $LIBSOCKET"
635
636AC_TRY_LINK([
637#include <stdio.h>
638],
639[
640printf("hello Xext\n");
641],
642kde_cv_have_libXext=yes,
643kde_cv_have_libXext=no
644 )
645
646LDFLAGS=$kde_ldflags_safe
647LIBS=$kde_libs_safe
648 ])
649
650AC_MSG_RESULT($kde_cv_have_libXext)
651
652if test "$kde_cv_have_libXext" = "no"; then
653 AC_MSG_ERROR([We need a working libXext to proceed. Since configure
654can't find it itself, we stop here assuming that make wouldn't find
655them either.])
656fi
657
658])
659
660AC_LANG_RESTORE
661])
662
663AC_DEFUN(KDE_PRINT_QT_PROGRAM,
664[
665AC_REQUIRE([KDE_USE_QT])
666cat > conftest.$ac_ext <<EOF
667#include "confdefs.h"
668#include <qglobal.h>
669#include <qapplication.h>
670#include <qapp.h>
671#include <qobjcoll.h>
672EOF
673if test "$kde_qtver" = "2"; then
674cat >> conftest.$ac_ext <<EOF
675#include <qevent.h>
676#include <qstring.h>
677#include <qstyle.h>
678EOF
679
680if test $kde_qtsubver -gt 0; then
681cat >> conftest.$ac_ext <<EOF
682#include <qiconview.h>
683EOF
684fi
685
686fi
687
688echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
689cat >> conftest.$ac_ext <<EOF
690#error 1
691#endif
692
693int main() {
694EOF
695if test "$kde_qtver" = "2"; then
696cat >> conftest.$ac_ext <<EOF
697 QStringList *t = new QStringList();
698EOF
699if test $kde_qtsubver -gt 0; then
700cat >> conftest.$ac_ext <<EOF
701 QIconView iv(0);
702 iv.setWordWrapIconText(false);
703 QString s;
704 s.setLatin1("Elvis is alive", 14);
705 int magnolia = QEvent::Speech; /* new in 2.2 beta2 */
706EOF
707fi
708fi
709cat >> conftest.$ac_ext <<EOF
710 return 0;
711}
712EOF
713])
714
715AC_DEFUN(KDE_USE_QT,
716[
717
718if test -z "$1"; then
719 kde_qtver=2
720 kde_qtsubver=1
721else
722 kde_qtsubver=`echo "$1" | sed -e 's#[0-9]\+\.\([0-9]\+\).*#\1#'`
723 # following is the check if subversion isn´t found in passed argument
724 if test "$kde_qtsubver" = "$1"; then
725 kde_qtsubver=1
726 fi
727 kde_qtver=`echo "$1" | sed -e 's#^\([0-9]\+\)\..*#\1#'`
728 if test "$kde_qtver" = "1"; then
729 kde_qtsubver=42
730 else
731 # this is the version number fallback to 2.1, unless major version is 1 or 2
732 if test "$kde_qtver" != "2"; then
733 kde_qtver=2
734 kde_qtsubver=1
735 fi
736 fi
737fi
738
739if test -z "$2"; then
740 if test $kde_qtver = 2; then
741 if test $kde_qtsubver -gt 0; then
742 kde_qt_minversion=">= Qt 2.2.2"
743 else
744 kde_qt_minversion=">= Qt 2.0.2"
745 fi
746 else
747 kde_qt_minversion=">= 1.42 and < 2.0"
748 fi
749else
750 kde_qt_minversion=$2
751fi
752
753if test -z "$3"; then
754 if test $kde_qtver = 2; then
755 if test $kde_qtsubver -gt 0; then
756 kde_qt_verstring="QT_VERSION >= 222"
757 else
758 kde_qt_verstring="QT_VERSION >= 200"
759 fi
760 else
761 kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
762 fi
763else
764 kde_qt_verstring=$3
765fi
766
767if test $kde_qtver = 2; then
768 kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
769else
770 kde_qt_dirs="$QTDIR /usr/lib/qt"
771fi
772])
773
774AC_DEFUN(KDE_CHECK_QT_DIRECT,
775[
776AC_REQUIRE([KDE_USE_QT])
777AC_MSG_CHECKING([if Qt compiles without flags])
778AC_CACHE_VAL(kde_cv_qt_direct,
779[
780AC_LANG_SAVE
781AC_LANG_CPLUSPLUS
782ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
783ac_LIBRARY_PATH="$LIBRARY_PATH"
784ac_cxxflags_safe="$CXXFLAGS"
785ac_ldflags_safe="$LDFLAGS"
786ac_libs_safe="$LIBS"
787
788CXXFLAGS="$CXXFLAGS -I$qt_includes"
789LDFLAGS="$LDFLAGS $X_LDFLAGS"
790LIBS="$LIBQT -lXext -lX11 $LIBSOCKET"
791LD_LIBRARY_PATH=
792export LD_LIBRARY_PATH
793LIBRARY_PATH=
794export LIBRARY_PATH
795
796KDE_PRINT_QT_PROGRAM
797
798if AC_TRY_EVAL(ac_link) && test -s conftest; then
799 kde_cv_qt_direct="yes"
800else
801 kde_cv_qt_direct="no"
802 echo "configure: failed program was:" >&AC_FD_CC
803 cat conftest.$ac_ext >&AC_FD_CC
804fi
805
806rm -f conftest*
807CXXFLAGS="$ac_cxxflags_safe"
808LDFLAGS="$ac_ldflags_safe"
809LIBS="$ac_libs_safe"
810
811LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
812export LD_LIBRARY_PATH
813LIBRARY_PATH="$ac_LIBRARY_PATH"
814export LIBRARY_PATH
815AC_LANG_RESTORE
816])
817
818if test "$kde_cv_qt_direct" = "yes"; then
819 AC_MSG_RESULT(yes)
820 $1
821else
822 AC_MSG_RESULT(no)
823 $2
824fi
825])
826
827dnl ------------------------------------------------------------------------
828dnl Try to find the Qt headers and libraries.
829dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
830dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
831dnl ------------------------------------------------------------------------
832dnl
833AC_DEFUN(AC_PATH_QT_1_3,
834[
835AC_REQUIRE([K_PATH_X])
836AC_REQUIRE([KDE_USE_QT])
837
838dnl ------------------------------------------------------------------------
839dnl Add configure flag to enable linking to MT version of Qt library.
840dnl ------------------------------------------------------------------------
841
842AC_ARG_ENABLE(
843 mt,
844 [ --enable-mt link to threaded Qt (experimental)],
845 kde_use_qt_mt=$enableval,
846 kde_use_qt_mt=no
847)
848
849USING_QT_MT=""
850
851dnl ------------------------------------------------------------------------
852dnl If we got --enable-qt-mt then adjust some vars for the host.
853dnl ------------------------------------------------------------------------
854
855if test "x$kde_use_qt_mt" = "xyes"; then
856
857 case $host in
858 *-*-linux-*)
859 if test "x$GCC" = "xyes"; then
860 CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT -pthread"
861 X_EXTRA_LIBS="$X_EXTRA_LIBS -pthread"
862 else
863 AC_MSG_WARN([Compiler is not gcc. MT support disabled.])
864 fi
865 ;;
866 *)
867 AC_MSG_WARN([MT not yet supported on $host - disabled.])
868 ;;
869 esac
870
871fi
872
873kde_qt_was_given=yes
874
875dnl ------------------------------------------------------------------------
876dnl If we haven't been told how to link to Qt, we work it out for ourselves.
877dnl ------------------------------------------------------------------------
878
879if test -z "$LIBQT_GLOB"; then
880
881 LIBQT_GLOB="libqt.*"
882
883fi
884
885if test -z "$LIBQT"; then
886
887 LIBQT="-lqt"
888 kde_int_qt="-lqt"
889
890dnl ------------------------------------------------------------------------
891dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
892dnl ------------------------------------------------------------------------
893
894 if test "x$kde_use_qt_mt" = "xyes"; then
895
896 case $host in
897 *-*-linux-*)
898 if test "x$GCC" = "xyes"; then
899 LIBQT="-lqt-mt"
900 kde_int_qt="-lqt-mt"
901 LIBQT_GLOB="libqt-mt.*"
902 USING_QT_MT="using -mt"
903 fi
904 ;;
905 esac
906 fi
907
908 kde_qt_was_given=no
909
910else
911 kde_int_qt="$LIBQT"
912fi
913
914if test $kde_qtver = 2; then
915
916 AC_REQUIRE([AC_FIND_PNG])
917 AC_REQUIRE([AC_FIND_JPEG])
918 LIBQT="$LIBQT $LIBPNG $LIBJPEG"
919fi
920
921AC_MSG_CHECKING([for Qt])
922
923LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
924ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
925qt_libraries=""
926qt_includes=""
927AC_ARG_WITH(qt-dir,
928 [ --with-qt-dir=DIR where the root of Qt is installed ],
929 [ ac_qt_includes="$withval"/include
930 ac_qt_libraries="$withval"/lib
931 ac_qt_bindir="$withval"/bin
932 ])
933
934AC_ARG_WITH(qt-includes,
935 [ --with-qt-includes=DIR where the Qt includes are. ],
936 [
937 ac_qt_includes="$withval"
938 ])
939
940kde_qt_libs_given=no
941
942AC_ARG_WITH(qt-libraries,
943 [ --with-qt-libraries=DIR where the Qt library is installed.],
944 [ ac_qt_libraries="$withval"
945 kde_qt_libs_given=yes
946 ])
947
948AC_CACHE_VAL(ac_cv_have_qt,
949[#try to guess Qt locations
950
951qt_incdirs=""
952for dir in $kde_qt_dirs; do
953 qt_incdirs="$qt_incdirs $dir/include $dir"
954done
955qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt $x_includes"
956if test ! "$ac_qt_includes" = "NO"; then
957 qt_incdirs="$ac_qt_includes $qt_incdirs"
958fi
959
960if test "$kde_qtver" = "2"; then
961 kde_qt_header=qstyle.h
962else
963 kde_qt_header=qglobal.h
964fi
965
966AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
967ac_qt_includes="$qt_incdir"
968
969qt_libdirs=""
970for dir in $kde_qt_dirs; do
971 qt_libdirs="$qt_libdirs $dir/lib $dir"
972done
973qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
974if test ! "$ac_qt_libraries" = "NO"; then
975 qt_libdir=$ac_qt_libraries
976else
977 qt_libdirs="$ac_qt_libraries $qt_libdirs"
978 # if the Qt was given, the chance is too big that libqt.* doesn't exist
979 qt_libdir=NONE
980 for dir in $qt_libdirs; do
981 try="ls -1 $dir/${LIBQT_GLOB}"
982 if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
983 done
984fi
985
986ac_qt_libraries="$qt_libdir"
987
988AC_LANG_SAVE
989AC_LANG_CPLUSPLUS
990
991ac_cxxflags_safe="$CXXFLAGS"
992ac_ldflags_safe="$LDFLAGS"
993ac_libs_safe="$LIBS"
994
995CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
996LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS"
997LIBS="$LIBS $LIBQT"
998
999KDE_PRINT_QT_PROGRAM
1000
1001if AC_TRY_EVAL(ac_link) && test -s conftest; then
1002 rm -f conftest*
1003else
1004 echo "configure: failed program was:" >&AC_FD_CC
1005 cat conftest.$ac_ext >&AC_FD_CC
1006 ac_qt_libraries="NO"
1007fi
1008rm -f conftest*
1009CXXFLAGS="$ac_cxxflags_safe"
1010LDFLAGS="$ac_ldflags_safe"
1011LIBS="$ac_libs_safe"
1012
1013AC_LANG_RESTORE
1014if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
1015 ac_cv_have_qt="have_qt=no"
1016 ac_qt_notfound=""
1017 if test "$ac_qt_includes" = NO; then
1018 if test "$ac_qt_libraries" = NO; then
1019 ac_qt_notfound="(headers and libraries)";
1020 else
1021 ac_qt_notfound="(headers)";
1022 fi
1023 else
1024 ac_qt_notfound="(libraries)";
1025 fi
1026
1027 AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
1028For more details about this problem, look at the end of config.log.])
1029else
1030 have_qt="yes"
1031fi
1032])
1033
1034eval "$ac_cv_have_qt"
1035
1036if test "$have_qt" != yes; then
1037 AC_MSG_RESULT([$have_qt]);
1038else
1039 ac_cv_have_qt="have_qt=yes \
1040 ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
1041 AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT])
1042
1043 qt_libraries="$ac_qt_libraries"
1044 qt_includes="$ac_qt_includes"
1045fi
1046
1047if test ! "$kde_qt_libs_given" = "yes"; then
1048KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
1049fi
1050
1051AC_SUBST(qt_libraries)
1052AC_SUBST(qt_includes)
1053
1054if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
1055 QT_INCLUDES="";
1056else
1057 QT_INCLUDES="-I$qt_includes"
1058 all_includes="$QT_INCLUDES $all_includes"
1059fi
1060
1061if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
1062 QT_LDFLAGS=""
1063else
1064 QT_LDFLAGS="-L$qt_libraries"
1065 all_libraries="$all_libraries $QT_LDFLAGS"
1066fi
1067
1068AC_SUBST(QT_INCLUDES)
1069AC_SUBST(QT_LDFLAGS)
1070AC_PATH_QT_MOC_UIC
1071
1072LIB_QT="$kde_int_qt "'$(LIBPNG) $(LIBJPEG) -lXext $(LIB_X11) $(LIBSM)'
1073AC_SUBST(LIB_QT)
1074
1075])
1076
1077AC_DEFUN(AC_PATH_QT,
1078[
1079AC_PATH_QT_1_3
1080])
1081
1082AC_DEFUN(KDE_CHECK_FINAL,
1083[
1084 AC_ARG_ENABLE(final, [ --enable-final build size optimized apps (experimental - needs lots of memory)],
1085 kde_use_final=$enableval, kde_use_final=no)
1086
1087 KDE_COMPILER_REPO
1088 if test "x$kde_use_final" = "xyes"; then
1089 KDE_USE_FINAL_TRUE=""
1090 KDE_USE_FINAL_FALSE="#"
1091 else
1092 KDE_USE_FINAL_TRUE="#"
1093 KDE_USE_FINAL_FALSE=""
1094 fi
1095 AC_SUBST(KDE_USE_FINAL_TRUE)
1096 AC_SUBST(KDE_USE_FINAL_FALSE)
1097
1098 AC_ARG_ENABLE(closure, [ --disable-closure don't delay template instantiation],
1099 kde_use_closure=$enableval, kde_use_closure=yes)
1100
1101 if test "x$kde_use_closure" = "xyes"; then
1102 KDE_USE_CLOSURE_TRUE=""
1103 KDE_USE_CLOSURE_FALSE="#"
1104# CXXFLAGS="$CXXFLAGS $REPO"
1105 else
1106 KDE_USE_CLOSURE_TRUE="#"
1107 KDE_USE_CLOSURE_FALSE=""
1108 fi
1109 AC_SUBST(KDE_USE_CLOSURE_TRUE)
1110 AC_SUBST(KDE_USE_CLOSURE_FALSE)
1111])
1112
1113dnl ------------------------------------------------------------------------
1114dnl Now, the same with KDE
1115dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
1116dnl and $(kde_includes) will be the kdehdrlocation (if needed)
1117dnl ------------------------------------------------------------------------
1118dnl
1119AC_DEFUN(AC_BASE_PATH_KDE,
1120[
1121AC_PREREQ([2.13])
1122AC_REQUIRE([AC_PATH_QT])dnl
1123AC_CHECK_RPATH
1124AC_MSG_CHECKING([for KDE])
1125
1126if test "${prefix}" != NONE; then
1127 kde_includes=${prefix}/include
1128 ac_kde_includes=$prefix/include
1129
1130 if test "${exec_prefix}" != NONE; then
1131 kde_libraries=${exec_prefix}/lib
1132 ac_kde_libraries=$exec_prefix/lib
1133 else
1134 kde_libraries=${prefix}/lib
1135 ac_kde_libraries=$prefix/lib
1136 fi
1137else
1138 ac_kde_includes=
1139 ac_kde_libraries=
1140 kde_libraries=""
1141 kde_includes=""
1142fi
1143
1144AC_CACHE_VAL(ac_cv_have_kde,
1145[#try to guess kde locations
1146
1147if test "$kde_qtver" = 1; then
1148 kde_check_header="ksock.h"
1149 kde_check_lib="libkdecore.la"
1150else
1151 kde_check_header="ksharedptr.h"
1152 kde_check_lib="libkio.la"
1153fi
1154
1155if test -z "$1"; then
1156
1157kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/kde/include /usr/include/kde /usr/include /opt/kde2/include /opt/kde/include $x_includes $qt_includes"
1158test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
1159kde_incdirs="$ac_kde_includes $kde_incdirs"
1160AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
1161ac_kde_includes="$kde_incdir"
1162
1163if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
1164 AC_MSG_ERROR([
1165in the prefix, you've chosen, are no KDE headers installed. This will fail.
1166So, check this please and use another prefix!])
1167fi
1168
1169kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /opt/kde2/lib /opt/kde/lib /usr/X11R6/kde/lib"
1170test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
1171kde_libdirs="$ac_kde_libraries $kde_libdirs"
1172AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
1173ac_kde_libraries="$kde_libdir"
1174
1175if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
1176AC_MSG_ERROR([
1177in the prefix, you've chosen, are no KDE libraries installed. This will fail.
1178So, check this please and use another prefix!])
1179fi
1180ac_kde_libraries="$kde_libdir"
1181
1182if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
1183 ac_cv_have_kde="have_kde=no"
1184else
1185 ac_cv_have_kde="have_kde=yes \
1186 ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1187fi
1188
1189else dnl test -z $1
1190
1191 ac_cv_have_kde="have_kde=no"
1192
1193fi
1194])dnl
1195
1196eval "$ac_cv_have_kde"
1197
1198if test "$have_kde" != "yes"; then
1199 if test "${prefix}" = NONE; then
1200 ac_kde_prefix="$ac_default_prefix"
1201 else
1202 ac_kde_prefix="$prefix"
1203 fi
1204 if test "$exec_prefix" = NONE; then
1205 ac_kde_exec_prefix="$ac_kde_prefix"
1206 AC_MSG_RESULT([will be installed in $ac_kde_prefix])
1207 else
1208 ac_kde_exec_prefix="$exec_prefix"
1209 AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
1210 fi
1211
1212 kde_libraries="${ac_kde_exec_prefix}/lib"
1213 kde_includes=${ac_kde_prefix}/include
1214
1215else
1216 ac_cv_have_kde="have_kde=yes \
1217 ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1218 AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
1219
1220 kde_libraries="$ac_kde_libraries"
1221 kde_includes="$ac_kde_includes"
1222fi
1223AC_SUBST(kde_libraries)
1224AC_SUBST(kde_includes)
1225
1226if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then
1227 KDE_INCLUDES=""
1228else
1229 KDE_INCLUDES="-I$kde_includes"
1230 all_includes="$KDE_INCLUDES $all_includes"
1231fi
1232
1233KDE_LDFLAGS="-L$kde_libraries"
1234if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then
1235 all_libraries="$all_libraries $KDE_LDFLAGS"
1236fi
1237
1238AC_SUBST(KDE_LDFLAGS)
1239AC_SUBST(KDE_INCLUDES)
1240
1241AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1242
1243all_libraries="$all_libraries $USER_LDFLAGS"
1244all_includes="$all_includes $USER_INCLUDES"
1245AC_SUBST(all_includes)
1246AC_SUBST(all_libraries)
1247
1248AC_SUBST(AUTODIRS)
1249])
1250
1251AC_DEFUN(KDE_CHECK_EXTRA_LIBS,
1252[
1253AC_MSG_CHECKING(for extra includes)
1254AC_ARG_WITH(extra-includes, [ --with-extra-includes=DIR
1255 adds non standard include paths],
1256 kde_use_extra_includes="$withval",
1257 kde_use_extra_includes=NONE
1258)
1259kde_extra_includes=
1260if test -n "$kde_use_extra_includes" && \
1261 test "$kde_use_extra_includes" != "NONE"; then
1262
1263 ac_save_ifs=$IFS
1264 IFS=':'
1265 for dir in $kde_use_extra_includes; do
1266 kde_extra_includes="$kde_extra_includes $dir"
1267 USER_INCLUDES="$USER_INCLUDES -I$dir"
1268 done
1269 IFS=$ac_save_ifs
1270 kde_use_extra_includes="added"
1271else
1272 kde_use_extra_includes="no"
1273fi
1274AC_SUBST(USER_INCLUDES)
1275
1276AC_MSG_RESULT($kde_use_extra_includes)
1277
1278kde_extra_libs=
1279AC_MSG_CHECKING(for extra libs)
1280AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR adds non standard library paths],
1281 kde_use_extra_libs=$withval,
1282 kde_use_extra_libs=NONE
1283)
1284if test -n "$kde_use_extra_libs" && \
1285 test "$kde_use_extra_libs" != "NONE"; then
1286
1287 ac_save_ifs=$IFS
1288 IFS=':'
1289 for dir in $kde_use_extra_libs; do
1290 kde_extra_libs="$kde_extra_libs $dir"
1291 KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
1292 USER_LDFLAGS="$USER_LDFLAGS -L$dir"
1293 done
1294 IFS=$ac_save_ifs
1295 kde_use_extra_libs="added"
1296else
1297 kde_use_extra_libs="no"
1298fi
1299
1300AC_SUBST(USER_LDFLAGS)
1301
1302AC_MSG_RESULT($kde_use_extra_libs)
1303
1304])
1305
1306AC_DEFUN(KDE_1_CHECK_PATH_HEADERS,
1307[
1308 AC_MSG_CHECKING([for KDE headers installed])
1309 AC_LANG_SAVE
1310 AC_LANG_CPLUSPLUS
1311cat > conftest.$ac_ext <<EOF
1312#include <stdio.h>
1313#include "confdefs.h"
1314#include <kapp.h>
1315
1316int main() {
1317 printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
1318 printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
1319 printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
1320 printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
1321 printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
1322 printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
1323 printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
1324 printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
1325 printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
1326 printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
1327 printf("kde_wallpaperdir=\\"%s\\"\n",
1328 KApplication::kde_wallpaperdir().data());
1329 printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
1330 printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
1331 printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
1332 printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
1333 printf("kde_moduledir=\\"/tmp/dummy\\"\n");
1334 return 0;
1335 }
1336EOF
1337
1338 ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext'
1339 if AC_TRY_EVAL(ac_compile); then
1340 AC_MSG_RESULT(yes)
1341 else
1342 AC_MSG_ERROR([your system is not able to compile a small KDE application!
1343Check, if you installed the KDE header files correctly.
1344For more details about this problem, look at the end of config.log.])
1345 fi
1346
1347 AC_LANG_RESTORE
1348])
1349
1350AC_DEFUN(KDE_CHECK_KDEQTADDON,
1351[
1352AC_MSG_CHECKING(for kde-qt-addon)
1353AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
1354[
1355 kde_ldflags_safe="$LDFLAGS"
1356 kde_libs_safe="$LIBS"
1357 kde_cxxflags_safe="$CXXFLAGS"
1358
1359 LIBS="-lkde-qt-addon $LIBQT $LIBS"
1360 CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes"
1361 LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
1362
1363 AC_TRY_LINK([
1364 #include <qdom.h>
1365 ],
1366 [
1367 QDomDocument doc;
1368 ],
1369 kde_cv_have_kdeqtaddon=yes,
1370 kde_cv_have_kdeqtaddon=no
1371 )
1372
1373 LDFLAGS=$kde_ldflags_safe
1374 LIBS=$kde_libs_safe
1375 kde_cxxflags_safe="$CXXFLAGS"
1376])
1377
1378AC_MSG_RESULT($kde_cv_have_kdeqtaddon)
1379
1380if test "$kde_cv_have_kdeqtaddon" = "no"; then
1381 AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first.
1382It is a separate package (and CVS module) named kde-qt-addon.])
1383fi
1384])
1385
1386AC_DEFUN(KDE_CHECK_KIMGIO,
1387[
1388 AC_REQUIRE([AC_BASE_PATH_KDE])
1389 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1390 AC_REQUIRE([AC_FIND_TIFF])
1391 AC_REQUIRE([AC_FIND_JPEG])
1392 AC_REQUIRE([AC_FIND_PNG])
1393 AC_REQUIRE([KDE_CREATE_LIBS_ALIASES])
1394
1395 if test "$1" = "existance"; then
1396 AC_LANG_SAVE
1397 AC_LANG_CPLUSPLUS
1398 kde_save_LIBS="$LIBS"
1399 LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm"
1400 AC_CHECK_LIB(kimgio, kimgioRegister, [
1401 LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no)
1402 LIBS="$kde_save_LIBS"
1403 AC_LANG_RESTORE
1404 else
1405 LIBKIMGIO_EXISTS=yes
1406 fi
1407
1408 if test "$LIBKIMGIO_EXISTS" = "yes"; then
1409 LIB_KIMGIO='-lkimgio'
1410 else
1411 LIB_KIMGIO=''
1412 fi
1413 AC_SUBST(LIB_KIMGIO)
1414])
1415
1416AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
1417[
1418 AC_REQUIRE([KDE_MISC_TESTS])
1419 AC_REQUIRE([KDE_CHECK_LIBDL])
1420 AC_REQUIRE([K_PATH_X])
1421
1422if test $kde_qtver = 2; then
1423 LIB_KDECORE='-lkdecore'
1424 AC_SUBST(LIB_KDECORE)
1425 LIB_KDEUI='-lkdeui'
1426 AC_SUBST(LIB_KDEUI)
1427 LIB_KFORMULA='-lkformula'
1428 AC_SUBST(LIB_KFORMULA)
1429 LIB_KIO='-lkio'
1430 AC_SUBST(LIB_KIO)
1431 LIB_KSYCOCA='-lksycoca'
1432 AC_SUBST(LIB_KSYCOCA)
1433 LIB_SMB='-lsmb'
1434 AC_SUBST(LIB_SMB)
1435 LIB_KFILE='-lkfile'
1436 AC_SUBST(LIB_KFILE)
1437 LIB_KAB='-lkab'
1438 AC_SUBST(LIB_KAB)
1439 LIB_KHTML='-lkhtml'
1440 AC_SUBST(LIB_KHTML)
1441 LIB_KSPELL='-lkspell'
1442 AC_SUBST(LIB_KSPELL)
1443 LIB_KPARTS='-lkparts'
1444 AC_SUBST(LIB_KPARTS)
1445 LIB_KWRITE='-lkwrite'
1446 AC_SUBST(LIB_KWRITE)
1447else
1448 LIB_KDECORE='-lkdecore -lXext $(LIB_QT)'
1449 AC_SUBST(LIB_KDECORE)
1450 LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
1451 AC_SUBST(LIB_KDEUI)
1452 LIB_KFM='-lkfm $(LIB_KDECORE)'
1453 AC_SUBST(LIB_KFM)
1454 LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)'
1455 AC_SUBST(LIB_KFILE)
1456 LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)'
1457 AC_SUBST(LIB_KAB)
1458fi
1459])
1460
1461AC_DEFUN(AC_PATH_KDE,
1462[
1463 AC_BASE_PATH_KDE
1464 AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install],
1465 [
1466 if test "$enableval" = "no";
1467 then ac_use_path_checking="default"
1468 else ac_use_path_checking=""
1469 fi
1470 ],
1471 [
1472 if test "$kde_qtver" = 1;
1473 then ac_use_path_checking=""
1474 else ac_use_path_checking="default"
1475 fi
1476 ]
1477 )
1478
1479 AC_CREATE_KFSSTND($ac_use_path_checking)
1480
1481 AC_SUBST_KFSSTND
1482 KDE_CREATE_LIBS_ALIASES
1483])
1484
1485dnl obsolete
1486AC_DEFUN(AC_CHECK_SETENV,
1487[
1488 AC_OBSOLETE([$0], [; instead use AC_CHECK_FUNCS([setenv unsetenv])])dnl
1489 AC_CHECK_FUNCS([setenv unsetenv])
1490])
1491
1492AC_DEFUN(AC_CHECK_GETDOMAINNAME,
1493[
1494AC_MSG_CHECKING(for getdomainname)
1495AC_CACHE_VAL(ac_cv_func_getdomainname,
1496[
1497AC_LANG_SAVE
1498AC_LANG_CPLUSPLUS
1499save_CXXFLAGS="$CXXFLAGS"
1500kde_safe_LIBS="$LIBS"
1501LIBS="$LIBS $X_EXTRA_LIBS"
1502if test "$GCC" = "yes"; then
1503CXXFLAGS="$CXXFLAGS -pedantic-errors"
1504fi
1505AC_TRY_COMPILE([
1506#include <stdlib.h>
1507#include <unistd.h>
1508],
1509[
1510char buffer[200];
1511getdomainname(buffer, 200);
1512],
1513ac_cv_func_getdomainname=yes,
1514ac_cv_func_getdomainname=no)
1515CXXFLAGS="$save_CXXFLAGS"
1516LIBS=$kde_safe_LIBS
1517AC_LANG_RESTORE
1518])
1519AC_MSG_RESULT($ac_cv_func_getdomainname)
1520
1521AC_MSG_CHECKING([if getdomainname needs custom prototype])
1522AC_CACHE_VAL(ac_cv_proto_getdomainname,
1523[
1524AC_LANG_SAVE
1525AC_LANG_CPLUSPLUS
1526if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then
1527 ac_cv_proto_getdomainname=no
1528else
1529 kde_safe_libs=$LIBS
1530 LIBS="$LIBS $X_EXTRA_LIBS"
1531 AC_TRY_LINK([
1532#include <stdlib.h>
1533#include <unistd.h>
1534
1535extern "C" int getdomainname (char *, int);
1536],
1537[
1538char buffer[200];
1539getdomainname(buffer, 200);
1540],
1541 ac_cv_func_getdomainname=yes
1542 ac_cv_proto_getdomainname=yes,
1543 AC_MSG_RESULT([fatal error])
1544 AC_MSG_ERROR([getdomainname unavailable]))
1545fi
1546LIBS=$kde_safe_libs
1547AC_LANG_RESTORE
1548])
1549AC_MSG_RESULT($ac_cv_proto_getdomainname)
1550
1551if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then
1552 AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname])
1553fi
1554if eval "test \"`echo $ac_cv_proto_getdomainname`\" = no"; then
1555 AC_DEFINE(HAVE_GETDOMAINNAME_PROTO, 1,
1556 [Define if you have getdomainname prototype])
1557fi
1558
1559])
1560
1561AC_DEFUN(AC_CHECK_GETHOSTNAME,
1562[
1563
1564AC_MSG_CHECKING([for gethostname])
1565AC_CACHE_VAL(ac_cv_func_gethostname,
1566[
1567AC_LANG_SAVE
1568AC_LANG_CPLUSPLUS
1569save_CXXFLAGS="$CXXFLAGS"
1570if test "$GCC" = "yes"; then
1571CXXFLAGS="$CXXFLAGS -pedantic-errors"
1572fi
1573AC_TRY_LINK([
1574#include <stdlib.h>
1575#include <unistd.h>
1576],
1577[
1578char buffer[200];
1579gethostname(buffer, 200);
1580],
1581ac_cv_func_gethostname=yes,
1582ac_cv_func_gethostname=no)
1583CXXFLAGS="$save_CXXFLAGS"
1584AC_LANG_RESTORE
1585])
1586AC_MSG_RESULT($ac_cv_func_gethostname)
1587
1588AC_MSG_CHECKING([if gethostname needs custom prototype])
1589AC_CACHE_VAL(ac_cv_proto_gethostname,
1590[
1591AC_LANG_SAVE
1592AC_LANG_CPLUSPLUS
1593if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then
1594 ac_cv_proto_gethostname=no
1595else
1596 AC_TRY_LINK([
1597#include <stdlib.h>
1598#include <unistd.h>
1599
1600extern "C" int gethostname (char *, int);
1601],
1602[
1603char buffer[200];
1604gethostname(buffer, 200);
1605],
1606 ac_cv_func_gethostname=yes
1607 ac_cv_proto_gethostname=yes,
1608 AC_MSG_RESULT([fatal error])
1609 AC_MSG_ERROR(gethostname unavailable))
1610fi
1611AC_LANG_RESTORE
1612])
1613AC_MSG_RESULT($ac_cv_proto_gethostname)
1614
1615if eval "test \"`echo $ac_cv_proto_gethostname`\" = no"; then
1616 AC_DEFINE(HAVE_GETHOSTNAME_PROTO, 1,
1617 [Define if you have gethostname prototype])
1618fi
1619if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then
1620 AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have getdomainname])
1621fi
1622])
1623
1624AC_DEFUN(AC_CHECK_USLEEP,
1625[
1626AC_MSG_CHECKING([for usleep])
1627AC_CACHE_VAL(ac_cv_func_usleep,
1628[
1629AC_LANG_SAVE
1630AC_LANG_CPLUSPLUS
1631ac_libs_safe="$LIBS"
1632LIBS="$LIBS $LIBUCB"
1633AC_TRY_LINK([
1634#include <stdlib.h>
1635#include <unistd.h>
1636],
1637[
1638usleep(200);
1639],
1640ac_cv_func_usleep=yes,
1641ac_cv_func_usleep=no)
1642LIBS="$ac_libs_safe"
1643AC_LANG_RESTORE
1644])
1645AC_MSG_RESULT($ac_cv_func_usleep)
1646if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then
1647 AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function])
1648fi
1649])
1650
1651AC_DEFUN(AC_CHECK_RANDOM,
1652[
1653AC_MSG_CHECKING([for random])
1654AC_CACHE_VAL(ac_cv_func_random,
1655[
1656AC_LANG_SAVE
1657AC_LANG_CPLUSPLUS
1658ac_libs_safe="$LIBS"
1659LIBS="$LIBS $LIBUCB"
1660AC_TRY_LINK([
1661#include <stdlib.h>
1662],
1663[
1664random();
1665],
1666ac_cv_func_random=yes,
1667ac_cv_func_random=no)
1668LIBS="$ac_libs_safe"
1669AC_LANG_RESTORE
1670])
1671AC_MSG_RESULT($ac_cv_func_random)
1672if eval "test \"`echo $ac_cv_func_random`\" = yes"; then
1673 AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random])
1674fi
1675])
1676
1677AC_DEFUN(AC_FIND_GIF,
1678 [AC_MSG_CHECKING([for giflib])
1679AC_CACHE_VAL(ac_cv_lib_gif,
1680[ac_save_LIBS="$LIBS"
1681LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
1682AC_TRY_LINK(dnl
1683[
1684#ifdef __cplusplus
1685extern "C" {
1686#endif
1687int GifLastError(void);
1688#ifdef __cplusplus
1689}
1690#endif
1691/* We use char because int might match the return type of a gcc2
1692 builtin and then its argument prototype would still apply. */
1693],
1694 [return GifLastError();],
1695 eval "ac_cv_lib_gif=yes",
1696 eval "ac_cv_lib_gif=no")
1697LIBS="$ac_save_LIBS"
1698])dnl
1699if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
1700 AC_MSG_RESULT(yes)
1701 AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
1702else
1703 AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
1704fi
1705])
1706
1707AC_DEFUN(KDE_FIND_JPEG_HELPER,
1708[
1709AC_MSG_CHECKING([for libjpeg$2])
1710AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
1711[
1712AC_LANG_C
1713ac_save_LIBS="$LIBS"
1714LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"
1715ac_save_CFLAGS="$CFLAGS"
1716CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
1717AC_TRY_LINK(
1718[/* Override any gcc2 internal prototype to avoid an error. */
1719struct jpeg_decompress_struct;
1720typedef struct jpeg_decompress_struct * j_decompress_ptr;
1721typedef int size_t;
1722#ifdef __cplusplus
1723extern "C" {
1724#endif
1725 void jpeg_CreateDecompress(j_decompress_ptr cinfo,
1726 int version, size_t structsize);
1727#ifdef __cplusplus
1728}
1729#endif
1730/* We use char because int might match the return type of a gcc2
1731 builtin and then its argument prototype would still apply. */
1732],
1733 [jpeg_CreateDecompress(0L, 0, 0);],
1734 eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
1735 eval "ac_cv_lib_jpeg_$1=no")
1736LIBS="$ac_save_LIBS"
1737CFLAGS="$ac_save_CFLAGS"
1738])
1739
1740if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
1741 LIBJPEG="$ac_cv_lib_jpeg_$1"
1742 AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
1743else
1744 AC_MSG_RESULT(no)
1745 $3
1746fi
1747
1748])
1749
1750AC_DEFUN(AC_FIND_JPEG,
1751[
1752dnl first look for libraries
1753KDE_FIND_JPEG_HELPER(6b, 6b,
1754 KDE_FIND_JPEG_HELPER(normal, [],
1755 [
1756dnl what to do, if the normal way fails:
1757 if test -f "$kde_libraries/libjpeg.so"; then
1758 test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so
1759 ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1760 else if test -f "$kde_libraries/libjpeg.sl"; then
1761 test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl
1762 ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1763 else if test -f "$kde_libraries/libjpeg.a"; then
1764 test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a
1765 ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1766 else
1767 ac_cv_lib_jpeg=
1768 fi
1769 fi
1770 fi
1771
1772 LIBJPEG=$ac_cv_lib_jpeg
1773]))
1774
1775dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
1776dnl requires system dependent includes loaded before it)
1777jpeg_incdirs="/usr/include /usr/local/include $kde_extra_includes"
1778AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)
1779test "x$jpeg_incdir" = xNO && jpeg_incdir=
1780
1781dnl if headers _and_ libraries are missing, this is no error, and we
1782dnl continue with a warning (the user will get no jpeg support in khtml)
1783dnl if only one is missing, it means a configuration error, but we still
1784dnl only warn
1785if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then
1786 AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
1787else
1788 if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then
1789 AC_MSG_WARN([
1790There is an installation error in jpeg support. You seem to have only one
1791of either the headers _or_ the libraries installed. You may need to either
1792provide correct --with-extra-... options, or the development package of
1793libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/
1794Disabling JPEG support.
1795])
1796 else
1797 AC_MSG_WARN([libjpeg not found. disable JPEG support.])
1798 fi
1799 jpeg_incdir=
1800 LIBJPEG=
1801fi
1802
1803AC_SUBST(LIBJPEG)
1804])
1805
1806AC_DEFUN(AC_FIND_ZLIB,
1807[
1808AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1809AC_MSG_CHECKING([for libz])
1810AC_CACHE_VAL(ac_cv_lib_z,
1811[
1812AC_LANG_C
1813kde_save_LIBS="$LIBS"
1814LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
1815kde_save_CFLAGS="$CFLAGS"
1816CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
1817AC_TRY_LINK(dnl
1818[
1819#include<zlib.h>
1820],
1821 [return (zlibVersion() == ZLIB_VERSION); ],
1822 eval "ac_cv_lib_z='-lz'",
1823 eval "ac_cv_lib_z=no")
1824LIBS="$kde_save_LIBS"
1825CFLAGS="$kde_save_CFLAGS"
1826])dnl
1827if test ! "$ac_cv_lib_z" = no; then
1828 AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
1829 LIBZ="$ac_cv_lib_z"
1830 AC_SUBST(LIBZ)
1831 AC_MSG_RESULT($ac_cv_lib_z)
1832else
1833 AC_MSG_ERROR(not found. Check your installation and look into config.log)
1834 LIBZ=""
1835 AC_SUBST(LIBZ)
1836fi
1837])
1838
1839AC_DEFUN(KDE_TRY_TIFFLIB,
1840[
1841AC_MSG_CHECKING([for libtiff $1])
1842
1843AC_CACHE_VAL(kde_cv_libtiff_$1,
1844[
1845AC_LANG_SAVE
1846AC_LANG_CPLUSPLUS
1847kde_save_LIBS="$LIBS"
1848LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
1849kde_save_CXXFLAGS="$CXXFLAGS"
1850CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
1851
1852AC_TRY_LINK(dnl
1853[
1854#include<tiffio.h>
1855],
1856 [return (TIFFOpen( "", "r") == 0); ],
1857[
1858 kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
1859], [
1860 kde_cv_libtiff_$1=no
1861])
1862
1863LIBS="$kde_save_LIBS"
1864CXXFLAGS="$kde_save_CXXFLAGS"
1865AC_LANG_RESTORE
1866])
1867
1868if test "$kde_cv_libtiff_$1" = "no"; then
1869 AC_MSG_RESULT(no)
1870 LIBTIFF=""
1871 $3
1872else
1873 LIBTIFF="$kde_cv_libtiff_$1"
1874 AC_MSG_RESULT(yes)
1875 AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
1876 $2
1877fi
1878
1879])
1880
1881AC_DEFUN(AC_FIND_TIFF,
1882[
1883AC_REQUIRE([K_PATH_X])
1884AC_REQUIRE([AC_FIND_ZLIB])
1885AC_REQUIRE([AC_FIND_JPEG])
1886AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1887
1888KDE_TRY_TIFFLIB(tiff, [],
1889 KDE_TRY_TIFFLIB(tiff34))
1890
1891AC_SUBST(LIBTIFF)
1892])
1893
1894
1895AC_DEFUN(AC_FIND_PNG,
1896[
1897AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1898AC_REQUIRE([AC_FIND_ZLIB])
1899AC_MSG_CHECKING([for libpng])
1900AC_CACHE_VAL(ac_cv_lib_png,
1901[
1902kde_save_LIBS="$LIBS"
1903LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET"
1904kde_save_CFLAGS="$CFLAGS"
1905CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
1906AC_LANG_C
1907AC_TRY_LINK(dnl
1908 [
1909 #include<png.h>
1910 ],
1911 [
1912 png_structp png_ptr = png_create_read_struct( /* image ptr */
1913 PNG_LIBPNG_VER_STRING, 0, 0, 0 );
1914 return( png_ptr != 0 );
1915 ],
1916 eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
1917 eval "ac_cv_lib_png=no"
1918)
1919LIBS="$kde_save_LIBS"
1920CFLAGS="$kde_save_CFLAGS"
1921])dnl
1922if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
1923 AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
1924 LIBPNG="$ac_cv_lib_png"
1925 AC_SUBST(LIBPNG)
1926 AC_MSG_RESULT($ac_cv_lib_png)
1927else
1928 AC_MSG_RESULT(no)
1929 LIBPNG=""
1930 AC_SUBST(LIBPNG)
1931fi
1932])
1933
1934AC_DEFUN(AC_CHECK_BOOL,
1935[
1936 AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool])
1937])
1938
1939AC_DEFUN(AC_CHECK_GNU_EXTENSIONS,
1940[
1941AC_MSG_CHECKING(if you need GNU extensions)
1942AC_CACHE_VAL(ac_cv_gnu_extensions,
1943[
1944cat > conftest.c << EOF
1945#include <features.h>
1946
1947#ifdef __GNU_LIBRARY__
1948yes
1949#endif
1950EOF
1951
1952if (eval "$ac_cpp conftest.c") 2>&5 |
1953 egrep "yes" >/dev/null 2>&1; then
1954 rm -rf conftest*
1955 ac_cv_gnu_extensions=yes
1956else
1957 ac_cv_gnu_extensions=no
1958fi
1959])
1960
1961AC_MSG_RESULT($ac_cv_gnu_extensions)
1962if test "$ac_cv_gnu_extensions" = "yes"; then
1963 AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
1964fi
1965])
1966
1967AC_DEFUN(KDE_CHECK_COMPILER_FLAG,
1968[
1969AC_REQUIRE([AC_CHECK_COMPILERS])
1970AC_MSG_CHECKING(whether $CXX supports -$1)
1971kde_cache=`echo $1 | sed 'y%.=/+-%___p_%'`
1972AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
1973[
1974echo 'int main() { return 0; }' >conftest.cc
1975eval "kde_cv_prog_cxx_$kde_cache=no"
1976if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then
1977 if test -z "`$CXX -$1 -o conftest conftest.o 2>&1`"; then
1978 eval "kde_cv_prog_cxx_$kde_cache=yes"
1979 fi
1980fi
1981rm -f conftest*
1982])
1983if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
1984 AC_MSG_RESULT(yes)
1985 :
1986 $2
1987else
1988 AC_MSG_RESULT(no)
1989 :
1990 $3
1991fi
1992])
1993
1994AC_DEFUN(KDE_PROG_CC_PG,
1995[ AC_CACHE_CHECK(whether ${CC-cc} accepts -pg, kde_cv_prog_cc_pg,
1996 [echo 'void f(){}' > conftest.c
1997 if test -z "`${CC-cc} -pg -c conftest.c 2>&1`"; then
1998 kde_cv_prog_cc_pg=yes
1999 else
2000 kde_cv_prog_cc_pg=no
2001 fi
2002 rm -f conftest*
2003])])
2004
2005AC_DEFUN(KDE_PROG_CXX_PG,
2006[ AC_CACHE_CHECK(whether ${CXX-g++} accepts -pg, kde_cv_prog_cxx_pg,
2007 [echo 'void f(){}' > conftest.cc
2008 if test -z "`${CXX-g++} -pg -c conftest.cc 2>&1`"; then
2009 kde_cv_prog_cxx_pg=yes
2010 else
2011 kde_cv_prog_cxx_pg=no
2012 fi
2013 rm -f conftest*
2014])])
2015
2016dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
2017dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
2018dnl it's all white-space separated
2019AC_DEFUN(AC_REMOVE_FORBIDDEN,
2020[ __val=$$1
2021 __forbid=" $2 "
2022 if test -n "$__val"; then
2023 __new=""
2024 ac_save_IFS=$IFS
2025 IFS=" "
2026 for i in $__val; do
2027 case "$__forbid" in
2028 *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
2029 *) # Careful to not add spaces, where there were none, because otherwise
2030 # libtool gets confused, if we change e.g. CXX
2031 if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
2032 esac
2033 done
2034 IFS=$ac_save_IFS
2035 $1=$__new
2036 fi
2037])
2038
2039dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
2040AC_DEFUN(AC_VALIDIFY_CXXFLAGS,
2041[dnl
2042 AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
2043 AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
2044])
2045
2046AC_DEFUN(AC_CHECK_COMPILERS,
2047[
2048 dnl this is somehow a fat lie, but prevents other macros from double checking
2049 AC_PROVIDE([AC_PROG_CC])
2050 AC_PROVIDE([AC_PROG_CPP])
2051 AC_PROVIDE([AC_PROG_CXX])
2052 AC_PROVIDE([AC_PROG_CXXCPP])
2053
2054 AC_ARG_ENABLE(debug,[ --enable-debug enables debug symbols [default=no]],
2055 [
2056 if test $enableval = "no"; dnl
2057 then
2058 kde_use_debug_code="no"
2059 kde_use_debug_define=yes
2060 else
2061 kde_use_debug_code="yes"
2062 kde_use_debug_define=no
2063 fi
2064 ], [kde_use_debug_code="no"
2065 kde_use_debug_define=no
2066 ])
2067 dnl Just for configure --help
2068 AC_ARG_ENABLE(dummyoption,[ --disable-debug disables debug output and debug symbols [default=no]],[],[])
2069
2070 AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)],
2071 [
2072 if test $enableval = "no"; then
2073 kde_use_strict_options="no"
2074 else
2075 kde_use_strict_options="yes"
2076 fi
2077 ], [kde_use_strict_options="no"])
2078
2079 AC_ARG_ENABLE(profile,[ --enable-profile creates profiling infos [default=no]],
2080 [kde_use_profiling=$enableval],
2081 [kde_use_profiling="no"]
2082 )
2083
2084dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
2085 AC_MSG_CHECKING(for a C-Compiler)
2086 dnl if there is one, print out. if not, don't matter
2087 AC_MSG_RESULT($CC)
2088
2089 if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
2090 if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
2091 if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
2092 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
2093
2094 AC_PROG_CC_WORKS
2095 AC_PROG_CC_GNU
2096
2097 if test $ac_cv_prog_gcc = yes; then
2098 GCC=yes
2099 else
2100 GCC=
2101 fi
2102
2103 USER_CFLAGS=$CFLAGS
2104 CFLAGS=
2105
2106 if test -z "$CFLAGS"; then
2107 if test "$kde_use_debug_code" = "yes"; then
2108 AC_PROG_CC_G
2109 if test $ac_cv_prog_cc_g = yes; then
2110 CFLAGS="-g"
2111 case $host in
2112 *-*-linux-gnu)
2113 CFLAGS="$CFLAGS -ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE -D_BSD_SOURCE"
2114 ;;
2115 esac
2116 fi
2117 else
2118 if test "$GCC" = "yes"; then
2119 CFLAGS="-O2"
2120 else
2121 CFLAGS=""
2122 fi
2123 if test "$kde_use_debug_define" = "yes"; then
2124 CFLAGS="$CFLAGS -DNDEBUG"
2125 dnl damn buggy compilers :-(
2126 dnl if test "$GCC" = "yes"; then
2127 dnl CFLAGS="$CFLAGS -fomit-frame-pointer"
2128 dnl CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
2129 dnl fi
2130 fi
2131 fi
2132
2133 if test "$kde_use_profiling" = yes; then
2134 KDE_PROG_CC_PG
2135 if test "$kde_cv_prog_cc_pg" = yes; then
2136 CFLAGS="$CFLAGS -pg"
2137 fi
2138 fi
2139
2140 if test "$GCC" = "yes"; then
2141 CFLAGS="$CFLAGS"
2142
2143 if test "$kde_use_strict_options" = "yes"; then
2144 CFLAGS="$CFLAGS -W -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
2145 fi
2146 fi
2147
2148 fi
2149
2150 case "$host" in
2151 *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
2152 *-*-sysv5uw7*) CFLAGS="$CFLAGS -D_UNIXWARE7";;
2153 esac
2154
2155 if test -n "$USER_CFLAGS"; then
2156 CFLAGS="$CFLAGS $USER_CFLAGS"
2157 fi
2158
2159 if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
2160 LDFLAGS=""
2161 fi
2162
2163
2164dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
2165dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
2166
2167 AC_MSG_CHECKING(how to run the C preprocessor)
2168 # On Suns, sometimes $CPP names a directory.
2169 if test -n "$CPP" && test -d "$CPP"; then
2170 CPP=
2171 fi
2172 if test -z "$CPP"; then
2173 AC_CACHE_VAL(ac_cv_prog_CPP,
2174 [ # This must be in double quotes, not single quotes, because CPP may get
2175 # substituted into the Makefile and "${CC-cc}" will confuse make.
2176 CPP="${CC-cc} -E"
2177 # On the NeXT, cc -E runs the code through the compiler's parser,
2178 # not just through cpp.
2179 dnl Use a header file that comes with gcc, so configuring glibc
2180 dnl with a fresh cross-compiler works.
2181 AC_TRY_CPP([#include <assert.h>
2182 Syntax Error], ,
2183 CPP="${CC-cc} -E -traditional-cpp"
2184 AC_TRY_CPP([#include <assert.h>
2185 Syntax Error], , CPP=/lib/cpp))
2186 ac_cv_prog_CPP="$CPP"])dnl
2187 CPP="$ac_cv_prog_CPP"
2188 else
2189 ac_cv_prog_CPP="$CPP"
2190 fi
2191 AC_MSG_RESULT($CPP)
2192 AC_SUBST(CPP)dnl
2193
2194
2195 AC_MSG_CHECKING(for a C++-Compiler)
2196 dnl if there is one, print out. if not, don't matter
2197 AC_MSG_RESULT($CXX)
2198
2199 if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
2200 if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
2201 if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
2202 if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
2203 test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH])
2204
2205 AC_PROG_CXX_WORKS
2206 AC_PROG_CXX_GNU
2207
2208 if test $ac_cv_prog_gxx = yes; then
2209 GXX=yes
2210 fi
2211
2212 USER_CXXFLAGS=$CXXFLAGS
2213 CXXFLAGS=""
2214
2215 if test -z "$CXXFLAGS"; then
2216 if test "$kde_use_debug_code" = "yes"; then
2217 AC_PROG_CXX_G
2218 if test $ac_cv_prog_cxx_g = yes; then
2219 CXXFLAGS="-g"
2220 case $host in dnl
2221 *-*-linux-gnu)
2222 CXXFLAGS="$CXXFLAGS -ansi -D_XOPEN_SOURCE -D_BSD_SOURCE -Wbad-function-cast -Wcast-align -Wundef -Wconversion"
2223 ;;
2224 esac
2225 fi
2226 else
2227 if test "$GXX" = "yes"; then
2228 CXXFLAGS="-O2"
2229 fi
2230 if test "$kde_use_debug_define" = "yes"; then
2231 CXXFLAGS="$CXXFLAGS -DNDEBUG"
2232 fi
2233 fi
2234
2235 if test "$kde_use_profiling" = yes; then
2236 KDE_PROG_CXX_PG
2237 if test "$kde_cv_prog_cxx_pg" = yes; then
2238 CXXFLAGS="$CXXFLAGS -pg"
2239 fi
2240 fi
2241
2242 KDE_CHECK_COMPILER_FLAG(fno-exceptions,
2243 [
2244 CXXFLAGS="$CXXFLAGS -fno-exceptions"
2245 ])
2246
2247dnl WABA: Nothing wrong with RTTI, keep it on.
2248dnl KDE_CHECK_COMPILER_FLAG(fno-rtti,
2249dnl [
2250dnl CXXFLAGS="$CXXFLAGS -fno-rtti"
2251dnl ])
2252
2253 KDE_CHECK_COMPILER_FLAG(fno-check-new,
2254 [
2255 CXXFLAGS="$CXXFLAGS -fno-check-new"
2256 ])
2257
2258 if test "$GXX" = "yes"; then
2259 CXXFLAGS="$CXXFLAGS"
2260
2261 if test true || test "$kde_use_debug_code" = "yes"; then
2262 CXXFLAGS="$CXXFLAGS -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings"
2263
2264 KDE_CHECK_COMPILER_FLAG(Wno-long-long,
2265 [
2266 CXXFLAGS="$CXXFLAGS -Wno-long-long"
2267 ])
2268 KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,
2269 [
2270 CXXFLAGS="$CXXFLAGS -Wnon-virtual-dtor"
2271 ])
2272 KDE_CHECK_COMPILER_FLAG(fno-builtin,
2273 [
2274 CXXFLAGS="$CXXFLAGS -fno-builtin"
2275 ])
2276
2277 fi
2278
2279 if test "$kde_use_strict_options" = "yes"; then
2280 CXXFLAGS="$CXXFLAGS -Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align"
2281 fi
2282
2283 if test "$kde_very_strict" = "yes"; then
2284 CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wredundant-decls -Wconversion"
2285 fi
2286 fi
2287 fi
2288
2289 KDE_CHECK_COMPILER_FLAG(fexceptions,
2290 [
2291 USE_EXCEPTIONS="-fexceptions"
2292 ],
2293 USE_EXCEPTIONS=
2294 )
2295 AC_SUBST(USE_EXCEPTIONS)
2296
2297 KDE_CHECK_COMPILER_FLAG(frtti,
2298 [
2299 USE_RTTI="-frtti"
2300 ],
2301 USE_RTTI=
2302 )
2303 AC_SUBST(USE_RTTI)
2304
2305 case "$host" in
2306 *-*-irix*) test "$GXX" = yes && CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS" ;;
2307 *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
2308 *-*-sysv5uw7*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE7";;
2309 *-*-solaris*)
2310 if test "$GXX" = yes; then
2311 libstdcpp=`gcc -print-file-name=libstdc++.so`
2312 if test ! -f $libstdcpp; then
2313 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])
2314 fi
2315 fi
2316 ;;
2317 esac
2318
2319 if test -n "$USER_CXXFLAGS"; then
2320 CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
2321 fi
2322
2323 AC_VALIDIFY_CXXFLAGS
2324
2325 AC_MSG_CHECKING(how to run the C++ preprocessor)
2326 if test -z "$CXXCPP"; then
2327 AC_CACHE_VAL(ac_cv_prog_CXXCPP,
2328 [
2329 AC_LANG_SAVE[]dnl
2330 AC_LANG_CPLUSPLUS[]dnl
2331 CXXCPP="${CXX-g++} -E"
2332 AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp)
2333 ac_cv_prog_CXXCPP="$CXXCPP"
2334 AC_LANG_RESTORE[]dnl
2335 ])dnl
2336 CXXCPP="$ac_cv_prog_CXXCPP"
2337 fi
2338 AC_MSG_RESULT($CXXCPP)
2339 AC_SUBST(CXXCPP)dnl
2340
2341 # the following is to allow programs, that are known to
2342 # have problems when compiled with -O2
2343 if test -n "$CXXFLAGS"; then
2344 kde_safe_IFS=$IFS
2345 IFS=" "
2346 NOOPT_CXXFLAGS=""
2347 for i in $CXXFLAGS; do
2348 case $i in
2349 -O*)
2350 ;;
2351 *)
2352 NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i"
2353 ;;
2354 esac
2355 done
2356 IFS=$kde_safe_IFS
2357 fi
2358 AC_SUBST(NOOPT_CXXFLAGS)
2359
2360 KDE_CHECK_FINAL
2361
2362 ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
2363
2364 KDE_CXXFLAGS=
2365 AC_SUBST(KDE_CXXFLAGS)
2366])
2367
2368AC_DEFUN(KDE_ADD_DEPENDENCIES,
2369[
2370 [A]M_DEPENDENCIES(CC)
2371 [A]M_DEPENDENCIES(CXX)
2372])
2373
2374dnl just a wrapper to clean up configure.in
2375AC_DEFUN(KDE_PROG_LIBTOOL,
2376[
2377AC_REQUIRE([AC_CHECK_COMPILERS])
2378AC_REQUIRE([AC_ENABLE_SHARED])
2379AC_REQUIRE([AC_ENABLE_STATIC])
2380
2381AC_REQUIRE([AC_LIBTOOL_DLOPEN])
2382
2383AC_LANG_SAVE
2384AC_LANG_C
2385AC_OBJEXT
2386AC_EXEEXT
2387AC_LANG_RESTORE
2388
2389AM_PROG_LIBTOOL
2390AC_LIBTOOL_CXX
2391
2392LIBTOOL_SHELL="/bin/sh ./libtool"
2393# LIBTOOL="$LIBTOOL --silent"
2394KDE_PLUGIN="-avoid-version -module -no-undefined"
2395AC_SUBST(KDE_PLUGIN)
2396])
2397
2398AC_DEFUN(KDE_CHECK_TYPES,
2399[ AC_CHECK_SIZEOF(int, 4)dnl
2400 AC_CHECK_SIZEOF(long, 4)dnl
2401 AC_CHECK_SIZEOF(char *, 4)dnl
2402])dnl
2403
2404AC_DEFUN(KDE_DO_IT_ALL,
2405[
2406AC_CANONICAL_SYSTEM
2407AC_ARG_PROGRAM
2408AM_INIT_AUTOMAKE($1, $2)
2409AM_DISABLE_LIBRARIES
2410AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
2411AC_CHECK_COMPILERS
2412KDE_PROG_LIBTOOL
2413AM_KDE_WITH_NLS
2414AC_PATH_KDE
2415])
2416
2417AC_DEFUN(AC_CHECK_RPATH,
2418[
2419AC_MSG_CHECKING(for rpath)
2420AC_ARG_ENABLE(rpath,
2421 [ --disable-rpath do not use the rpath feature of ld],
2422 USE_RPATH=$enableval, USE_RPATH=yes)
2423
2424if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
2425
2426 KDE_RPATH="-R \$(kde_libraries)"
2427
2428 if test -n "$qt_libraries"; then
2429 KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)"
2430 fi
2431 dnl $x_libraries is set to /usr/lib in case
2432 if test -n "$X_LDFLAGS"; then
2433 KDE_RPATH="$KDE_RPATH -R \$(x_libraries)"
2434 fi
2435 if test -n "$KDE_EXTRA_RPATH"; then
2436 KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
2437 fi
2438fi
2439AC_SUBST(KDE_EXTRA_RPATH)
2440AC_SUBST(KDE_RPATH)
2441AC_MSG_RESULT($USE_RPATH)
2442])
2443
2444dnl Check for the type of the third argument of getsockname
2445AC_DEFUN(AC_CHECK_KSIZE_T,
2446[AC_MSG_CHECKING(for the third argument of getsockname)
2447AC_CACHE_VAL(ac_cv_ksize_t,
2448AC_LANG_SAVE
2449AC_LANG_CPLUSPLUS
2450[AC_TRY_COMPILE([
2451#include <sys/types.h>
2452#include <sys/socket.h>
2453],[
2454socklen_t a=0;
2455getsockname(0,(struct sockaddr*)0, &a);
2456],
2457ac_cv_ksize_t=socklen_t,
2458ac_cv_ksize_t=)
2459if test -z "$ac_cv_ksize_t"; then
2460ac_safe_cxxflags="$CXXFLAGS"
2461if test "$GCC" = "yes"; then
2462 CXXFLAGS="-Werror $CXXFLAGS"
2463fi
2464AC_TRY_COMPILE([
2465#include <sys/types.h>
2466#include <sys/socket.h>
2467],[
2468int a=0;
2469getsockname(0,(struct sockaddr*)0, &a);
2470],
2471ac_cv_ksize_t=int,
2472ac_cv_ksize_t=size_t)
2473CXXFLAGS="$ac_safe_cxxflags"
2474fi
2475AC_LANG_RESTORE
2476])
2477
2478if test -z "$ac_cv_ksize_t"; then
2479 ac_cv_ksize_t=int
2480fi
2481
2482AC_MSG_RESULT($ac_cv_ksize_t)
2483AC_DEFINE_UNQUOTED(ksize_t, $ac_cv_ksize_t,
2484 [Define the type of the third argument for getsockname]
2485)
2486
2487])
2488
2489dnl This is a merge of some macros out of the gettext aclocal.m4
2490dnl since we don't need anything, I took the things we need
2491dnl the copyright for them is:
2492dnl >
2493dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
2494dnl This Makefile.in is free software; the Free Software Foundation
2495dnl gives unlimited permission to copy and/or distribute it,
2496dnl with or without modifications, as long as this notice is preserved.
2497
2498dnl This program is distributed in the hope that it will be useful,
2499dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
2500dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2501dnl PARTICULAR PURPOSE.
2502dnl >
2503dnl for this file it is relicensed under LGPL
2504
2505AC_DEFUN(AM_KDE_WITH_NLS,
2506 [
2507 dnl If we use NLS figure out what method
2508
2509 AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt,
2510 [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
2511 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2512
2513 if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
2514 AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
2515 GMSGFMT=":"
2516 fi
2517 MSGFMT=$GMSGFMT
2518 AC_SUBST(GMSGFMT)
2519 AC_SUBST(MSGFMT)
2520
2521 AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
2522 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2523
2524 dnl Test whether we really found GNU xgettext.
2525 if test "$XGETTEXT" != ":"; then
2526 dnl If it is no GNU xgettext we define it as : so that the
2527 dnl Makefiles still can work.
2528 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2529 : ;
2530 else
2531 AC_MSG_RESULT(
2532 [found xgettext programs is not GNU xgettext; ignore it])
2533 XGETTEXT=":"
2534 fi
2535 fi
2536 AC_SUBST(XGETTEXT)
2537
2538 ])
2539
2540# Search path for a program which passes the given test.
2541# Ulrich Drepper <drepper@cygnus.com>, 1996.
2542
2543# serial 1
2544# Stephan Kulow: I appended a _KDE against name conflicts
2545
2546dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
2547dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2548AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE,
2549[# Extract the first word of "$2", so it can be a program name with args.
2550set dummy $2; ac_word=[$]2
2551AC_MSG_CHECKING([for $ac_word])
2552AC_CACHE_VAL(ac_cv_path_$1,
2553[case "[$]$1" in
2554 /*)
2555 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2556 ;;
2557 *)
2558 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2559 for ac_dir in ifelse([$5], , $PATH, [$5]); do
2560 test -z "$ac_dir" && ac_dir=.
2561 if test -f $ac_dir/$ac_word; then
2562 if [$3]; then
2563 ac_cv_path_$1="$ac_dir/$ac_word"
2564 break
2565 fi
2566 fi
2567 done
2568 IFS="$ac_save_ifs"
2569dnl If no 4th arg is given, leave the cache variable unset,
2570dnl so AC_PATH_PROGS will keep looking.
2571ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2572])dnl
2573 ;;
2574esac])dnl
2575$1="$ac_cv_path_$1"
2576if test -n "[$]$1"; then
2577 AC_MSG_RESULT([$]$1)
2578else
2579 AC_MSG_RESULT(no)
2580fi
2581AC_SUBST($1)dnl
2582])
2583
2584
2585# Check whether LC_MESSAGES is available in <locale.h>.
2586# Ulrich Drepper <drepper@cygnus.com>, 1995.
2587
2588# serial 1
2589
2590AC_DEFUN(AM_LC_MESSAGES,
2591 [if test $ac_cv_header_locale_h = yes; then
2592 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2593 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2594 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2595 if test $am_cv_val_LC_MESSAGES = yes; then
2596 AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
2597 fi
2598 fi])
2599
2600dnl From Jim Meyering.
2601dnl FIXME: migrate into libit.
2602
2603AC_DEFUN(AM_FUNC_OBSTACK,
2604[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
2605 [AC_TRY_LINK([#include "obstack.h"],
2606 [struct obstack *mem;obstack_free(mem,(char *) 0)],
2607 am_cv_func_obstack=yes,
2608 am_cv_func_obstack=no)])
2609 if test $am_cv_func_obstack = yes; then
2610 AC_DEFINE(HAVE_OBSTACK)
2611 else
2612 LIBOBJS="$LIBOBJS obstack.o"
2613 fi
2614])
2615
2616dnl From Jim Meyering. Use this if you use the GNU error.[ch].
2617dnl FIXME: Migrate into libit
2618
2619AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
2620[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
2621 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
2622 am_cv_lib_error_at_line=yes,
2623 am_cv_lib_error_at_line=no)])
2624 if test $am_cv_lib_error_at_line = no; then
2625 LIBOBJS="$LIBOBJS error.o"
2626 fi
2627 AC_SUBST(LIBOBJS)dnl
2628])
2629
2630# Macro to add for using GNU gettext.
2631# Ulrich Drepper <drepper@cygnus.com>, 1995.
2632
2633# serial 1
2634# Stephan Kulow: I put a KDE in it to avoid name conflicts
2635
2636AC_DEFUN(AM_KDE_GNU_GETTEXT,
2637 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2638 AC_REQUIRE([AC_PROG_RANLIB])dnl
2639 AC_REQUIRE([AC_HEADER_STDC])dnl
2640 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2641 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2642 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2643 AC_REQUIRE([AC_FUNC_MMAP])dnl
2644 AC_REQUIRE([AM_KDE_WITH_NLS])dnl
2645 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h string.h values.h alloca.h])
2646 AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
2647__argz_count __argz_stringify __argz_next])
2648
2649 AC_MSG_CHECKING(for stpcpy)
2650 AC_CACHE_VAL(kde_cv_func_stpcpy,
2651 [
2652 kde_safe_cxxflags=$CXXFLAGS
2653 CXXFLAGS="-Wmissing-prototypes -Werror"
2654 AC_LANG_SAVE
2655 AC_LANG_CPLUSPLUS
2656 AC_TRY_COMPILE([
2657 #include <string.h>
2658 ],
2659 [
2660 char buffer[200];
2661 stpcpy(buffer, buffer);
2662 ],
2663 kde_cv_func_stpcpy=yes,
2664 kde_cv_func_stpcpy=no)
2665 AC_LANG_RESTORE
2666 CXXFLAGS=$kde_safe_cxxflags
2667 ])
2668 AC_MSG_RESULT($kde_cv_func_stpcpy)
2669 if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
2670 AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
2671 fi
2672
2673 AM_LC_MESSAGES
2674
2675 if test "x$CATOBJEXT" != "x"; then
2676 if test "x$ALL_LINGUAS" = "x"; then
2677 LINGUAS=
2678 else
2679 AC_MSG_CHECKING(for catalogs to be installed)
2680 NEW_LINGUAS=
2681 for lang in ${LINGUAS=$ALL_LINGUAS}; do
2682 case "$ALL_LINGUAS" in
2683 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
2684 esac
2685 done
2686 LINGUAS=$NEW_LINGUAS
2687 AC_MSG_RESULT($LINGUAS)
2688 fi
2689
2690 dnl Construct list of names of catalog files to be constructed.
2691 if test -n "$LINGUAS"; then
2692 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2693 fi
2694 fi
2695
2696 ])
2697
2698AC_DEFUN(AC_HAVE_XPM,
2699 [AC_REQUIRE_CPP()dnl
2700 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2701
2702 test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
2703 test -z "$XPM_INCLUDE" && XPM_INCLUDE=
2704
2705 AC_ARG_WITH(xpm, [ --without-xpm disable color pixmap XPM tests],
2706 xpm_test=$withval, xpm_test="yes")
2707 if test "x$xpm_test" = xno; then
2708 ac_cv_have_xpm=no
2709 else
2710 AC_MSG_CHECKING(for XPM)
2711 AC_CACHE_VAL(ac_cv_have_xpm,
2712 [
2713 AC_LANG_C
2714 ac_save_ldflags="$LDFLAGS"
2715 ac_save_cflags="$CFLAGS"
2716 LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET"
2717 CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES"
2718 test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
2719 AC_TRY_LINK([#include <X11/xpm.h>],[],
2720 ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
2721 LDFLAGS="$ac_save_ldflags"
2722 CFLAGS="$ac_save_cflags"
2723 ])dnl
2724
2725 if test "$ac_cv_have_xpm" = no; then
2726 AC_MSG_RESULT(no)
2727 XPM_LDFLAGS=""
2728 XPMINC=""
2729 $2
2730 else
2731 AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
2732 if test "$XPM_LDFLAGS" = ""; then
2733 XPMLIB='-lXpm $(LIB_X11)'
2734 else
2735 XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
2736 fi
2737 if test "$XPM_INCLUDE" = ""; then
2738 XPMINC=""
2739 else
2740 XPMINC="-I$XPM_INCLUDE"
2741 fi
2742 AC_MSG_RESULT(yes)
2743 $1
2744 fi
2745 fi
2746 AC_SUBST(XPMINC)
2747 AC_SUBST(XPMLIB)
2748])
2749
2750AC_DEFUN(AC_HAVE_DPMS,
2751 [AC_REQUIRE_CPP()dnl
2752 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2753
2754 test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS=
2755 test -z "$DPMS_INCLUDE" && DPMS_INCLUDE=
2756 DPMS_LIB=
2757
2758 AC_ARG_WITH(dpms, [ --without-dpms disable DPMS power saving],
2759 dpms_test=$withval, dpms_test="yes")
2760 if test "x$dpms_test" = xno; then
2761 ac_cv_have_dpms=no
2762 else
2763 AC_MSG_CHECKING(for DPMS)
2764 dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms.
2765 dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms".
2766 AC_CACHE_VAL(ac_cv_have_dpms,
2767 [
2768 AC_LANG_C
2769 ac_save_ldflags="$LDFLAGS"
2770 ac_save_cflags="$CFLAGS"
2771 ac_save_libs="$LIBS"
2772 LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
2773 CFLAGS="$CFLAGS $X_INCLUDES"
2774 test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
2775 AC_TRY_LINK([
2776 #include <X11/Xproto.h>
2777 #include <X11/X.h>
2778 #include <X11/Xlib.h>
2779 #include <X11/extensions/dpms.h>
2780 int foo_test_dpms()
2781 { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
2782 ac_cv_have_dpms="yes", [
2783 LDFLAGS="$ac_save_ldflags"
2784 CFLAGS="$ac_save_cflags"
2785 LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
2786 LIBS="$LIBS -lXdpms"
2787 CFLAGS="$CFLAGS $X_INCLUDES"
2788 test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
2789 AC_TRY_LINK([
2790 #include <X11/Xproto.h>
2791 #include <X11/X.h>
2792 #include <X11/Xlib.h>
2793 #include <X11/extensions/dpms.h>
2794 int foo_test_dpms()
2795 { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
2796 [
2797 ac_cv_have_dpms="-lXdpms"
2798 ],ac_cv_have_dpms="no")
2799 ])
2800 LDFLAGS="$ac_save_ldflags"
2801 CFLAGS="$ac_save_cflags"
2802 LIBS="$ac_save_libs"
2803 ])dnl
2804
2805 if test "$ac_cv_have_dpms" = no; then
2806 AC_MSG_RESULT(no)
2807 DPMS_LDFLAGS=""
2808 DPMSINC=""
2809 $2
2810 else
2811 AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support])
2812 if test "$ac_cv_have_dpms" = "-lXdpms"; then
2813 DPMS_LIB="-lXdpms"
2814 fi
2815 if test "$DPMS_LDFLAGS" = ""; then
2816 DPMSLIB="$DPMS_LIB "'$(LIB_X11)'
2817 else
2818 DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)'
2819 fi
2820 if test "$DPMS_INCLUDE" = ""; then
2821 DPMSINC=""
2822 else
2823 DPMSINC="-I$DPMS_INCLUDE"
2824 fi
2825 AC_MSG_RESULT(yes)
2826 $1
2827 fi
2828 fi
2829 AC_SUBST(DPMSINC)
2830 AC_SUBST(DPMSLIB)
2831])
2832
2833AC_DEFUN(AC_HAVE_GL,
2834 [AC_REQUIRE_CPP()dnl
2835 AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2836
2837 test -z "$GL_LDFLAGS" && GL_LDFLAGS=
2838 test -z "$GL_INCLUDE" && GL_INCLUDE=
2839
2840 AC_ARG_WITH(gl, [ --without-gl disable 3D GL modes],
2841 gl_test=$withval, gl_test="yes")
2842 if test "x$gl_test" = xno; then
2843 ac_cv_have_gl=no
2844 else
2845 AC_MSG_CHECKING(for GL)
2846 AC_CACHE_VAL(ac_cv_have_gl,
2847 [
2848 AC_LANG_C
2849 ac_save_ldflags="$LDFLAGS"
2850 ac_save_cflags="$CFLAGS"
2851 LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET"
2852 CFLAGS="$CFLAGS $X_INCLUDES"
2853 test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
2854 AC_TRY_LINK([#include <GL/gl.h>
2855#include <GL/glu.h>
2856], [],
2857 ac_cv_have_gl="mesa", ac_cv_have_gl="no")
2858 if test "x$ac_cv_have_gl" = "xno"; then
2859 LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGL -lGLU -lX11 -lXext -lm $LIBSOCKET"
2860 CFLAGS="$ac_save_cflags $X_INCLUDES"
2861 test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
2862 AC_TRY_LINK([#include <GL/gl.h>
2863#include <GL/glu.h>
2864], [],
2865 ac_cv_have_gl="yes", ac_cv_have_gl="no")
2866 fi
2867 LDFLAGS="$ac_save_ldflags"
2868 CFLAGS="$ac_save_cflags"
2869 ])dnl
2870
2871 if test "$ac_cv_have_gl" = "no"; then
2872 AC_MSG_RESULT(no)
2873 GL_LDFLAGS=""
2874 GLINC=""
2875 $2
2876 else
2877 AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)])
2878 if test "$GL_LDFLAGS" = ""; then
2879 if test "$ac_cv_have_gl" = "mesa"; then
2880 GLLIB='-lMesaGL -lMesaGLU $(LIB_X11)'
2881 else
2882 GLLIB='-lGL -lGLU $(LIB_X11)'
2883 fi
2884 else
2885 if test "$ac_cv_have_gl" = "mesa"; then
2886 GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU "'$(LIB_X11)'
2887 else
2888 GLLIB="$GL_LDFLAGS -lGL -lGLU "'$(LIB_X11)'
2889 fi
2890 fi
2891 if test "$GL_INCLUDE" = ""; then
2892 GLINC=""
2893 else
2894 GLINC="-I$GL_INCLUDE"
2895 fi
2896 AC_MSG_RESULT($ac_cv_have_gl)
2897 $1
2898 fi
2899 fi
2900 AC_SUBST(GLINC)
2901 AC_SUBST(GLLIB)
2902])
2903
2904 dnl PAM pam
2905
2906 dnl Should test for PAM (Pluggable Authentication Modules)
2907 AC_DEFUN(AC_PATH_PAM_DIRECT,
2908 [
2909 test -z "$pam_direct_test_library" && pam_direct_test_library=pam
2910 test -z "$pam_direct_test_include" && pam_direct_test_include=security/pam_appl.h
2911
2912 for ac_dir in \
2913 \
2914 /usr/local/include \
2915 /usr/include \
2916 /usr/unsupported/include \
2917 /opt/include \
2918 /usr/pam/include \
2919 /usr/local/pam/include \
2920 /usr/lib/pam/include \
2921 \
2922 $extra_include \
2923 ; \
2924 do
2925 if test -r "$ac_dir/$pam_direct_test_include"; then
2926 no_pam= ac_pam_includes=$ac_dir
2927 break
2928 fi
2929 done
2930
2931 # First see if replacing the include by lib works.
2932 for ac_dir in `echo "$ac_pam_includes" | sed s/include/lib/` \
2933 \
2934 /lib \
2935 /usr/lib \
2936 /usr/local/lib \
2937 /usr/unsupported/lib \
2938 /lib/security \
2939 /usr/security/lib \
2940 $extra_lib \
2941 ; \
2942 do
2943 for ac_extension in a so sl; do
2944 if test -r $ac_dir/lib${pam_direct_test_library}.$ac_extension; then
2945 no_pam= ac_pam_libraries=$ac_dir
2946 break 2
2947 fi
2948 done
2949 done
2950])
2951
2952AC_DEFUN(AC_PATH_PAM,
2953 [
2954 AC_REQUIRE([KDE_CHECK_LIBDL])
2955 AC_REQUIRE_CPP()dnl
2956
2957dnl AC_CHECK_LIB(pam_misc, main, [PAM_MISC_LIB="-lpam_misc"
2958dnl AC_DEFINE_UNQUOTED(HAVE_PAM_MISC, 1, [Define if you have a PAM implementation with the pam_misc library])], [], [-lpam $LIBDL])
2959
2960 AC_MSG_CHECKING(for PAM)
2961 AC_ARG_WITH(pam,
2962[ --with-pam[=ARG] enable support for PAM: ARG=[yes|no|service name]],
2963 [
2964 if test "x$withval" = "xyes"; then
2965 no_pam=
2966 default_pam=yes
2967 elif test "x$withval" = "xno"; then
2968 no_pam=yes
2969 else
2970 no_pam=
2971 pam_service="$withval"
2972 if test -z "$pam_service"; then
2973 default_pam=yes
2974 else
2975 default_pam=
2976 fi
2977 fi
2978 ], no_pam=yes
2979 )
2980
2981 if test ! "$no_pam" = yes; then
2982
2983 AC_CACHE_VAL(ac_cv_path_pam,
2984 [
2985 ac_pam_includes=NONE
2986 ac_pam_libraries=NONE
2987 if test -z "$pam_libraries"; then
2988 pam_libraries=NONE
2989 fi
2990 if test -z "$pam_includes"; then
2991 pam_includes=NONE
2992 fi
2993
2994 AC_PATH_PAM_DIRECT
2995
2996 test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
2997 test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
2998
2999 if test ! "x$pam_includes" = xNONE && test ! "x$pam_libraries" = xNONE; then
3000 ac_pam_libs="-lpam $PAM_MISC_LIB $LIBDL"
3001 ac_cv_path_pam="no_pam= ac_pam_includes=$ac_pam_includes ac_pam_libraries=$ac_pam_libraries ac_pam_libs=\"$ac_pam_libs\""
3002 else
3003 ac_cv_path_pam="no_pam=yes"
3004 fi
3005 ])
3006
3007 eval "$ac_cv_path_pam"
3008
3009 fi
3010
3011 if test "$no_pam" = yes; then
3012 AC_MSG_RESULT(no)
3013 else
3014 AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules); Redhat-Users!])
3015 PAMLIBS="$ac_pam_libs"
3016 test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
3017 test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
3018 AC_MSG_RESULT([libraries $pam_libraries, headers $pam_includes])
3019 if test "$default_pam" = yes; then
3020 AC_MSG_RESULT(["default pam service name will be used"])
3021 else
3022 AC_DEFINE_UNQUOTED(KDE_PAM_SERVICE,"$pam_service", [Define to change the default name of the PAM service used by KDE])
3023 AC_MSG_RESULT(["pam service name will be: " $pam_service])
3024 fi
3025dnl test whether struct pam_message is const (Linux) or not (Sun)
3026 pam_appl_h="$ac_pam_includes/security/pam_appl.h"
3027 AC_MSG_CHECKING(for const pam_message)
3028 AC_EGREP_HEADER([struct pam_message],
3029 $pam_appl_h,
3030 [ AC_EGREP_HEADER([const struct pam_message],
3031 $pam_appl_h,
3032 [AC_MSG_RESULT(["const: Linux-type PAM"]) ],
3033 [AC_MSG_RESULT(["nonconst: Sun-type PAM"])
3034 AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
3035 )],
3036 [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])]
3037 )
3038 fi
3039
3040 if test "x$pam_libraries" != x && test "x$pam_libraries" != xNONE ; then
3041 PAMLIBPATHS="-L$pam_libraries"
3042 fi
3043 if test "x$pam_includes" != x && test "x$pam_includes" != xNONE ; then
3044 PAMINC="-I$pam_includes"
3045 fi
3046
3047 AC_SUBST(PAMINC)
3048 AC_SUBST(PAMLIBS)
3049 AC_SUBST(PAMLIBPATHS)
3050
3051])
3052
3053AC_DEFUN(KDE_CHECK_LIBDL,
3054[
3055AC_CHECK_LIB(dl, dlopen, [
3056LIBDL="-ldl"
3057ac_cv_have_dlfcn=yes
3058])
3059
3060AC_CHECK_LIB(dld, shl_unload, [
3061LIBDL="-ldld"
3062ac_cv_have_shload=yes
3063])
3064
3065AC_SUBST(LIBDL)
3066])
3067
3068AC_DEFUN(KDE_CHECK_DLOPEN,
3069[
3070KDE_CHECK_LIBDL
3071AC_CHECK_HEADERS(dlfcn.h dl.h)
3072if test "$ac_cv_header_dlfcn_h" = "no"; then
3073 ac_cv_have_dlfcn=no
3074fi
3075
3076if test "$ac_cv_header_dl_h" = "no"; then
3077 ac_cv_have_shload=no
3078fi
3079
3080dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE
3081dnl (MM)
3082AC_ARG_ENABLE(dlopen,
3083[ --disable-dlopen link statically [default=no]] ,
3084enable_dlopen=$enableval,
3085enable_dlopen=yes)
3086
3087# override the user's opinion, if we know it better ;)
3088if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
3089 enable_dlopen=no
3090fi
3091
3092if test "$ac_cv_have_dlfcn" = "yes"; then
3093 AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn])
3094fi
3095
3096if test "$ac_cv_have_shload" = "yes"; then
3097 AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload])
3098fi
3099
3100if test "$enable_dlopen" = no ; then
3101 test -n "$1" && eval $1
3102else
3103 test -n "$2" && eval $2
3104fi
3105
3106])
3107
3108AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING,
3109[
3110KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no)
3111KDE_PROG_LIBTOOL
3112AC_MSG_CHECKING([dynamic loading])
3113eval "`egrep '^build_libtool_libs=' libtool`"
3114if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
3115 dynamic_loading=yes
3116 AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
3117else
3118 dynamic_loading=no
3119fi
3120AC_MSG_RESULT($dynamic_loading)
3121if test "$dynamic_loading" = "yes"; then
3122 $1
3123else
3124 $2
3125fi
3126])
3127
3128AC_DEFUN(KDE_ADD_INCLUDES,
3129[
3130if test -z "$1"; then
3131 test_include="Pix.h"
3132else
3133 test_include="$1"
3134fi
3135
3136AC_MSG_CHECKING([for libg++ ($test_include)])
3137
3138AC_CACHE_VAL(kde_cv_libgpp_includes,
3139[
3140kde_cv_libgpp_includes=no
3141
3142 for ac_dir in \
3143 \
3144 /usr/include/g++ \
3145 /usr/include \
3146 /usr/unsupported/include \
3147 /opt/include \
3148 $extra_include \
3149 ; \
3150 do
3151 if test -r "$ac_dir/$test_include"; then
3152 kde_cv_libgpp_includes=$ac_dir
3153 break
3154 fi
3155 done
3156])
3157
3158AC_MSG_RESULT($kde_cv_libgpp_includes)
3159if test "$kde_cv_libgpp_includes" != "no"; then
3160 all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES"
3161fi
3162])
3163])
3164
3165
3166AC_DEFUN(KDE_CHECK_MICO,
3167[
3168AC_REQUIRE([KDE_CHECK_LIBDL])
3169AC_REQUIRE([KDE_MISC_TESTS])
3170AC_MSG_CHECKING(for MICO)
3171
3172if test -z "$MICODIR"; then
3173 kde_micodir=/usr/local
3174 else
3175 kde_micodir="$MICODIR"
3176fi
3177
3178AC_ARG_WITH(micodir,
3179 [ --with-micodir=micodir where mico is installed ],
3180 kde_micodir=$withval,
3181 kde_micodir=$kde_micodir
3182)
3183
3184AC_CACHE_VAL(kde_cv_mico_incdir,
3185[
3186 mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes"
3187AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir)
3188
3189])
3190kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'`
3191
3192if test ! -r $kde_micodir/include/CORBA.h; then
3193 AC_MSG_ERROR([No CORBA.h found, specify another micodir])
3194fi
3195
3196AC_MSG_RESULT($kde_micodir)
3197
3198MICO_INCLUDES=-I$kde_micodir/include
3199AC_SUBST(MICO_INCLUDES)
3200MICO_LDFLAGS=-L$kde_micodir/lib
3201AC_SUBST(MICO_LDFLAGS)
3202micodir=$kde_micodir
3203AC_SUBST(micodir)
3204
3205AC_MSG_CHECKING([for MICO version])
3206AC_CACHE_VAL(kde_cv_mico_version,
3207[
3208AC_LANG_C
3209cat >conftest.$ac_ext <<EOF
3210#include <stdio.h>
3211#include <mico/version.h>
3212int main() {
3213
3214 printf("MICO_VERSION=%s\n",MICO_VERSION);
3215 return (0);
3216}
3217EOF
3218ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest'
3219if AC_TRY_EVAL(ac_compile); then
3220 if eval `./conftest 2>&5`; then
3221 kde_cv_mico_version=$MICO_VERSION
3222 else
3223 AC_MSG_ERROR([your system is not able to execute a small application to
3224 find MICO version! Check $kde_micodir/include/mico/version.h])
3225 fi
3226else
3227 AC_MSG_ERROR([your system is not able to compile a small application to
3228 find MICO version! Check $kde_micodir/include/mico/version.h])
3229fi
3230])
3231
3232dnl installed MICO version
3233mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
3234mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
3235mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
3236
3237if test "x$1" = "x"; then
3238 req_version="2.3.0"
3239else
3240 req_version=$1
3241fi
3242
3243dnl required MICO version
3244req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
3245req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
3246req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
3247
3248if test "$mico_v_maj" -lt "$req_v_maj" || \
3249 ( test "$mico_v_maj" -eq "$req_v_maj" && \
3250 test "$mico_v_mid" -lt "$req_v_mid" ) || \
3251 ( test "$mico_v_mid" -eq "$req_v_mid" && \
3252 test "$mico_v_min" -lt "$req_v_min" )
3253
3254then
3255 AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \
3256at least is required. You should upgrade MICO.])
3257else
3258 AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)])
3259fi
3260
3261LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL"
3262AC_SUBST(LIBMICO)
3263if test -z "$IDL"; then
3264 IDL='$(kde_bindir)/cuteidl'
3265fi
3266AC_SUBST(IDL)
3267IDL_DEPENDENCIES='$(kde_includes)/CUTE.h'
3268AC_SUBST(IDL_DEPENDENCIES)
3269
3270idldir="\$(includedir)/idl"
3271AC_SUBST(idldir)
3272
3273])
3274
3275AC_DEFUN(KDE_CHECK_MINI_STL,
3276[
3277AC_REQUIRE([KDE_CHECK_MICO])
3278
3279AC_MSG_CHECKING(if we use mico's mini-STL)
3280AC_CACHE_VAL(kde_cv_have_mini_stl,
3281[
3282AC_LANG_SAVE
3283AC_LANG_CPLUSPLUS
3284kde_save_cxxflags="$CXXFLAGS"
3285CXXFLAGS="$CXXFLAGS $MICO_INCLUDES"
3286AC_TRY_COMPILE(
3287[
3288#include <mico/config.h>
3289],
3290[
3291#ifdef HAVE_MINI_STL
3292#error "nothing"
3293#endif
3294],
3295kde_cv_have_mini_stl=no,
3296kde_cv_have_mini_stl=yes)
3297CXXFLAGS="$kde_save_cxxflags"
3298AC_LANG_RESTORE
3299])
3300
3301if test "x$kde_cv_have_mini_stl" = "xyes"; then
3302 AC_MSG_RESULT(yes)
3303 $1
3304else
3305 AC_MSG_RESULT(no)
3306 $2
3307fi
3308])
3309
3310])
3311
3312
3313AC_DEFUN(KDE_CHECK_LIBPTHREAD,
3314[
3315AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] )
3316AC_SUBST(LIBPTHREAD)
3317])
3318
3319AC_DEFUN(KDE_CHECK_PTHREAD_OPTION,
3320[
3321 AC_ARG_ENABLE(kernel-threads, [ --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.],
3322 kde_use_kernthreads=$enableval, kde_use_kernthreads=no)
3323
3324 if test "$kde_use_kernthreads" = "yes"; then
3325 ac_save_CXXFLAGS="$CXXFLAGS"
3326 ac_save_CFLAGS="$CXXFLAGS"
3327 CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS"
3328 CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS"
3329 AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h)
3330 CXXFLAGS="$ac_save_CXXFLAGS"
3331 CFLAGS="$ac_save_CFLAGS"
3332 if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then
3333 kde_use_kernthreads=no
3334 else
3335 dnl Add proper -I and -l statements
3336 AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD
3337 if test "x$LIBPTHREAD" = "x"; then
3338 kde_use_kernthreads=no
3339 else
3340 USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads"
3341 fi
3342 fi
3343 else
3344 USE_THREADS=""
3345 if test -z "$LIBPTHREAD"; then
3346 KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] )
3347 fi
3348 fi
3349
3350 case $host_os in
3351 solaris*)
3352 KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
3353 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS"
3354 echo "Setting Solaris pthread compilation options"
3355 ;;
3356 freebsd*)
3357 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
3358 echo "Setting FreeBSD pthread compilation options"
3359 ;;
3360 aix*)
3361 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
3362 LIBPTHREAD="$LIBPTHREAD -lc_r"
3363 echo "Setting AIX pthread compilation options"
3364 ;;
3365 linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT"
3366 USE_THREADS="$USE_THREADS -DPIC -fPIC"
3367 echo "Setting Linux pthread compilation options"
3368 ;;
3369 *)
3370 ;;
3371 esac
3372 AC_SUBST(USE_THREADS)
3373 AC_SUBST(LIBPTHREAD)
3374])
3375
3376AC_DEFUN(KDE_CHECK_THREADING,
3377[
3378 AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
3379 AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
3380 dnl default is yes if libpthread is found and no if no libpthread is available
3381 if test -z "$LIBPTHREAD"; then
3382 kde_check_threading_default=no
3383 else
3384 kde_check_threading_default=yes
3385 fi
3386 AC_ARG_ENABLE(threading, [ --disable-threading disables threading even if libpthread found ],
3387 kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
3388
3389 if test "x$kde_use_threading" = "xyes"; then
3390 AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
3391 fi
3392])
3393
3394AC_DEFUN(KDE_TRY_LINK_PYTHON,
3395[
3396if test "$kde_python_link_found" = no; then
3397
3398if test "$1" = normal; then
3399 AC_MSG_CHECKING(if a Python application links)
3400else
3401 AC_MSG_CHECKING(if Python depends on $2)
3402fi
3403
3404AC_CACHE_VAL(kde_cv_try_link_python_$1,
3405[
3406AC_LANG_SAVE
3407AC_LANG_C
3408kde_save_cflags="$CFLAGS"
3409CFLAGS="$CFLAGS $PYTHONINC"
3410kde_save_libs="$LIBS"
3411LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
3412kde_save_ldflags="$LDFLAGS"
3413LDFLAGS="$LDFLAGS $PYTHONLIB"
3414
3415AC_TRY_LINK(
3416[
3417#include <Python.h>
3418],[
3419 PySys_SetArgv(1, 0);
3420],
3421 [kde_cv_try_link_python_$1=yes],
3422 [kde_cv_try_link_python_$1=no]
3423)
3424CFLAGS="$kde_save_cflags"
3425LIBS="$kde_save_libs"
3426LDFLAGS="$kde_save_ldflags"
3427])
3428
3429if test "$kde_cv_try_link_python_$1" = "yes"; then
3430 AC_MSG_RESULT(yes)
3431 kde_python_link_found=yes
3432 if test ! "$1" = normal; then
3433 LIBPYTHON="$LIBPYTHON $2"
3434 fi
3435 $3
3436else
3437 AC_MSG_RESULT(no)
3438 $4
3439fi
3440AC_LANG_RESTORE
3441
3442fi
3443
3444])
3445
3446AC_DEFUN(KDE_CHECK_PYTHON,
3447[
3448AC_REQUIRE([KDE_CHECK_LIBDL])
3449AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
3450
3451AC_MSG_CHECKING([for Python directory])
3452
3453AC_CACHE_VAL(kde_cv_pythondir,
3454[
3455 if test -z "$PYTHONDIR"; then
3456 kde_cv_pythondir=/usr/local
3457 else
3458 kde_cv_pythondir="$PYTHONDIR"
3459 fi
3460])
3461
3462AC_ARG_WITH(pythondir,
3463[ --with-pythondir=pythondir use python installed in pythondir ],
3464[
3465 ac_python_dir=$withval
3466], ac_python_dir=$kde_cv_pythondir
3467)
3468
3469AC_MSG_RESULT($ac_python_dir)
3470
3471if test -z "$1"; then
3472 version="1.5"
3473else
3474 version="$1"
3475fi
3476
3477AC_MSG_CHECKING([for Python$version])
3478
3479python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes"
3480AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
3481if test ! -r $python_incdir/Python.h; then
3482 AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir)
3483 python_incdir=$python_incdir/python$version
3484 if test ! -r $python_incdir/Python.h; then
3485 AC_MSG_ERROR(Python.h not found.)
3486 fi
3487fi
3488
3489PYTHONINC=-I$python_incdir
3490
3491python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs"
3492AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
3493if test ! -r $python_libdir/libpython$version.a; then
3494 AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir)
3495 python_libdir=$python_libdir/python$version/config
3496 if test ! -r $python_libdir/libpython$version.a; then
3497 AC_MSG_ERROR(libpython$version.a not found.)
3498 fi
3499fi
3500
3501PYTHONLIB=-L$python_libdir
3502if test -z "$LIBPYTHON"; then
3503LIBPYTHON=-lpython$version
3504fi
3505
3506python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs"
3507AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir)
3508python_moddir=$python_moddir/python$version
3509if test ! -r $python_moddir/copy.py; then
3510 AC_MSG_ERROR(python module directory not found.)
3511fi
3512
3513PYTHONMODDIR=$python_moddir
3514
3515AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir)
3516
3517dnl Note: this test is very weak
3518kde_python_link_found=no
3519KDE_TRY_LINK_PYTHON(normal)
3520KDE_TRY_LINK_PYTHON(m, -lm)
3521KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
3522KDE_TRY_LINK_PYTHON(tcl, -ltcl)
3523KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm], [],
3524 [AC_MSG_WARN([it seems, Python depends on another library.
3525 Pleae use \"make LIBPTYHON='-lpython$version -lotherlib'\" to fix this
3526 and contact the authors to let them know about this problem])
3527 ])
3528
3529LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
3530AC_SUBST(PYTHONINC)
3531AC_SUBST(PYTHONLIB)
3532AC_SUBST(LIBPYTHON)
3533AC_SUBST(PYTHONMODDIR)
3534
3535])
3536
3537
3538AC_DEFUN(KDE_CHECK_STL_SGI,
3539[
3540 AC_MSG_CHECKING([if STL implementation is SGI like])
3541 AC_CACHE_VAL(kde_cv_stl_type_sgi,
3542 [
3543 AC_TRY_COMPILE([
3544#include <string>
3545using namespace std;
3546],[
3547 string astring="Hallo Welt.";
3548 astring.erase(0, 6); // now astring is "Welt"
3549 return 0;
3550], kde_cv_stl_type_sgi=yes,
3551 kde_cv_stl_type_sgi=no)
3552])
3553
3554 AC_MSG_RESULT($kde_cv_stl_type_sgi)
3555
3556 if test "$kde_cv_stl_type_sgi" = "yes"; then
3557 AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI])
3558 fi
3559])
3560
3561AC_DEFUN(KDE_CHECK_STL_HP,
3562[
3563 AC_MSG_CHECKING([if STL implementation is HP like])
3564 AC_CACHE_VAL(kde_cv_stl_type_hp,
3565 [
3566 AC_TRY_COMPILE([
3567#include <string>
3568using namespace std;
3569],[
3570 string astring="Hello World";
3571 astring.remove(0, 6); // now astring is "World"
3572 return 0;
3573], kde_cv_stl_type_hp=yes,
3574 kde_cv_stl_type_hp=no)
3575])
3576 AC_MSG_RESULT($kde_cv_stl_type_hp)
3577
3578 if test "$kde_cv_stl_type_hp" = "yes"; then
3579 AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by SGI])
3580 fi
3581])
3582
3583AC_DEFUN(KDE_CHECK_STL,
3584[
3585 AC_LANG_SAVE
3586 AC_LANG_CPLUSPLUS
3587 ac_save_CXXFLAGS="$CXXFLAGS"
3588 CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`"
3589 KDE_CHECK_STL_SGI
3590
3591 if test "$kde_cv_stl_type_sgi" = "no"; then
3592 KDE_CHECK_STL_HP
3593
3594 if test "$kde_cv_stl_type_hp" = "no"; then
3595 AC_MSG_ERROR("no known STL type found")
3596 fi
3597 fi
3598
3599 CXXFLAGS="$ac_save_CXXFLAGS"
3600 AC_LANG_RESTORE
3601])
3602
3603AC_DEFUN(AC_FIND_QIMGIO,
3604 [AC_REQUIRE([AC_FIND_JPEG])
3605AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3606AC_MSG_CHECKING([for qimgio])
3607AC_CACHE_VAL(ac_cv_lib_qimgio,
3608[
3609AC_LANG_SAVE
3610AC_LANG_CPLUSPLUS
3611ac_save_LIBS="$LIBS"
3612ac_save_CXXFLAGS="$CXXFLAGS"
3613LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
3614CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
3615AC_TRY_RUN(dnl
3616[
3617#include <qimageio.h>
3618#include <qstring.h>
3619int main() {
3620 QString t = "hallo";
3621 t.fill('t');
3622 qInitImageIO();
3623}
3624],
3625 ac_cv_lib_qimgio=yes,
3626 ac_cv_lib_qimgio=no,
3627 ac_cv_lib_qimgio=no)
3628LIBS="$ac_save_LIBS"
3629CXXFLAGS="$ac_save_CXXFLAGS"
3630AC_LANG_RESTORE
3631])dnl
3632if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
3633 LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
3634 AC_MSG_RESULT(yes)
3635 AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
3636 AC_SUBST(LIBQIMGIO)
3637else
3638 AC_MSG_RESULT(not found)
3639fi
3640])
3641
3642AC_DEFUN(KDE_CHECK_ANSI,
3643[
3644])
3645
3646AC_DEFUN(KDE_CHECK_INSURE,
3647[
3648 AC_ARG_ENABLE(insure, [ --enable-insure use insure++ for debugging [default=no]],
3649 [
3650 if test $enableval = "no"; dnl
3651 then ac_use_insure="no"
3652 else ac_use_insure="yes"
3653 fi
3654 ], [ac_use_insure="no"])
3655
3656 AC_MSG_CHECKING(if we will use Insure++ to debug)
3657 AC_MSG_RESULT($ac_use_insure)
3658 if test "$ac_use_insure" = "yes"; dnl
3659 then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "????
3660 fi
3661])
3662
3663AC_DEFUN(AM_DISABLE_LIBRARIES,
3664[
3665 AC_PROVIDE([AM_ENABLE_STATIC])
3666 AC_PROVIDE([AM_ENABLE_SHARED])
3667 enable_static=no
3668 enable_shared=yes
3669])
3670
3671
3672AC_DEFUN(AC_CHECK_UTMP_FILE,
3673[
3674 AC_MSG_CHECKING([for utmp file])
3675
3676 AC_CACHE_VAL(kde_cv_utmp_file,
3677 [
3678 kde_cv_utmp_file=no
3679
3680 for ac_file in \
3681 \
3682 /var/run/utmp \
3683 /var/adm/utmp \
3684 /etc/utmp \
3685 ; \
3686 do
3687 if test -r "$ac_file"; then
3688 kde_cv_utmp_file=$ac_file
3689 break
3690 fi
3691 done
3692 ])
3693
3694 if test "$kde_cv_utmp_file" != "no"; then
3695 AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries])
3696 $1
3697 AC_MSG_RESULT($kde_cv_utmp_file)
3698 else
3699 $2
3700 AC_MSG_RESULT([non found])
3701 fi
3702])
3703
3704
3705AC_DEFUN(KDE_CREATE_SUBDIRSLIST,
3706[
3707
3708DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
3709
3710if test ! -s $srcdir/subdirs; then
3711 dnl Note: Makefile.common creates subdirs, so this is just a fallback
3712 TOPSUBDIRS=""
3713 files=`cd $srcdir && ls -1`
3714 dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
3715 for i in $dirs; do
3716 echo $i >> $srcdir/subdirs
3717 done
3718fi
3719
3720if test -s $srcdir/inst-apps; then
3721 ac_topsubdirs="`cat $srcdir/inst-apps`"
3722else
3723 ac_topsubdirs="`cat $srcdir/subdirs`"
3724fi
3725
3726for i in $ac_topsubdirs; do
3727 AC_MSG_CHECKING([if $i should be compiled])
3728 if test -d $srcdir/$i; then
3729 install_it="yes"
3730 for j in $DO_NOT_COMPILE; do
3731 if test $i = $j; then
3732 install_it="no"
3733 fi
3734 done
3735 else
3736 install_it="no"
3737 fi
3738 AC_MSG_RESULT($install_it)
3739 if test $install_it = "yes"; then
3740 TOPSUBDIRS="$TOPSUBDIRS $i"
3741 fi
3742done
3743
3744AC_SUBST(TOPSUBDIRS)
3745])
3746
3747AC_DEFUN(KDE_CHECK_NAMESPACES,
3748[
3749AC_MSG_CHECKING(whether C++ compiler supports namespaces)
3750AC_LANG_SAVE
3751AC_LANG_CPLUSPLUS
3752AC_TRY_COMPILE([
3753],
3754[
3755namespace Foo {
3756 extern int i;
3757 namespace Bar {
3758 extern int i;
3759 }
3760}
3761
3762int Foo::i = 0;
3763int Foo::Bar::i = 1;
3764],[
3765 AC_MSG_RESULT(yes)
3766 AC_DEFINE(HAVE_NAMESPACES)
3767], [
3768AC_MSG_RESULT(no)
3769])
3770AC_LANG_RESTORE
3771])
3772
3773AC_DEFUN(KDE_CHECK_NEWLIBS,
3774[
3775
3776])
3777
3778dnl ------------------------------------------------------------------------
3779dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
3780dnl ------------------------------------------------------------------------
3781dnl
3782AC_DEFUN(AC_CHECK_S_ISSOCK,
3783[
3784AC_MSG_CHECKING(for S_ISSOCK)
3785AC_CACHE_VAL(ac_cv_have_s_issock,
3786[
3787AC_LANG_SAVE
3788AC_LANG_C
3789AC_TRY_LINK(
3790[
3791#include <sys/stat.h>
3792],
3793[
3794struct stat buff;
3795int b = S_ISSOCK( buff.st_mode );
3796],
3797ac_cv_have_s_issock=yes,
3798ac_cv_have_s_issock=no)
3799AC_LANG_RESTORE
3800])
3801AC_MSG_RESULT($ac_cv_have_s_issock)
3802if test "$ac_cv_have_s_issock" = "yes"; then
3803 AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
3804fi
3805])
3806
3807dnl ------------------------------------------------------------------------
3808dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
3809dnl ------------------------------------------------------------------------
3810dnl
3811AC_DEFUN(AC_CHECK_KDEMAXPATHLEN,
3812[
3813AC_MSG_CHECKING(for MAXPATHLEN)
3814AC_CACHE_VAL(ac_cv_maxpathlen,
3815[
3816AC_LANG_C
3817cat > conftest.$ac_ext <<EOF
3818#include <stdio.h>
3819#include <sys/param.h>
3820#ifndef MAXPATHLEN
3821#define MAXPATHLEN 1024
3822#endif
3823
3824KDE_HELLO MAXPATHLEN
3825
3826EOF
3827
3828ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
3829
3830if AC_TRY_EVAL(ac_try) && test -s conftest.out; then
3831 ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
3832else
3833 ac_cv_maxpathlen=1024
3834fi
3835
3836rm conftest.*
3837
3838])
3839AC_MSG_RESULT($ac_cv_maxpathlen)
3840AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] )
3841])
3842
3843dnl -------------------------------------------------------------------------
3844dnl See if the compiler supports a template repository bero@redhat.de
3845dnl -------------------------------------------------------------------------
3846AC_DEFUN(KDE_COMPILER_REPO,
3847[
3848 REPO=""
3849 NOREPO=""
3850
3851 KDE_CHECK_COMPILER_FLAG(frepo,
3852 [
3853 REPO="-frepo"
3854 NOREPO="-fno-repo"
3855 ])
3856
3857 if test -z "$REPO"; then
3858 KDE_CHECK_COMPILER_FLAG(instances=explicit,
3859 [
3860 REPO="-instances=explicit"
3861 NOREPO="-instances=extern"
3862 ])
3863 fi
3864
3865 if test -n "$REPO"; then
3866 AC_DEFINE_UNQUOTED(HAVE_TEMPLATE_REPOSITORY, 1,
3867 [C++ compiler supports template repository])
3868 $1
3869 fi
3870
3871 AC_SUBST(REPO)
3872 AC_SUBST(NOREPO)
3873])
3874
3875AC_DEFUN(KDE_CHECK_HEADER,
3876[
3877 AC_LANG_SAVE
3878 kde_safe_cppflags=$CPPFLAGS
3879 CPPFLAGS="$CPPFLAGS $all_includes"
3880 AC_LANG_CPLUSPLUS
3881 AC_CHECK_HEADER($1, $2, $3)
3882 CPPFLAGS=$kde_safe_cppflags
3883 AC_LANG_RESTORE
3884])
3885
3886AC_DEFUN(KDE_CHECK_QWSPRITEFIELD,
3887[
3888 KDE_CHECK_HEADER(QwSpriteField.h, ,
3889 [
3890 AC_MSG_WARN([you don't have QwSpriteField.h somewhere. Please install
3891 QwSpriteField out of kdesupport.])
3892 $1
3893 ])
3894])
3895
3896AC_DEFUN(KDE_FAST_CONFIGURE,
3897[
3898 dnl makes configure fast (needs perl)
3899 AC_ARG_ENABLE(fast-perl, [ --disable-fast-perl disable fast Makefile generation (needs perl)],
3900 with_fast_perl=$enableval, with_fast_perl=yes)
3901])
3902
3903AC_DEFUN(KDE_CONF_FILES,
3904[
3905 val=
3906 if test -f $srcdir/configure.files ; then
3907 val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files`
3908 fi
3909 CONF_FILES=
3910 if test -n "$val" ; then
3911 for i in $val ; do
3912 CONF_FILES="$CONF_FILES $i"
3913 done
3914 fi
3915 AC_SUBST(CONF_FILES)
3916])dnl
3917
3918AC_DEFUN(KDE_SET_PREFIX,
3919[
3920 unset CDPATH
3921 dnl make $KDEDIR the default for the installation
3922 AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
3923
3924 if test "x$prefix" = "xNONE"; then
3925 prefix=$ac_default_prefix
3926 ac_configure_args="$ac_configure_args --prefix $prefix"
3927 fi
3928 KDE_FAST_CONFIGURE
3929 KDE_CONF_FILES
3930])
3931
3932pushdef([AC_PROG_INSTALL],
3933[
3934 dnl our own version, testing for a -p flag
3935 popdef([AC_PROG_INSTALL])
3936 dnl as AC_PROG_INSTALL works as it works we first have
3937 dnl to save if the user didn't specify INSTALL, as the
3938 dnl autoconf one overwrites INSTALL and we have no chance to find
3939 dnl out afterwards
3940 test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL
3941 test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM
3942 test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT
3943 AC_PROG_INSTALL
3944
3945 if test -z "$kde_save_INSTALL_given" ; then
3946 # OK, user hasn't given any INSTALL, autoconf found one for us
3947 # now we test, if it supports the -p flag
3948 AC_MSG_CHECKING(for -p flag to install)
3949 rm -f confinst.$$.* > /dev/null 2>&1
3950 echo "Testtest" > confinst.$$.orig
3951 ac_res=no
3952 if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
3953 if test -f confinst.$$.new ; then
3954 # OK, -p seems to do no harm to install
3955 INSTALL="${INSTALL} -p"
3956 ac_res=yes
3957 fi
3958 fi
3959 rm -f confinst.$$.*
3960 AC_MSG_RESULT($ac_res)
3961 fi
3962 dnl the following tries to resolve some signs and wonders coming up
3963 dnl with different autoconf/automake versions
3964 dnl e.g.:
3965 dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
3966 dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
3967 dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
3968 dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
3969 dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
3970 dnl install-@DIR@PROGRAMS targets to explicitly use that flag
3971 dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
3972 dnl INSTALL_SCRIPT, which breaks with automake <= 1.4
3973 dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure
3974 dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from
3975 dnl automake (due to broken Makefile.am or whatever) to install programs,
3976 dnl and so does not see the -s flag in automake > 1.4
3977 dnl to clean up that mess we:
3978 dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
3979 dnl which cleans KDE's program with automake > 1.4;
3980 dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
3981 dnl with automake<=1.4
3982 dnl note that dues to this sometimes two '-s' flags are used (if KDE
3983 dnl properly uses install-@DIR@PROGRAMS, but I don't care
3984 dnl
3985 dnl And to all this comes, that I even can't write in comments variable
3986 dnl names used by automake, because it is so stupid to think I wanted to
3987 dnl _use_ them, therefor I have written A_M_... instead of AM_
3988 dnl hmm, I wanted to say something ... ahh yes: Arghhh.
3989
3990 if test -z "$kde_save_INSTALL_PROGRAM_given" ; then
3991 INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
3992 fi
3993 if test -z "$kde_save_INSTALL_SCRIPT_given" ; then
3994 INSTALL_SCRIPT='${INSTALL}'
3995 fi
3996])dnl
3997
3998AC_DEFUN(KDE_LANG_CPLUSPLUS,
3999[AC_LANG_CPLUSPLUS
4000ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
4001pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
4002])
4003
4004pushdef([AC_LANG_CPLUSPLUS],
4005[popdef([AC_LANG_CPLUSPLUS])
4006KDE_LANG_CPLUSPLUS
4007])
4008
4009AC_DEFUN(KDE_CHECK_LONG_LONG,
4010[
4011AC_MSG_CHECKING(for long long)
4012AC_CACHE_VAL(kde_cv_c_long_long,
4013[
4014 AC_LANG_SAVE
4015 AC_LANG_CPLUSPLUS
4016 AC_TRY_LINK([], [
4017 long long foo = 0;
4018 foo = foo+1;
4019 ],
4020 kde_cv_c_long_long=yes, kde_cv_c_long_long=no)
4021])
4022AC_MSG_RESULT($kde_cv_c_long_long)
4023if test "$kde_cv_c_long_long" = yes; then
4024 AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype])
4025fi
4026])
4027
Note: See TracBrowser for help on using the repository browser.