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