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