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