]> git.lyx.org Git - features.git/blob - config/kde.m4
9dc24cf1286bd177caf89b2266466e5b1375782e
[features.git] / config / kde.m4
1 # Configure paths and libs when using KDE GUI
2 ##    -*- shell-script -*-
3
4 ##    This file is part of the KDE libraries/packages
5 ##    Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
6 ##              (C) 1997 Stephan Kulow (coolo@kde.org)
7
8 ##    This file is free software; you can redistribute it and/or
9 ##    modify it under the terms of the GNU Library General Public
10 ##    License as published by the Free Software Foundation; either
11 ##    version 2 of the License, or (at your option) any later version.
12
13 ##    This library is distributed in the hope that it will be useful,
14 ##    but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 ##    Library General Public License for more details.
17
18 ##    You should have received a copy of the GNU Library General Public License
19 ##    along with this library; see the file COPYING.LIB.  If not, write to
20 ##    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 ##    Boston, MA 02111-1307, USA.        
22
23 ## IMPORTANT NOTE:
24 ## Please do not modify this file unless you expect your modifications to be
25 ## carried into every other module in the repository. If you decide that you
26 ## really want to modify it, contact coolo@kde.org mentioning that you have
27 ## and that the modified file should be committed to every module.
28 ##
29 ## Single-module modifications are best placed in configure.in for kdelibs
30 ## and kdebase or configure.in.1 if present.
31
32
33 ## ------------------------------------------------------------------------
34 ## Find a file (or one of more files in a list of dirs)
35 ## ------------------------------------------------------------------------
36 ##
37 AC_DEFUN(AC_FIND_FILE,
38 [
39 $3=NO
40 for i in $2;
41 do
42   for j in $1;
43   do
44     if test -r "$i/$j"; then
45       $3=$i
46       break 2
47     fi
48   done
49 done
50 ])
51
52 AC_DEFUN(KDE_FIND_PATH,
53 [
54    AC_MSG_CHECKING([for $1])
55    AC_CACHE_VAL(kde_cv_path_$1,
56    [
57      kde_cv_path_$1="NONE"
58      if test -n "$$2"; then
59         kde_cv_path_$1="$$2";
60      else
61         dirs="$3"
62         kde_save_IFS=$IFS
63         IFS=':'
64         for dir in $PATH; do
65           dirs="$dirs $dir"
66         done
67         IFS=$kde_save_IFS
68  
69         for dir in $dirs; do
70           if test -x "$dir/$1"; then
71             if test -n "$5"
72             then
73               evalstr="$dir/$1 $5 2>&1 "
74               if eval $evalstr; then
75                 kde_cv_path_$1="$dir/$1"
76                 break
77               fi
78             else
79                 kde_cv_path_$1="$dir/$1"
80                 break
81             fi
82           fi
83         done
84  
85      fi
86  
87    ])
88  
89    if test -z "$kde_cv_path_$1" || test "$kde_cv_path_$1" = "NONE"; then
90       AC_MSG_RESULT(not found)
91       $4
92    else
93      AC_MSG_RESULT($kde_cv_path_$1)
94      $2=$kde_cv_path_$1
95    fi
96 ])
97 AC_DEFUN(KDE_MOC_ERROR_MESSAGE,
98 [
99     AC_MSG_ERROR([No Qt meta object compiler (moc) found!
100 Please check whether you installed Qt correctly.
101 You need to have a running moc binary.
102 configure tried to run $ac_cv_path_moc and the test didn't
103 succeed. If configure shouldn't have tried this one, set
104 the environment variable MOC to the right one before running
105 configure.
106 ])
107 ])
108
109 dnl ------------------------------------------------------------------------
110 dnl Find the meta object compiler in the PATH, in $QTDIR/bin, and some
111 dnl more usual places
112 dnl ------------------------------------------------------------------------
113 dnl
114 AC_DEFUN(AC_PATH_QT_MOC,
115 [
116    KDE_FIND_PATH(moc, MOC, [$ac_qt_bindir $QTDIR/bin \
117             /usr/bin /usr/X11R6/bin /usr/lib/qt/bin \
118             /usr/local/qt/bin], [KDE_MOC_ERROR_MESSAGE])
119  
120    if test -z "$MOC"; then
121      if test -n "$ac_cv_path_moc"; then
122        output=`eval "$ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt"`
123      fi
124      echo "configure:__oline__: tried to call $ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt" >&AC_FD_CC
125      echo "configure:__oline__: moc output: $output" >&AC_FD_CC
126  
127      if test -z "$output"; then
128        KDE_MOC_ERROR_MESSAGE
129     fi
130    fi
131  
132    AC_SUBST(MOC)
133 ])
134
135 AC_DEFUN(KDE_REPLACE_ROOT,
136   $1=`echo "$$1" | sed -e "s#^/#\$\{install_root\}/#"`
137 )
138
139 AC_DEFUN(AC_CREATE_KFSSTND,
140 [
141 AC_REQUIRE([AC_CHECK_RPATH])
142
143 if test "$1" = "default"; then
144
145   AC_MSG_CHECKING(for KDE paths)
146
147   if test -z "$kde_htmldir"; then
148     kde_htmldir="\$(prefix)/share/doc/HTML"
149   fi
150   if test -z "$kde_appsdir"; then
151     kde_appsdir="\$(prefix)/share/applnk"
152   fi
153   if test -z "$kde_icondir"; then
154     kde_icondir="\$(prefix)/share/icons"
155   fi
156   if test -z "$kde_sounddir"; then
157     kde_sounddir="\$(prefix)/share/sounds"
158   fi
159   if test -z "$kde_datadir"; then
160     kde_datadir="\$(prefix)/share/apps"
161   fi
162   if test -z "$kde_locale"; then
163     kde_locale="\$(prefix)/share/locale"
164   fi
165   if test -z "$kde_cgidir"; then
166     kde_cgidir="\$(exec_prefix)/cgi-bin"
167   fi
168   if test -z "$kde_confdir"; then
169     kde_confdir="\$(prefix)/share/config"
170   fi
171   if test -z "$kde_mimedir"; then
172     kde_mimedir="\$(prefix)/share/mimelnk"
173   fi
174   if test -z "$kde_toolbardir"; then
175     kde_toolbardir="\$(prefix)/share/toolbar"
176   fi
177   if test -z "$kde_wallpaperdir"; then
178     kde_wallpaperdir="\$(prefix)/share/wallpapers"
179   fi
180   if test -z "$kde_bindir"; then
181     kde_bindir="\$(exec_prefix)/bin"
182   fi
183   if test -z "$kde_partsdir"; then
184     kde_partsdir="\$(exec_prefix)/parts"
185   fi
186   AC_MSG_RESULT(defaults)       
187
188 else 
189
190 AC_CACHE_VAL(kde_cv_all_paths,
191 [
192 AC_MSG_CHECKING([for kde headers installed])
193 AC_LANG_CPLUSPLUS
194 cat > conftest.$ac_ext <<EOF
195 #include <stdio.h>
196 #include "confdefs.h"
197 #include <kapp.h>
198
199 int main() {
200 printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
201 printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
202 printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
203 printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
204 printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
205 printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
206 printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
207 printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
208 printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
209 printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
210 printf("kde_wallpaperdir=\\"%s\\"\n", KApplication::kde_wallpaperdir().data());
211 printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
212 printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
213 return 0;
214 }
215 EOF
216
217 if test -n "$kde_libraries"; then
218   KDE_TEST_RPATH="-rpath $kde_libraries"
219 fi
220
221 if test -n "$qt_libraries"; then
222   KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $qt_libraries"
223 fi
224
225 if test -n "$x_libraries"; then
226   KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $x_libraries"
227 fi
228
229 KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
230
231 ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext'
232 if AC_TRY_EVAL(ac_compile); then
233   AC_MSG_RESULT(yes)
234 else
235   AC_MSG_ERROR([your system is not able to compile a small KDE application!
236 Check, if you installed the KDE header files correctly.])
237 fi
238
239 AC_MSG_CHECKING([for kde libraries installed])
240 ac_link='/bin/sh ./libtool --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore -lqt -lXext -lX11 $LIBSOCKET $KDE_TEST_RPATH 1>&5'
241
242 if AC_TRY_EVAL(ac_link) && test -s conftest; then 
243   AC_MSG_RESULT(yes)
244 else
245   AC_MSG_ERROR([your system fails at linking a small KDE application!
246 Check, if your compiler is installed correctly and if you have used the
247 same compiler to compile Qt and kdelibs as you did use now])
248 fi
249
250 AC_MSG_CHECKING([for KDE paths])
251 if eval `./conftest 2>&5`; then
252   AC_MSG_RESULT(done)
253 else
254   AC_MSG_RESULT(problems)
255 fi
256
257 ./conftest 2> /dev/null >&5 # make an echo for config.log
258 kde_have_all_paths=yes
259 AC_LANG_CPLUSPLUS
260
261 if test "$kde_have_all_paths" = "yes"; then
262 kde_cv_all_paths="kde_have_all_paths=\"yes\" \
263         kde_htmldir=\"$kde_htmldir\" \
264         kde_appsdir=\"$kde_appsdir\" \
265         kde_icondir=\"$kde_icondir\" \
266         kde_sounddir=\"$kde_sounddir\" \
267         kde_datadir=\"$kde_datadir\" \
268         kde_locale=\"$kde_locale\" \
269         kde_cgidir=\"$kde_cgidir\" \
270         kde_confdir=\"$kde_confdir\" \
271         kde_mimedir=\"$kde_mimedir\" \
272         kde_toolbardir=\"$kde_toolbardir\" \
273         kde_wallpaperdir=\"$kde_wallpaperdir\" \
274         kde_bindir=\"$kde_bindir\" \
275         kde_partsdir=\"$kde_partsdir\""
276 fi
277 rm -fr conftest*
278
279 ])
280
281 eval "$kde_cv_all_paths"
282
283 if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
284    test -z "$kde_icondir" || test -z "$kde_sounddir" ||
285    test -z "$kde_datadir" || test -z "$kde_locale"  ||
286    test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
287    test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
288    test -z "$kde_wallpaperdir" || test -z "$kde_bindir" ||
289    test -z "$kde_partsdir" || test "$kde_have_all_paths" != "yes"; then
290   kde_have_all_paths=no
291   AC_MSG_ERROR([configure could not run a little KDE program to test the environment. 
292 Since it had compiled and linked before, it must be a strange problem on your system.
293 Look at config.log for details. If you are not able to fix this, please contact Stephan Kulow <coolo@kde.org>.])
294 fi
295
296 if test -n "$install_root"; then
297   KDE_REPLACE_ROOT(kde_htmldir)
298   KDE_REPLACE_ROOT(kde_appsdir)
299   KDE_REPLACE_ROOT(kde_icondir)
300   KDE_REPLACE_ROOT(kde_sounddir)
301   KDE_REPLACE_ROOT(kde_datadir)
302   KDE_REPLACE_ROOT(kde_locale)
303   KDE_REPLACE_ROOT(kde_cgidir)
304   KDE_REPLACE_ROOT(kde_confdir)
305   KDE_REPLACE_ROOT(kde_mimedir)
306   KDE_REPLACE_ROOT(kde_toolbardir)
307   KDE_REPLACE_ROOT(kde_wallpaperdir)
308   KDE_REPLACE_ROOT(kde_bindir)
309   KDE_REPLACE_ROOT(kde_partsdir)
310   AC_SUBST(install_root)
311 fi
312
313 fi
314
315 bindir=$kde_bindir
316
317 ])
318
319 AC_DEFUN(AC_SUBST_KFSSTND,
320 [
321 AC_SUBST(kde_htmldir)
322 AC_SUBST(kde_appsdir)
323 AC_SUBST(kde_icondir)
324 AC_SUBST(kde_sounddir)
325 kde_minidir="$kde_icondir/mini"
326 AC_SUBST(kde_minidir)
327 AC_SUBST(kde_datadir)
328 AC_SUBST(kde_locale)
329 AC_SUBST(kde_cgidir)
330 AC_SUBST(kde_confdir)
331 AC_SUBST(kde_mimedir)
332 AC_SUBST(kde_toolbardir)
333 AC_SUBST(kde_wallpaperdir)
334 AC_SUBST(kde_bindir)
335 AC_SUBST(kde_partsdir)
336 ])
337
338 AC_DEFUN(KDE_MISC_TESTS,
339 [
340    AC_LANG_C
341    dnl Checks for libraries. 
342    AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD
343    AC_SUBST(LIBCOMPAT)
344    AC_CHECK_LIB(crypt, main, [LIBCRYPT="-lcrypt"]) dnl for BSD
345    AC_SUBST(LIBCRYPT)
346    AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
347    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
348       AC_CHECK_LIB(dnet_stub, dnet_ntoa,
349         [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
350    fi
351    AC_CHECK_FUNC(gethostbyname)
352    if test $ac_cv_func_gethostbyname = no; then
353      AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
354    fi
355    AC_CHECK_FUNC(connect)
356    if test $ac_cv_func_connect = no; then
357       AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
358         $X_EXTRA_LIBS)
359    fi
360
361    AC_CHECK_FUNC(remove)
362    if test $ac_cv_func_remove = no; then
363       AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
364    fi
365  
366    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
367    AC_CHECK_FUNC(shmat)
368    if test $ac_cv_func_shmat = no; then
369      AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")
370    fi
371
372    LIBSOCKET=$X_EXTRA_LIBS
373    AC_SUBST(LIBSOCKET)
374    AC_SUBST(X_EXTRA_LIBS)
375    AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
376    AC_SUBST(LIBUCB)
377
378    case $host in  dnl this *is* LynxOS specific
379    *-*-lynxos* )
380         AC_MSG_CHECKING([LynxOS header file wrappers])
381         [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
382         AC_MSG_RESULT(disabled)
383         AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
384          ;;
385     esac
386
387 ])
388
389 ## ------------------------------------------------------------------------
390 ## Find the header files and libraries for X-Windows. Extended the 
391 ## macro AC_PATH_X
392 ## ------------------------------------------------------------------------
393 ##
394 AC_DEFUN(K_PATH_X,
395 [
396 AC_MSG_CHECKING(for X)
397 AC_CACHE_VAL(ac_cv_have_x,
398 [# One or both of the vars are not set, and there is no cached value.
399 ac_x_includes=NO ac_x_libraries=NO
400 AC_PATH_X_DIRECT
401 AC_PATH_X_XMKMF
402 if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
403   AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
404 else
405   # Record where we found X for the cache.
406   ac_cv_have_x="have_x=yes \
407                 ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
408 fi])dnl
409 eval "$ac_cv_have_x"
410  
411 if test "$have_x" != yes; then
412   AC_MSG_RESULT($have_x)
413   no_x=yes
414 else
415   # If each of the values was on the command line, it overrides each guess.
416   test "x$x_includes" = xNONE && x_includes=$ac_x_includes
417   test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
418   # Update the cache value to reflect the command line values.
419   ac_cv_have_x="have_x=yes \
420                 ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
421   AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
422 fi
423
424 if test -z "$x_includes" || test "x$x_includes" = xNONE; then
425   X_INCLUDES=""
426   x_includes="."; dnl better than nothing :-
427  else
428   X_INCLUDES="-I$x_includes"
429 fi
430
431 if test -z "$x_libraries" || test "x$x_libraries" = xNONE; then
432   X_LDFLAGS=""
433   x_libraries="/usr/lib"; dnl better than nothing :-
434  else
435   X_LDFLAGS="-L$x_libraries"
436 fi
437 all_includes="$all_includes $X_INCLUDES"  
438 all_libraries="$all_libraries $X_LDFLAGS"  
439
440 AC_SUBST(X_INCLUDES)
441 AC_SUBST(X_LDFLAGS)
442 AC_SUBST(x_libraries)
443 AC_SUBST(x_includes)
444 ])
445
446 AC_DEFUN(KDE_PRINT_QT_PROGRAM,
447 [
448 AC_LANG_CPLUSPLUS
449 cat > conftest.$ac_ext <<EOF
450 #include "confdefs.h"
451 #include <qmovie.h>
452 #include <qapplication.h>
453 int main() {
454   QMovie m;
455   m.setSpeed(20);
456   return 0;
457 }
458 EOF
459 ])
460
461 AC_DEFUN(KDE_CHECK_QT_DIRECT,
462 [
463 AC_MSG_CHECKING([if Qt compiles without flags])
464 AC_CACHE_VAL(kde_cv_qt_direct,
465 [
466 ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
467 ac_LIBRARY_PATH="$LIBRARY_PATH"
468 ac_cxxflags_safe="$CXXFLAGS"
469 ac_ldflags_safe="$LDFLAGS"
470 ac_libs_safe="$LIBS"
471
472 CXXFLAGS="$CXXFLAGS -I$qt_includes"
473 LDFLAGS="$X_LDFLAGS"
474 LIBS="-lqt -lXext -lX11 $LIBSOCKET"
475 LD_LIBRARY_PATH=
476 export LD_LIBRARY_PATH
477 LIBRARY_PATH=
478 export LIBRARY_PATH
479
480 KDE_PRINT_QT_PROGRAM
481
482 if AC_TRY_EVAL(ac_link) && test -s conftest; then
483   kde_cv_qt_direct="yes"
484 else
485   kde_cv_qt_direct="no"
486   echo "configure: failed program was:" >&AC_FD_CC
487   cat conftest.$ac_ext >&AC_FD_CC
488 fi
489 rm -f conftest*
490 CXXFLAGS="$ac_cxxflags_safe"
491 LDFLAGS="$ac_ldflags_safe"
492 LIBS="$ac_libs_safe"
493
494 LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
495 export LD_LIBRARY_PATH
496 LIBRARY_PATH="$ac_LIBRARY_PATH"
497 export LIBRARY_PATH
498 ])
499
500 if test "$kde_cv_qt_direct" = "yes"; then
501   AC_MSG_RESULT(yes)
502   $1
503 else
504   AC_MSG_RESULT(no)
505   $2
506 fi
507 ])
508
509 ## ------------------------------------------------------------------------
510 ## Try to find the Qt headers and libraries.
511 ## $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
512 ## and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
513 ## ------------------------------------------------------------------------
514 ##
515 AC_DEFUN(AC_PATH_QT_1_3,
516 [
517 AC_REQUIRE([K_PATH_X])
518
519 AC_MSG_CHECKING([for Qt])
520 ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
521 qt_libraries=""
522 qt_includes=""
523 AC_ARG_WITH(qt-dir,
524     [  --with-qt-dir           where the root of qt is installed ],
525     [  ac_qt_includes="$withval"/include
526        ac_qt_libraries="$withval"/lib
527        ac_qt_bindir="$withval"/bin
528     ])
529
530 AC_ARG_WITH(qt-includes,
531     [  --with-qt-includes      where the Qt includes are. ],
532     [  
533        ac_qt_includes="$withval"
534     ])
535     
536 kde_qt_libs_given=no
537
538 AC_ARG_WITH(qt-libraries,
539     [  --with-qt-libraries     where the Qt library is installed.],
540     [  ac_qt_libraries="$withval"
541        kde_qt_libs_given=yes
542     ])
543
544 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
545
546 AC_CACHE_VAL(ac_cv_have_qt,
547 [#try to guess Qt locations
548
549 qt_incdirs="$ac_qt_includes /usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt $x_includes $QTINC"
550 test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs"
551 AC_FIND_FILE(qmovie.h, $qt_incdirs, qt_incdir)
552 ac_qt_includes="$qt_incdir"
553
554 if test ! "$ac_qt_libraries" = "NO"; then
555   qt_libdirs="$ac_qt_libraries"
556 fi
557
558 qt_libdirs="$qt_libdirs /usr/lib/qt/lib /usr/X11R6/lib /usr/lib /usr/local/qt/lib /usr/lib/qt $x_libraries $QTLIB"
559 test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs"
560
561 test=NONE
562 qt_libdir=NONE
563 for dir in $qt_libdirs; do
564   try="ls -1 $dir/libqt*"
565   if test=`eval $try 2> /dev/null`; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
566 done
567
568 dnl AC_FIND_FILE(libqt.so libqt.so.1.40 libqt.so.1.41 libqt.so.1 libqt.a libqt.sl, $qt_libdirs, qt_libdir)
569 ac_qt_libraries="$qt_libdir"
570
571 ac_cxxflags_safe="$CXXFLAGS"
572 ac_ldflags_safe="$LDFLAGS"
573 ac_libs_safe="$LIBS"
574
575 CXXFLAGS="$CXXFLAGS -I$qt_incdir"
576 LDFLAGS="-L$qt_libdir $X_LDFLAGS"
577 LIBS="$LIBS -lqt -lXext -lX11 $LIBSOCKET"
578
579 KDE_PRINT_QT_PROGRAM
580
581 if AC_TRY_EVAL(ac_link) && test -s conftest; then
582   rm -f conftest*
583 else
584   echo "configure: failed program was:" >&AC_FD_CC
585   cat conftest.$ac_ext >&AC_FD_CC
586   ac_qt_libraries="NO"
587 fi
588 rm -f conftest*
589 CXXFLAGS="$ac_cxxflags_safe"
590 LDFLAGS="$ac_ldflags_safe"
591 LIBS="$ac_libs_safe"
592
593 if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
594   ac_cv_have_qt="have_qt=no"
595   ac_qt_notfound=""
596   if test "$ac_qt_includes" = NO; then
597     if test "$ac_qt_libraries" = NO; then
598       ac_qt_notfound="(headers and libraries)";
599     else
600       ac_qt_notfound="(headers)";
601     fi
602   else
603     ac_qt_notfound="(libraries)";
604   fi
605
606   AC_MSG_ERROR([Qt-1.4 $ac_qt_notfound not found. Please check your installation! ]);
607 else
608   have_qt="yes"
609 fi
610 ])
611 else
612   have_qt="yes"
613 fi
614
615 eval "$ac_cv_have_qt"
616
617 if test "$have_qt" != yes; then
618   AC_MSG_RESULT([$have_qt]);
619 else
620   ac_cv_have_qt="have_qt=yes \
621     ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
622   AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes])
623   
624   qt_libraries="$ac_qt_libraries"
625   qt_includes="$ac_qt_includes"
626 fi
627
628 if test ! "$kde_qt_libs_given" = "yes"; then
629 KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
630 fi
631
632 AC_SUBST(qt_libraries)
633 AC_SUBST(qt_includes)
634
635 if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
636  QT_INCLUDES="";
637 else
638  QT_INCLUDES="-I$qt_includes"
639  all_includes="$QT_INCLUDES $all_includes"
640 fi
641
642 if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
643  QT_LDFLAGS=""
644 else
645  QT_LDFLAGS="-L$qt_libraries"
646  all_libraries="$QT_LDFLAGS $all_libraries"
647 fi
648
649 AC_SUBST(QT_INCLUDES)
650 AC_SUBST(QT_LDFLAGS)
651 AC_PATH_QT_MOC
652 ])
653
654 AC_DEFUN(AC_PATH_QT,
655 [
656 AC_PATH_QT_1_3
657 ])
658
659 ## ------------------------------------------------------------------------
660 ## Now, the same with KDE
661 ## $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
662 ## and $(kde_includes) will be the kdehdrlocation (if needed)
663 ## ------------------------------------------------------------------------
664 ##
665 AC_DEFUN(AC_BASE_PATH_KDE,
666 [
667 AC_REQUIRE([KDE_MISC_TESTS])
668 AC_REQUIRE([AC_PATH_QT])dnl
669 AC_MSG_CHECKING([for KDE])
670
671 if test "${prefix}" != NONE; then
672   kde_includes=${prefix}/include
673   ac_kde_includes=$prefix/include
674
675   if test "${exec_prefix}" != NONE; then
676     kde_libraries=${exec_prefix}/lib
677     ac_kde_libraries=$exec_prefix/lib
678   else
679     kde_libraries=${prefix}/lib
680     ac_kde_libraries=$prefix/lib
681   fi
682 else
683   ac_kde_includes=
684   ac_kde_libraries=
685   kde_libraries=""
686   kde_includes=""
687 fi
688
689 AC_ARG_WITH(kde-dir,
690     [  --with-kde-dir          where the KDE root is ],
691     [
692        ac_kde_includes="$withval"/include
693        ac_kde_libraries="$withval"/lib
694     ])
695  
696 AC_ARG_WITH(kde-includes,
697     [  --with-kde-includes     where the KDE includes are. ],
698     [
699        ac_kde_includes="$withval"
700     ])
701  
702 AC_ARG_WITH(kde-libraries,
703     [  --with-kde-libraries    where the KDE library is installed.],
704     [
705        ac_kde_libraries="$withval"
706     ])
707  
708 AC_CACHE_VAL(ac_cv_have_kde,
709 [#try to guess kde locations
710
711 if test -z "$1"; then
712
713 kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/kde/include /usr/include/kde /usr/include /opt/kde/include $x_includes $qt_includes"
714 test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR $kde_incdirs"
715 kde_incdirs="$ac_kde_includes $kde_incdirs"
716 AC_FIND_FILE(ksock.h, $kde_incdirs, kde_incdir)
717 ac_kde_includes="$kde_incdir"
718
719 if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/ksock.h"; then
720   AC_MSG_ERROR([
721 in the prefix, you've chosen, are no kde headers installed. This will fail.
722 So, check this please and use another prefix!])
723 fi
724
725 kde_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"
726 test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
727 kde_libdirs="$ac_kde_libraries $kde_libdirs"
728 AC_FIND_FILE(libkdecore.la, $kde_libdirs, kde_libdir)
729 ac_kde_libraries="$kde_libdir"
730
731 if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/libkdecore.la"; then
732 AC_MSG_ERROR([
733 in the prefix, you've chosen $ac_kde_libraries, are no kde libraries installed. This will fail.
734 So, check this please and use another prefix!])
735 fi
736
737 if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
738   ac_cv_have_kde="have_kde=no"
739 else
740   ac_cv_have_kde="have_kde=yes \
741     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
742 fi
743
744 else dnl test -z $1 
745   
746   ac_cv_have_kde="have_kde=no"
747
748 fi
749 ])dnl
750
751 eval "$ac_cv_have_kde"
752
753 if test "$have_kde" != "yes"; then
754  if test "${prefix}" = NONE; then
755   ac_kde_prefix="$ac_default_prefix"
756  else
757   ac_kde_prefix="$prefix"
758  fi
759  if test "$exec_prefix" = NONE; then
760   ac_kde_exec_prefix="$ac_kde_prefix"
761   AC_MSG_RESULT([will be installed in $ac_kde_prefix])
762  else
763   ac_kde_exec_prefix="$exec_prefix"
764   AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
765  fi
766
767  kde_libraries="${ac_kde_exec_prefix}/lib"
768  kde_includes=${ac_kde_prefix}/include
769
770 else
771   ac_cv_have_kde="have_kde=yes \
772     ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
773   AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
774   
775   kde_libraries="$ac_kde_libraries"
776   kde_includes="$ac_kde_includes"
777 fi
778 AC_SUBST(kde_libraries)
779 AC_SUBST(kde_includes)
780
781 if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then
782  KDE_INCLUDES=""
783 else
784  KDE_INCLUDES="-I$kde_includes"
785  all_includes="$KDE_INCLUDES $all_includes"
786 fi
787
788 if test "$kde_libraries" = "$x_libraries" || test "$kde_libraries" = "$qt_libraries" ; then
789  KDE_LDFLAGS=""
790 else
791  KDE_LDFLAGS="-L$kde_libraries"
792  all_libraries="$KDE_LDFLAGS $all_libraries"
793 fi
794
795 AC_SUBST(KDE_LDFLAGS)
796 AC_SUBST(KDE_INCLUDES)
797
798 AC_SUBST(all_includes)
799 AC_SUBST(all_libraries)
800
801 ])
802
803 AC_DEFUN(KDE_CHECK_KIMGIO,
804 [
805    AC_REQUIRE([AC_FIND_TIFF])
806    AC_REQUIRE([AC_FIND_JPEG]) 
807    AC_REQUIRE([AC_FIND_PNG]) 
808
809    LIB_KIMGIO='-lkimgio $(LIBJPEG) $(LIBTIFF) $(LIBPNG) -lm'
810    AC_SUBST(LIB_KIMGIO)
811    LIB_KHTMLW='-lkhtmlw $(LIB_KIMGIO) -ljscript'
812    AC_SUBST(LIB_KHTMLW)
813    LIB_KHTML='-lkhtml $(LIB_KIMGIO) -ljscript'
814    AC_SUBST(LIB_KHTML)
815 ])
816
817 AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
818 [
819    AC_REQUIRE([KDE_MISC_TESTS])
820
821    KDE_LIBS='-lqt -lkdecore -lkdeui -lkfm -lkfile'
822    AC_SUBST(KDE_LIBS)
823 #   LIB_X11='-lX11 $(LIBSOCKET)'
824 #   AC_SUBST(LIB_X11)
825 #   LIB_QT='-lqt $(LIB_X11)'
826 #   AC_SUBST(LIB_QT)
827 #   LIB_KDECORE='-lkdecore -lXext $(LIB_QT)'
828 #   AC_SUBST(LIB_KDECORE)
829 #   LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
830 #   AC_SUBST(LIB_KDEUI)
831 #   LIB_KFM='-lkfm $(LIB_KDECORE)'
832 #   AC_SUBST(LIB_KFM)
833 #   LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)'
834 #   AC_SUBST(LIB_KFILE)
835 ])
836
837 AC_DEFUN(AC_PATH_KDE,
838 [
839   AC_BASE_PATH_KDE
840   AC_ARG_ENABLE(path-check, [  --disable-path-check    don't try to find out, where to install],
841   [
842   if test "$enableval" = "no"; 
843     then ac_use_path_checking="default"
844     else ac_use_path_checking=""
845   fi
846   ], [ac_use_path_checking=""]
847   )
848
849   AC_ARG_WITH(install-root, [  --with-install-root     the root, where to install to [default=/]],
850   [
851   if test "$withval" = "no";
852     then kde_install_root="";
853     else kde_install_root=$withval;
854   fi
855   ], [kde_install_root=""]
856   )
857   
858   if test -n "$kde_install_root"; then
859      install_root="$kde_install_root"
860   else
861      install_root=
862   fi
863
864   AC_CREATE_KFSSTND($ac_use_path_checking)
865
866   AC_SUBST_KFSSTND
867   KDE_CREATE_LIBS_ALIASES
868 ])
869
870 dnl slightly changed version of AC_CHECK_FUNC(setenv)
871 AC_DEFUN(AC_CHECK_SETENV,
872 [AC_MSG_CHECKING([for setenv])
873 AC_CACHE_VAL(ac_cv_func_setenv,
874 [AC_LANG_C
875 AC_TRY_LINK(
876 dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
877 dnl which includes <sys/select.h> which contains a prototype for
878 dnl select.  Similarly for bzero.
879 [#include <assert.h>
880 ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
881 extern "C"
882 #endif
883 ])dnl
884 [/* We use char because int might match the return type of a gcc2
885     builtin and then its argument prototype would still apply.  */
886 #include <stdlib.h>
887 ], [
888 /* The GNU C library defines this for functions which it implements
889     to always fail with ENOSYS.  Some functions are actually named
890     something starting with __ and the normal name is an alias.  */
891 #if defined (__stub_$1) || defined (__stub___$1)
892 choke me
893 #else
894 setenv("TEST", "alle", 1);
895 #endif
896 ], eval "ac_cv_func_setenv=yes", eval "ac_cv_func_setenv=no")])
897
898 if test "$ac_cv_func_setenv" = "yes"; then
899   AC_MSG_RESULT(yes)
900   AC_DEFINE_UNQUOTED(HAVE_FUNC_SETENV)
901 else
902   AC_MSG_RESULT(no)
903 fi
904 ])
905
906 AC_DEFUN(AC_CHECK_GETDOMAINNAME,
907 [
908 AC_LANG_CPLUSPLUS
909 save_CXXFLAGS="$CXXFLAGS"
910 if test "$GCC" = "yes"; then
911 CXXFLAGS="$CXXFLAGS -pedantic-errors"
912 fi
913 AC_MSG_CHECKING(for getdomainname)
914 AC_CACHE_VAL(ac_cv_func_getdomainname,
915 [
916 AC_TRY_COMPILE([
917 #include <stdlib.h>
918 #include <unistd.h>
919 ],
920 [
921 char buffer[200];
922 getdomainname(buffer, 200);
923 ],
924 ac_cv_func_getdomainname=yes,
925 ac_cv_func_getdomainname=no)
926 ])
927 AC_MSG_RESULT($ac_cv_func_getdomainname)
928 if eval "test \"`echo `$ac_cv_func_getdomainname\" = yes"; then
929   AC_DEFINE(HAVE_GETDOMAINNAME)
930 fi
931 CXXFLAGS="$save_CXXFLAGS"
932 ])
933
934 AC_DEFUN(AC_CHECK_GETHOSTNAME,
935 [
936 AC_LANG_CPLUSPLUS
937 save_CXXFLAGS="$CXXFLAGS"
938 if test "$GCC" = "yes"; then
939 CXXFLAGS="$CXXFLAGS -pedantic-errors"
940 fi
941
942 AC_MSG_CHECKING([for gethostname])
943 AC_CACHE_VAL(ac_cv_func_gethostname,
944 [
945 AC_TRY_COMPILE([
946 #include <stdlib.h>
947 #include <unistd.h>
948 ],
949 [
950 char buffer[200];
951 gethostname(buffer, 200);
952 ],
953 ac_cv_func_gethostname=yes,
954 ac_cv_func_gethostname=no)
955 ])
956 AC_MSG_RESULT($ac_cv_func_gethostname)
957 if eval "test \"`echo `$ac_cv_func_gethostname\" = yes"; then
958   AC_DEFINE(HAVE_GETHOSTNAME)
959 fi
960 CXXFLAGS="$save_CXXFLAGS"
961 ])
962
963 AC_DEFUN(AC_CHECK_USLEEP,
964 [
965 AC_LANG_CPLUSPLUS
966
967 AC_MSG_CHECKING([for usleep])
968 AC_CACHE_VAL(ac_cv_func_usleep,
969 [
970 ac_libs_safe="$LIBS"
971 LIBS="$LIBS $LIBUCB"
972 AC_TRY_LINK([
973 #include <stdlib.h>
974 #include <unistd.h>
975 ],
976 [
977 usleep(200);
978 ],
979 ac_cv_func_usleep=yes,
980 ac_cv_func_usleep=no)
981 ])
982 AC_MSG_RESULT($ac_cv_func_usleep)
983 if eval "test \"`echo `$ac_cv_func_usleep\" = yes"; then
984   AC_DEFINE(HAVE_USLEEP)
985 fi
986 LIBS="$ac_libs_safe"
987 ])
988
989 AC_DEFUN(AC_FIND_GIF,
990    [AC_MSG_CHECKING([for giflib])
991 AC_CACHE_VAL(ac_cv_lib_gif,
992 [ac_save_LIBS="$LIBS"
993 LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
994 AC_TRY_LINK(dnl
995 [
996 #ifdef __cplusplus
997 extern "C" {
998 #endif
999 int GifLastError(void);
1000 #ifdef __cplusplus
1001 }
1002 #endif
1003 /* We use char because int might match the return type of a gcc2
1004     builtin and then its argument prototype would still apply.  */
1005 ],
1006             [return GifLastError();],
1007             eval "ac_cv_lib_gif=yes",
1008             eval "ac_cv_lib_gif=no")
1009 LIBS="$ac_save_LIBS"
1010 ])dnl
1011 if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
1012   AC_MSG_RESULT(yes)
1013   AC_DEFINE_UNQUOTED(HAVE_LIBGIF)
1014 else
1015   AC_MSG_ERROR(You need giflib23. Please install the kdesupport package)
1016 fi
1017 ])
1018
1019 AC_DEFUN(AC_FIND_JPEG,
1020    [AC_MSG_CHECKING([for jpeglib])
1021 AC_CACHE_VAL(ac_cv_lib_jpeg,
1022 [ac_save_LIBS="$LIBS"
1023 LIBS="$all_libraries -ljpeg -lm"
1024 AC_TRY_LINK(
1025 [/* Override any gcc2 internal prototype to avoid an error.  */
1026 struct jpeg_decompress_struct;
1027 typedef struct jpeg_decompress_struct * j_decompress_ptr;
1028 typedef int size_t;
1029 #ifdef __cplusplus
1030 extern "C" {
1031 #endif
1032     void jpeg_CreateDecompress(j_decompress_ptr cinfo,
1033                                     int version, size_t structsize);
1034 #ifdef __cplusplus
1035 }
1036 #endif
1037 /* We use char because int might match the return type of a gcc2
1038     builtin and then its argument prototype would still apply.  */
1039 ],
1040             [jpeg_CreateDecompress(0L, 0, 0);],
1041             eval "ac_cv_lib_jpeg=-ljpeg",
1042             eval "ac_cv_lib_jpeg=no")
1043 LIBS="$ac_save_LIBS"
1044
1045 dnl what to do, if the normal way fails:
1046 if eval "test \"`echo $ac_cv_lib_jpeg`\" = no"; then
1047         if test -f "$kde_libraries/libjpeg.so"; then
1048            test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so
1049            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1050         else if test -f "$kde_libraries/libjpeg.sl"; then
1051            test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl
1052            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"      
1053         else if test -f "$kde_libraries/libjpeg.a"; then
1054            test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a
1055            ac_cv_lib_jpeg="-L\${topdir} -ljpegkde"
1056         else
1057           AC_MSG_ERROR([
1058 You need jpeglib6a. Please install the kdesupport package.
1059 If you have already installed kdesupport, you may have an
1060 old libjpeg somewhere. 
1061 In this case copy $KDEDIR/lib/libjpeg* to /usr/lib.
1062 ])
1063         fi
1064       fi
1065    fi
1066 fi
1067 ])dnl
1068 if eval "test ! \"`echo $ac_cv_lib_jpeg`\" = no"; then
1069   LIBJPEG="$ac_cv_lib_jpeg"
1070   AC_SUBST(LIBJPEG)
1071   AC_MSG_RESULT($ac_cv_lib_jpeg)
1072   AC_DEFINE_UNQUOTED(HAVE_LIBJPEG)
1073 fi
1074 ])
1075
1076 AC_DEFUN(AC_FIND_ZLIB,
1077 [
1078 AC_MSG_CHECKING([for libz])
1079 AC_CACHE_VAL(ac_cv_lib_z,
1080 [ac_save_LIBS="$LIBS"
1081 LIBS="$all_libraries -lz $LIBSOCKET"
1082 AC_TRY_LINK(dnl
1083 [
1084 #include<zlib.h>
1085 ],
1086             [return (zlibVersion() == ZLIB_VERSION); ],
1087             eval "ac_cv_lib_z='-lz'",
1088             eval "ac_cv_lib_z=no")
1089 LIBS="$ac_save_LIBS"
1090 ])dnl
1091 if eval "test ! \"`echo $ac_cv_lib_z`\" = no"; then
1092 dnl  AC_DEFINE_UNQUOTED(HAVE_LIBZ)
1093   LIBZ="$ac_cv_lib_z"
1094   AC_SUBST(LIBZ)
1095   AC_MSG_RESULT($ac_cv_lib_z)
1096 else
1097   AC_MSG_RESULT(no)
1098   LIBZ=""
1099   AC_SUBST(LIBZ)
1100 fi
1101 ])
1102
1103 AC_DEFUN(AC_FIND_TIFF,
1104 [
1105 AC_REQUIRE([AC_FIND_ZLIB])
1106 AC_REQUIRE([AC_FIND_JPEG])
1107 AC_MSG_CHECKING([for libtiff])
1108 AC_CACHE_VAL(ac_cv_lib_tiff,
1109 [ac_save_LIBS="$LIBS"
1110 LIBS="$all_libraries -ltiff $LIBJPEG $LIBZ -lX11 $LIBSOCKET"
1111 AC_TRY_LINK(dnl
1112 [
1113 #include<tiffio.h>
1114 ],
1115             [return (TIFFOpen( "", "r") == 0); ],
1116             eval "ac_cv_lib_tiff='-ltiff $LIBJPEG $LIBZ'",
1117             eval "ac_cv_lib_tiff=no")
1118 LIBS="$ac_save_LIBS"
1119 ])dnl
1120 if eval "test ! \"`echo $ac_cv_lib_tiff`\" = no"; then
1121   AC_DEFINE_UNQUOTED(HAVE_LIBTIFF)
1122   LIBTIFF="$ac_cv_lib_tiff"
1123   AC_SUBST(LIBTIFF)
1124   AC_MSG_RESULT($ac_cv_lib_tiff)
1125 else
1126   AC_MSG_RESULT(no)
1127   LIBTIFF=""
1128   AC_SUBST(LIBTIFF)
1129 fi
1130 ])
1131
1132
1133 AC_DEFUN(AC_FIND_PNG,
1134 [
1135 AC_REQUIRE([AC_FIND_ZLIB])
1136 AC_MSG_CHECKING([for libpng])
1137 AC_CACHE_VAL(ac_cv_lib_png,
1138 [ac_save_LIBS="$LIBS"
1139 LIBS="$all_libraries -lpng $LIBZ -lm -lX11 $LIBSOCKET"
1140 AC_LANG_C
1141 AC_TRY_LINK(dnl
1142     [
1143     #include<png.h>
1144     ],
1145     [
1146     png_structp png_ptr = png_create_read_struct(  // image ptr
1147                 PNG_LIBPNG_VER_STRING, 0, 0, 0 );
1148     return( png_ptr != 0 ); 
1149     ],
1150     eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
1151     eval "ac_cv_lib_png=no")
1152     LIBS="$ac_save_LIBS"
1153 ])dnl
1154 if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
1155   AC_DEFINE_UNQUOTED(HAVE_LIBPNG)
1156   LIBPNG="$ac_cv_lib_png"
1157   AC_SUBST(LIBPNG)
1158   AC_MSG_RESULT($ac_cv_lib_png)
1159 else
1160   AC_MSG_RESULT(no)
1161   LIBPNG=""
1162   AC_SUBST(LIBPNG)
1163 fi
1164 ])
1165
1166 AC_DEFUN(AC_CHECK_GNU_EXTENSIONS,
1167 [
1168 AC_MSG_CHECKING(if you need GNU extensions)
1169 AC_CACHE_VAL(ac_cv_gnu_extensions,
1170 [
1171 cat > conftest.c << EOF
1172 #include <features.h>
1173
1174 #ifdef __GNU_LIBRARY__
1175 yes
1176 #endif
1177 EOF
1178
1179 if (eval "$ac_cpp conftest.c") 2>&5 |
1180   egrep "yes" >/dev/null 2>&1; then
1181   rm -rf conftest*
1182   ac_cv_gnu_extensions=yes
1183 else
1184   ac_cv_gnu_extensions=no
1185 fi
1186 ])
1187
1188 AC_MSG_RESULT($ac_cv_gnu_extensions)
1189 if test "$ac_cv_gnu_extensions" = "yes"; then
1190   AC_DEFINE_UNQUOTED(_GNU_SOURCE)
1191 fi
1192 ])
1193
1194 AC_DEFUN(AC_CHECK_COMPILERS,
1195 [
1196   dnl this is somehow a fat lie, but prevents other macros from double checking
1197   AC_PROVIDE([AC_PROG_CC])
1198   AC_PROVIDE([AC_PROG_CPP])
1199   AC_ARG_ENABLE(debug,[  --enable-debug           creates debugging code [default=no]],
1200   [ 
1201    if test $enableval = "no"; dnl 
1202      then ac_use_debug_code="no"
1203      else ac_use_debug_code="yes"
1204    fi
1205   ], [ac_use_debug_code="no"])
1206
1207   AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
1208    [ 
1209     if test $enableval = "no"; then 
1210          ac_use_strict_options="no"
1211        else 
1212          ac_use_strict_options="yes"
1213     fi
1214    ], [ac_use_strict_options="no"])
1215
1216 dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
1217   AC_MSG_CHECKING(for a C-Compiler)
1218   dnl if there is one, print out. if not, don't matter
1219   AC_MSG_RESULT($CC) 
1220  
1221   if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
1222   if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
1223   if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
1224   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
1225
1226   AC_PROG_CC_WORKS
1227   AC_PROG_CC_GNU
1228
1229   if test $ac_cv_prog_gcc = yes; then
1230     GCC=yes
1231   else
1232     GCC=
1233   fi
1234
1235   if test -z "$CFLAGS"; then
1236     if test "$ac_use_debug_code" = "yes"; then
1237       AC_PROG_CC_G
1238       if test $ac_cv_prog_cc_g = yes; then
1239         CFLAGS="-g"
1240       fi
1241     else
1242       if test "$GCC" = "yes"; then
1243         CFLAGS="-O2"
1244       else
1245         CFLAGS=""
1246       fi
1247     fi
1248
1249     if test "$GCC" = "yes"; then
1250      CFLAGS="$CFLAGS -Wall"
1251
1252      if test "$ac_use_strict_options" = "yes"; then
1253         CFLAGS="$CFLAGS -W -ansi -pedantic"     
1254      fi
1255     fi
1256
1257   fi
1258
1259   case "$host" in 
1260   *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";;
1261   esac
1262
1263   if test -z "$LDFLAGS" && test "$ac_use_debug_code" = "no" && test "$GCC" = "yes"; then
1264      LDFLAGS="-s"
1265   fi
1266
1267
1268 dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
1269 dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
1270
1271   AC_MSG_CHECKING(how to run the C preprocessor)
1272   # On Suns, sometimes $CPP names a directory.
1273   if test -n "$CPP" && test -d "$CPP"; then
1274     CPP=
1275   fi
1276   if test -z "$CPP"; then
1277   AC_CACHE_VAL(ac_cv_prog_CPP,
1278   [  # This must be in double quotes, not single quotes, because CPP may get
1279     # substituted into the Makefile and "${CC-cc}" will confuse make.
1280     CPP="${CC-cc} -E"
1281     # On the NeXT, cc -E runs the code through the compiler's parser,
1282     # not just through cpp.
1283     dnl Use a header file that comes with gcc, so configuring glibc    
1284     dnl with a fresh cross-compiler works.
1285     AC_TRY_CPP([#include <assert.h>
1286     Syntax Error], ,
1287     CPP="${CC-cc} -E -traditional-cpp"
1288     AC_TRY_CPP([#include <assert.h>
1289     Syntax Error], , CPP=/lib/cpp))
1290     ac_cv_prog_CPP="$CPP"])dnl
1291     CPP="$ac_cv_prog_CPP"
1292   else
1293     ac_cv_prog_CPP="$CPP"
1294   fi
1295   AC_MSG_RESULT($CPP)
1296   AC_SUBST(CPP)dnl
1297
1298
1299   AC_MSG_CHECKING(for a C++-Compiler)
1300   dnl if there is one, print out. if not, don't matter
1301   AC_MSG_RESULT($CXX) 
1302  
1303   if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
1304   if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
1305   if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
1306   if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
1307   test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH])
1308
1309   AC_PROG_CXX_WORKS
1310   AC_PROG_CXX_GNU
1311
1312   if test $ac_cv_prog_gxx = yes; then
1313     GXX=yes
1314   else
1315     AC_MSG_CHECKING(whether we are using SPARC CC)
1316     GXX=
1317     cat > conftest.C << EOF
1318 #ifdef __SUNPRO_CC
1319    yes;
1320 #endif
1321 EOF
1322
1323     ac_try="$CXX -E conftest.C"
1324     if { (eval echo configure:__online__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | egrep yes >/dev/null 2>&1; then
1325       ac_cv_prog_CC=yes
1326     else
1327       ac_cv_prog_CC=no
1328     fi
1329     AC_MSG_RESULT($ac_cv_prog_CC)
1330   fi
1331
1332   if test -z "$CXXFLAGS"; then 
1333     if test "$ac_use_debug_code" = "yes"; then
1334       AC_PROG_CXX_G
1335       if test $ac_cv_prog_cxx_g = yes; then
1336         CXXFLAGS="-g"
1337       fi
1338       if test "$ac_cv_prog_CC" = "yes"; then
1339         CXXFLAGS="$CXXFLAGS -pto"
1340       fi
1341     else
1342       if test "$GXX" = "yes"; then
1343          CXXFLAGS="-O2"
1344       else
1345          if test "$ac_cv_prog_CC" = "yes"; then
1346             CXXFLAGS="-pto -O2"
1347          else
1348             CXXFLAGS=""
1349          fi
1350       fi
1351     fi
1352
1353     if test "$GXX" = "yes"; then
1354        CXXFLAGS="$CXXFLAGS -Wall"
1355  
1356        if test "$ac_use_strict_options" = "yes"; then
1357         CXXFLAGS="$CXXFLAGS -W -ansi -Wtraditional  -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Woverloaded-virtual -Wbad-function-cast  -Wsynth"
1358        fi
1359
1360        if test "$kde_very_strict" = "yes"; then
1361          CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wshadow -Wredundant-decls -Wconversion"
1362        fi
1363     fi
1364   fi  
1365
1366     case "$host" in
1367       *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";;
1368     esac    
1369
1370 ])
1371
1372 dnl just a wrapper to clean up configure.in
1373 AC_DEFUN(KDE_PROG_LIBTOOL,
1374 [
1375 AC_REQUIRE([AM_ENABLE_SHARED])
1376 AC_REQUIRE([AM_ENABLE_STATIC])
1377 dnl libtool is only for C, so I must force him
1378 dnl to find the correct flags for C++
1379 ac_save_cc=$CC
1380 ac_save_cflags="$CFLAGS"
1381 CC=$CXX
1382 CFLAGS="$CXXFLAGS"
1383 AM_PROG_LIBTOOL dnl for libraries
1384 CC=$ac_save_cc
1385 CFLAGS="$ac_save_cflags"
1386 ])
1387
1388 AC_DEFUN(KDE_DO_IT_ALL,
1389 [
1390 AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
1391 KDE_PROG_LIBTOOL
1392 AC_PATH_KDE
1393 ])
1394
1395 AC_DEFUN(AC_CHECK_RPATH,
1396 [
1397 AC_MSG_CHECKING(for rpath)
1398 AC_ARG_ENABLE(rpath,
1399       [  --disable-rpath         do not use the rpath feature of ld],
1400       USE_RPATH=$enableval, USE_RPATH=yes)
1401 if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
1402
1403   KDE_RPATH="-rpath \$(kde_libraries)"
1404
1405   if test -n "$qt_libraries"; then
1406     KDE_RPATH="$KDE_RPATH -rpath \$(qt_libraries)"
1407   fi
1408   dnl $x_libraries is set to /usr/lib in case
1409   if test -n "$X_LDFLAGS"; then 
1410     KDE_RPATH="$KDE_RPATH -rpath \$(x_libraries)"
1411   fi
1412   if test -n "$KDE_EXTRA_RPATH"; then
1413     KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
1414   fi
1415 fi 
1416 AC_SUBST(KDE_EXTRA_RPATH)
1417 AC_SUBST(KDE_RPATH)
1418 AC_MSG_RESULT($USE_RPATH)
1419 ])
1420
1421 # Search path for a program which passes the given test.
1422 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1423
1424 # serial 1
1425 # Stephan Kulow: I appended a _KDE against name conflicts
1426
1427 dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
1428 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1429 AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE,
1430 [# Extract the first word of "$2", so it can be a program name with args.
1431 set dummy $2; ac_word=[$]2
1432 AC_MSG_CHECKING([for $ac_word])
1433 AC_CACHE_VAL(ac_cv_path_$1,
1434 [case "[$]$1" in
1435   /*)
1436   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1437   ;;
1438   *)
1439   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1440   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1441     test -z "$ac_dir" && ac_dir=.
1442     if test -f $ac_dir/$ac_word; then
1443       if [$3]; then
1444         ac_cv_path_$1="$ac_dir/$ac_word"
1445         break
1446       fi
1447     fi
1448   done
1449   IFS="$ac_save_ifs"
1450 dnl If no 4th arg is given, leave the cache variable unset,
1451 dnl so AC_PATH_PROGS will keep looking.
1452 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1453 ])dnl
1454   ;;
1455 esac])dnl
1456 $1="$ac_cv_path_$1"
1457 if test -n "[$]$1"; then
1458   AC_MSG_RESULT([$]$1)
1459 else
1460   AC_MSG_RESULT(no)
1461 fi
1462 AC_SUBST($1)dnl
1463 ])
1464
1465
1466 dnl From Jim Meyering.
1467 dnl FIXME: migrate into libit.
1468
1469 AC_DEFUN(AM_FUNC_OBSTACK,
1470 [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
1471  [AC_TRY_LINK([#include "obstack.h"],
1472               [struct obstack *mem;obstack_free(mem,(char *) 0)],
1473               am_cv_func_obstack=yes,
1474               am_cv_func_obstack=no)])
1475  if test $am_cv_func_obstack = yes; then
1476    AC_DEFINE(HAVE_OBSTACK)
1477  else
1478    LIBOBJS="$LIBOBJS obstack.o"
1479  fi
1480 ])
1481
1482 dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
1483 dnl FIXME: Migrate into libit
1484
1485 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
1486 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
1487  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
1488               am_cv_lib_error_at_line=yes,
1489               am_cv_lib_error_at_line=no)])
1490  if test $am_cv_lib_error_at_line = no; then
1491    LIBOBJS="$LIBOBJS error.o"
1492  fi
1493  AC_SUBST(LIBOBJS)dnl
1494 ])
1495
1496 # Macro to add for using GNU gettext.
1497 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1498
1499 # serial 1
1500 # Stephan Kulow: I put a KDE in it to avoid name conflicts
1501
1502 AC_DEFUN(AM_KDE_GNU_GETTEXT,
1503   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1504    AC_REQUIRE([AC_PROG_RANLIB])dnl
1505    AC_REQUIRE([AC_HEADER_STDC])dnl
1506    AC_REQUIRE([AC_C_INLINE])dnl
1507    AC_REQUIRE([AC_TYPE_OFF_T])dnl
1508    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1509    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1510    AC_REQUIRE([AC_FUNC_MMAP])dnl
1511    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
1512 unistd.h values.h alloca.h])
1513    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
1514 __argz_count __argz_stringify __argz_next stpcpy])
1515
1516    AM_LC_MESSAGES
1517
1518    if test "x$CATOBJEXT" != "x"; then
1519      if test "x$ALL_LINGUAS" = "x"; then
1520        LINGUAS=
1521      else
1522        AC_MSG_CHECKING(for catalogs to be installed)
1523        NEW_LINGUAS=
1524        for lang in ${LINGUAS=$ALL_LINGUAS}; do
1525          case "$ALL_LINGUAS" in
1526           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
1527          esac
1528        done
1529        LINGUAS=$NEW_LINGUAS
1530        AC_MSG_RESULT($LINGUAS)
1531      fi
1532
1533      dnl Construct list of names of catalog files to be constructed.
1534      if test -n "$LINGUAS"; then
1535        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1536      fi
1537    fi
1538
1539   ])
1540
1541 AC_DEFUN(AC_HAVE_XPM,
1542  [AC_REQUIRE_CPP()dnl
1543
1544  test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
1545  test -z "$XPM_INCLUDE" && XPM_INCLUDE=
1546
1547  AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM tests],
1548         xpm_test=$withval, xpm_test="yes")
1549  if test "x$xpm_test" = xno; then
1550    ac_cv_have_xpm=no
1551  else
1552    AC_MSG_CHECKING(for XPM)
1553    AC_CACHE_VAL(ac_cv_have_xpm,
1554    [
1555     AC_LANG_C
1556     ac_save_ldflags="$LDFLAGS"
1557     ac_save_cflags="$CFLAGS"
1558     LDFLAGS="$LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBSOCKET"
1559     CFLAGS="$CFLAGS $X_INCLUDES"
1560     test ! -z "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
1561     AC_TRY_LINK([#include <X11/xpm.h>],[],
1562         ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
1563     LDFLAGS="$ac_save_ldflags"
1564     CFLAGS="$ac_save_cflags"
1565    ])dnl
1566  
1567   if test "$ac_cv_have_xpm" = no; then
1568     AC_MSG_RESULT(no)
1569     XPM_LDFLAGS=""
1570     XPMINC=""
1571     $2
1572   else
1573     AC_DEFINE(HAVE_XPM)
1574     if test "$XPM_LDFLAGS" = ""; then
1575        XPMLIB="-lXpm"
1576     else
1577        XPMLIB="-L$XPM_LDFLAGS -lXpm"
1578     fi
1579     if test "$XPM_INCLUDE" = ""; then
1580        XPMINC=""
1581     else
1582        XPMINC="-I$XPM_INCLUDE"
1583     fi
1584     AC_MSG_RESULT(yes)
1585     $1
1586   fi
1587  fi
1588  AC_SUBST(XPMINC)
1589  AC_SUBST(XPMLIB)
1590 ]) 
1591
1592 AC_DEFUN(AC_HAVE_GL,
1593  [AC_REQUIRE_CPP()dnl
1594
1595  test -z "$GL_LDFLAGS" && GL_LDFLAGS=
1596  test -z "$GL_INCLUDE" && GL_INCLUDE=
1597
1598  AC_ARG_WITH(gl, [  --without-gl            disable 3D GL modes],
1599         gl_test=$withval, gl_test="yes")
1600  if test "x$gl_test" = xno; then
1601    ac_cv_have_gl=no
1602  else
1603    AC_MSG_CHECKING(for GL)
1604    AC_CACHE_VAL(ac_cv_have_gl,
1605    [
1606     AC_LANG_C
1607     ac_save_ldflags="$LDFLAGS"
1608     ac_save_cflags="$CFLAGS"
1609     LDFLAGS="$LDFLAGS $GL_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET"
1610     CFLAGS="$CFLAGS $X_INCLUDES"
1611     test ! -z "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
1612     AC_TRY_LINK([],[],
1613         ac_cv_have_gl="yes",ac_cv_have_gl="no")
1614     LDFLAGS="$ac_save_ldflags"
1615     CFLAGS="$ac_save_cflags"
1616    ])dnl
1617  
1618   if test "$ac_cv_have_gl" = no; then
1619     AC_MSG_RESULT(no)
1620     GL_LDFLAGS=""
1621     GLINC=""
1622     $2
1623   else
1624     AC_DEFINE(HAVE_GL)
1625     if test "$GL_LDFLAGS" = ""; then
1626        GLLIB="-lMesaGL -lMesaGLU"
1627     else
1628        GLLIB="-L$GL_LDFLAGS -lMesaGL -lMesaGLU"
1629     fi
1630     if test "$GL_INCLUDE" = ""; then
1631        GLINC=""
1632     else
1633        GLINC="-I$GL_INCLUDE"
1634     fi
1635     AC_MSG_RESULT(yes)
1636     $1
1637   fi
1638  fi
1639  AC_SUBST(GLINC)
1640  AC_SUBST(GLLIB)
1641 ]) 
1642
1643  dnl PAM pam
1644  
1645  dnl Should test for PAM (Pluggable Authentication Modules)
1646  AC_DEFUN(AC_PATH_PAM_DIRECT,
1647  [
1648  test -z "$pam_direct_test_library" && pam_direct_test_library=pam
1649  test -z "$pam_direct_test_include" && pam_direct_test_include=security/pam_appl.h
1650  
1651    for ac_dir in               \
1652                                \
1653      /usr/local/include        \
1654      /usr/include              \
1655      /usr/unsupported/include  \
1656      /opt/include              \
1657      /usr/pam/include          \
1658      /usr/local/pam/include    \
1659      /usr/lib/pam/include      \
1660                               \
1661      $extra_include            \
1662      ; \
1663    do
1664      if test -r "$ac_dir/$pam_direct_test_include"; then
1665        no_pam= ac_pam_includes=$ac_dir
1666        break
1667      fi
1668    done
1669  
1670  # First see if replacing the include by lib works.
1671  for ac_dir in `echo "$ac_pam_includes" | sed s/include/lib/` \
1672                            \
1673      /lib                  \
1674      /usr/lib              \
1675      /usr/local/lib        \
1676      /usr/unsupported/lib  \
1677      /lib/security         \
1678      /usr/security/lib     \
1679      $extra_lib            \
1680      ; \
1681  do
1682    for ac_extension in a so sl; do
1683      if test -r $ac_dir/lib${pam_direct_test_library}.$ac_extension; then
1684        no_pam= ac_pam_libraries=$ac_dir
1685        break 2
1686      fi
1687    done
1688  done
1689 ])
1690
1691 AC_DEFUN(AC_PATH_PAM,
1692  [AC_REQUIRE_CPP()dnl
1693
1694   AC_CHECK_LIB(pam_misc, main, [PAM_MISC_LIB="-lpam_misc"], [], [-lpam -ldl])
1695
1696  AC_MSG_CHECKING(for PAM)
1697  AC_ARG_WITH(pam, 
1698 [  --with-pam[=ARG]        enable support for PAM: ARG=[yes|no|service name]],
1699   [
1700     if test "x$withval" = "xyes"; then
1701       no_pam=
1702       default_pam=yes
1703     elif test "x$withval" = "xno"; then
1704       no_pam=yes
1705     else
1706       no_pam=
1707       pam_service="$withval"
1708         if test -z "$pam_service"; then
1709         default_pam=yes
1710         else
1711         default_pam=
1712         fi 
1713       fi
1714   ], no_pam=yes
1715  )
1716
1717  if test ! "$no_pam" = yes; then
1718
1719  AC_CACHE_VAL(ac_cv_path_pam,
1720  [
1721  ac_pam_includes=NONE
1722  ac_pam_libraries=NONE
1723  if test -z "$pam_libraries"; then
1724    pam_libraries=NONE
1725  fi
1726  if test -z "$pam_includes"; then
1727    pam_includes=NONE
1728  fi
1729
1730  AC_PATH_PAM_DIRECT
1731  
1732  test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
1733  test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
1734  
1735  if test ! "x$pam_includes" = xNONE && test ! "x$pam_libraries" = xNONE; then
1736    ac_pam_libs="-lpam $PAM_MISC_LIB -ldl"
1737    ac_cv_path_pam="no_pam= ac_pam_includes=$ac_pam_includes ac_pam_libraries=$ac_pam_libraries ac_pam_libs=\"$ac_pam_libs\""
1738  else
1739    ac_cv_path_pam="no_pam=yes"
1740  fi
1741  ])
1742
1743  eval "$ac_cv_path_pam"
1744  
1745  fi
1746
1747  if test "$no_pam" = yes; then
1748    AC_MSG_RESULT(no)
1749  else
1750    AC_DEFINE(HAVE_PAM)
1751    PAMLIBS="$ac_pam_libs"
1752    test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes
1753    test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries
1754    AC_MSG_RESULT([libraries $pam_libraries, headers $pam_includes])
1755  if test "$default_pam" = yes; then
1756    AC_MSG_RESULT(["default pam service name will be used"])
1757  else
1758    AC_DEFINE_UNQUOTED(KDE_PAM_SERVICE,"$pam_service")
1759    AC_MSG_RESULT(["pam service name will be: " $pam_service])
1760  fi
1761 dnl test whether struct pam_message is const (Linux) or not (Sun)
1762    pam_appl_h="$ac_pam_includes/security/pam_appl.h"
1763    AC_MSG_CHECKING(for const pam_message)
1764    AC_EGREP_HEADER([struct pam_message],
1765       $pam_appl_h,
1766       [ AC_EGREP_HEADER([const struct pam_message],
1767                         $pam_appl_h,
1768                         [AC_MSG_RESULT(["const: Linux-type PAM"]) ],
1769                         [AC_MSG_RESULT(["nonconst: Sun-type PAM"])
1770                         AC_DEFINE(PAM_MESSAGE_NONCONST)] 
1771                         )],
1772        [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])]
1773        )
1774  fi
1775  
1776  if test "x$pam_libraries" != x && test "x$pam_libraries" != xNONE ; then
1777      PAMLIBPATHS="-L$pam_libraries"
1778  fi
1779  if test "x$pam_includes" != x && test "x$pam_includes" != xNONE ; then
1780      PAMINC="-I$pam_includes"
1781  fi
1782  
1783  AC_SUBST(PAMINC)
1784  AC_SUBST(PAMLIBS)
1785  AC_SUBST(PAMLIBPATHS)
1786
1787 ]) 
1788
1789 AC_DEFUN(KDE_CHECK_LIBDL,
1790 [
1791 AC_CHECK_LIB(dl, dlopen, [
1792 LIBDL="-ldl"
1793 ac_cv_have_dlfcn=yes
1794 ])
1795
1796 AC_CHECK_LIB(dld, shl_unload, [
1797 LIBDL="-ldld"
1798 ac_cv_have_shload=yes
1799 ])
1800
1801 AC_SUBST(LIBDL)
1802 ])
1803
1804 AC_DEFUN(KDE_CHECK_DLOPEN,
1805 [
1806 KDE_CHECK_LIBDL
1807 AC_CHECK_HEADERS(dlfcn.h dl.h)
1808 if test "$ac_cv_header_dlfcn_h" = "no"; then
1809   ac_cv_have_dlfcn=no
1810 fi
1811
1812 if test "$ac_cv_header_dl_h" = "no"; then
1813   ac_cv_have_shload=no
1814 fi
1815
1816 enable_dlopen=no
1817 AC_ARG_ENABLE(dlopen,
1818 [  --disable-dlopen        link staticly [default=no]] ,
1819 [if test "$enableval" = yes; then
1820   enable_dlopen=yes
1821 fi],
1822 enable_dlopen=yes)
1823
1824 # override the user's opinion, if we know it better ;)
1825 if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
1826   enable_dlopen=no
1827 fi
1828
1829 if test "$ac_cv_have_dlfcn" = "yes"; then
1830   AC_DEFINE_UNQUOTED(HAVE_DLFCN)
1831 fi
1832
1833 if test "$ac_cv_have_shload" = "yes"; then
1834   AC_DEFINE_UNQUOTED(HAVE_SHLOAD)
1835 fi
1836
1837 if test "$enable_dlopen" = no ; then
1838   test -n "$1" && eval $1
1839 else
1840   test -n "$2" && eval $2
1841 fi
1842
1843 ])
1844
1845 AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING,
1846 [
1847 KDE_CHECK_DLOPEN(libtool_enable_shared=no, libtool_enable_static=no)
1848 KDE_PROG_LIBTOOL
1849 AC_MSG_CHECKING([dynamic loading])
1850 eval "`egrep '^build_libtool_libs=' libtool`"
1851 if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
1852   dynamic_loading=yes
1853   AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
1854 else
1855   dynamic_loading=no
1856 fi
1857 AC_MSG_RESULT($dynamic_loading)
1858 if test "$dynamic_loading" = "yes"; then
1859   $1
1860 else
1861   $2
1862 fi
1863 ])
1864
1865 AC_DEFUN(KDE_ADD_INCLUDES,
1866 [
1867 if test -z "$1"; then 
1868   test_include="Pix.h"
1869 else
1870   test_include="$1"
1871 fi
1872
1873 AC_MSG_CHECKING([for libg++ ($test_include)])
1874
1875 AC_CACHE_VAL(kde_cv_libgpp_includes,
1876 [
1877 kde_cv_libgpp_includes=no
1878
1879    for ac_dir in               \
1880                                \
1881      /usr/include/g++          \
1882      /usr/include              \
1883      /usr/unsupported/include  \
1884      /opt/include              \
1885      $extra_include            \
1886      ; \
1887    do
1888      if test -r "$ac_dir/$test_include"; then
1889        kde_cv_libgpp_includes=$ac_dir
1890        break
1891      fi
1892    done
1893 ])
1894
1895 AC_MSG_RESULT($kde_cv_libgpp_includes)
1896 if test "$kde_cv_libgpp_includes" != "no"; then
1897   all_includes="-I$kde_cv_libgpp_includes $all_includes"
1898 fi
1899 ])
1900 ])
1901
1902
1903 AC_DEFUN(KDE_CHECK_MICO,
1904 [
1905 AC_REQUIRE([KDE_CHECK_LIBDL])
1906 AC_MSG_CHECKING(for MICO)
1907 AC_ARG_WITH(micodir,
1908   [  --with-micodir=micodir  where mico is installed ],
1909   kde_micodir=$withval,
1910   kde_micodir=/usr/local
1911 )
1912 AC_MSG_RESULT($kde_micodir)
1913 if test ! -r  $kde_micodir/include/CORBA.h; then
1914   AC_MSG_ERROR([No CORBA.h found, specify another micodir])
1915 fi
1916
1917 MICO_INCLUDES=-I$kde_micodir/include
1918 AC_SUBST(MICO_INCLUDES)
1919 MICO_LDFLAGS=-L$kde_micodir/lib
1920 AC_SUBST(MICO_LDFLAGS)
1921
1922 AC_MSG_CHECKING([for MICO version])
1923 AC_CACHE_VAL(kde_cv_mico_version,
1924 [
1925 AC_LANG_C
1926 cat >conftest.$ac_ext <<EOF
1927 #include <stdio.h>
1928 #include <mico/version.h>
1929 int main() { 
1930     
1931    printf("MICO_VERSION=%s\n",MICO_VERSION); 
1932    return (0); 
1933 }
1934 EOF
1935 ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest'
1936 if AC_TRY_EVAL(ac_compile); then
1937   if eval `./conftest 2>&5`; then
1938     kde_cv_mico_version=$MICO_VERSION
1939   else
1940     AC_MSG_ERROR([your system is not able to execute a small application to
1941     find MICO version! Check $kde_micodir/include/mico/version.h])
1942   fi 
1943 else
1944   AC_MSG_ERROR([your system is not able to compile a small application to
1945   find MICO version! Check $kde_micodir/include/mico/version.h])
1946 fi
1947 ])
1948
1949 dnl installed MICO version
1950 mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
1951 mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
1952 mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
1953
1954 dnl required MICO version
1955 req_v_maj=`echo $1 | sed -e 's/^\(.*\)\..*\..*$/\1/'`
1956 req_v_mid=`echo $1 | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
1957 req_v_min=`echo $1 | sed -e 's/^.*\..*\.\(.*\)$/\1/'` 
1958
1959 if test "$mico_v_maj" -lt "$req_v_maj" || \
1960    ( test "$mico_v_maj" -eq "$req_v_maj" && \
1961         test "$mico_v_mid" -lt "$req_v_mid" ) || \
1962    ( test "$mico_v_mid" -eq "$req_v_mid" && \
1963         test "$mico_v_min" -lt "$req_v_min" )
1964
1965 then
1966   AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $1 \
1967 at least is required. You should upgrade MICO.])
1968 else
1969   AC_MSG_RESULT([$kde_cv_mico_version (minimum version $1, ok)])
1970 fi
1971
1972 LIBMICO="-lmico$kde_cv_mico_version $LIBDL"
1973 AC_SUBST(LIBMICO)
1974 IDL=$kde_micodir/bin/idl
1975 AC_SUBST(IDL)
1976 ])
1977
1978
1979 AC_DEFUN(KDE_CHECK_MINI_STL,
1980 [
1981 AC_REQUIRE([KDE_CHECK_MICO])
1982
1983 AC_MSG_CHECKING(if we use mico's mini-STL)
1984 AC_CACHE_VAL(kde_cv_have_mini_stl,
1985 [
1986 AC_LANG_CPLUSPLUS
1987 kde_save_cxxflags="$CXXFLAGS"
1988 CXXFLAGS="$CXXFLAGS $MICO_INCLUDES"
1989 AC_TRY_COMPILE(
1990 [
1991 #include <mico/config.h>
1992 ],
1993 [
1994 #ifdef HAVE_MINI_STL
1995 #error "nothing"
1996 #endif
1997 ],
1998 kde_cv_have_mini_stl=no,
1999 kde_cv_have_mini_stl=yes)
2000 CXXFLAGS="$kde_save_cxxflags"
2001 ])
2002
2003
2004 AC_MSG_RESULT($kde_cv_have_mini_stl)
2005 if test "$kde_cv_have_mini_stl" = "yes"; then
2006   AC_DEFINE_UNQUOTED(HAVE_MINI_STL)
2007 fi
2008 ])
2009
2010 ])
2011
2012
2013 AC_DEFUN(KDE_CHECK_LIBPTHREAD,
2014 [
2015 AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"], LIBPTHREAD= )
2016 AC_SUBST(LIBPTHREAD)
2017 ])
2018
2019 AC_DEFUN(KDE_TRY_LINK_PYTHON,
2020 [
2021 AC_CACHE_VAL(kde_cv_try_link_python_$1,
2022 [
2023 kde_save_cxxflags="$CXXFLAGS"
2024 CXXFLAGS="$CXXFLAGS $PYTHONINC"
2025 kde_save_libs="$LIBS"
2026 LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
2027 kde_save_ldflags="$LDFLAGS"
2028 LDFLAGS="$LDFLAGS $PYTHONLIB"
2029
2030 AC_TRY_LINK(
2031 [
2032 #include <Python.h>
2033 ],[
2034         PySys_SetArgv(1, 0);
2035 ],
2036         [kde_cv_try_link_python_$1=yes],
2037         [kde_cv_try_link_python_$1=no]
2038 )
2039 CXXFLAGS="$kde_save_cxxflags"
2040 LIBS="$kde_save_libs"
2041 LDFLAGS="$kde_save_ldflags"
2042 ])
2043
2044 if test "$kde_cv_try_link_python_$1" = "yes"; then
2045   $3
2046 else
2047   $4
2048 fi
2049
2050 ])
2051
2052 AC_DEFUN(KDE_CHECK_PYTHON,
2053 [
2054 AC_REQUIRE([KDE_CHECK_LIBDL])
2055 AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
2056 if test -z "$1"; then 
2057   version="1.5"
2058 else
2059   version="$1"
2060 fi
2061
2062 AC_MSG_CHECKING([for Python$version])
2063
2064 AC_ARG_WITH(pythondir, 
2065 [  --with-pythondir=pythondir   use python installed in pythondir ],
2066 [
2067   ac_python_dir=$withval
2068 ], ac_python_dir=/usr/local
2069 )
2070
2071 python_incdirs="$ac_python_dir/include/python$version /usr/include/python$version /usr/local/include/python$version /usr/local/include"
2072 AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
2073 if test ! -r $python_incdir/Python.h; then
2074   AC_MSG_ERROR(Python.h not found.)
2075 fi
2076
2077 PYTHONINC=-I$python_incdir
2078
2079 python_libdirs="$ac_python_dir/lib/python$version/config /usr/lib/python$version/config /usr/local/python$version/config"
2080 AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
2081 if test ! -r $python_libdir/libpython$version.a; then
2082   AC_MSG_ERROR(libpython$version.a not found.)
2083 fi
2084
2085 PYTHONLIB=-L$python_libdir
2086 LIBPYTHON=-lpython$version
2087
2088 AC_MSG_RESULT(header $python_incdir library $python_libdir)
2089
2090 dnl Note: this test is very weak
2091 AC_MSG_CHECKING(if an Python application links)
2092 KDE_TRY_LINK_PYTHON(normal, "", AC_MSG_RESULT(yes),
2093  [
2094     AC_MSG_RESULT(no)
2095     AC_MSG_CHECKING(if Python depends on -lpthread)
2096     KDE_TRY_LINK_PYTHON(pthread, "$LIBPTHREAD",
2097     [  
2098        AC_MSG_RESULT(yes)
2099        LIBPYTHON="$LIBPYTHON $LIBPTHREAD $LIBDL"
2100     ],
2101     [
2102        AC_MSG_RESULT(no)
2103        AC_MSG_CHECKING(if Python depeds on -ltcl)
2104        KDE_TRY_LINK_PYTHON(tcl, "-ltcl",
2105        [
2106           AC_MSG_RESULT(yes)
2107           LIBPYTHON="$LIBPYTHON -ltcl"
2108        ],
2109        [
2110           AC_MSG_RESULT(no)
2111         AC_MSG_WARN([it seems, Python depends on another library. 
2112     Pleae use \"make LIBPTYHON='-lpython$version -lotherlib'\" to fix this
2113     and contact the authors to let them know about this problem])
2114         ])
2115     ])
2116  ]) 
2117
2118 AC_SUBST(PYTHONINC)
2119 AC_SUBST(PYTHONLIB)
2120 AC_SUBST(LIBPYTHON)
2121
2122 ])
2123
2124
2125 AC_DEFUN(KDE_CHECK_STL_SGI,
2126 [
2127     AC_MSG_CHECKING([if STL implementation is SGI like])
2128     AC_CACHE_VAL(kde_cv_stl_type_sgi,
2129     [
2130       AC_TRY_COMPILE([
2131 #include <string>
2132 ],[
2133   string astring="Hallo Welt.";
2134   astring.erase(0, 6); // now astring is "Welt"
2135   return 0;
2136 ], kde_cv_stl_type_sgi=yes,
2137    kde_cv_stl_type_sgi=no)
2138 ])
2139
2140    AC_MSG_RESULT($kde_cv_stl_type_sgi)
2141
2142    if test "$kde_cv_stl_type_sgi" = "yes"; then
2143         AC_DEFINE_UNQUOTED(HAVE_SGI_STL) 
2144    fi
2145 ])
2146
2147 AC_DEFUN(KDE_CHECK_STL_HP,
2148 [
2149     AC_MSG_CHECKING([if STL implementation is HP like])
2150     AC_CACHE_VAL(kde_cv_stl_type_hp,
2151     [
2152       AC_TRY_COMPILE([
2153 #include <string>
2154 ],[
2155   string astring="Hello World";
2156   astring.remove(0, 6); // now astring is "World"
2157   return 0;
2158 ], kde_cv_stl_type_hp=yes,
2159    kde_cv_stl_type_hp=no)
2160 ])
2161    AC_MSG_RESULT($kde_cv_stl_type_hp)
2162
2163    if test "$kde_cv_stl_type_hp" = "yes"; then
2164         AC_DEFINE_UNQUOTED(HAVE_HP_STL) 
2165    fi
2166 ])
2167
2168 AC_DEFUN(KDE_CHECK_STL,
2169 [
2170     KDE_CHECK_STL_SGI
2171     
2172     if test "$kde_cv_stl_type_sgi" = "no"; then
2173        KDE_CHECK_STL_HP
2174
2175        if test "$kde_cv_stl_type_hp" = "no"; then
2176          AC_MSG_ERROR("no known STL type found")
2177        fi
2178     fi
2179
2180 ])
2181
2182 AC_DEFUN(AC_FIND_QIMGIO,
2183    [AC_REQUIRE([AC_FIND_JPEG])
2184 AC_MSG_CHECKING([for qimgio])
2185 AC_CACHE_VAL(ac_cv_lib_qimgio,
2186 [ac_save_LIBS="$LIBS"
2187 LIBS="$all_libraries -lqimgio -lpng -lz -lqt $LIBJPEG -lX11 $LIBSOCKET"
2188 AC_TRY_LINK(dnl
2189 [
2190 void qInitImageIO ();
2191 ],
2192             [qInitImageIO();],
2193             eval "ac_cv_lib_qimgio=yes",
2194             eval "ac_cv_lib_qimgio=no")
2195 LIBS="$ac_save_LIBS"
2196 ])dnl
2197 if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
2198   LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
2199   AC_MSG_RESULT(yes)
2200   AC_DEFINE_UNQUOTED(HAVE_QIMGIO)
2201   AC_SUBST(LIBQIMGIO)
2202 else
2203   AC_MSG_RESULT(not found)
2204 fi
2205 ])
2206
2207 AC_DEFUN(KDE_CHECK_ANSI,
2208 [
2209 AC_MSG_CHECKING([for strdup])
2210
2211     AC_CACHE_VAL(kde_cv_stl_type_sgi,
2212     [
2213 AC_LANG_CPLUSPLUS
2214 save_CXXFLAGS="$CXXFLAGS"
2215 if test "$GCC" = "yes"; then
2216   CXXFLAGS="$CXXFLAGS -pedantic-errors"
2217 fi
2218
2219 AC_TRY_COMPILE([
2220 #include <string.h>
2221 ],[
2222   char buffer[] = "Hallo";
2223   strdup(buffer)
2224 ], kde_cv_has_strdup=yes,
2225    kde_cv_has_strdup=no)
2226 CXXFLAGS="$save_CXXFLAGS"
2227 ])
2228 AC_MSG_RESULT($kde_cv_has_strdup)
2229
2230 if test "$kde_cv_has_strdup" = "yes"; then
2231   AC_DEFINE_UNQUOTED(HAVE_STRDUP)
2232 fi
2233
2234 ])
2235
2236 AC_DEFUN(KDE_CHECK_INSURE,
2237 [
2238   AC_ARG_ENABLE(insure, [  --enable-insure             use insure++ for debugging [default=no]],
2239   [
2240   if test $enableval = "no"; dnl
2241         then ac_use_insure="no"
2242         else ac_use_insure="yes"
2243    fi
2244   ], [ac_use_insure="no"])
2245
2246   AC_MSG_CHECKING(if we will use Insure++ to debug)
2247   AC_MSG_RESULT($ac_use_insure)
2248   if test "$ac_use_insure" = "yes"; dnl
2249        then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "????
2250    fi
2251 ])          
2252
2253 dnl this is for kdm:
2254
2255 AC_DEFUN(AC_CHECK_KDM,
2256 [
2257 AC_CHECK_FUNCS(getsecretkey)
2258 dnl checks for X server
2259
2260 AC_PATH_PROG(X_SERVER, X)
2261 if test ! -z "$X_SERVER"; then
2262 X_SERVER=`echo $X_SERVER | sed -e 's+/X$++'`
2263 AC_DEFINE_UNQUOTED(XBINDIR,$X_SERVER)
2264 XBINDIR=$X_SERVER
2265 AC_SUBST(XBINDIR)
2266 fi
2267
2268 dnl This one tries to find XDMDIR for config files
2269 AC_ARG_WITH(xdmdir,
2270         [  --with-xdmdir                  If the xdm config dir can't be found automaticly],
2271         [ ac_xdmdir=$withval],
2272         [ ac_xdmdir="no"])
2273
2274 AC_MSG_CHECKING([for xdm configuration dir])
2275 if test "$ac_xdmdir" = "no"; then
2276     rm -fr conftestdir
2277     if mkdir conftestdir; then
2278         cd conftestdir
2279     cat > Imakefile <<'EOF'
2280 acfindxdm:
2281         @echo 'ac_xdmdir="$(XDMDIR)";'
2282 EOF
2283         if (xmkmf) > /dev/null 2> /dev/null && test -f Makefile; then
2284             eval `${MAKE-make} acfindxdm 2>/dev/null 2>/dev/null | grep -v make`
2285         fi
2286         cd ..
2287         rm -fr conftestdir
2288         dnl Check if Imake was right
2289         if test -f $ac_xdmdir/xdm-config; then
2290             AC_MSG_RESULT($ac_xdmdir)
2291         else
2292             dnl Here we must do something else
2293             dnl Maybe look for xdm-config in standard places, and
2294             dnl if that fails use a fresh copy in $KDEDIR/config/kdm/
2295             AC_FIND_FILE(xdm-config,/etc/X11/xdm /var/X11/xdm /usr/openwin/xdm /usr/X11R6/lib/X11/xdm,ac_xdmdir)
2296             if test -f $ac_xdmdir/xdm-config; then
2297                 AC_MSG_RESULT($ac_xdmdir)
2298             else                                 
2299                 if test "${prefix}" = NONE; then
2300                         ac_xdmdir=$ac_default_prefix/config/kdm
2301                 else
2302                         ac_xdmdir=$prefix/config/kdm
2303                 fi
2304                 AC_MSG_RESULT([xdm config dir not found, installing defaults in $ac_xdmdir])
2305                 xdmconfigsubdir=xdmconfig
2306                 AC_SUBST(xdmconfigsubdir)
2307             fi
2308         fi
2309     fi
2310 else
2311     if test -f $ac_xdmdir/xdm-config; then
2312         AC_MSG_RESULT($ac_xdmdir)
2313     else
2314
2315         AC_MSG_RESULT([xdm config dir not found, installing defaults in $ac_xdmdir])
2316         xdmconfigsubdir=xdmconfig
2317         AC_SUBST(xdmconfigsubdir)
2318     fi
2319 fi
2320 AC_DEFINE_UNQUOTED(XDMDIR,"$ac_xdmdir")
2321 AC_SUBST(ac_xdmdir)
2322
2323 AC_PATH_PAM
2324 if test "x$no_pam" = "xyes"; then 
2325         pam_support="no"
2326 else
2327         pam_support="yes"
2328         shadow_support="no" # if pam is installed, use it. We can't savely 
2329                             # test, if it works *sigh*
2330 fi
2331
2332 AC_ARG_WITH(shadow,
2333         [  --with-shadow                  If you want shadow password support ],
2334         [ if test "$withval" = "yes"; then
2335              shadow_support="yes"
2336           else
2337              shadow_support="no"
2338           fi
2339           if test "$pam_support" = "yes" && test "$shadow_support=yes"; then
2340                 AC_MSG_WARN("You can not define both pam AND shadow")
2341           fi
2342         ],
2343         [ if test -z "$shadow_support"; then shadow_support="no"; fi ] )
2344
2345 if test "$pam_support" = "yes"; then
2346   AC_CHECK_LIB(pam, main, [PASSWDLIB="-lpam -ldl"
2347   AC_DEFINE_UNQUOTED(HAVE_PAM_LIB)],
2348   [],-ldl)
2349 fi
2350
2351 if test -z "$PASSWDLIB" && test "$shadow_support" = "yes"; then
2352   AC_CHECK_LIB(shadow, main,
2353     [ PASSWDLIB="-lshadow"
2354       AC_DEFINE_UNQUOTED(HAVE_SHADOW_LIB)
2355     ])
2356 fi
2357 AC_SUBST(PASSWDLIB)
2358 AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for FreeBSD
2359 AC_SUBST(LIBUTIL)
2360 AC_CHECK_LIB(s, main, [LIB_LIBS="-ls"]) dnl for AIX
2361 AC_SUBST(LIB_LIBS)
2362 AC_CHECK_LIB(Xdmcp, main, [LIBXDMCP="-lXdmcp"], , $X_LDFLAGS -lX11) dnl for Unixware
2363 AC_SUBST(LIBXDMCP)
2364
2365 if test -n "$LIBXDMCP"; then
2366   ac_cpp_safe=$ac_cpp
2367   ac_cpp='$CXXCPP $CPPFLAGS $X_INCLUDES'
2368   AC_CHECK_HEADERS(X11/Xdmcp.h)
2369   ac_cpp=$ac_cpp_safe
2370 fi
2371
2372 ])