1dnl aclocal.m4 generated automatically by aclocal 1.4-p5
2
3dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13
14dnl    This file is part of the KDE libraries/packages
15dnl    Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
16dnl              (C) 1997,98,99 Stephan Kulow (coolo@kde.org)
17
18dnl    This file is free software; you can redistribute it and/or
19dnl    modify it under the terms of the GNU Library General Public
20dnl    License as published by the Free Software Foundation; either
21dnl    version 2 of the License, or (at your option) any later version.
22
23dnl    This library is distributed in the hope that it will be useful,
24dnl    but WITHOUT ANY WARRANTY; without even the implied warranty of
25dnl    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26dnl    Library General Public License for more details.
27
28dnl    You should have received a copy of the GNU Library General Public License
29dnl    along with this library; see the file COPYING.LIB.  If not, write to
30dnl    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
31dnl    Boston, MA 02111-1307, USA.
32
33dnl IMPORTANT NOTE:
34dnl Please do not modify this file unless you expect your modifications to be
35dnl carried into every other module in the repository. If you decide that you
36dnl really want to modify it, contact coolo@kde.org mentioning that you have
37dnl and that the modified file should be committed to every module.
38dnl
39dnl Single-module modifications are best placed in configure.in for kdelibs
40dnl and kdebase or configure.in.in if present.
41
42dnl ------------------------------------------------------------------------
43dnl Forward compatibility macros (make autoconf 2.13 look like 2.50),
44dnl thanks to Raja R Harinath.
45dnl ------------------------------------------------------------------------
46dnl
47ifdef([_AC_PATH_X_XMKMF],[],
48   [AC_DEFUN([_AC_PATH_X_XMKMF],[AC_PATH_X_XMKMF])])
49ifdef([AC_OUTPUT_SUBDIRS],[],
50   [AC_DEFUN([AC_OUTPUT_SUBDIRS],[subdirs=$1; _AC_OUTPUT_SUBDIRS])])
51
52# KDE_PATH_X_DIRECT
53dnl Internal subroutine of AC_PATH_X.
54dnl Set ac_x_includes and/or ac_x_libraries.
55AC_DEFUN(KDE_PATH_X_DIRECT,
56[if test "$ac_x_includes" = NO; then
57  # Guess where to find include files, by looking for this one X11 .h file.
58  test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
59
60  # First, try using that file with no special directory specified.
61AC_TRY_CPP([#include <$x_direct_test_include>],
62[# We can compile using X headers with no special include directory.
63ac_x_includes=],
64[# Look for the header file in a standard set of common directories.
65# Check X11 before X11Rn because it is often a symlink to the current release.
66  for ac_dir in               \
67    /usr/X11/include          \
68    /usr/X11R6/include        \
69    /usr/X11R5/include        \
70    /usr/X11R4/include        \
71                              \
72    /usr/include/X11          \
73    /usr/include/X11R6        \
74    /usr/include/X11R5        \
75    /usr/include/X11R4        \
76                              \
77    /usr/local/X11/include    \
78    /usr/local/X11R6/include  \
79    /usr/local/X11R5/include  \
80    /usr/local/X11R4/include  \
81                              \
82    /usr/local/include/X11    \
83    /usr/local/include/X11R6  \
84    /usr/local/include/X11R5  \
85    /usr/local/include/X11R4  \
86                              \
87    /usr/X386/include         \
88    /usr/x386/include         \
89    /usr/XFree86/include/X11  \
90                              \
91    /usr/include              \
92    /usr/local/include        \
93    /usr/unsupported/include  \
94    /usr/athena/include       \
95    /usr/local/x11r5/include  \
96    /usr/lpp/Xamples/include  \
97                              \
98    /usr/openwin/include      \
99    /usr/openwin/share/include \
100    ; \
101  do
102    if test -r "$ac_dir/$x_direct_test_include"; then
103      ac_x_includes=$ac_dir
104      break
105    fi
106  done])
107fi # $ac_x_includes = NO
108
109if test "$ac_x_libraries" = NO; then
110  # Check for the libraries.
111
112  test -z "$x_direct_test_library" && x_direct_test_library=Xt
113  test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
114
115  # See if we find them without any special options.
116  # Don't add to $LIBS permanently.
117  ac_save_LIBS="$LIBS"
118  LIBS="-l$x_direct_test_library $LIBS"
119AC_TRY_LINK(, [${x_direct_test_function}()],
120[LIBS="$ac_save_LIBS"
121# We can link X programs with no special library path.
122ac_x_libraries=],
123[LIBS="$ac_save_LIBS"
124# First see if replacing the include by lib works.
125# Check X11 before X11Rn because it is often a symlink to the current release.
126for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
127    /usr/X11/lib          \
128    /usr/X11R6/lib        \
129    /usr/X11R5/lib        \
130    /usr/X11R4/lib        \
131                          \
132    /usr/lib/X11          \
133    /usr/lib/X11R6        \
134    /usr/lib/X11R5        \
135    /usr/lib/X11R4        \
136                          \
137    /usr/local/X11/lib    \
138    /usr/local/X11R6/lib  \
139    /usr/local/X11R5/lib  \
140    /usr/local/X11R4/lib  \
141                          \
142    /usr/local/lib/X11    \
143    /usr/local/lib/X11R6  \
144    /usr/local/lib/X11R5  \
145    /usr/local/lib/X11R4  \
146                          \
147    /usr/X386/lib         \
148    /usr/x386/lib         \
149    /usr/XFree86/lib/X11  \
150                          \
151    /usr/lib              \
152    /usr/local/lib        \
153    /usr/unsupported/lib  \
154    /usr/athena/lib       \
155    /usr/local/x11r5/lib  \
156    /usr/lpp/Xamples/lib  \
157    /lib/usr/lib/X11	  \
158                          \
159    /usr/openwin/lib      \
160    /usr/openwin/share/lib \
161    ; \
162do
163dnl Don't even attempt the hair of trying to link an X program!
164  for ac_extension in a so sl; do
165    if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
166      ac_x_libraries=$ac_dir
167      break 2
168    fi
169  done
170done])
171fi # $ac_x_libraries = NO
172])
173
174
175dnl ------------------------------------------------------------------------
176dnl Find a file (or one of more files in a list of dirs)
177dnl ------------------------------------------------------------------------
178dnl
179AC_DEFUN(AC_FIND_FILE,
180[
181$3=NO
182for i in $2;
183do
184  for j in $1;
185  do
186    echo "configure: __oline__: $i/$j" >&AC_FD_CC
187    if test -r "$i/$j"; then
188      echo "taking that" >&AC_FD_CC
189      $3=$i
190      break 2
191    fi
192  done
193done
194])
195
196dnl KDE_FIND_PATH(programm-name, variable-name, list of directories,
197dnl	if-not-found, test-parameter)
198AC_DEFUN(KDE_FIND_PATH,
199[
200   AC_MSG_CHECKING([for $1])
201   if test -n "$$2"; then
202        kde_cv_path="$$2";
203   else
204        kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
205
206        AC_CACHE_VAL(kde_cv_path_$kde_cache,
207        [
208        kde_cv_path="NONE"
209	dirs="$3"
210	kde_save_IFS=$IFS
211	IFS=':'
212	for dir in $PATH; do
213	  dirs="$dirs $dir"
214        done
215	IFS=$kde_save_IFS
216
217        for dir in $dirs; do
218	  if test -x "$dir/$1"; then
219	    if test -n "$5"
220	    then
221              evalstr="$dir/$1 $5 2>&1 "
222	      if eval $evalstr; then
223                kde_cv_path="$dir/$1"
224                break
225	      fi
226            else
227		kde_cv_path="$dir/$1"
228                break
229	    fi
230          fi
231        done
232
233        eval "kde_cv_path_$kde_cache=$kde_cv_path"
234
235        ])
236
237      eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
238
239   fi
240
241   if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
242      AC_MSG_RESULT(not found)
243      $4
244   else
245      AC_MSG_RESULT($kde_cv_path)
246      $2=$kde_cv_path
247
248   fi
249])
250
251AC_DEFUN(KDE_MOC_ERROR_MESSAGE,
252[
253    AC_MSG_ERROR([No Qt meta object compiler (moc) found!
254Please check whether you installed Qt correctly.
255You need to have a running moc binary.
256configure tried to run $ac_cv_path_moc and the test didn't
257succeed. If configure shouldn't have tried this one, set
258the environment variable MOC to the right one before running
259configure.
260])
261])
262
263AC_DEFUN(KDE_UIC_ERROR_MESSAGE,
264[
265    AC_MSG_WARN([No Qt ui compiler (uic) found!
266Please check whether you installed Qt correctly.
267You need to have a running uic binary.
268configure tried to run $ac_cv_path_uic and the test didn't
269succeed. If configure shouldn't have tried this one, set
270the environment variable UIC to the right one before running
271configure.
272])
273])
274
275
276AC_DEFUN(KDE_CHECK_UIC_FLAG,
277[
278    AC_MSG_CHECKING([whether uic supports -$1 ])
279    kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'`
280    AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache,
281    [
282        cat >conftest.ui <<EOT
283        <!DOCTYPE UI><UI version="3" stdsetdef="1"></UI>
284EOT
285        ac_uic_testrun="$UIC -$1 $2 conftest.ui >/dev/null"
286        if AC_TRY_EVAL(ac_uic_testrun); then
287            eval "kde_cv_prog_uic_$kde_cache=yes"
288        else
289            eval "kde_cv_prog_uic_$kde_cache=no"
290        fi
291        rm -f conftest*
292    ])
293
294    if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then
295        AC_MSG_RESULT([yes])
296        :
297        $3
298    else
299        AC_MSG_RESULT([no])
300        :
301        $4
302    fi
303])
304
305
306dnl ------------------------------------------------------------------------
307dnl Find the meta object compiler and the ui compiler in the PATH,
308dnl in $QTDIR/bin, and some more usual places
309dnl ------------------------------------------------------------------------
310dnl
311AC_DEFUN(AC_PATH_QT_MOC_UIC,
312[
313   qt_bindirs=""
314   for dir in $kde_qt_dirs; do
315      qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc"
316   done
317   qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
318   if test ! "$ac_qt_bindir" = "NO"; then
319      qt_bindirs="$ac_qt_bindir $qt_bindirs"
320   fi
321
322   KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE])
323   if test -z "$UIC_NOT_NEEDED"; then
324     KDE_FIND_PATH(uic, UIC, [$qt_bindirs], [UIC=""])
325     if test -z "$UIC" ; then
326       KDE_UIC_ERROR_MESSAGE
327       exit 1
328     elif test $kde_qtver = 3; then
329       KDE_CHECK_UIC_FLAG(L,[/nonexistant],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no)
330       KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no)
331
332       if test x$ac_uic_supports_libpath = xyes; then
333           UIC="$UIC -L \$(kde_widgetdir)"
334       fi
335       if test x$ac_uic_supports_nounload = xyes; then
336           UIC="$UIC -nounload"
337       fi
338     fi
339   else
340     UIC="echo uic not available: "
341   fi
342
343   AC_SUBST(MOC)
344   AC_SUBST(UIC)
345
346   UIC_TR="i18n"
347   if test $kde_qtver = 3; then
348     UIC_TR="tr2i18n"
349   fi
350
351   AC_SUBST(UIC_TR)
352])
353
354AC_DEFUN(KDE_1_CHECK_PATHS,
355[
356  KDE_1_CHECK_PATH_HEADERS
357
358  KDE_TEST_RPATH=
359
360  if test -n "$USE_RPATH"; then
361
362     if test -n "$kde_libraries"; then
363       KDE_TEST_RPATH="-R $kde_libraries"
364     fi
365
366     if test -n "$qt_libraries"; then
367       KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries"
368     fi
369
370     if test -n "$x_libraries"; then
371       KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries"
372     fi
373
374     KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
375  fi
376
377AC_MSG_CHECKING([for KDE libraries installed])
378ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5'
379
380if AC_TRY_EVAL(ac_link) && test -s conftest; then
381  AC_MSG_RESULT(yes)
382else
383  AC_MSG_ERROR([your system fails at linking a small KDE application!
384Check, if your compiler is installed correctly and if you have used the
385same compiler to compile Qt and kdelibs as you did use now.
386For more details about this problem, look at the end of config.log.])
387fi
388
389if eval `KDEDIR= ./conftest 2>&5`; then
390  kde_result=done
391else
392  kde_result=problems
393fi
394
395KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
396kde_have_all_paths=yes
397
398KDE_SET_PATHS($kde_result)
399
400])
401
402AC_DEFUN(KDE_SET_PATHS,
403[
404  kde_cv_all_paths="kde_have_all_paths=\"yes\" \
405	kde_htmldir=\"$kde_htmldir\" \
406	kde_appsdir=\"$kde_appsdir\" \
407	kde_icondir=\"$kde_icondir\" \
408	kde_sounddir=\"$kde_sounddir\" \
409	kde_datadir=\"$kde_datadir\" \
410	kde_locale=\"$kde_locale\" \
411	kde_cgidir=\"$kde_cgidir\" \
412	kde_confdir=\"$kde_confdir\" \
413	kde_mimedir=\"$kde_mimedir\" \
414	kde_toolbardir=\"$kde_toolbardir\" \
415	kde_wallpaperdir=\"$kde_wallpaperdir\" \
416	kde_templatesdir=\"$kde_templatesdir\" \
417	kde_bindir=\"$kde_bindir\" \
418	kde_servicesdir=\"$kde_servicesdir\" \
419	kde_servicetypesdir=\"$kde_servicetypesdir\" \
420	kde_moduledir=\"$kde_moduledir\" \
421   kde_styledir=\"$kde_styledir\" \
422	kde_widgetdir=\"$kde_widgetdir\" \
423	kde_result=$1"
424])
425
426AC_DEFUN(KDE_SET_DEFAULT_PATHS,
427[
428if test "$1" = "default"; then
429
430  if test -z "$kde_htmldir"; then
431    kde_htmldir='\${prefix}/share/doc/HTML'
432  fi
433  if test -z "$kde_appsdir"; then
434    kde_appsdir='\${prefix}/share/applnk'
435  fi
436  if test -z "$kde_icondir"; then
437    kde_icondir='\${prefix}/share/icons'
438  fi
439  if test -z "$kde_sounddir"; then
440    kde_sounddir='\${prefix}/share/sounds'
441  fi
442  if test -z "$kde_datadir"; then
443    kde_datadir='\${prefix}/share/apps'
444  fi
445  if test -z "$kde_locale"; then
446    kde_locale='\${prefix}/share/locale'
447  fi
448  if test -z "$kde_cgidir"; then
449    kde_cgidir='\${exec_prefix}/cgi-bin'
450  fi
451  if test -z "$kde_confdir"; then
452    kde_confdir='\${prefix}/share/config'
453  fi
454  if test -z "$kde_mimedir"; then
455    kde_mimedir='\${prefix}/share/mimelnk'
456  fi
457  if test -z "$kde_toolbardir"; then
458    kde_toolbardir='\${prefix}/share/toolbar'
459  fi
460  if test -z "$kde_wallpaperdir"; then
461    kde_wallpaperdir='\${prefix}/share/wallpapers'
462  fi
463  if test -z "$kde_templatesdir"; then
464    kde_templatesdir='\${prefix}/share/templates'
465  fi
466  if test -z "$kde_bindir"; then
467    kde_bindir='\${exec_prefix}/bin'
468  fi
469  if test -z "$kde_servicesdir"; then
470    kde_servicesdir='\${prefix}/share/services'
471  fi
472  if test -z "$kde_servicetypesdir"; then
473    kde_servicetypesdir='\${prefix}/share/servicetypes'
474  fi
475  if test -z "$kde_moduledir"; then
476    if test "$kde_qtver" = "2"; then
477      kde_moduledir='\${exec_prefix}/lib/kde2'
478    else
479      kde_moduledir='\${exec_prefix}/lib/kde3'
480    fi
481  fi
482  if test -z "$kde_styledir"; then
483    kde_styledir='\${exec_prefix}/lib/kde3/plugins/styles'
484  fi
485  if test -z "$kde_widgetdir"; then
486    kde_widgetdir='\${exec_prefix}/lib/kde3/plugins/designer'
487  fi
488
489  KDE_SET_PATHS(defaults)
490
491else
492
493  if test $kde_qtver = 1; then
494     AC_MSG_RESULT([compiling])
495     KDE_1_CHECK_PATHS
496  else
497     AC_MSG_ERROR([path checking not yet supported for KDE 2])
498  fi
499
500fi
501])
502
503AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS,
504[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
505   test -z "$kde_icondir" || test -z "$kde_sounddir" ||
506   test -z "$kde_datadir" || test -z "$kde_locale"  ||
507   test -z "$kde_cgidir"  || test -z "$kde_confdir" ||
508   test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
509   test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" ||
510   test -z "$kde_bindir" || test -z "$kde_servicesdir" ||
511   test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" ||
512   test -z "$kde_styledir" || test -z "kde_widgetdir"
513   test "x$kde_have_all_paths" != "xyes"; then
514     kde_have_all_paths=no
515  fi
516])
517
518AC_DEFUN(KDE_MISSING_PROG_ERROR,
519[
520    AC_MSG_ERROR([The important program $1 was not found!
521Please check whether you installed KDE correctly.
522])
523])
524
525AC_DEFUN(KDE_SUBST_PROGRAMS,
526[
527
528        kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin"
529        if test -n "$KDEDIRS"; then
530           kde_save_IFS=$IFS
531           IFS=:
532           for dir in $KDEDIRS; do
533                kde_default_bindirs="$dir/bin $kde_default_bindirs "
534           done
535           IFS=$kde_save_IFS
536        fi
537        kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs"
538        KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)])
539        KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)])
540        KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(mcopidl)])
541        KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(artsc-config)])
542        KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs])
543        KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs])
544
545        if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then
546 	    kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share"
547            test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs"
548            AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET)
549	    if test "$KDE_XSL_STYLESHEET" = "NO"; then
550		KDE_XSL_STYLESHEET=""
551	    else
552                KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl"
553	    fi
554        fi
555
556        DCOP_DEPENDENCIES='$(DCOPIDL)'
557        AC_SUBST(DCOPIDL)
558        AC_SUBST(DCOPIDL2CPP)
559        AC_SUBST(DCOP_DEPENDENCIES)
560        AC_SUBST(MCOPIDL)
561        AC_SUBST(ARTSCCONFIG)
562        AC_SUBST(KDECONFIG)
563	AC_SUBST(MEINPROC)
564 	AC_SUBST(KDE_XSL_STYLESHEET)
565
566        if test -x "$KDECONFIG"; then # it can be "compiled"
567          kde_libs_prefix=`$KDECONFIG --prefix`
568          if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
569               AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs.
570                          This means it has been moved since you installed it.
571                          This won't work. Please recompile kdelibs for the new prefix.
572                          ])
573           fi
574           kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
575        else
576           kde_libs_prefix='$(prefix)'
577           kde_libs_htmldir='$(kde_htmldir)'
578        fi
579        AC_SUBST(kde_libs_prefix)
580        AC_SUBST(kde_libs_htmldir)
581])dnl
582
583AC_DEFUN(AC_CREATE_KFSSTND,
584[
585AC_REQUIRE([AC_CHECK_RPATH])
586
587AC_MSG_CHECKING([for KDE paths])
588kde_result=""
589kde_cached_paths=yes
590AC_CACHE_VAL(kde_cv_all_paths,
591[
592  KDE_SET_DEFAULT_PATHS($1)
593  kde_cached_paths=no
594])
595eval "$kde_cv_all_paths"
596KDE_CHECK_PATHS_FOR_COMPLETENESS
597if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then
598  # wrong values were cached, may be, we can set better ones
599  kde_result=
600  kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir=
601  kde_datadir= kde_locale=  kde_cgidir=  kde_confdir=
602  kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir=
603  kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir=
604  kde_have_all_paths=
605  kde_styledir=
606  kde_widgetdir=
607  KDE_SET_DEFAULT_PATHS($1)
608  eval "$kde_cv_all_paths"
609  KDE_CHECK_PATHS_FOR_COMPLETENESS
610  kde_result="$kde_result (cache overridden)"
611fi
612if test "$kde_have_all_paths" = "no"; then
613  AC_MSG_ERROR([configure could not run a little KDE program to test the environment.
614Since it had compiled and linked before, it must be a strange problem on your system.
615Look at config.log for details. If you are not able to fix this, look at
616http://www.kde.org/faq/installation.html or any www.kde.org mirror.
617(If you're using an egcs version on Linux, you may update binutils!)
618])
619else
620  rm -f conftest*
621  AC_MSG_RESULT($kde_result)
622fi
623
624bindir=$kde_bindir
625
626KDE_SUBST_PROGRAMS
627
628])
629
630AC_DEFUN(AC_SUBST_KFSSTND,
631[
632AC_SUBST(kde_htmldir)
633AC_SUBST(kde_appsdir)
634AC_SUBST(kde_icondir)
635AC_SUBST(kde_sounddir)
636AC_SUBST(kde_datadir)
637AC_SUBST(kde_locale)
638AC_SUBST(kde_confdir)
639AC_SUBST(kde_mimedir)
640AC_SUBST(kde_wallpaperdir)
641AC_SUBST(kde_bindir)
642dnl for KDE 2
643AC_SUBST(kde_templatesdir)
644AC_SUBST(kde_servicesdir)
645AC_SUBST(kde_servicetypesdir)
646AC_SUBST(kde_moduledir)
647AC_SUBST(kde_styledir)
648AC_SUBST(kde_widgetdir)
649if test "$kde_qtver" = 1; then
650  kde_minidir="$kde_icondir/mini"
651else
652# for KDE 1 - this breaks KDE2 apps using minidir, but
653# that's the plan ;-/
654  kde_minidir="/dev/null"
655fi
656dnl AC_SUBST(kde_minidir)
657dnl AC_SUBST(kde_cgidir)
658dnl AC_SUBST(kde_toolbardir)
659])
660
661AC_DEFUN(KDE_MISC_TESTS,
662[
663   AC_LANG_C
664   dnl Checks for libraries.
665   AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD
666   AC_SUBST(LIBUTIL)
667   AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD
668   AC_SUBST(LIBCOMPAT)
669   kde_have_crypt=
670   AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
671      AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
672        AC_MSG_WARN([you have no crypt in either libcrypt or libc.
673You should install libcrypt from another source or configure with PAM
674support])
675	kde_have_crypt=no
676      ]))
677   AC_SUBST(LIBCRYPT)
678   if test $kde_have_crypt = yes; then
679      AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
680   fi
681   AC_CHECK_SOCKLEN_T
682   AC_LANG_C
683   AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
684   if test $ac_cv_lib_dnet_dnet_ntoa = no; then
685      AC_CHECK_LIB(dnet_stub, dnet_ntoa,
686        [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
687   fi
688   AC_CHECK_FUNC(inet_ntoa)
689   if test $ac_cv_func_inet_ntoa = no; then
690     AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
691   fi
692   AC_CHECK_FUNC(connect)
693   if test $ac_cv_func_connect = no; then
694      AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
695        $X_EXTRA_LIBS)
696   fi
697
698   AC_CHECK_FUNC(remove)
699   if test $ac_cv_func_remove = no; then
700      AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
701   fi
702
703   # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
704   AC_CHECK_FUNC(shmat, ,
705     AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"))
706
707   # Solaris 2.6 and others need -lresolv for res_init
708   AC_CHECK_FUNCS(res_init, , [
709     kde_libs_safe="$LIBS"
710     LIBS="$LIBS $X_EXTRA_LIBS -lresolv"
711     AC_TRY_LINK(
712[
713#include <resolv.h>
714],
715[
716res_init();
717],
718        LIBRESOLV="-lresolv"
719        X_EXTRA_LIBS="$X_EXTRA_LIBS $LIBRESOLV"
720        AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function])
721     )
722     LIBS=$kde_libs_safe
723   ])
724
725   LIBSOCKET="$X_EXTRA_LIBS"
726   AC_SUBST(LIBSOCKET)
727   AC_SUBST(LIBRESOLV)
728   AC_SUBST(X_EXTRA_LIBS)
729   AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
730   AC_SUBST(LIBUCB)
731
732   case $host in  dnl this *is* LynxOS specific
733   *-*-lynxos* )
734        AC_MSG_CHECKING([LynxOS header file wrappers])
735        [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
736        AC_MSG_RESULT(disabled)
737        AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
738         ;;
739    esac
740
741   KDE_CHECK_TYPES
742   KDE_CHECK_LIBDL
743])
744
745dnl ------------------------------------------------------------------------
746dnl Find the header files and libraries for X-Windows. Extended the
747dnl macro AC_PATH_X
748dnl ------------------------------------------------------------------------
749dnl
750AC_DEFUN(K_PATH_X,
751[
752AC_REQUIRE([KDE_MISC_TESTS])dnl
753
754AC_ARG_ENABLE(
755  embedded,
756  [  --enable-embedded       link to Qt-embedded, don't use X],
757  kde_use_qt_emb=$enableval,
758  kde_use_qt_emb=no
759)
760
761AC_ARG_ENABLE(
762  qtopia,
763  [  --enable-qtopia         link to Qt-embedded, link to the Qtopia Environment],
764  kde_use_qt_emb_palm=$enableval,
765  kde_use_qt_emb_palm=no
766)
767
768if test "$kde_use_qt_emb" = "no"; then
769
770AC_MSG_CHECKING(for X)
771AC_LANG_SAVE
772AC_LANG_C
773AC_CACHE_VAL(kde_cv_have_x,
774[# One or both of the vars are not set, and there is no cached value.
775if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
776   kde_x_includes=NO
777else
778   kde_x_includes=$x_includes
779fi
780if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
781   kde_x_libraries=NO
782else
783   kde_x_libraries=$x_libraries
784fi
785
786# below we use the standard autoconf calls
787ac_x_libraries=$kde_x_libraries
788ac_x_includes=$kde_x_includes
789
790KDE_PATH_X_DIRECT
791dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries.
792dnl Unfortunately, if compiling with the N32 ABI, this is not the correct
793dnl location. The correct location is /usr/lib32 or an undefined value
794dnl (the linker is smart enough to pick the correct default library).
795dnl Things work just fine if you use just AC_PATH_X_DIRECT.
796dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to
797dnl /usr/openwin/include, which doesn't work. /usr/include does work, so
798dnl x_includes should be left alone.
799case "$host" in
800mips-sgi-irix6*)
801  ;;
802*-*-solaris*)
803  ;;
804*)
805  _AC_PATH_X_XMKMF
806  if test -z "$ac_x_includes"; then
807    ac_x_includes="."
808  fi
809  if test -z "$ac_x_libraries"; then
810    ac_x_libraries="/usr/lib"
811  fi
812esac
813#from now on we use our own again
814
815# when the user already gave --x-includes, we ignore
816# what the standard autoconf macros told us.
817if test "$kde_x_includes" = NO; then
818  kde_x_includes=$ac_x_includes
819fi
820
821# for --x-libraries too
822if test "$kde_x_libraries" = NO; then
823  kde_x_libraries=$ac_x_libraries
824fi
825
826if test "$kde_x_includes" = NO; then
827  AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
828fi
829
830if test "$kde_x_libraries" = NO; then
831  AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
832fi
833
834# Record where we found X for the cache.
835kde_cv_have_x="have_x=yes \
836         kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries"
837])dnl
838
839eval "$kde_cv_have_x"
840
841if test "$have_x" != yes; then
842  AC_MSG_RESULT($have_x)
843  no_x=yes
844else
845  AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes])
846fi
847
848if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
849  X_INCLUDES=""
850  x_includes="."; dnl better than nothing :-
851 else
852  x_includes=$kde_x_includes
853  X_INCLUDES="-I$x_includes"
854fi
855
856if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then
857  X_LDFLAGS=""
858  x_libraries="/usr/lib"; dnl better than nothing :-
859 else
860  x_libraries=$kde_x_libraries
861  X_LDFLAGS="-L$x_libraries"
862fi
863all_includes="$X_INCLUDES"
864all_libraries="$X_LDFLAGS"
865
866AC_SUBST(X_INCLUDES)
867AC_SUBST(X_LDFLAGS)
868AC_SUBST(x_libraries)
869AC_SUBST(x_includes)
870
871# Check for libraries that X11R6 Xt/Xaw programs need.
872ac_save_LDFLAGS="$LDFLAGS"
873LDFLAGS="$LDFLAGS $X_LDFLAGS"
874# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
875# check for ICE first), but we must link in the order -lSM -lICE or
876# we get undefined symbols.  So assume we have SM if we have ICE.
877# These have to be linked with before -lX11, unlike the other
878# libraries we check for below, so use a different variable.
879#  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
880AC_CHECK_LIB(ICE, IceConnectionNumber,
881  [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS)
882AC_SUBST(LIBSM)
883LDFLAGS="$ac_save_LDFLAGS"
884
885AC_SUBST(X_PRE_LIBS)
886
887LIB_X11='-lX11 $(LIBSOCKET)'
888AC_SUBST(LIB_X11)
889
890AC_MSG_CHECKING(for libXext)
891AC_CACHE_VAL(kde_cv_have_libXext,
892[
893kde_ldflags_safe="$LDFLAGS"
894kde_libs_safe="$LIBS"
895
896LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS"
897LIBS="-lXext -lX11 $LIBSOCKET"
898
899AC_TRY_LINK([
900#include <stdio.h>
901#ifdef STDC_HEADERS
902# include <stdlib.h>
903#endif
904],
905[
906printf("hello Xext\n");
907],
908kde_cv_have_libXext=yes,
909kde_cv_have_libXext=no
910   )
911
912LDFLAGS=$kde_ldflags_safe
913LIBS=$kde_libs_safe
914 ])
915
916AC_MSG_RESULT($kde_cv_have_libXext)
917
918if test "$kde_cv_have_libXext" = "no"; then
919  AC_MSG_ERROR([We need a working libXext to proceed. Since configure
920can't find it itself, we stop here assuming that make wouldn't find
921them either.])
922fi
923
924AC_MSG_CHECKING(for Xinerama)
925
926 AC_ARG_WITH(xinerama,
927  [  --with-xinerama         enable support for Xinerama ],
928  [
929    no_xinerama=no
930  ], [
931    no_xinerama=yes
932  ]
933)
934
935kde_save_LDFLAGS="$LDFLAGS"
936kde_save_CFLAGS="$CFLAGS"
937kde_save_LIBS="$LIBS"
938LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS"
939CFLAGS="$CFLAGS -I$x_includes"
940LIBS="-lXinerama -lXext"
941
942if test "x$no_xinerama" = "xno"; then
943
944  AC_CACHE_VAL(ac_cv_have_xinerama,
945  [
946	  AC_TRY_LINK([#include <X11/Xlib.h>
947  			#include <X11/extensions/Xinerama.h>],
948	  	  [XineramaIsActive(NULL);],
949		  [ac_cv_have_xinerama="yes"],
950		  [ac_cv_have_xinerama="no"])
951  ])
952else
953  ac_cv_have_xinerama=no;
954fi
955
956AC_MSG_RESULT($ac_cv_have_xinerama)
957
958LIBXINERAMA=""
959
960if test "$ac_cv_have_xinerama" = "yes"; then
961  AC_DEFINE(HAVE_XINERAMA, 1, [Define if you want Xinerama support])
962  LIBXINERAMA="-lXinerama"
963fi
964
965AC_SUBST(LIBXINERAMA)
966
967LDFLAGS="$kde_save_LDFLAGS"
968CFLAGS="$kde_save_CFLAGS"
969LIBS="$kde_save_LIBS"
970
971LIB_XEXT="-lXext"
972QTE_NORTTI=""
973
974else
975  dnl We're using QT Embedded
976  CXXFLAGS="$CXXFLAGS -fno-rtti -DQWS"
977  CFLAGS="$CFLAGS -DQWS"
978  LDFLAGS="$LDFLAGS -DQWS"
979  QTE_NORTTI="-fno-rtti -DQWS"
980  X_PRE_LIBS=""
981  LIB_X11=""
982  LIB_XEXT=""
983  LIBSM=""
984  X_INCLUDES=""
985  X_LDFLAGS=""
986  x_includes=""
987  x_libraries=""
988  AC_SUBST(X_PRE_LIBS)
989  AC_SUBST(LIB_X11)
990  AC_SUBST(LIBSM)
991  AC_SUBST(X_INCLUDES)
992  AC_SUBST(X_LDFLAGS)
993  AC_SUBST(x_includes)
994  AC_SUBST(x_libraries)
995fi
996AC_SUBST(QTE_NORTTI)
997AC_SUBST(LIB_XEXT)
998
999
1000AC_LANG_RESTORE
1001
1002])
1003
1004AC_DEFUN(KDE_PRINT_QT_PROGRAM,
1005[
1006AC_REQUIRE([KDE_USE_QT])
1007cat > conftest.$ac_ext <<EOF
1008#include "confdefs.h"
1009#include <qglobal.h>
1010#include <qapplication.h>
1011EOF
1012if test "$kde_qtver" = "2"; then
1013cat >> conftest.$ac_ext <<EOF
1014#include <qevent.h>
1015#include <qstring.h>
1016#include <qstyle.h>
1017EOF
1018
1019if test $kde_qtsubver -gt 0; then
1020cat >> conftest.$ac_ext <<EOF
1021#include <qiconview.h>
1022EOF
1023fi
1024fi
1025
1026if test "$kde_qtver" = "3"; then
1027cat >> conftest.$ac_ext <<EOF
1028#include <qcursor.h>
1029#include <qstylefactory.h>
1030#include <private/qucomextra_p.h>
1031EOF
1032fi
1033
1034echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
1035cat >> conftest.$ac_ext <<EOF
1036#error 1
1037#endif
1038
1039int main() {
1040EOF
1041if test "$kde_qtver" = "2"; then
1042cat >> conftest.$ac_ext <<EOF
1043    QStringList *t = new QStringList();
1044    Q_UNUSED(t);
1045EOF
1046if test $kde_qtsubver -gt 0; then
1047cat >> conftest.$ac_ext <<EOF
1048    QIconView iv(0);
1049    iv.setWordWrapIconText(false);
1050    QString s;
1051    s.setLatin1("Elvis is alive", 14);
1052EOF
1053fi
1054fi
1055if test "$kde_qtver" = "3"; then
1056cat >> conftest.$ac_ext <<EOF
1057    (void)QStyleFactory::create(QString::null);
1058    QCursor c(Qt::WhatsThisCursor);
1059EOF
1060fi
1061cat >> conftest.$ac_ext <<EOF
1062    return 0;
1063}
1064EOF
1065])
1066
1067AC_DEFUN(KDE_USE_QT,
1068[
1069if test -z "$1"; then
1070  kde_qtver=3
1071  kde_qtsubver=1
1072else
1073  kde_qtsubver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'`
1074  # following is the check if subversion isn�t found in passed argument
1075  if test "$kde_qtsubver" = "$1"; then
1076    kde_qtsubver=1
1077  fi
1078  kde_qtver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'`
1079  if test "$kde_qtver" = "1"; then
1080    kde_qtsubver=42
1081  fi
1082fi
1083
1084if test -z "$2"; then
1085  if test "$kde_qtver" = "2"; then
1086    if test $kde_qtsubver -gt 0; then
1087      kde_qt_minversion=">= Qt 2.2.2"
1088    else
1089      kde_qt_minversion=">= Qt 2.0.2"
1090    fi
1091  fi
1092  if test "$kde_qtver" = "3"; then
1093    kde_qt_minversion=">= Qt 3.0.2"
1094  fi
1095  if test "$kde_qtver" = "1"; then
1096    kde_qt_minversion=">= 1.42 and < 2.0"
1097  fi
1098else
1099   kde_qt_minversion=$2
1100fi
1101
1102if test -z "$3"; then
1103   if test $kde_qtver = 3; then
1104     kde_qt_verstring="QT_VERSION >= 302"
1105   fi
1106   if test $kde_qtver = 2; then
1107     if test $kde_qtsubver -gt 0; then
1108       kde_qt_verstring="QT_VERSION >= 222"
1109     else
1110       kde_qt_verstring="QT_VERSION >= 200"
1111     fi
1112   fi
1113   if test $kde_qtver = 1; then
1114    kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
1115   fi
1116else
1117   kde_qt_verstring=$3
1118fi
1119
1120if test $kde_qtver = 3; then
1121  kde_qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt"
1122fi
1123if test $kde_qtver = 2; then
1124   kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
1125fi
1126if test $kde_qtver = 1; then
1127   kde_qt_dirs="$QTDIR /usr/lib/qt"
1128fi
1129])
1130
1131AC_DEFUN(KDE_CHECK_QT_DIRECT,
1132[
1133AC_REQUIRE([KDE_USE_QT])
1134AC_MSG_CHECKING([if Qt compiles without flags])
1135AC_CACHE_VAL(kde_cv_qt_direct,
1136[
1137AC_LANG_SAVE
1138AC_LANG_CPLUSPLUS
1139ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
1140ac_LIBRARY_PATH="$LIBRARY_PATH"
1141ac_cxxflags_safe="$CXXFLAGS"
1142ac_ldflags_safe="$LDFLAGS"
1143ac_libs_safe="$LIBS"
1144
1145CXXFLAGS="$CXXFLAGS -I$qt_includes"
1146LDFLAGS="$LDFLAGS $X_LDFLAGS"
1147if test "x$kde_use_qt_emb" != "xyes"; then
1148LIBS="$LIBQT -lXext -lX11 $LIBSOCKET"
1149else
1150LIBS="$LIBQT $LIBSOCKET"
1151fi
1152LD_LIBRARY_PATH=
1153export LD_LIBRARY_PATH
1154LIBRARY_PATH=
1155export LIBRARY_PATH
1156
1157KDE_PRINT_QT_PROGRAM
1158
1159if AC_TRY_EVAL(ac_link) && test -s conftest; then
1160  kde_cv_qt_direct="yes"
1161else
1162  kde_cv_qt_direct="no"
1163  echo "configure: failed program was:" >&AC_FD_CC
1164  cat conftest.$ac_ext >&AC_FD_CC
1165fi
1166
1167rm -f conftest*
1168CXXFLAGS="$ac_cxxflags_safe"
1169LDFLAGS="$ac_ldflags_safe"
1170LIBS="$ac_libs_safe"
1171
1172LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
1173export LD_LIBRARY_PATH
1174LIBRARY_PATH="$ac_LIBRARY_PATH"
1175export LIBRARY_PATH
1176AC_LANG_RESTORE
1177])
1178
1179if test "$kde_cv_qt_direct" = "yes"; then
1180  AC_MSG_RESULT(yes)
1181  $1
1182else
1183  AC_MSG_RESULT(no)
1184  $2
1185fi
1186])
1187
1188dnl ------------------------------------------------------------------------
1189dnl Try to find the Qt headers and libraries.
1190dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
1191dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
1192dnl ------------------------------------------------------------------------
1193dnl
1194AC_DEFUN(AC_PATH_QT_1_3,
1195[
1196AC_REQUIRE([K_PATH_X])
1197AC_REQUIRE([KDE_USE_QT])
1198
1199dnl ------------------------------------------------------------------------
1200dnl Add configure flag to enable linking to MT version of Qt library.
1201dnl ------------------------------------------------------------------------
1202
1203AC_ARG_ENABLE(
1204  mt,
1205  [  --disable-mt            link to non-threaded Qt (deprecated)],
1206  kde_use_qt_mt=$enableval,
1207  [
1208    if test $kde_qtver = 3; then
1209      kde_use_qt_mt=yes
1210    else
1211      kde_use_qt_mt=no
1212    fi
1213  ]
1214)
1215
1216USING_QT_MT=""
1217
1218dnl ------------------------------------------------------------------------
1219dnl If we not get --disable-qt-mt then adjust some vars for the host.
1220dnl ------------------------------------------------------------------------
1221
1222KDE_MT_LDFLAGS=
1223KDE_MT_LIBS=
1224if test "x$kde_use_qt_mt" = "xyes"; then
1225  KDE_CHECK_THREADING
1226  if test "x$kde_use_threading" = "xyes"; then
1227    CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS"
1228    KDE_MT_LDFLAGS="$USE_THREADS"
1229    KDE_MT_LIBS="$LIBPTHREAD"
1230  else
1231    kde_use_qt_mt=no
1232  fi
1233fi
1234AC_SUBST(KDE_MT_LDFLAGS)
1235AC_SUBST(KDE_MT_LIBS)
1236
1237kde_qt_was_given=yes
1238
1239dnl ------------------------------------------------------------------------
1240dnl If we haven't been told how to link to Qt, we work it out for ourselves.
1241dnl ------------------------------------------------------------------------
1242if test -z "$LIBQT_GLOB"; then
1243  if test "x$kde_use_qt_emb" = "xyes"; then
1244    LIBQT_GLOB="libqte.*"
1245  else
1246    LIBQT_GLOB="libqt.*"
1247  fi
1248fi
1249
1250if test -z "$LIBQT"; then
1251dnl ------------------------------------------------------------
1252dnl If we got --enable-embedded then adjust the Qt library name.
1253dnl ------------------------------------------------------------
1254  if test "x$kde_use_qt_emb" = "xyes"; then
1255    qtlib="qte"
1256  else
1257    qtlib="qt"
1258  fi
1259
1260  kde_int_qt="-l$qtlib"
1261else
1262  kde_int_qt="$LIBQT"
1263  kde_lib_qt_set=yes
1264fi
1265
1266if test -z "$LIBQPE"; then
1267dnl ------------------------------------------------------------
1268dnl If we got --enable-palmtop then add -lqpe to the link line
1269dnl ------------------------------------------------------------
1270  if test "x$kde_use_qt_emb" = "xyes"; then
1271    if test "x$kde_use_qt_emb_palm" = "xyes"; then
1272      LIB_QPE="-lqpe"
1273    else
1274      LIB_QPE=""
1275    fi
1276  else
1277    LIB_QPE=""
1278  fi
1279fi
1280
1281dnl ------------------------------------------------------------------------
1282dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
1283dnl ------------------------------------------------------------------------
1284
1285if test "x$kde_use_qt_mt" = "xyes"; then
1286  if test -z "$LIBQT"; then
1287    LIBQT="-l$qtlib-mt"
1288    kde_int_qt="-l$qtlib-mt"
1289  else
1290    LIBQT="$qtlib-mt"
1291    kde_int_qt="$qtlib-mt"
1292  fi
1293  LIBQT_GLOB="lib$qtlib-mt.*"
1294  USING_QT_MT="using -mt"
1295else
1296  LIBQT="-l$qtlib"
1297fi
1298
1299if test $kde_qtver != 1; then
1300
1301  AC_REQUIRE([AC_FIND_PNG])
1302  AC_REQUIRE([AC_FIND_JPEG])
1303  LIBQT="$LIBQT $LIBPNG $LIBJPEG"
1304fi
1305
1306if test $kde_qtver = 3; then
1307  AC_REQUIRE([KDE_CHECK_LIBDL])
1308  LIBQT="$LIBQT $LIBDL"
1309fi
1310
1311AC_MSG_CHECKING([for Qt])
1312
1313if test "x$kde_use_qt_emb" != "xyes"; then
1314LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
1315fi
1316ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
1317qt_libraries=""
1318qt_includes=""
1319AC_ARG_WITH(qt-dir,
1320    [  --with-qt-dir=DIR       where the root of Qt is installed ],
1321    [  ac_qt_includes="$withval"/include
1322       ac_qt_libraries="$withval"/lib
1323       ac_qt_bindir="$withval"/bin
1324    ])
1325
1326AC_ARG_WITH(qt-includes,
1327    [  --with-qt-includes=DIR  where the Qt includes are. ],
1328    [
1329       ac_qt_includes="$withval"
1330    ])
1331
1332kde_qt_libs_given=no
1333
1334AC_ARG_WITH(qt-libraries,
1335    [  --with-qt-libraries=DIR where the Qt library is installed.],
1336    [  ac_qt_libraries="$withval"
1337       kde_qt_libs_given=yes
1338    ])
1339
1340AC_CACHE_VAL(ac_cv_have_qt,
1341[#try to guess Qt locations
1342
1343qt_incdirs=""
1344for dir in $kde_qt_dirs; do
1345   qt_incdirs="$qt_incdirs $dir/include $dir"
1346done
1347qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 $x_includes"
1348if test ! "$ac_qt_includes" = "NO"; then
1349   qt_incdirs="$ac_qt_includes $qt_incdirs"
1350fi
1351
1352if test "$kde_qtver" != "1"; then
1353  kde_qt_header=qstyle.h
1354else
1355  kde_qt_header=qglobal.h
1356fi
1357
1358AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
1359ac_qt_includes="$qt_incdir"
1360
1361qt_libdirs=""
1362for dir in $kde_qt_dirs; do
1363   qt_libdirs="$qt_libdirs $dir/lib $dir"
1364done
1365qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
1366if test ! "$ac_qt_libraries" = "NO"; then
1367  qt_libdir=$ac_qt_libraries
1368else
1369  qt_libdirs="$ac_qt_libraries $qt_libdirs"
1370  # if the Qt was given, the chance is too big that libqt.* doesn't exist
1371  qt_libdir=NONE
1372  for dir in $qt_libdirs; do
1373    try="ls -1 $dir/${LIBQT_GLOB}"
1374    if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
1375  done
1376fi
1377
1378ac_qt_libraries="$qt_libdir"
1379
1380AC_LANG_SAVE
1381AC_LANG_CPLUSPLUS
1382
1383ac_cxxflags_safe="$CXXFLAGS"
1384ac_ldflags_safe="$LDFLAGS"
1385ac_libs_safe="$LIBS"
1386
1387CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
1388LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
1389LIBS="$LIBS $LIBQT $KDE_MT_LIBS"
1390
1391KDE_PRINT_QT_PROGRAM
1392
1393if AC_TRY_EVAL(ac_link) && test -s conftest; then
1394  rm -f conftest*
1395else
1396  echo "configure: failed program was:" >&AC_FD_CC
1397  cat conftest.$ac_ext >&AC_FD_CC
1398  ac_qt_libraries="NO"
1399fi
1400rm -f conftest*
1401CXXFLAGS="$ac_cxxflags_safe"
1402LDFLAGS="$ac_ldflags_safe"
1403LIBS="$ac_libs_safe"
1404
1405AC_LANG_RESTORE
1406if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
1407  ac_cv_have_qt="have_qt=no"
1408  ac_qt_notfound=""
1409  missing_qt_mt=""
1410  if test "$ac_qt_includes" = NO; then
1411    if test "$ac_qt_libraries" = NO; then
1412      ac_qt_notfound="(headers and libraries)";
1413    else
1414      ac_qt_notfound="(headers)";
1415    fi
1416  else
1417    if test "x$kde_use_qt_mt" = "xyes"; then
1418       missing_qt_mt="
1419Make sure that you have compiled Qt with thread support!"
1420       ac_qt_notfound="(library $qtlib-mt)";
1421    else
1422       ac_qt_notfound="(library $qtlib)";
1423    fi
1424  fi
1425
1426  AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
1427For more details about this problem, look at the end of config.log.$missing_qt_mt])
1428else
1429  have_qt="yes"
1430fi
1431])
1432
1433eval "$ac_cv_have_qt"
1434
1435if test "$have_qt" != yes; then
1436  AC_MSG_RESULT([$have_qt]);
1437else
1438  ac_cv_have_qt="have_qt=yes \
1439    ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
1440  AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT])
1441
1442  qt_libraries="$ac_qt_libraries"
1443  qt_includes="$ac_qt_includes"
1444fi
1445
1446if test ! "$kde_qt_libs_given" = "yes"; then
1447KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
1448fi
1449
1450AC_SUBST(qt_libraries)
1451AC_SUBST(qt_includes)
1452
1453if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
1454 QT_INCLUDES=""
1455else
1456 QT_INCLUDES="-I$qt_includes"
1457 all_includes="$QT_INCLUDES $all_includes"
1458fi
1459
1460if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
1461 QT_LDFLAGS=""
1462else
1463 QT_LDFLAGS="-L$qt_libraries"
1464 all_libraries="$all_libraries $QT_LDFLAGS"
1465fi
1466test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS"
1467
1468AC_SUBST(QT_INCLUDES)
1469AC_SUBST(QT_LDFLAGS)
1470AC_PATH_QT_MOC_UIC
1471
1472KDE_CHECK_QT_JPEG
1473
1474if test "x$kde_use_qt_emb" != "xyes"; then
1475LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBPNG) -lXext $(LIB_X11) $(LIBSM)'
1476else
1477LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBPNG)'
1478fi
1479test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS"
1480
1481AC_SUBST(LIB_QT)
1482AC_SUBST(LIB_QPE)
1483
1484AC_SUBST(kde_qtver)
1485])
1486
1487AC_DEFUN(AC_PATH_QT,
1488[
1489AC_PATH_QT_1_3
1490])
1491
1492AC_DEFUN(KDE_CHECK_FINAL,
1493[
1494  AC_ARG_ENABLE(final, [  --enable-final          build size optimized apps (experimental - needs lots of memory)],
1495	kde_use_final=$enableval, kde_use_final=no)
1496
1497  KDE_COMPILER_REPO
1498  if test "x$kde_use_final" = "xyes"; then
1499      KDE_USE_FINAL_TRUE=""
1500      KDE_USE_FINAL_FALSE="#"
1501   else
1502      KDE_USE_FINAL_TRUE="#"
1503      KDE_USE_FINAL_FALSE=""
1504  fi
1505  AC_SUBST(KDE_USE_FINAL_TRUE)
1506  AC_SUBST(KDE_USE_FINAL_FALSE)
1507
1508  AC_ARG_ENABLE(closure, [  --disable-closure       don't delay template instantiation],
1509  	kde_use_closure=$enableval, kde_use_closure=yes)
1510
1511  if test "x$kde_use_closure" = "xyes"; then
1512       KDE_USE_CLOSURE_TRUE=""
1513       KDE_USE_CLOSURE_FALSE="#"
1514#       CXXFLAGS="$CXXFLAGS $REPO"
1515  else
1516       KDE_USE_CLOSURE_TRUE="#"
1517       KDE_USE_CLOSURE_FALSE=""
1518  fi
1519  AC_SUBST(KDE_USE_CLOSURE_TRUE)
1520  AC_SUBST(KDE_USE_CLOSURE_FALSE)
1521])
1522
1523dnl ------------------------------------------------------------------------
1524dnl Now, the same with KDE
1525dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
1526dnl and $(kde_includes) will be the kdehdrlocation (if needed)
1527dnl ------------------------------------------------------------------------
1528dnl
1529AC_DEFUN(AC_BASE_PATH_KDE,
1530[
1531AC_PREREQ([2.13])
1532AC_REQUIRE([AC_PATH_QT])dnl
1533AC_CHECK_RPATH
1534AC_MSG_CHECKING([for KDE])
1535
1536if test "${prefix}" != NONE; then
1537  kde_includes=${prefix}/include
1538  ac_kde_includes=$prefix/include
1539
1540  if test "${exec_prefix}" != NONE; then
1541    kde_libraries=${exec_prefix}/lib
1542    ac_kde_libraries=$exec_prefix/lib
1543  else
1544    kde_libraries=${prefix}/lib
1545    ac_kde_libraries=$prefix/lib
1546  fi
1547else
1548  ac_kde_includes=
1549  ac_kde_libraries=
1550  kde_libraries=""
1551  kde_includes=""
1552fi
1553
1554AC_CACHE_VAL(ac_cv_have_kde,
1555[#try to guess kde locations
1556
1557if test "$kde_qtver" = 1; then
1558  kde_check_header="ksock.h"
1559  kde_check_lib="libkdecore.la"
1560else
1561  kde_check_header="ksharedptr.h"
1562  kde_check_lib="libkio.la"
1563fi
1564
1565if test -z "$1"; then
1566
1567kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes"
1568test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
1569kde_incdirs="$ac_kde_includes $kde_incdirs"
1570AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
1571ac_kde_includes="$kde_incdir"
1572
1573if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
1574  AC_MSG_ERROR([
1575in the prefix, you've chosen, are no KDE headers installed. This will fail.
1576So, check this please and use another prefix!])
1577fi
1578
1579kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde3 /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde3/lib /opt/kde/lib /usr/X11R6/kde/lib"
1580test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
1581kde_libdirs="$ac_kde_libraries $kde_libdirs"
1582AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
1583ac_kde_libraries="$kde_libdir"
1584
1585if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
1586AC_MSG_ERROR([
1587in the prefix, you've chosen, are no KDE libraries installed. This will fail.
1588So, check this please and use another prefix!])
1589fi
1590ac_kde_libraries="$kde_libdir"
1591
1592if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
1593  ac_cv_have_kde="have_kde=no"
1594else
1595  ac_cv_have_kde="have_kde=yes \
1596    ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1597fi
1598
1599else dnl test -z $1
1600
1601  ac_cv_have_kde="have_kde=no"
1602
1603fi
1604])dnl
1605
1606eval "$ac_cv_have_kde"
1607
1608if test "$have_kde" != "yes"; then
1609 if test "${prefix}" = NONE; then
1610  ac_kde_prefix="$ac_default_prefix"
1611 else
1612  ac_kde_prefix="$prefix"
1613 fi
1614 if test "$exec_prefix" = NONE; then
1615  ac_kde_exec_prefix="$ac_kde_prefix"
1616  AC_MSG_RESULT([will be installed in $ac_kde_prefix])
1617 else
1618  ac_kde_exec_prefix="$exec_prefix"
1619  AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
1620 fi
1621
1622 kde_libraries="${ac_kde_exec_prefix}/lib"
1623 kde_includes=${ac_kde_prefix}/include
1624
1625else
1626  ac_cv_have_kde="have_kde=yes \
1627    ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
1628  AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
1629
1630  kde_libraries="$ac_kde_libraries"
1631  kde_includes="$ac_kde_includes"
1632fi
1633AC_SUBST(kde_libraries)
1634AC_SUBST(kde_includes)
1635
1636if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes"  || test "$kde_includes" = "/usr/include"; then
1637 KDE_INCLUDES=""
1638else
1639 KDE_INCLUDES="-I$kde_includes"
1640 all_includes="$KDE_INCLUDES $all_includes"
1641fi
1642
1643KDE_LDFLAGS="-L$kde_libraries"
1644if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then
1645 all_libraries="$all_libraries $KDE_LDFLAGS"
1646fi
1647
1648AC_SUBST(KDE_LDFLAGS)
1649AC_SUBST(KDE_INCLUDES)
1650
1651AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1652
1653all_libraries="$all_libraries $USER_LDFLAGS"
1654all_includes="$all_includes $USER_INCLUDES"
1655AC_SUBST(all_includes)
1656AC_SUBST(all_libraries)
1657
1658AC_SUBST(AUTODIRS)
1659])
1660
1661AC_DEFUN(KDE_CHECK_EXTRA_LIBS,
1662[
1663AC_MSG_CHECKING(for extra includes)
1664AC_ARG_WITH(extra-includes, [  --with-extra-includes=DIR
1665                          adds non standard include paths],
1666  kde_use_extra_includes="$withval",
1667  kde_use_extra_includes=NONE
1668)
1669kde_extra_includes=
1670if test -n "$kde_use_extra_includes" && \
1671   test "$kde_use_extra_includes" != "NONE"; then
1672
1673   ac_save_ifs=$IFS
1674   IFS=':'
1675   for dir in $kde_use_extra_includes; do
1676     kde_extra_includes="$kde_extra_includes $dir"
1677     USER_INCLUDES="$USER_INCLUDES -I$dir"
1678   done
1679   IFS=$ac_save_ifs
1680   kde_use_extra_includes="added"
1681else
1682   kde_use_extra_includes="no"
1683fi
1684AC_SUBST(USER_INCLUDES)
1685
1686AC_MSG_RESULT($kde_use_extra_includes)
1687
1688kde_extra_libs=
1689AC_MSG_CHECKING(for extra libs)
1690AC_ARG_WITH(extra-libs, [  --with-extra-libs=DIR   adds non standard library paths],
1691  kde_use_extra_libs=$withval,
1692  kde_use_extra_libs=NONE
1693)
1694if test -n "$kde_use_extra_libs" && \
1695   test "$kde_use_extra_libs" != "NONE"; then
1696
1697   ac_save_ifs=$IFS
1698   IFS=':'
1699   for dir in $kde_use_extra_libs; do
1700     kde_extra_libs="$kde_extra_libs $dir"
1701     KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
1702     USER_LDFLAGS="$USER_LDFLAGS -L$dir"
1703   done
1704   IFS=$ac_save_ifs
1705   kde_use_extra_libs="added"
1706else
1707   kde_use_extra_libs="no"
1708fi
1709
1710AC_SUBST(USER_LDFLAGS)
1711
1712AC_MSG_RESULT($kde_use_extra_libs)
1713
1714])
1715
1716AC_DEFUN(KDE_1_CHECK_PATH_HEADERS,
1717[
1718    AC_MSG_CHECKING([for KDE headers installed])
1719    AC_LANG_SAVE
1720    AC_LANG_CPLUSPLUS
1721cat > conftest.$ac_ext <<EOF
1722#ifdef STDC_HEADERS
1723# include <stdlib.h>
1724#endif
1725#include <stdio.h>
1726#include "confdefs.h"
1727#include <kapp.h>
1728
1729int main() {
1730    printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
1731    printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
1732    printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
1733    printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data());
1734    printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
1735    printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
1736    printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
1737    printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
1738    printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
1739    printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
1740    printf("kde_wallpaperdir=\\"%s\\"\n",
1741	KApplication::kde_wallpaperdir().data());
1742    printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
1743    printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
1744    printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
1745    printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
1746    printf("kde_moduledir=\\"/tmp/dummy\\"\n");
1747    printf("kde_styledir=\\"/tmp/dummy\\"\n");
1748    printf("kde_widgetdir=\\"/tmp/dummy\\"\n");
1749    return 0;
1750    }
1751EOF
1752
1753 ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext'
1754 if AC_TRY_EVAL(ac_compile); then
1755   AC_MSG_RESULT(yes)
1756 else
1757   AC_MSG_ERROR([your system is not able to compile a small KDE application!
1758Check, if you installed the KDE header files correctly.
1759For more details about this problem, look at the end of config.log.])
1760  fi
1761
1762  AC_LANG_RESTORE
1763])
1764
1765AC_DEFUN(KDE_CHECK_KDEQTADDON,
1766[
1767AC_MSG_CHECKING(for kde-qt-addon)
1768AC_CACHE_VAL(kde_cv_have_kdeqtaddon,
1769[
1770 kde_ldflags_safe="$LDFLAGS"
1771 kde_libs_safe="$LIBS"
1772 kde_cxxflags_safe="$CXXFLAGS"
1773
1774 LIBS="-lkde-qt-addon $LIBQT $LIBS"
1775 CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes"
1776 LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
1777
1778 AC_TRY_LINK([
1779   #include <qdom.h>
1780 ],
1781 [
1782   QDomDocument doc;
1783 ],
1784  kde_cv_have_kdeqtaddon=yes,
1785  kde_cv_have_kdeqtaddon=no
1786 )
1787
1788 LDFLAGS=$kde_ldflags_safe
1789 LIBS=$kde_libs_safe
1790 CXXFLAGS=$kde_cxxflags_safe
1791])
1792
1793AC_MSG_RESULT($kde_cv_have_kdeqtaddon)
1794
1795if test "$kde_cv_have_kdeqtaddon" = "no"; then
1796  AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first.
1797It is a separate package (and CVS module) named kde-qt-addon.])
1798fi
1799])
1800
1801AC_DEFUN(KDE_CHECK_KIMGIO,
1802[
1803   AC_REQUIRE([AC_BASE_PATH_KDE])
1804   AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
1805   AC_REQUIRE([AC_FIND_TIFF])
1806   AC_REQUIRE([AC_FIND_JPEG])
1807   AC_REQUIRE([AC_FIND_PNG])
1808   AC_REQUIRE([KDE_CREATE_LIBS_ALIASES])
1809
1810   if test "$1" = "existance"; then
1811     AC_LANG_SAVE
1812     AC_LANG_CPLUSPLUS
1813     kde_save_LIBS="$LIBS"
1814     LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm"
1815     AC_CHECK_LIB(kimgio, kimgioRegister, [
1816      LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no)
1817     LIBS="$kde_save_LIBS"
1818     AC_LANG_RESTORE
1819   else
1820     LIBKIMGIO_EXISTS=yes
1821   fi
1822
1823   if test "$LIBKIMGIO_EXISTS" = "yes"; then
1824     LIB_KIMGIO='-lkimgio'
1825   else
1826     LIB_KIMGIO=''
1827   fi
1828   AC_SUBST(LIB_KIMGIO)
1829])
1830
1831AC_DEFUN(KDE_CREATE_LIBS_ALIASES,
1832[
1833   AC_REQUIRE([KDE_MISC_TESTS])
1834   AC_REQUIRE([KDE_CHECK_LIBDL])
1835   AC_REQUIRE([K_PATH_X])
1836
1837if test $kde_qtver = 3; then
1838   LIB_KDECORE='-lkdecore'
1839   AC_SUBST(LIB_KDECORE)
1840   LIB_KDEUI='-lkdeui'
1841   AC_SUBST(LIB_KDEUI)
1842   LIB_KIO='-lkio'
1843   AC_SUBST(LIB_KIO)
1844   LIB_SMB='-lsmb'
1845   AC_SUBST(LIB_SMB)
1846   LIB_KAB='-lkab'
1847   AC_SUBST(LIB_KAB)
1848   LIB_KHTML='-lkhtml'
1849   AC_SUBST(LIB_KHTML)
1850   LIB_KSPELL='-lkspell'
1851   AC_SUBST(LIB_KSPELL)
1852   LIB_KPARTS='-lkparts'
1853   AC_SUBST(LIB_KPARTS)
1854   LIB_KDEPRINT='-lkdeprint'
1855   AC_SUBST(LIB_KDEPRINT)
1856# these are for backward compatibility
1857   LIB_KSYCOCA='-lkio'
1858   AC_SUBST(LIB_KSYCOCA)
1859   LIB_KFILE='-lkio'
1860   AC_SUBST(LIB_KFILE)
1861elif test $kde_qtver = 2; then
1862   LIB_KDECORE='-lkdecore'
1863   AC_SUBST(LIB_KDECORE)
1864   LIB_KDEUI='-lkdeui'
1865   AC_SUBST(LIB_KDEUI)
1866   LIB_KIO='-lkio'
1867   AC_SUBST(LIB_KIO)
1868   LIB_KSYCOCA='-lksycoca'
1869   AC_SUBST(LIB_KSYCOCA)
1870   LIB_SMB='-lsmb'
1871   AC_SUBST(LIB_SMB)
1872   LIB_KFILE='-lkfile'
1873   AC_SUBST(LIB_KFILE)
1874   LIB_KAB='-lkab'
1875   AC_SUBST(LIB_KAB)
1876   LIB_KHTML='-lkhtml'
1877   AC_SUBST(LIB_KHTML)
1878   LIB_KSPELL='-lkspell'
1879   AC_SUBST(LIB_KSPELL)
1880   LIB_KPARTS='-lkparts'
1881   AC_SUBST(LIB_KPARTS)
1882   LIB_KDEPRINT='-lkdeprint'
1883   AC_SUBST(LIB_KDEPRINT)
1884else
1885   LIB_KDECORE='-lkdecore -lXext $(LIB_QT)'
1886   AC_SUBST(LIB_KDECORE)
1887   LIB_KDEUI='-lkdeui $(LIB_KDECORE)'
1888   AC_SUBST(LIB_KDEUI)
1889   LIB_KFM='-lkfm $(LIB_KDECORE)'
1890   AC_SUBST(LIB_KFM)
1891   LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)'
1892   AC_SUBST(LIB_KFILE)
1893   LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)'
1894   AC_SUBST(LIB_KAB)
1895fi
1896])
1897
1898AC_DEFUN(AC_PATH_KDE,
1899[
1900  AC_BASE_PATH_KDE
1901  AC_ARG_ENABLE(path-check, [  --disable-path-check    don't try to find out, where to install],
1902  [
1903  if test "$enableval" = "no";
1904    then ac_use_path_checking="default"
1905    else ac_use_path_checking=""
1906  fi
1907  ],
1908  [
1909  if test "$kde_qtver" = 1;
1910    then ac_use_path_checking=""
1911    else ac_use_path_checking="default"
1912  fi
1913  ]
1914  )
1915
1916  AC_CREATE_KFSSTND($ac_use_path_checking)
1917
1918  AC_SUBST_KFSSTND
1919  KDE_CREATE_LIBS_ALIASES
1920])
1921
1922dnl obsolete
1923AC_DEFUN(AC_CHECK_SETENV,
1924[
1925   AC_OBSOLETE([$0], [; instead use AC_CHECK_FUNCS([setenv unsetenv])])dnl
1926   AC_CHECK_FUNCS([setenv unsetenv])
1927])
1928
1929AC_DEFUN(AC_CHECK_GETDOMAINNAME,
1930[
1931AC_MSG_CHECKING(for getdomainname)
1932AC_CACHE_VAL(ac_cv_func_getdomainname,
1933[
1934AC_LANG_SAVE
1935AC_LANG_CPLUSPLUS
1936save_CXXFLAGS="$CXXFLAGS"
1937kde_safe_LIBS="$LIBS"
1938LIBS="$LIBS $X_EXTRA_LIBS"
1939if test "$GCC" = "yes"; then
1940CXXFLAGS="$CXXFLAGS -pedantic-errors"
1941fi
1942AC_TRY_COMPILE([
1943#include <stdlib.h>
1944#include <unistd.h>
1945],
1946[
1947char buffer[200];
1948getdomainname(buffer, 200);
1949],
1950ac_cv_func_getdomainname=yes,
1951ac_cv_func_getdomainname=no)
1952CXXFLAGS="$save_CXXFLAGS"
1953LIBS=$kde_safe_LIBS
1954AC_LANG_RESTORE
1955])
1956AC_MSG_RESULT($ac_cv_func_getdomainname)
1957
1958AC_MSG_CHECKING([if getdomainname needs custom prototype])
1959AC_CACHE_VAL(ac_cv_proto_getdomainname,
1960[
1961AC_LANG_SAVE
1962AC_LANG_CPLUSPLUS
1963if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then
1964  ac_cv_proto_getdomainname=no
1965else
1966  kde_safe_libs=$LIBS
1967  LIBS="$LIBS $X_EXTRA_LIBS"
1968  AC_TRY_LINK([
1969#include <stdlib.h>
1970#include <unistd.h>
1971
1972extern "C" int getdomainname (char *, int);
1973],
1974[
1975char buffer[200];
1976getdomainname(buffer, 200);
1977],
1978  ac_cv_func_getdomainname=yes
1979  ac_cv_proto_getdomainname=yes,
1980  AC_MSG_RESULT([fatal error])
1981  AC_MSG_ERROR([getdomainname unavailable]))
1982fi
1983LIBS=$kde_safe_libs
1984AC_LANG_RESTORE
1985])
1986AC_MSG_RESULT($ac_cv_proto_getdomainname)
1987
1988if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then
1989  AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname])
1990fi
1991if eval "test \"`echo $ac_cv_proto_getdomainname`\" = no"; then
1992  AC_DEFINE(HAVE_GETDOMAINNAME_PROTO, 1,
1993  [Define if you have getdomainname prototype])
1994fi
1995
1996])
1997
1998AC_DEFUN(AC_CHECK_GETHOSTNAME,
1999[
2000
2001AC_MSG_CHECKING([for gethostname])
2002AC_CACHE_VAL(ac_cv_func_gethostname,
2003[
2004AC_LANG_SAVE
2005AC_LANG_CPLUSPLUS
2006save_CXXFLAGS="$CXXFLAGS"
2007if test "$GCC" = "yes"; then
2008CXXFLAGS="$CXXFLAGS -pedantic-errors"
2009fi
2010AC_TRY_LINK([
2011#include <stdlib.h>
2012#include <unistd.h>
2013],
2014[
2015char buffer[200];
2016gethostname(buffer, 200);
2017],
2018ac_cv_func_gethostname=yes,
2019ac_cv_func_gethostname=no)
2020CXXFLAGS="$save_CXXFLAGS"
2021AC_LANG_RESTORE
2022])
2023AC_MSG_RESULT($ac_cv_func_gethostname)
2024
2025AC_MSG_CHECKING([if gethostname needs custom prototype])
2026AC_CACHE_VAL(ac_cv_proto_gethostname,
2027[
2028AC_LANG_SAVE
2029AC_LANG_CPLUSPLUS
2030if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then
2031  ac_cv_proto_gethostname=no
2032else
2033  AC_TRY_LINK([
2034#include <stdlib.h>
2035#include <unistd.h>
2036
2037extern "C" int gethostname (char *, int);
2038],
2039[
2040char buffer[200];
2041gethostname(buffer, 200);
2042],
2043  ac_cv_func_gethostname=yes
2044  ac_cv_proto_gethostname=yes,
2045  AC_MSG_RESULT([fatal error])
2046  AC_MSG_ERROR(gethostname unavailable))
2047fi
2048AC_LANG_RESTORE
2049])
2050AC_MSG_RESULT($ac_cv_proto_gethostname)
2051
2052if eval "test \"`echo $ac_cv_proto_gethostname`\" = no"; then
2053  AC_DEFINE(HAVE_GETHOSTNAME_PROTO, 1,
2054  [Define if you have gethostname prototype])
2055fi
2056if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then
2057  AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have gethostname])
2058fi
2059])
2060
2061AC_DEFUN(AC_CHECK_USLEEP,
2062[
2063AC_MSG_CHECKING([for usleep])
2064AC_CACHE_VAL(ac_cv_func_usleep,
2065[
2066AC_LANG_SAVE
2067AC_LANG_CPLUSPLUS
2068ac_libs_safe="$LIBS"
2069LIBS="$LIBS $LIBUCB"
2070AC_TRY_LINK([
2071#include <stdlib.h>
2072#include <unistd.h>
2073],
2074[
2075usleep(200);
2076],
2077ac_cv_func_usleep=yes,
2078ac_cv_func_usleep=no)
2079LIBS="$ac_libs_safe"
2080AC_LANG_RESTORE
2081])
2082AC_MSG_RESULT($ac_cv_func_usleep)
2083if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then
2084  AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function])
2085fi
2086])
2087
2088AC_DEFUN(AC_CHECK_RANDOM,
2089[
2090AC_MSG_CHECKING([for random])
2091AC_CACHE_VAL(ac_cv_func_random,
2092[
2093AC_LANG_SAVE
2094AC_LANG_CPLUSPLUS
2095ac_libs_safe="$LIBS"
2096LIBS="$LIBS $LIBUCB"
2097AC_TRY_LINK([
2098#include <stdlib.h>
2099],
2100[
2101random();
2102],
2103ac_cv_func_random=yes,
2104ac_cv_func_random=no)
2105LIBS="$ac_libs_safe"
2106AC_LANG_RESTORE
2107])
2108AC_MSG_RESULT($ac_cv_func_random)
2109if eval "test \"`echo $ac_cv_func_random`\" = yes"; then
2110  AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random])
2111fi
2112])
2113
2114AC_DEFUN(AC_FIND_GIF,
2115   [AC_MSG_CHECKING([for giflib])
2116AC_CACHE_VAL(ac_cv_lib_gif,
2117[ac_save_LIBS="$LIBS"
2118if test "x$kde_use_qt_emb" != "xyes"; then
2119LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
2120else
2121LIBS="$all_libraries -lgif"
2122fi
2123AC_TRY_LINK(dnl
2124[
2125#ifdef __cplusplus
2126extern "C" {
2127#endif
2128int GifLastError(void);
2129#ifdef __cplusplus
2130}
2131#endif
2132/* We use char because int might match the return type of a gcc2
2133    builtin and then its argument prototype would still apply.  */
2134],
2135            [return GifLastError();],
2136            eval "ac_cv_lib_gif=yes",
2137            eval "ac_cv_lib_gif=no")
2138LIBS="$ac_save_LIBS"
2139])dnl
2140if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
2141  AC_MSG_RESULT(yes)
2142  AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
2143else
2144  AC_MSG_ERROR(You need giflib30. Please install the kdesupport package)
2145fi
2146])
2147
2148AC_DEFUN(KDE_FIND_JPEG_HELPER,
2149[
2150AC_MSG_CHECKING([for libjpeg$2])
2151AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
2152[
2153AC_LANG_C
2154ac_save_LIBS="$LIBS"
2155LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"
2156ac_save_CFLAGS="$CFLAGS"
2157CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2158AC_TRY_LINK(
2159[/* Override any gcc2 internal prototype to avoid an error.  */
2160struct jpeg_decompress_struct;
2161typedef struct jpeg_decompress_struct * j_decompress_ptr;
2162typedef int size_t;
2163#ifdef __cplusplus
2164extern "C" {
2165#endif
2166    void jpeg_CreateDecompress(j_decompress_ptr cinfo,
2167                                    int version, size_t structsize);
2168#ifdef __cplusplus
2169}
2170#endif
2171/* We use char because int might match the return type of a gcc2
2172    builtin and then its argument prototype would still apply.  */
2173],
2174            [jpeg_CreateDecompress(0L, 0, 0);],
2175            eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
2176            eval "ac_cv_lib_jpeg_$1=no")
2177LIBS="$ac_save_LIBS"
2178CFLAGS="$ac_save_CFLAGS"
2179])
2180
2181if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
2182  LIBJPEG="$ac_cv_lib_jpeg_$1"
2183  AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
2184else
2185  AC_MSG_RESULT(no)
2186  $3
2187fi
2188
2189])
2190
2191AC_DEFUN(AC_FIND_JPEG,
2192[
2193dnl first look for libraries
2194KDE_FIND_JPEG_HELPER(6b, 6b,
2195   KDE_FIND_JPEG_HELPER(normal, [],
2196    [
2197       LIBJPEG=
2198    ]
2199   )
2200)
2201
2202dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
2203dnl requires system dependent includes loaded before it)
2204jpeg_incdirs="/usr/include /usr/local/include $kde_extra_includes"
2205AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)
2206test "x$jpeg_incdir" = xNO && jpeg_incdir=
2207
2208dnl if headers _and_ libraries are missing, this is no error, and we
2209dnl continue with a warning (the user will get no jpeg support in khtml)
2210dnl if only one is missing, it means a configuration error, but we still
2211dnl only warn
2212if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then
2213  AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
2214else
2215  if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then
2216    AC_MSG_WARN([
2217There is an installation error in jpeg support. You seem to have only one
2218of either the headers _or_ the libraries installed. You may need to either
2219provide correct --with-extra-... options, or the development package of
2220libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/
2221Disabling JPEG support.
2222])
2223  else
2224    AC_MSG_WARN([libjpeg not found. disable JPEG support.])
2225  fi
2226  jpeg_incdir=
2227  LIBJPEG=
2228fi
2229
2230AC_SUBST(LIBJPEG)
2231])
2232
2233AC_DEFUN(KDE_CHECK_QT_JPEG,
2234[
2235AC_MSG_CHECKING([if Qt needs $LIBJPEG])
2236AC_CACHE_VAL(kde_cv_qt_jpeg,
2237[
2238AC_LANG_SAVE
2239AC_LANG_CPLUSPLUS
2240ac_save_LIBS="$LIBS"
2241LIBS="$all_libraries $USER_LDFLAGS $LIBQT"
2242LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`
2243ac_save_CXXFLAGS="$CXXFLAGS"
2244CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
2245AC_TRY_LINK(
2246[#include <qapplication.h>],
2247            [
2248            int argc;
2249            char** argv;
2250            QApplication app(argc, argv);],
2251            eval "kde_cv_qt_jpeg=no",
2252            eval "kde_cv_qt_jpeg=yes")
2253LIBS="$ac_save_LIBS"
2254CXXFLAGS="$ac_save_CXXFLAGS"
2255AC_LANG_RESTORE
2256])
2257
2258if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then
2259  AC_MSG_RESULT(yes)
2260  LIBJPEG_QT='$(LIBJPEG)'
2261else
2262  AC_MSG_RESULT(no)
2263  LIBJPEG_QT=
2264fi
2265
2266])
2267
2268AC_DEFUN(AC_FIND_ZLIB,
2269[
2270AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2271AC_MSG_CHECKING([for libz])
2272AC_CACHE_VAL(ac_cv_lib_z,
2273[
2274AC_LANG_C
2275kde_save_LIBS="$LIBS"
2276LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
2277kde_save_CFLAGS="$CFLAGS"
2278CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2279AC_TRY_LINK(dnl
2280[
2281#include<zlib.h>
2282],
2283            [return (zlibVersion() == ZLIB_VERSION); ],
2284            eval "ac_cv_lib_z='-lz'",
2285            eval "ac_cv_lib_z=no")
2286LIBS="$kde_save_LIBS"
2287CFLAGS="$kde_save_CFLAGS"
2288])dnl
2289if test ! "$ac_cv_lib_z" = no; then
2290  AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
2291  LIBZ="$ac_cv_lib_z"
2292  AC_SUBST(LIBZ)
2293  AC_MSG_RESULT($ac_cv_lib_z)
2294else
2295  AC_MSG_ERROR(not found. Check your installation and look into config.log)
2296  LIBZ=""
2297  AC_SUBST(LIBZ)
2298fi
2299])
2300
2301AC_DEFUN(KDE_TRY_TIFFLIB,
2302[
2303AC_MSG_CHECKING([for libtiff $1])
2304
2305AC_CACHE_VAL(kde_cv_libtiff_$1,
2306[
2307AC_LANG_SAVE
2308AC_LANG_CPLUSPLUS
2309kde_save_LIBS="$LIBS"
2310if test "x$kde_use_qt_emb" != "xyes"; then
2311LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
2312else
2313LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm"
2314fi
2315kde_save_CXXFLAGS="$CXXFLAGS"
2316CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
2317
2318AC_TRY_LINK(dnl
2319[
2320#include<tiffio.h>
2321],
2322    [return (TIFFOpen( "", "r") == 0); ],
2323[
2324    kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
2325], [
2326    kde_cv_libtiff_$1=no
2327])
2328
2329LIBS="$kde_save_LIBS"
2330CXXFLAGS="$kde_save_CXXFLAGS"
2331AC_LANG_RESTORE
2332])
2333
2334if test "$kde_cv_libtiff_$1" = "no"; then
2335    AC_MSG_RESULT(no)
2336    LIBTIFF=""
2337    $3
2338else
2339    LIBTIFF="$kde_cv_libtiff_$1"
2340    AC_MSG_RESULT(yes)
2341    AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
2342    $2
2343fi
2344
2345])
2346
2347AC_DEFUN(AC_FIND_TIFF,
2348[
2349AC_REQUIRE([K_PATH_X])
2350AC_REQUIRE([AC_FIND_ZLIB])
2351AC_REQUIRE([AC_FIND_JPEG])
2352AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2353
2354KDE_TRY_TIFFLIB(tiff, [],
2355   KDE_TRY_TIFFLIB(tiff34))
2356
2357AC_SUBST(LIBTIFF)
2358])
2359
2360
2361AC_DEFUN(AC_FIND_PNG,
2362[
2363AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
2364AC_REQUIRE([AC_FIND_ZLIB])
2365AC_MSG_CHECKING([for libpng])
2366AC_CACHE_VAL(ac_cv_lib_png,
2367[
2368kde_save_LIBS="$LIBS"
2369if test "x$kde_use_qt_emb" != "xyes"; then
2370LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET"
2371else
2372LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm"
2373fi
2374kde_save_CFLAGS="$CFLAGS"
2375CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
2376AC_LANG_C
2377AC_TRY_LINK(dnl
2378    [
2379    #include<png.h>
2380    ],
2381    [
2382    png_structp png_ptr = png_create_read_struct(  /* image ptr */
2383		PNG_LIBPNG_VER_STRING, 0, 0, 0 );
2384    return( png_ptr != 0 );
2385    ],
2386    eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
2387    eval "ac_cv_lib_png=no"
2388)
2389LIBS="$kde_save_LIBS"
2390CFLAGS="$kde_save_CFLAGS"
2391])dnl
2392if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
2393  AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
2394  LIBPNG="$ac_cv_lib_png"
2395  AC_SUBST(LIBPNG)
2396  AC_MSG_RESULT($ac_cv_lib_png)
2397else
2398  AC_MSG_RESULT(no)
2399  LIBPNG=""
2400  AC_SUBST(LIBPNG)
2401fi
2402])
2403
2404AC_DEFUN(AC_CHECK_BOOL,
2405[
2406  AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool])
2407])
2408
2409AC_DEFUN(AC_CHECK_GNU_EXTENSIONS,
2410[
2411AC_MSG_CHECKING(if you need GNU extensions)
2412AC_CACHE_VAL(ac_cv_gnu_extensions,
2413[
2414cat > conftest.c << EOF
2415#include <features.h>
2416
2417#ifdef __GNU_LIBRARY__
2418yes
2419#endif
2420EOF
2421
2422if (eval "$ac_cpp conftest.c") 2>&5 |
2423  egrep "yes" >/dev/null 2>&1; then
2424  rm -rf conftest*
2425  ac_cv_gnu_extensions=yes
2426else
2427  ac_cv_gnu_extensions=no
2428fi
2429])
2430
2431AC_MSG_RESULT($ac_cv_gnu_extensions)
2432if test "$ac_cv_gnu_extensions" = "yes"; then
2433  AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions])
2434fi
2435])
2436
2437AC_DEFUN(KDE_CHECK_COMPILER_FLAG,
2438[
2439AC_MSG_CHECKING(whether $CXX supports -$1)
2440kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'`
2441AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
2442[
2443  AC_LANG_SAVE
2444  AC_LANG_CPLUSPLUS
2445  save_CXXFLAGS="$CXXFLAGS"
2446  CXXFLAGS="$CXXFLAGS -$1"
2447  AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], [])
2448  CXXFLAGS="$save_CXXFLAGS"
2449  AC_LANG_RESTORE
2450])
2451if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
2452 AC_MSG_RESULT(yes)
2453 :
2454 $2
2455else
2456 AC_MSG_RESULT(no)
2457 :
2458 $3
2459fi
2460])
2461
2462dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
2463dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
2464dnl it's all white-space separated
2465AC_DEFUN(AC_REMOVE_FORBIDDEN,
2466[ __val=$$1
2467  __forbid=" $2 "
2468  if test -n "$__val"; then
2469    __new=""
2470    ac_save_IFS=$IFS
2471    IFS=" 	"
2472    for i in $__val; do
2473      case "$__forbid" in
2474        *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
2475	*) # Careful to not add spaces, where there were none, because otherwise
2476	   # libtool gets confused, if we change e.g. CXX
2477	   if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
2478      esac
2479    done
2480    IFS=$ac_save_IFS
2481    $1=$__new
2482  fi
2483])
2484
2485dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
2486AC_DEFUN(AC_VALIDIFY_CXXFLAGS,
2487[dnl
2488if test "x$kde_use_qt_emb" != "xyes"; then
2489 AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
2490 AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
2491else
2492 AC_REMOVE_FORBIDDEN(CXX, [-rpath])
2493 AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath])
2494fi
2495])
2496
2497AC_DEFUN(AC_CHECK_COMPILERS,
2498[
2499  AC_ARG_ENABLE(debug,[  --enable-debug[=ARG]    enables debug symbols (yes|no|full) [default=no]],
2500  [
2501    case $enableval in
2502      yes)
2503        kde_use_debug_code="yes"
2504        kde_use_debug_define=no
2505        ;;
2506      full)
2507        kde_use_debug_code="full"
2508        kde_use_debug_define=no
2509        ;;
2510      *)
2511        kde_use_debug_code="no"
2512        kde_use_debug_define=yes
2513        ;;
2514    esac
2515  ],
2516    [kde_use_debug_code="no"
2517      kde_use_debug_define=no
2518  ])
2519
2520  dnl Just for configure --help
2521  AC_ARG_ENABLE(dummyoption,[  --disable-debug         disables debug output and debug symbols [default=no]],[],[])
2522
2523  AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
2524   [
2525    if test $enableval = "no"; then
2526         kde_use_strict_options="no"
2527       else
2528         kde_use_strict_options="yes"
2529    fi
2530   ], [kde_use_strict_options="no"])
2531
2532  AC_ARG_ENABLE(warnings,[  --enable-warnings       compiles with -Wall and similiar],
2533   [
2534    if test $enableval = "no"; then
2535         kde_use_warnings="no"
2536       else
2537         kde_use_warnings="yes"
2538    fi
2539   ], [kde_use_warnings="no"])
2540
2541  dnl enable warnings for debug build
2542  if test "$kde_use_debug_code" != "no"; then
2543    kde_use_warnings=yes
2544  fi
2545
2546  AC_ARG_ENABLE(profile,[  --enable-profile        creates profiling infos [default=no]],
2547    [kde_use_profiling=$enableval],
2548    [kde_use_profiling="no"]
2549  )
2550
2551  dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
2552  CFLAGS=" $CFLAGS"
2553
2554  AC_PROG_CC
2555
2556  AC_PROG_CPP
2557
2558  if test "$GCC" = "yes"; then
2559    if test "$kde_use_debug_code" != "no"; then
2560      if test $kde_use_debug_code = "full"; then
2561        CFLAGS="-g3 $CFLAGS"
2562      else
2563        CFLAGS="-g -O2 $CFLAGS"
2564      fi
2565    else
2566      CFLAGS="-O2 $CFLAGS"
2567    fi
2568  fi
2569
2570  if test "$kde_use_debug_define" = "yes"; then
2571    CFLAGS="-DNDEBUG $CFLAGS"
2572  fi
2573
2574
2575  case "$host" in
2576  *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";;
2577  *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";;
2578  esac
2579
2580  if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
2581     LDFLAGS=""
2582  fi
2583
2584  CXXFLAGS=" $CXXFLAGS"
2585
2586  AC_PROG_CXX
2587
2588  if test "$GXX" = "yes" || test "$CXX" = "KCC"; then
2589    if test "$kde_use_debug_code" != "no"; then
2590      if test "$CXX" = "KCC"; then
2591        CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS"
2592      else
2593        if test "$kde_use_debug_code" = "full"; then
2594          CXXFLAGS="-g3 $CXXFLAGS"
2595        else
2596          CXXFLAGS="-g -O2 $CXXFLAGS"
2597        fi
2598      fi
2599      KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"])
2600
2601      dnl convenience compiler flags
2602      KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""])
2603      AC_SUBST(WOVERLOADED_VIRTUAL)
2604    else
2605      if test "$CXX" = "KCC"; then
2606        CXXFLAGS="+K3 $CXXFLAGS"
2607      else
2608        CXXFLAGS="-O2 $CXXFLAGS"
2609      fi
2610    fi
2611  fi
2612
2613  if test "$kde_use_debug_define" = "yes"; then
2614    CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS"
2615  fi
2616
2617  if test "$kde_use_profiling" = "yes"; then
2618    KDE_CHECK_COMPILER_FLAG(pg,
2619    [
2620      CFLAGS="-pg $CFLAGS"
2621      CXXFLAGS="-pg $CXXFLAGS"
2622    ])
2623  fi
2624
2625  if test "$kde_use_warnings" = "yes"; then
2626      if test "$GCC" = "yes"; then
2627        case $host in
2628          *-*-linux-gnu)
2629            CFLAGS="-ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS"
2630            CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion $CXXFLAGS"
2631          ;;
2632        esac
2633        CXXFLAGS="-Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS"
2634        KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"])
2635        KDE_CHECK_COMPILER_FLAG(Wbad-function-cast,[CXXFLAGS="-Wbad-function-cast $CXXFLAGS"])
2636        KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"])
2637        KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"])
2638     fi
2639  fi
2640
2641  if test "$GCC" = "yes" && test "$kde_use_strict_options" = "yes"; then
2642    CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS"
2643  fi
2644
2645  if test "$GXX" = "yes"; then
2646    KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"])
2647    KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"])
2648    KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS=	)
2649  fi
2650  if test "$CXX" = "KCC"; then
2651    dnl unfortunately we currently cannot disable exception support in KCC
2652    dnl because doing so is binary incompatible and Qt by default links with exceptions :-(
2653    dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"])
2654    dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS=	)
2655
2656    AC_ARG_ENABLE(pch,[  --enable-pch            enables precompiled header support (currently only KCC) [default=no]],
2657    [
2658      kde_use_pch=$enableval
2659    ],[kde_use_pch=no])
2660
2661    if test "$kde_use_pch" = "yes"; then
2662      dnl TODO: support --pch-dir!
2663      KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"])
2664      dnl the below works (but the dir must exist), but it's
2665      dnl useless for a whole package.
2666      dnl The are precompiled headers for each source file, so when compiling
2667      dnl from scratch, it doesn't make a difference, and they take up
2668      dnl around ~5Mb _per_ sourcefile.
2669      dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp,
2670      dnl   [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"])
2671    fi
2672    dnl this flag controls inlining. by default KCC inlines in optimisation mode
2673    dnl all implementations that are defined inside the class {} declaration.
2674    dnl because of templates-compatibility with broken gcc compilers, this
2675    dnl can cause excessive inlining. This flag limits it to a sane level
2676    KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"])
2677    KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"])
2678    KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"])
2679    KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"])
2680    dnl Some source files are shared between multiple executables
2681    dnl (or libraries) and some of those need template instantiations.
2682    dnl In that case KCC needs to compile those sources with
2683    dnl --one_instantiation_per_object.  To make it easy for us we compile
2684    dnl _all_ objects with that flag (--one_per is a shorthand).
2685    KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"])
2686  fi
2687  AC_SUBST(USE_EXCEPTIONS)
2688  dnl obsolete macro - provided to keep things going
2689  USE_RTTI=
2690  AC_SUBST(USE_RTTI)
2691
2692  case "$host" in
2693      *-*-irix*)  test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;;
2694      *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";;
2695      *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";;
2696      *-*-solaris*)
2697        if test "$GXX" = yes; then
2698          libstdcpp=`$CXX -print-file-name=libstdc++.so`
2699          if test ! -f $libstdcpp; then
2700             AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so])
2701          fi
2702        fi
2703        ;;
2704  esac
2705
2706  AC_VALIDIFY_CXXFLAGS
2707
2708  AC_PROG_CXXCPP
2709
2710  # the following is to allow programs, that are known to
2711  # have problems when compiled with -O2
2712  if test -n "$CXXFLAGS"; then
2713      kde_safe_IFS=$IFS
2714      IFS=" "
2715      NOOPT_CXXFLAGS=""
2716      for i in $CXXFLAGS; do
2717        case $i in
2718          -O*)
2719                ;;
2720          *)
2721                NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i"
2722                ;;
2723        esac
2724      done
2725      IFS=$kde_safe_IFS
2726  fi
2727
2728  if test -n "$CFLAGS"; then
2729      kde_safe_IFS=$IFS
2730      IFS=" "
2731      NOOPT_CFLAGS=""
2732      for i in $CFLAGS; do
2733        case $i in
2734          -O*)
2735                ;;
2736          *)
2737                NOOPT_CFLAGS="$NOOPT_CFLAGS $i"
2738                ;;
2739        esac
2740      done
2741      IFS=$kde_safe_IFS
2742  fi
2743
2744  if test "x$kde_use_qt_emb" = "xyes"; then
2745    NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS -fno-rtti -DQWS"
2746  fi
2747
2748  AC_SUBST(NOOPT_CXXFLAGS)
2749  AC_SUBST(NOOPT_CFLAGS)
2750
2751  KDE_CHECK_FINAL
2752
2753  ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
2754
2755  KDE_CXXFLAGS=
2756  AC_SUBST(KDE_CXXFLAGS)
2757])
2758
2759AC_DEFUN(KDE_ADD_DEPENDENCIES,
2760[
2761   [A]M_DEPENDENCIES(CC)
2762   [A]M_DEPENDENCIES(CXX)
2763])
2764
2765dnl just a wrapper to clean up configure.in
2766AC_DEFUN(KDE_PROG_LIBTOOL,
2767[
2768AC_REQUIRE([AC_CHECK_COMPILERS])
2769AC_REQUIRE([AC_ENABLE_SHARED])
2770AC_REQUIRE([AC_ENABLE_STATIC])
2771
2772AC_REQUIRE([AC_LIBTOOL_DLOPEN])
2773
2774AC_LANG_SAVE
2775AC_LANG_C
2776AC_OBJEXT
2777AC_EXEEXT
2778AC_LANG_RESTORE
2779
2780AM_PROG_LIBTOOL
2781AC_LIBTOOL_CXX
2782
2783LIBTOOL_SHELL="/bin/sh ./libtool"
2784#  LIBTOOL="$LIBTOOL --silent"
2785KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)"
2786AC_SUBST(KDE_PLUGIN)
2787
2788AC_ARG_ENABLE(objprelink, [  --enable-objprelink     prelink apps using objprelink (experimental [only tested on linux/386])],
2789       kde_use_objprelink=$enableval, kde_use_objprelink=no)
2790  if test "x$kde_use_objprelink" = "xyes"; then
2791
2792      KDE_FIND_PATH(objprelink, OBJPRELINK, [], [kde_use_objprelink=no])
2793
2794      if test "x$kde_use_objprelink" = "xyes"; then
2795      AC_MSG_CHECKING([Patching libtool to run objprelink.])
2796      mv libtool libtool.orig
2797      cat > libtool <<\EOF
2798#! /bin/sh
2799for n ; do case $n in
2800  *.o)  test -r $n && echo objprelink $n && objprelink $n ;;
2801  *.lo) m=`basename $n .lo`".o" && test -r $m && echo objprelink $m && objprelink $m
2802        m=".libs/$m" && test -r $m && echo objprelink $m && objprelink $m ;;
2803esac; done
2804EOF
2805      cat >> libtool libtool.orig
2806      rm libtool.orig
2807      chmod a+x libtool
2808      AC_MSG_RESULT(done)
2809	fi
2810  fi
2811])
2812
2813AC_DEFUN(KDE_CHECK_TYPES,
2814[  AC_CHECK_SIZEOF(int, 4)dnl
2815  AC_CHECK_SIZEOF(long, 4)dnl
2816  AC_CHECK_SIZEOF(char *, 4)dnl
2817  AC_CHECK_SIZEOF(char, 1)dnl
2818])dnl
2819
2820AC_DEFUN(KDE_DO_IT_ALL,
2821[
2822AC_CANONICAL_SYSTEM
2823AC_ARG_PROGRAM
2824AM_INIT_AUTOMAKE($1, $2)
2825AM_DISABLE_LIBRARIES
2826AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
2827AC_CHECK_COMPILERS
2828KDE_PROG_LIBTOOL
2829AM_KDE_WITH_NLS
2830AC_PATH_KDE
2831])
2832
2833AC_DEFUN(AC_CHECK_RPATH,
2834[
2835AC_MSG_CHECKING(for rpath)
2836AC_ARG_ENABLE(rpath,
2837      [  --disable-rpath         do not use the rpath feature of ld],
2838      USE_RPATH=$enableval, USE_RPATH=yes)
2839
2840if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
2841
2842  KDE_RPATH="-R \$(kde_libraries)"
2843
2844  if test -n "$qt_libraries"; then
2845    KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)"
2846  fi
2847  dnl $x_libraries is set to /usr/lib in case
2848  if test -n "$X_LDFLAGS"; then
2849    KDE_RPATH="$KDE_RPATH -R \$(x_libraries)"
2850  fi
2851  if test -n "$KDE_EXTRA_RPATH"; then
2852    KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
2853  fi
2854fi
2855AC_SUBST(KDE_EXTRA_RPATH)
2856AC_SUBST(KDE_RPATH)
2857AC_MSG_RESULT($USE_RPATH)
2858])
2859
2860dnl Check for the type of the third argument of getsockname
2861AC_DEFUN(AC_CHECK_SOCKLEN_T, [
2862  AC_MSG_CHECKING(for socklen_t)
2863  AC_CACHE_VAL(ac_cv_socklen_t, [
2864    AC_LANG_SAVE
2865    AC_LANG_CPLUSPLUS
2866    AC_TRY_COMPILE([
2867#include <sys/types.h>
2868#include <sys/socket.h>
2869      ],[
2870socklen_t a=0;
2871getsockname(0,(struct sockaddr*)0, &a);
2872      ],
2873      ac_cv_socklen_t=socklen_t,
2874      AC_TRY_COMPILE([
2875#include <sys/types.h>
2876#include <sys/socket.h>
2877        ],[
2878int a=0;
2879getsockname(0,(struct sockaddr*)0, &a);
2880        ],
2881        ac_cv_socklen_t=int,
2882        ac_cv_socklen_t=size_t
2883      )
2884    )
2885    AC_LANG_RESTORE
2886  ])
2887
2888  AC_MSG_RESULT($ac_cv_socklen_t)
2889  if test "$ac_cv_socklen_t" != "socklen_t"; then
2890    AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t,
2891        [Define the real type of socklen_t])
2892  fi
2893  AC_DEFINE_UNQUOTED(ksize_t, socklen_t, [Compatibility define])
2894
2895])
2896
2897dnl This is a merge of some macros out of the gettext aclocal.m4
2898dnl since we don't need anything, I took the things we need
2899dnl the copyright for them is:
2900dnl >
2901dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
2902dnl This Makefile.in is free software; the Free Software Foundation
2903dnl gives unlimited permission to copy and/or distribute it,
2904dnl with or without modifications, as long as this notice is preserved.
2905
2906dnl This program is distributed in the hope that it will be useful,
2907dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
2908dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2909dnl PARTICULAR PURPOSE.
2910dnl >
2911dnl for this file it is relicensed under LGPL
2912
2913AC_DEFUN(AM_KDE_WITH_NLS,
2914  [
2915    dnl If we use NLS figure out what method
2916
2917    AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt,
2918        [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
2919    AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2920
2921     if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
2922        AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
2923        GMSGFMT=":"
2924      fi
2925      MSGFMT=$GMSGFMT
2926      AC_SUBST(GMSGFMT)
2927      AC_SUBST(MSGFMT)
2928
2929      AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
2930	[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2931
2932      dnl Test whether we really found GNU xgettext.
2933      if test "$XGETTEXT" != ":"; then
2934	dnl If it is no GNU xgettext we define it as : so that the
2935	dnl Makefiles still can work.
2936	if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2937	  : ;
2938	else
2939	  AC_MSG_RESULT(
2940	    [found xgettext programs is not GNU xgettext; ignore it])
2941	  XGETTEXT=":"
2942	fi
2943      fi
2944     AC_SUBST(XGETTEXT)
2945
2946  ])
2947
2948# Search path for a program which passes the given test.
2949# Ulrich Drepper <drepper@cygnus.com>, 1996.
2950
2951# serial 1
2952# Stephan Kulow: I appended a _KDE against name conflicts
2953
2954dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
2955dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2956AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE,
2957[# Extract the first word of "$2", so it can be a program name with args.
2958set dummy $2; ac_word=[$]2
2959AC_MSG_CHECKING([for $ac_word])
2960AC_CACHE_VAL(ac_cv_path_$1,
2961[case "[$]$1" in
2962  /*)
2963  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2964  ;;
2965  *)
2966  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2967  for ac_dir in ifelse([$5], , $PATH, [$5]); do
2968    test -z "$ac_dir" && ac_dir=.
2969    if test -f $ac_dir/$ac_word; then
2970      if [$3]; then
2971	ac_cv_path_$1="$ac_dir/$ac_word"
2972	break
2973      fi
2974    fi
2975  done
2976  IFS="$ac_save_ifs"
2977dnl If no 4th arg is given, leave the cache variable unset,
2978dnl so AC_PATH_PROGS will keep looking.
2979ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2980])dnl
2981  ;;
2982esac])dnl
2983$1="$ac_cv_path_$1"
2984if test -n "[$]$1"; then
2985  AC_MSG_RESULT([$]$1)
2986else
2987  AC_MSG_RESULT(no)
2988fi
2989AC_SUBST($1)dnl
2990])
2991
2992
2993# Check whether LC_MESSAGES is available in <locale.h>.
2994# Ulrich Drepper <drepper@cygnus.com>, 1995.
2995
2996# serial 1
2997
2998AC_DEFUN(AM_LC_MESSAGES,
2999  [if test $ac_cv_header_locale_h = yes; then
3000    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
3001      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
3002       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
3003    if test $am_cv_val_LC_MESSAGES = yes; then
3004      AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
3005    fi
3006  fi])
3007
3008dnl From Jim Meyering.
3009dnl FIXME: migrate into libit.
3010
3011AC_DEFUN([AM_FUNC_OBSTACK],
3012[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
3013 [AC_TRY_LINK([#include "obstack.h"],
3014	      [struct obstack *mem;obstack_free(mem,(char *) 0)],
3015	      am_cv_func_obstack=yes,
3016	      am_cv_func_obstack=no)])
3017 if test $am_cv_func_obstack = yes; then
3018   AC_DEFINE(HAVE_OBSTACK)
3019 else
3020   LIBOBJS="$LIBOBJS obstack.o"
3021 fi
3022])
3023
3024dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
3025dnl FIXME: Migrate into libit
3026
3027AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
3028[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
3029 [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
3030              am_cv_lib_error_at_line=yes,
3031	      am_cv_lib_error_at_line=no)])
3032 if test $am_cv_lib_error_at_line = no; then
3033   LIBOBJS="$LIBOBJS error.o"
3034 fi
3035 AC_SUBST(LIBOBJS)dnl
3036])
3037
3038# Macro to add for using GNU gettext.
3039# Ulrich Drepper <drepper@cygnus.com>, 1995.
3040
3041# serial 1
3042# Stephan Kulow: I put a KDE in it to avoid name conflicts
3043
3044AC_DEFUN(AM_KDE_GNU_GETTEXT,
3045  [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3046   AC_REQUIRE([AC_PROG_RANLIB])dnl
3047   AC_REQUIRE([AC_HEADER_STDC])dnl
3048   AC_REQUIRE([AC_TYPE_OFF_T])dnl
3049   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
3050   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
3051   AC_REQUIRE([AC_FUNC_MMAP])dnl
3052   AC_REQUIRE([AM_KDE_WITH_NLS])dnl
3053   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h string.h values.h alloca.h])
3054   AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
3055__argz_count __argz_stringify __argz_next])
3056
3057   AC_MSG_CHECKING(for stpcpy)
3058   AC_CACHE_VAL(kde_cv_func_stpcpy,
3059   [
3060   kde_safe_cxxflags=$CXXFLAGS
3061   CXXFLAGS="-Wmissing-prototypes -Werror"
3062   AC_LANG_SAVE
3063   AC_LANG_CPLUSPLUS
3064   AC_TRY_COMPILE([
3065   #include <string.h>
3066   ],
3067   [
3068   char buffer[200];
3069   stpcpy(buffer, buffer);
3070   ],
3071   kde_cv_func_stpcpy=yes,
3072   kde_cv_func_stpcpy=no)
3073   AC_LANG_RESTORE
3074   CXXFLAGS=$kde_safe_cxxflags
3075   ])
3076   AC_MSG_RESULT($kde_cv_func_stpcpy)
3077   if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
3078     AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
3079   fi
3080
3081   AM_LC_MESSAGES
3082
3083   if test "x$CATOBJEXT" != "x"; then
3084     if test "x$ALL_LINGUAS" = "x"; then
3085       LINGUAS=
3086     else
3087       AC_MSG_CHECKING(for catalogs to be installed)
3088       NEW_LINGUAS=
3089       for lang in ${LINGUAS=$ALL_LINGUAS}; do
3090         case "$ALL_LINGUAS" in
3091          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
3092         esac
3093       done
3094       LINGUAS=$NEW_LINGUAS
3095       AC_MSG_RESULT($LINGUAS)
3096     fi
3097
3098     dnl Construct list of names of catalog files to be constructed.
3099     if test -n "$LINGUAS"; then
3100       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
3101     fi
3102   fi
3103
3104  ])
3105
3106AC_DEFUN(AC_HAVE_XPM,
3107 [AC_REQUIRE_CPP()dnl
3108  AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3109
3110 test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
3111 test -z "$XPM_INCLUDE" && XPM_INCLUDE=
3112
3113 AC_ARG_WITH(xpm, [  --without-xpm           disable color pixmap XPM tests],
3114	xpm_test=$withval, xpm_test="yes")
3115 if test "x$xpm_test" = xno; then
3116   ac_cv_have_xpm=no
3117 else
3118   AC_MSG_CHECKING(for XPM)
3119   AC_CACHE_VAL(ac_cv_have_xpm,
3120   [
3121    AC_LANG_C
3122    ac_save_ldflags="$LDFLAGS"
3123    ac_save_cflags="$CFLAGS"
3124    if test "x$kde_use_qt_emb" != "xyes"; then
3125      LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET"
3126    else
3127      LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET"
3128    fi
3129    CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES"
3130    test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
3131    AC_TRY_LINK([#include <X11/xpm.h>],[],
3132	ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
3133    LDFLAGS="$ac_save_ldflags"
3134    CFLAGS="$ac_save_cflags"
3135   ])dnl
3136
3137  if test "$ac_cv_have_xpm" = no; then
3138    AC_MSG_RESULT(no)
3139    XPM_LDFLAGS=""
3140    XPMINC=""
3141    $2
3142  else
3143    AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
3144    if test "$XPM_LDFLAGS" = ""; then
3145       XPMLIB='-lXpm $(LIB_X11)'
3146    else
3147       XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
3148    fi
3149    if test "$XPM_INCLUDE" = ""; then
3150       XPMINC=""
3151    else
3152       XPMINC="-I$XPM_INCLUDE"
3153    fi
3154    AC_MSG_RESULT(yes)
3155    $1
3156  fi
3157 fi
3158 AC_SUBST(XPMINC)
3159 AC_SUBST(XPMLIB)
3160])
3161
3162AC_DEFUN(AC_HAVE_DPMS,
3163 [AC_REQUIRE_CPP()dnl
3164  AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3165
3166 test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS=
3167 test -z "$DPMS_INCLUDE" && DPMS_INCLUDE=
3168 DPMS_LIB=
3169
3170 AC_ARG_WITH(dpms, [  --without-dpms          disable DPMS power saving],
3171	dpms_test=$withval, dpms_test="yes")
3172 if test "x$dpms_test" = xno; then
3173   ac_cv_have_dpms=no
3174 else
3175   AC_MSG_CHECKING(for DPMS)
3176   dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms.
3177   dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms".
3178   AC_CACHE_VAL(ac_cv_have_dpms,
3179   [
3180    if test "x$kde_use_qt_emb" = "xyes"; then
3181      AC_MSG_RESULT(no)
3182      ac_cv_have_dpms="no"
3183    else
3184      AC_LANG_C
3185      ac_save_ldflags="$LDFLAGS"
3186      ac_save_cflags="$CFLAGS"
3187      ac_save_libs="$LIBS"
3188      LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
3189      CFLAGS="$CFLAGS $X_INCLUDES"
3190      test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
3191      AC_TRY_LINK([
3192	  #include <X11/Xproto.h>
3193	  #include <X11/X.h>
3194	  #include <X11/Xlib.h>
3195	  #include <X11/extensions/dpms.h>
3196	  int foo_test_dpms()
3197	  { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
3198	  ac_cv_have_dpms="yes", [
3199              LDFLAGS="$ac_save_ldflags"
3200              CFLAGS="$ac_save_cflags"
3201              LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET"
3202              LIBS="$LIBS -lXdpms"
3203              CFLAGS="$CFLAGS $X_INCLUDES"
3204              test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
3205              AC_TRY_LINK([
3206	          #include <X11/Xproto.h>
3207        	  #include <X11/X.h>
3208        	  #include <X11/Xlib.h>
3209        	  #include <X11/extensions/dpms.h>
3210        	  int foo_test_dpms()
3211        	  { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
3212        	  [
3213                  ac_cv_have_dpms="-lXdpms"
3214                  ],ac_cv_have_dpms="no")
3215              ])
3216      LDFLAGS="$ac_save_ldflags"
3217      CFLAGS="$ac_save_cflags"
3218      LIBS="$ac_save_libs"
3219    fi
3220   ])dnl
3221
3222  if test "$ac_cv_have_dpms" = no; then
3223    AC_MSG_RESULT(no)
3224    DPMS_LDFLAGS=""
3225    DPMSINC=""
3226    $2
3227  else
3228    AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support])
3229    if test "$ac_cv_have_dpms" = "-lXdpms"; then
3230       DPMS_LIB="-lXdpms"
3231    fi
3232    if test "$DPMS_LDFLAGS" = ""; then
3233       DPMSLIB="$DPMS_LIB "'$(LIB_X11)'
3234    else
3235       DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)'
3236    fi
3237    if test "$DPMS_INCLUDE" = ""; then
3238       DPMSINC=""
3239    else
3240       DPMSINC="-I$DPMS_INCLUDE"
3241    fi
3242    AC_MSG_RESULT(yes)
3243    $1
3244  fi
3245 fi
3246 AC_SUBST(DPMSINC)
3247 AC_SUBST(DPMSLIB)
3248])
3249
3250AC_DEFUN(AC_HAVE_GL,
3251 [AC_REQUIRE_CPP()dnl
3252  AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
3253
3254 test -z "$GL_LDFLAGS" && GL_LDFLAGS=
3255 test -z "$GL_INCLUDE" && GL_INCLUDE=
3256
3257 AC_ARG_WITH(gl, [  --without-gl            disable 3D GL modes],
3258	gl_test=$withval, gl_test="yes")
3259 if test "x$kde_use_qt_emb" = "xyes"; then
3260   # GL and Qt Embedded is a no-go for now.
3261   ac_cv_have_gl=no
3262 elif test "x$gl_test" = xno; then
3263   ac_cv_have_gl=no
3264 else
3265   AC_MSG_CHECKING(for GL)
3266   AC_CACHE_VAL(ac_cv_have_gl,
3267   [
3268    AC_LANG_C
3269    ac_save_ldflags="$LDFLAGS"
3270    ac_save_cflags="$CFLAGS"
3271    LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU"
3272    test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11"
3273    LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET"
3274    CFLAGS="$CFLAGS $X_INCLUDES"
3275    test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
3276    AC_TRY_LINK([#include <GL/gl.h>
3277#include <GL/glu.h>
3278], [],
3279	ac_cv_have_gl="mesa", ac_cv_have_gl="no")
3280    if test "x$ac_cv_have_gl" = "xno"; then
3281      LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGL -lGLU"
3282      test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11"
3283      LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET"
3284      CFLAGS="$ac_save_cflags $X_INCLUDES"
3285      test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
3286      AC_TRY_LINK([#include <GL/gl.h>
3287#include <GL/glu.h>
3288], [],
3289	  ac_cv_have_gl="yes", ac_cv_have_gl="no")
3290    fi
3291    LDFLAGS="$ac_save_ldflags"
3292    CFLAGS="$ac_save_cflags"
3293   ])dnl
3294
3295  if test "$ac_cv_have_gl" = "no"; then
3296    AC_MSG_RESULT(no)
3297    GL_LDFLAGS=""
3298    GLINC=""
3299    $2
3300  else
3301    AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)])
3302    if test "$GL_LDFLAGS" = ""; then
3303       if test "$ac_cv_have_gl" = "mesa"; then
3304          GLLIB='-lMesaGL -lMesaGLU $(LIB_X11)'
3305       else
3306          GLLIB='-lGL -lGLU $(LIB_X11)'
3307       fi
3308    else
3309       if test "$ac_cv_have_gl" = "mesa"; then
3310          GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU "'$(LIB_X11)'
3311       else
3312          GLLIB="$GL_LDFLAGS -lGL -lGLU "'$(LIB_X11)'
3313       fi
3314    fi
3315    if test "$GL_INCLUDE" = ""; then
3316       GLINC=""
3317    else
3318       GLINC="-I$GL_INCLUDE"
3319    fi
3320    AC_MSG_RESULT($ac_cv_have_gl)
3321    $1
3322  fi
3323 fi
3324 AC_SUBST(GLINC)
3325 AC_SUBST(GLLIB)
3326])
3327
3328
3329 dnl shadow password and PAM magic - maintained by ossi@kde.org
3330
3331AC_DEFUN(KDE_PAM, [
3332  AC_REQUIRE([KDE_CHECK_LIBDL])
3333
3334  AC_ARG_WITH(pam,
3335    [  --with-pam[=ARG]        enable support for PAM: ARG=[yes|no|service name]],
3336    [ if test "x$withval" = "xyes"; then
3337        use_pam=yes
3338        pam_service=kde
3339      elif test "x$withval" = "xno"; then
3340        use_pam=no
3341      else
3342        use_pam=yes
3343        pam_service=$withval
3344      fi
3345      ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service"
3346    ], [
3347      AC_CACHE_VAL(ac_cv_path_pam,
3348        [ use_pam=no
3349          AC_CHECK_LIB(pam, pam_start,
3350            [ AC_CHECK_HEADER(security/pam_appl.h,
3351                [ use_pam=yes
3352                  pam_service=kde ])
3353            ], , $LIBDL)
3354          ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service"
3355        ])
3356    ])
3357  eval "$ac_cv_path_pam"
3358
3359  AC_MSG_CHECKING(for PAM)
3360  if test "x$use_pam" = xno; then
3361    AC_MSG_RESULT(no)
3362    PAMLIBS=""
3363  else
3364    AC_MSG_RESULT(yes)
3365    AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)])
3366    PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL"
3367
3368    dnl test whether struct pam_message is const (Linux) or not (Sun)
3369    AC_MSG_CHECKING(for const pam_message)
3370    AC_EGREP_HEADER([struct pam_message], security/pam_appl.h,
3371      [ AC_EGREP_HEADER([const struct pam_message], security/pam_appl.h,
3372                        [AC_MSG_RESULT([const: Linux-type PAM])],
3373                        [AC_MSG_RESULT([nonconst: Sun-type PAM])
3374                        AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
3375                        )],
3376      [AC_MSG_RESULT([not found - assume const, Linux-type PAM])])
3377  fi
3378
3379  AC_SUBST(PAMLIBS)
3380])
3381
3382dnl DEF_PAM_SERVICE(arg name, full name, define name)
3383AC_DEFUN(DEF_PAM_SERVICE, [
3384  AC_ARG_WITH($1-pam,
3385    [  --with-$1-pam=[val]    override PAM service from --with-pam for $2],
3386    [ if test "x$use_pam" = xyes; then
3387        $3_PAM_SERVICE="$withval"
3388      else
3389        AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected.
3390You may want to enforce it by using --with-pam.])
3391      fi
3392    ],
3393    [ if test "x$use_pam" = xyes; then
3394        $3_PAM_SERVICE="$pam_service"
3395      fi
3396    ])
3397    if test -n "$$3_PAM_SERVICE"; then
3398      AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE])
3399      AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2])
3400    fi
3401    AC_SUBST($3_PAM_SERVICE)
3402])
3403
3404AC_DEFUN(KDE_SHADOWPASSWD, [
3405  AC_REQUIRE([KDE_PAM])
3406
3407  AC_CHECK_LIB(shadow, getspent,
3408    [ LIBSHADOW="-lshadow"
3409      ac_use_shadow=yes
3410    ],
3411    [ dnl for UnixWare
3412      AC_CHECK_LIB(gen, getspent,
3413        [ LIBGEN="-lgen"
3414          ac_use_shadow=yes
3415        ],
3416        [ AC_CHECK_FUNC(getspent,
3417            [ ac_use_shadow=yes ],
3418            [ ac_use_shadow=no ])
3419	])
3420    ])
3421  AC_SUBST(LIBSHADOW)
3422  AC_SUBST(LIBGEN)
3423
3424  AC_MSG_CHECKING([for shadow passwords])
3425
3426  AC_ARG_WITH(shadow,
3427    [  --with-shadow		  If you want shadow password support ],
3428    [ if test "x$withval" != "xno"; then
3429        use_shadow=yes
3430      else
3431        use_shadow=no
3432      fi
3433    ], [
3434      use_shadow="$ac_use_shadow"
3435    ])
3436
3437  if test "x$use_shadow" = xyes; then
3438    AC_MSG_RESULT(yes)
3439    AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords])
3440  else
3441    AC_MSG_RESULT(no)
3442    LIBSHADOW=
3443    LIBGEN=
3444  fi
3445
3446  dnl finally make the relevant binaries setuid root, if we have shadow passwds.
3447  dnl this still applies, if we could use it indirectly through pam.
3448  if test "x$use_shadow" = xyes ||
3449     ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then
3450      case $host in
3451      *-*-freebsd* | *-*-netbsd* | *-*-openbsd*)
3452	SETUIDFLAGS="-m 4755 -o root";;
3453      *)
3454	SETUIDFLAGS="-m 4755";;
3455      esac
3456  fi
3457  AC_SUBST(SETUIDFLAGS)
3458
3459])
3460
3461AC_DEFUN(KDE_PASSWDLIBS, [
3462  AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT
3463  AC_REQUIRE([KDE_PAM])
3464  AC_REQUIRE([KDE_SHADOWPASSWD])
3465
3466  if test "x$use_pam" = "xyes"; then
3467    PASSWDLIBS="$PAMLIBS"
3468  else
3469    PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN"
3470  fi
3471
3472  dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but
3473  dnl /etc/master.passwd holds the actual passwords.  /etc/master.passwd requires
3474  dnl root to read, so kcheckpass needs to be root (even when using pam, since pam
3475  dnl may need to read /etc/master.passwd).
3476  case $host in
3477  *-*-freebsd*)
3478    SETUIDFLAGS="-m 4755 -o root"
3479    ;;
3480  *)
3481    ;;
3482  esac
3483
3484  AC_SUBST(PASSWDLIBS)
3485])
3486
3487AC_DEFUN(KDE_CHECK_LIBDL,
3488[
3489AC_CHECK_LIB(dl, dlopen, [
3490LIBDL="-ldl"
3491ac_cv_have_dlfcn=yes
3492])
3493
3494AC_CHECK_LIB(dld, shl_unload, [
3495LIBDL="-ldld"
3496ac_cv_have_shload=yes
3497])
3498
3499AC_SUBST(LIBDL)
3500])
3501
3502AC_DEFUN(KDE_CHECK_DLOPEN,
3503[
3504KDE_CHECK_LIBDL
3505AC_CHECK_HEADERS(dlfcn.h dl.h)
3506if test "$ac_cv_header_dlfcn_h" = "no"; then
3507  ac_cv_have_dlfcn=no
3508fi
3509
3510if test "$ac_cv_header_dl_h" = "no"; then
3511  ac_cv_have_shload=no
3512fi
3513
3514dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE
3515dnl (MM)
3516AC_ARG_ENABLE(dlopen,
3517[  --disable-dlopen        link statically [default=no]] ,
3518enable_dlopen=$enableval,
3519enable_dlopen=yes)
3520
3521# override the user's opinion, if we know it better ;)
3522if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
3523  enable_dlopen=no
3524fi
3525
3526if test "$ac_cv_have_dlfcn" = "yes"; then
3527  AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn])
3528fi
3529
3530if test "$ac_cv_have_shload" = "yes"; then
3531  AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload])
3532fi
3533
3534if test "$enable_dlopen" = no ; then
3535  test -n "$1" && eval $1
3536else
3537  test -n "$2" && eval $2
3538fi
3539
3540])
3541
3542AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING,
3543[
3544KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no)
3545KDE_PROG_LIBTOOL
3546AC_MSG_CHECKING([dynamic loading])
3547eval "`egrep '^build_libtool_libs=' libtool`"
3548if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
3549  dynamic_loading=yes
3550  AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
3551else
3552  dynamic_loading=no
3553fi
3554AC_MSG_RESULT($dynamic_loading)
3555if test "$dynamic_loading" = "yes"; then
3556  $1
3557else
3558  $2
3559fi
3560])
3561
3562AC_DEFUN(KDE_ADD_INCLUDES,
3563[
3564if test -z "$1"; then
3565  test_include="Pix.h"
3566else
3567  test_include="$1"
3568fi
3569
3570AC_MSG_CHECKING([for libg++ ($test_include)])
3571
3572AC_CACHE_VAL(kde_cv_libgpp_includes,
3573[
3574kde_cv_libgpp_includes=no
3575
3576   for ac_dir in               \
3577                               \
3578     /usr/include/g++          \
3579     /usr/include              \
3580     /usr/unsupported/include  \
3581     /opt/include              \
3582     $extra_include            \
3583     ; \
3584   do
3585     if test -r "$ac_dir/$test_include"; then
3586       kde_cv_libgpp_includes=$ac_dir
3587       break
3588     fi
3589   done
3590])
3591
3592AC_MSG_RESULT($kde_cv_libgpp_includes)
3593if test "$kde_cv_libgpp_includes" != "no"; then
3594  all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES"
3595fi
3596])
3597])
3598
3599
3600AC_DEFUN(KDE_CHECK_MICO,
3601[
3602AC_REQUIRE([KDE_CHECK_LIBDL])
3603AC_REQUIRE([KDE_MISC_TESTS])
3604AC_MSG_CHECKING(for MICO)
3605
3606if test -z "$MICODIR"; then
3607    kde_micodir=/usr/local
3608 else
3609    kde_micodir="$MICODIR"
3610fi
3611
3612AC_ARG_WITH(micodir,
3613  [  --with-micodir=micodir  where mico is installed ],
3614  kde_micodir=$withval,
3615  kde_micodir=$kde_micodir
3616)
3617
3618AC_CACHE_VAL(kde_cv_mico_incdir,
3619[
3620  mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes"
3621AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir)
3622
3623])
3624kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'`
3625
3626if test ! -r  $kde_micodir/include/CORBA.h; then
3627  AC_MSG_ERROR([No CORBA.h found, specify another micodir])
3628fi
3629
3630AC_MSG_RESULT($kde_micodir)
3631
3632MICO_INCLUDES=-I$kde_micodir/include
3633AC_SUBST(MICO_INCLUDES)
3634MICO_LDFLAGS=-L$kde_micodir/lib
3635AC_SUBST(MICO_LDFLAGS)
3636micodir=$kde_micodir
3637AC_SUBST(micodir)
3638
3639AC_MSG_CHECKING([for MICO version])
3640AC_CACHE_VAL(kde_cv_mico_version,
3641[
3642AC_LANG_C
3643cat >conftest.$ac_ext <<EOF
3644#include <stdio.h>
3645#include <mico/version.h>
3646int main() {
3647
3648   printf("MICO_VERSION=%s\n",MICO_VERSION);
3649   return (0);
3650}
3651EOF
3652ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest'
3653if AC_TRY_EVAL(ac_compile); then
3654  if eval `./conftest 2>&5`; then
3655    kde_cv_mico_version=$MICO_VERSION
3656  else
3657    AC_MSG_ERROR([your system is not able to execute a small application to
3658    find MICO version! Check $kde_micodir/include/mico/version.h])
3659  fi
3660else
3661  AC_MSG_ERROR([your system is not able to compile a small application to
3662  find MICO version! Check $kde_micodir/include/mico/version.h])
3663fi
3664])
3665
3666dnl installed MICO version
3667mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
3668mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
3669mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
3670
3671if test "x$1" = "x"; then
3672 req_version="2.3.0"
3673else
3674 req_version=$1
3675fi
3676
3677dnl required MICO version
3678req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'`
3679req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'`
3680req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'`
3681
3682if test "$mico_v_maj" -lt "$req_v_maj" || \
3683   ( test "$mico_v_maj" -eq "$req_v_maj" && \
3684        test "$mico_v_mid" -lt "$req_v_mid" ) || \
3685   ( test "$mico_v_mid" -eq "$req_v_mid" && \
3686        test "$mico_v_min" -lt "$req_v_min" )
3687
3688then
3689  AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \
3690at least is required. You should upgrade MICO.])
3691else
3692  AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)])
3693fi
3694
3695LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL"
3696AC_SUBST(LIBMICO)
3697if test -z "$IDL"; then
3698  IDL='$(kde_bindir)/cuteidl'
3699fi
3700AC_SUBST(IDL)
3701IDL_DEPENDENCIES='$(kde_includes)/CUTE.h'
3702AC_SUBST(IDL_DEPENDENCIES)
3703
3704idldir="\$(includedir)/idl"
3705AC_SUBST(idldir)
3706
3707])
3708
3709AC_DEFUN(KDE_CHECK_MINI_STL,
3710[
3711AC_REQUIRE([KDE_CHECK_MICO])
3712
3713AC_MSG_CHECKING(if we use mico's mini-STL)
3714AC_CACHE_VAL(kde_cv_have_mini_stl,
3715[
3716AC_LANG_SAVE
3717AC_LANG_CPLUSPLUS
3718kde_save_cxxflags="$CXXFLAGS"
3719CXXFLAGS="$CXXFLAGS $MICO_INCLUDES"
3720AC_TRY_COMPILE(
3721[
3722#include <mico/config.h>
3723],
3724[
3725#ifdef HAVE_MINI_STL
3726#error "nothing"
3727#endif
3728],
3729kde_cv_have_mini_stl=no,
3730kde_cv_have_mini_stl=yes)
3731CXXFLAGS="$kde_save_cxxflags"
3732AC_LANG_RESTORE
3733])
3734
3735if test "x$kde_cv_have_mini_stl" = "xyes"; then
3736   AC_MSG_RESULT(yes)
3737   $1
3738else
3739   AC_MSG_RESULT(no)
3740   $2
3741fi
3742])
3743
3744])
3745
3746
3747AC_DEFUN(KDE_CHECK_LIBPTHREAD,
3748[
3749AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] )
3750AC_SUBST(LIBPTHREAD)
3751])
3752
3753AC_DEFUN(KDE_CHECK_PTHREAD_OPTION,
3754[
3755    AC_ARG_ENABLE(kernel-threads, [  --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.],
3756	kde_use_kernthreads=$enableval, kde_use_kernthreads=no)
3757
3758    if test "$kde_use_kernthreads" = "yes"; then
3759      ac_save_CXXFLAGS="$CXXFLAGS"
3760      ac_save_CFLAGS="$CFLAGS"
3761      CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS"
3762      CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS"
3763      AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h)
3764      CXXFLAGS="$ac_save_CXXFLAGS"
3765      CFLAGS="$ac_save_CFLAGS"
3766      if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then
3767        kde_use_kernthreads=no
3768      else
3769        dnl Add proper -I and -l statements
3770        AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD
3771        if test "x$LIBPTHREAD" = "x"; then
3772          kde_use_kernthreads=no
3773        else
3774          USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads"
3775        fi
3776      fi
3777    else
3778      USE_THREADS=""
3779      if test -z "$LIBPTHREAD"; then
3780        KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] )
3781      fi
3782    fi
3783
3784    case $host_os in
3785 	solaris*)
3786		KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
3787                CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4"
3788    		;;
3789        freebsd*)
3790                CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
3791                ;;
3792        aix*)
3793                CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
3794                LIBPTHREAD="$LIBPTHREAD -lc_r"
3795                ;;
3796        linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT"
3797                if test "$CXX" = "KCC"; then
3798                  CXXFLAGS="$CXXFLAGS --thread_safe"
3799		  NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe"
3800                fi
3801                ;;
3802	*)
3803		;;
3804    esac
3805    AC_SUBST(USE_THREADS)
3806    AC_SUBST(LIBPTHREAD)
3807])
3808
3809AC_DEFUN(KDE_CHECK_THREADING,
3810[
3811  AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
3812  AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
3813  dnl default is yes if libpthread is found and no if no libpthread is available
3814  if test -z "$LIBPTHREAD"; then
3815    if test -z "$USE_THREADS"; then
3816      kde_check_threading_default=no
3817    else
3818      kde_check_threading_default=yes
3819    fi
3820  else
3821    kde_check_threading_default=yes
3822  fi
3823  AC_ARG_ENABLE(threading, [  --disable-threading     disables threading even if libpthread found ],
3824   kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
3825  if test "x$kde_use_threading" = "xyes"; then
3826    AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
3827  fi
3828])
3829
3830AC_DEFUN(KDE_TRY_LINK_PYTHON,
3831[
3832if test "$kde_python_link_found" = no; then
3833
3834if test "$1" = normal; then
3835  AC_MSG_CHECKING(if a Python application links)
3836else
3837  AC_MSG_CHECKING(if Python depends on $2)
3838fi
3839
3840AC_CACHE_VAL(kde_cv_try_link_python_$1,
3841[
3842AC_LANG_SAVE
3843AC_LANG_C
3844kde_save_cflags="$CFLAGS"
3845CFLAGS="$CFLAGS $PYTHONINC"
3846kde_save_libs="$LIBS"
3847LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
3848kde_save_ldflags="$LDFLAGS"
3849LDFLAGS="$LDFLAGS $PYTHONLIB"
3850
3851AC_TRY_LINK(
3852[
3853#include <Python.h>
3854],[
3855	PySys_SetArgv(1, 0);
3856],
3857	[kde_cv_try_link_python_$1=yes],
3858	[kde_cv_try_link_python_$1=no]
3859)
3860CFLAGS="$kde_save_cflags"
3861LIBS="$kde_save_libs"
3862LDFLAGS="$kde_save_ldflags"
3863])
3864
3865if test "$kde_cv_try_link_python_$1" = "yes"; then
3866  AC_MSG_RESULT(yes)
3867  kde_python_link_found=yes
3868  if test ! "$1" = normal; then
3869    LIBPYTHON="$LIBPYTHON $2"
3870  fi
3871  $3
3872else
3873  AC_MSG_RESULT(no)
3874  $4
3875fi
3876AC_LANG_RESTORE
3877
3878fi
3879
3880])
3881
3882AC_DEFUN(KDE_CHECK_PYTHON_DIR,
3883[
3884AC_MSG_CHECKING([for Python directory])
3885
3886AC_CACHE_VAL(kde_cv_pythondir,
3887[
3888  if test -z "$PYTHONDIR"; then
3889    kde_cv_pythondir=/usr/local
3890  else
3891    kde_cv_pythondir="$PYTHONDIR"
3892  fi
3893])
3894
3895AC_ARG_WITH(pythondir,
3896[  --with-pythondir=pythondir   use python installed in pythondir ],
3897[
3898  ac_python_dir=$withval
3899], ac_python_dir=$kde_cv_pythondir
3900)
3901
3902AC_MSG_RESULT($ac_python_dir)
3903])
3904
3905AC_DEFUN(KDE_CHECK_PYTHON_INTERN,
3906[
3907AC_REQUIRE([KDE_CHECK_LIBDL])
3908AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
3909AC_REQUIRE([KDE_CHECK_PYTHON_DIR])
3910
3911if test -z "$1"; then
3912  version="1.5"
3913else
3914  version="$1"
3915fi
3916
3917AC_MSG_CHECKING([for Python$version])
3918
3919python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes"
3920AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
3921if test ! -r $python_incdir/Python.h; then
3922  AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir)
3923  python_incdir=$python_incdir/python$version
3924  if test ! -r $python_incdir/Python.h; then
3925    python_incdir=no
3926  fi
3927fi
3928
3929PYTHONINC=-I$python_incdir
3930
3931python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs"
3932AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
3933if test ! -r $python_libdir/libpython$version.a; then
3934  AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir)
3935  python_libdir=$python_libdir/python$version/config
3936  if test ! -r $python_libdir/libpython$version.a; then
3937    python_libdir=no
3938  fi
3939fi
3940
3941PYTHONLIB=-L$python_libdir
3942kde_orig_LIBPYTHON=$LIBPYTHON
3943if test -z "$LIBPYTHON"; then
3944  LIBPYTHON=-lpython$version
3945fi
3946
3947python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs"
3948AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir)
3949python_moddir=$python_moddir/python$version
3950if test ! -r $python_moddir/copy.py; then
3951  python_moddir=no
3952fi
3953
3954PYTHONMODDIR=$python_moddir
3955
3956AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir)
3957
3958if test x$python_incdir = xno ||  test x$python_libdir = xno ||  test x$python_moddir = xno; then
3959   LIBPYTHON=$kde_orig_LIBPYTHON
3960   test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB=""
3961   test "x$PYTHONINC" = "x-Ino" && PYTHONINC=""
3962   $2
3963else
3964  dnl Note: this test is very weak
3965  kde_python_link_found=no
3966  KDE_TRY_LINK_PYTHON(normal)
3967  KDE_TRY_LINK_PYTHON(m, -lm)
3968  KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
3969  KDE_TRY_LINK_PYTHON(tcl, -ltcl)
3970  KDE_TRY_LINK_PYTHON(db2, -ldb2)
3971  KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm])
3972  KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil])
3973  KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil])
3974  KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3])
3975  KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil])
3976  KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm])
3977  KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [],
3978	[AC_MSG_WARN([it seems, Python depends on another library.
3979    Pleae set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this
3980    and contact the authors to let them know about this problem])
3981	])
3982
3983  LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
3984  AC_SUBST(PYTHONINC)
3985  AC_SUBST(PYTHONLIB)
3986  AC_SUBST(LIBPYTHON)
3987  AC_SUBST(PYTHONMODDIR)
3988  AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python])
3989fi
3990
3991])
3992
3993
3994AC_DEFUN(KDE_CHECK_PYTHON,
3995[
3996  KDE_CHECK_PYTHON_INTERN("2.2",
3997    [KDE_CHECK_PYTHON_INTERN("2.1",
3998      [KDE_CHECK_PYTHON_INTERN("2.0", [ KDE_CHECK_PYTHON_INTERN($1, $2) ])
3999  ])])
4000])
4001
4002AC_DEFUN(KDE_CHECK_STL_SGI,
4003[
4004    AC_MSG_CHECKING([if STL implementation is SGI like])
4005    AC_CACHE_VAL(kde_cv_stl_type_sgi,
4006    [
4007      AC_TRY_COMPILE([
4008#include <string>
4009using namespace std;
4010],[
4011  string astring="Hallo Welt.";
4012  astring.erase(0, 6); // now astring is "Welt"
4013  return 0;
4014], kde_cv_stl_type_sgi=yes,
4015   kde_cv_stl_type_sgi=no)
4016])
4017
4018   AC_MSG_RESULT($kde_cv_stl_type_sgi)
4019
4020   if test "$kde_cv_stl_type_sgi" = "yes"; then
4021	AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI])
4022   fi
4023])
4024
4025AC_DEFUN(KDE_CHECK_STL_HP,
4026[
4027    AC_MSG_CHECKING([if STL implementation is HP like])
4028    AC_CACHE_VAL(kde_cv_stl_type_hp,
4029    [
4030      AC_TRY_COMPILE([
4031#include <string>
4032using namespace std;
4033],[
4034  string astring="Hello World";
4035  astring.remove(0, 6); // now astring is "World"
4036  return 0;
4037], kde_cv_stl_type_hp=yes,
4038   kde_cv_stl_type_hp=no)
4039])
4040   AC_MSG_RESULT($kde_cv_stl_type_hp)
4041
4042   if test "$kde_cv_stl_type_hp" = "yes"; then
4043	AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by HP])
4044   fi
4045])
4046
4047AC_DEFUN(KDE_CHECK_STL,
4048[
4049    AC_LANG_SAVE
4050    AC_LANG_CPLUSPLUS
4051    ac_save_CXXFLAGS="$CXXFLAGS"
4052    CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`"
4053    KDE_CHECK_STL_SGI
4054
4055    if test "$kde_cv_stl_type_sgi" = "no"; then
4056       KDE_CHECK_STL_HP
4057
4058       if test "$kde_cv_stl_type_hp" = "no"; then
4059         AC_MSG_ERROR("no known STL type found - did you forget to install libstdc++[-devel] ?")
4060       fi
4061    fi
4062
4063    CXXFLAGS="$ac_save_CXXFLAGS"
4064    AC_LANG_RESTORE
4065])
4066
4067AC_DEFUN(AC_FIND_QIMGIO,
4068   [AC_REQUIRE([AC_FIND_JPEG])
4069AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
4070AC_MSG_CHECKING([for qimgio])
4071AC_CACHE_VAL(ac_cv_lib_qimgio,
4072[
4073AC_LANG_SAVE
4074AC_LANG_CPLUSPLUS
4075ac_save_LIBS="$LIBS"
4076ac_save_CXXFLAGS="$CXXFLAGS"
4077LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT"
4078CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
4079AC_TRY_RUN(dnl
4080[
4081#include <qimageio.h>
4082#include <qstring.h>
4083int main() {
4084		QString t = "hallo";
4085		t.fill('t');
4086		qInitImageIO();
4087}
4088],
4089            ac_cv_lib_qimgio=yes,
4090            ac_cv_lib_qimgio=no,
4091	    ac_cv_lib_qimgio=no)
4092LIBS="$ac_save_LIBS"
4093CXXFLAGS="$ac_save_CXXFLAGS"
4094AC_LANG_RESTORE
4095])dnl
4096if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
4097  LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
4098  AC_MSG_RESULT(yes)
4099  AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
4100  AC_SUBST(LIBQIMGIO)
4101else
4102  AC_MSG_RESULT(not found)
4103fi
4104])
4105
4106AC_DEFUN(KDE_CHECK_ANSI,
4107[
4108])
4109
4110AC_DEFUN(KDE_CHECK_INSURE,
4111[
4112  AC_ARG_ENABLE(insure, [  --enable-insure             use insure++ for debugging [default=no]],
4113  [
4114  if test $enableval = "no"; dnl
4115	then ac_use_insure="no"
4116	else ac_use_insure="yes"
4117   fi
4118  ], [ac_use_insure="no"])
4119
4120  AC_MSG_CHECKING(if we will use Insure++ to debug)
4121  AC_MSG_RESULT($ac_use_insure)
4122  if test "$ac_use_insure" = "yes"; dnl
4123       then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "????
4124   fi
4125])
4126
4127AC_DEFUN(AM_DISABLE_LIBRARIES,
4128[
4129    AC_PROVIDE([AM_ENABLE_STATIC])
4130    AC_PROVIDE([AM_ENABLE_SHARED])
4131    enable_static=no
4132    enable_shared=yes
4133])
4134
4135
4136AC_DEFUN(AC_CHECK_UTMP_FILE,
4137[
4138    AC_MSG_CHECKING([for utmp file])
4139
4140    AC_CACHE_VAL(kde_cv_utmp_file,
4141    [
4142    kde_cv_utmp_file=no
4143
4144    for ac_file in    \
4145                      \
4146	/var/run/utmp \
4147	/var/adm/utmp \
4148	/etc/utmp     \
4149     ; \
4150    do
4151     if test -r "$ac_file"; then
4152       kde_cv_utmp_file=$ac_file
4153       break
4154     fi
4155    done
4156    ])
4157
4158    if test "$kde_cv_utmp_file" != "no"; then
4159	AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries])
4160	$1
4161	AC_MSG_RESULT($kde_cv_utmp_file)
4162    else
4163    	$2
4164	AC_MSG_RESULT([non found])
4165    fi
4166])
4167
4168
4169AC_DEFUN(KDE_CREATE_SUBDIRSLIST,
4170[
4171
4172DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
4173
4174if test ! -s $srcdir/subdirs; then
4175  dnl Note: Makefile.common creates subdirs, so this is just a fallback
4176  TOPSUBDIRS=""
4177  files=`cd $srcdir && ls -1`
4178  dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
4179  for i in $dirs; do
4180    echo $i >> $srcdir/subdirs
4181  done
4182fi
4183
4184if test -s $srcdir/inst-apps; then
4185  ac_topsubdirs="`cat $srcdir/inst-apps`"
4186else
4187  ac_topsubdirs="`cat $srcdir/subdirs`"
4188fi
4189
4190for i in $ac_topsubdirs; do
4191  AC_MSG_CHECKING([if $i should be compiled])
4192  if test -d $srcdir/$i; then
4193    install_it="yes"
4194    for j in $DO_NOT_COMPILE; do
4195      if test $i = $j; then
4196        install_it="no"
4197      fi
4198    done
4199  else
4200    install_it="no"
4201  fi
4202  AC_MSG_RESULT($install_it)
4203  if test $install_it = "yes"; then
4204    TOPSUBDIRS="$TOPSUBDIRS $i"
4205  fi
4206done
4207
4208AC_SUBST(TOPSUBDIRS)
4209])
4210
4211AC_DEFUN(KDE_CHECK_NAMESPACES,
4212[
4213AC_MSG_CHECKING(whether C++ compiler supports namespaces)
4214AC_LANG_SAVE
4215AC_LANG_CPLUSPLUS
4216AC_TRY_COMPILE([
4217],
4218[
4219namespace Foo {
4220  extern int i;
4221  namespace Bar {
4222    extern int i;
4223  }
4224}
4225
4226int Foo::i = 0;
4227int Foo::Bar::i = 1;
4228],[
4229  AC_MSG_RESULT(yes)
4230  AC_DEFINE(HAVE_NAMESPACES)
4231], [
4232AC_MSG_RESULT(no)
4233])
4234AC_LANG_RESTORE
4235])
4236
4237AC_DEFUN(KDE_CHECK_NEWLIBS,
4238[
4239
4240])
4241
4242dnl ------------------------------------------------------------------------
4243dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
4244dnl ------------------------------------------------------------------------
4245dnl
4246AC_DEFUN(AC_CHECK_S_ISSOCK,
4247[
4248AC_MSG_CHECKING(for S_ISSOCK)
4249AC_CACHE_VAL(ac_cv_have_s_issock,
4250[
4251AC_LANG_SAVE
4252AC_LANG_C
4253AC_TRY_LINK(
4254[
4255#include <sys/stat.h>
4256],
4257[
4258struct stat buff;
4259int b = S_ISSOCK( buff.st_mode );
4260],
4261ac_cv_have_s_issock=yes,
4262ac_cv_have_s_issock=no)
4263AC_LANG_RESTORE
4264])
4265AC_MSG_RESULT($ac_cv_have_s_issock)
4266if test "$ac_cv_have_s_issock" = "yes"; then
4267  AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
4268fi
4269])
4270
4271dnl ------------------------------------------------------------------------
4272dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
4273dnl ------------------------------------------------------------------------
4274dnl
4275AC_DEFUN(AC_CHECK_KDEMAXPATHLEN,
4276[
4277AC_MSG_CHECKING(for MAXPATHLEN)
4278AC_CACHE_VAL(ac_cv_maxpathlen,
4279[
4280AC_LANG_C
4281cat > conftest.$ac_ext <<EOF
4282#ifdef STDC_HEADERS
4283# include <stdlib.h>
4284#endif
4285#include <stdio.h>
4286#include <sys/param.h>
4287#ifndef MAXPATHLEN
4288#define MAXPATHLEN 1024
4289#endif
4290
4291KDE_HELLO MAXPATHLEN
4292
4293EOF
4294
4295ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
4296
4297if AC_TRY_EVAL(ac_try) && test -s conftest.out; then
4298    ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
4299else
4300    ac_cv_maxpathlen=1024
4301fi
4302
4303rm conftest.*
4304
4305])
4306AC_MSG_RESULT($ac_cv_maxpathlen)
4307AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] )
4308])
4309
4310dnl -------------------------------------------------------------------------
4311dnl See if the compiler supports a template repository         bero@redhat.de
4312dnl -------------------------------------------------------------------------
4313AC_DEFUN(KDE_COMPILER_REPO,
4314[
4315  REPO=""
4316  NOREPO=""
4317
4318  KDE_CHECK_COMPILER_FLAG(frepo,
4319   [
4320     REPO="-frepo"
4321     NOREPO="-fno-repo"
4322   ])
4323
4324  if test -z "$REPO"; then
4325  KDE_CHECK_COMPILER_FLAG(instances=explicit,
4326  [
4327     REPO="-instances=explicit"
4328     NOREPO="-instances=extern"
4329  ])
4330  fi
4331
4332  if test -n "$REPO"; then
4333     AC_DEFINE_UNQUOTED(HAVE_TEMPLATE_REPOSITORY, 1,
4334		[C++ compiler supports template repository])
4335     $1
4336  fi
4337
4338  AC_SUBST(REPO)
4339  AC_SUBST(NOREPO)
4340])
4341
4342AC_DEFUN(KDE_CHECK_HEADER,
4343[
4344   AC_LANG_SAVE
4345   kde_safe_cppflags=$CPPFLAGS
4346   CPPFLAGS="$CPPFLAGS $all_includes"
4347   AC_LANG_CPLUSPLUS
4348   AC_CHECK_HEADER($1, $2, $3)
4349   CPPFLAGS=$kde_safe_cppflags
4350   AC_LANG_RESTORE
4351])
4352
4353AC_DEFUN(KDE_FAST_CONFIGURE,
4354[
4355  dnl makes configure fast (needs perl)
4356  AC_ARG_ENABLE(fast-perl, [  --disable-fast-perl     disable fast Makefile generation (needs perl)],
4357      with_fast_perl=$enableval, with_fast_perl=yes)
4358])
4359
4360AC_DEFUN(KDE_CONF_FILES,
4361[
4362  val=
4363  if test -f $srcdir/configure.files ; then
4364    val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files`
4365  fi
4366  CONF_FILES=
4367  if test -n "$val" ; then
4368    for i in $val ; do
4369      CONF_FILES="$CONF_FILES $i"
4370    done
4371  fi
4372  AC_SUBST(CONF_FILES)
4373])dnl
4374
4375AC_DEFUN(KDE_SET_PREFIX,
4376[
4377  unset CDPATH
4378  dnl make $KDEDIR the default for the installation
4379  AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde})
4380
4381  if test "x$prefix" = "xNONE"; then
4382    prefix=$ac_default_prefix
4383    ac_configure_args="$ac_configure_args --prefix=$prefix"
4384  fi
4385  KDE_FAST_CONFIGURE
4386  KDE_CONF_FILES
4387])
4388
4389pushdef([AC_PROG_INSTALL],
4390[
4391  dnl our own version, testing for a -p flag
4392  popdef([AC_PROG_INSTALL])
4393  dnl as AC_PROG_INSTALL works as it works we first have
4394  dnl to save if the user didn't specify INSTALL, as the
4395  dnl autoconf one overwrites INSTALL and we have no chance to find
4396  dnl out afterwards
4397  test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL
4398  test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM
4399  test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT
4400  AC_PROG_INSTALL
4401
4402  if test -z "$kde_save_INSTALL_given" ; then
4403    # OK, user hasn't given any INSTALL, autoconf found one for us
4404    # now we test, if it supports the -p flag
4405    AC_MSG_CHECKING(for -p flag to install)
4406    rm -f confinst.$$.* > /dev/null 2>&1
4407    echo "Testtest" > confinst.$$.orig
4408    ac_res=no
4409    if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
4410      if test -f confinst.$$.new ; then
4411        # OK, -p seems to do no harm to install
4412	INSTALL="${INSTALL} -p"
4413	ac_res=yes
4414      fi
4415    fi
4416    rm -f confinst.$$.*
4417    AC_MSG_RESULT($ac_res)
4418  fi
4419  dnl the following tries to resolve some signs and wonders coming up
4420  dnl with different autoconf/automake versions
4421  dnl e.g.:
4422  dnl  *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
4423  dnl   and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
4424  dnl   it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
4425  dnl  *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
4426  dnl   INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
4427  dnl   install-@DIR@PROGRAMS targets to explicitly use that flag
4428  dnl  *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
4429  dnl   INSTALL_SCRIPT, which breaks with automake <= 1.4
4430  dnl  *autoconf >2.13 (since 10.Apr 1999) has not that failure
4431  dnl  *sometimes KDE does not use the install-@DIR@PROGRAM targets from
4432  dnl   automake (due to broken Makefile.am or whatever) to install programs,
4433  dnl   and so does not see the -s flag in automake > 1.4
4434  dnl to clean up that mess we:
4435  dnl  +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
4436  dnl   which cleans KDE's program with automake > 1.4;
4437  dnl  +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
4438  dnl   with automake<=1.4
4439  dnl  note that dues to this sometimes two '-s' flags are used (if KDE
4440  dnl   properly uses install-@DIR@PROGRAMS, but I don't care
4441  dnl
4442  dnl And to all this comes, that I even can't write in comments variable
4443  dnl  names used by automake, because it is so stupid to think I wanted to
4444  dnl  _use_ them, therefor I have written A_M_... instead of AM_
4445  dnl hmm, I wanted to say something ... ahh yes: Arghhh.
4446
4447  if test -z "$kde_save_INSTALL_PROGRAM_given" ; then
4448    INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
4449  fi
4450  if test -z "$kde_save_INSTALL_SCRIPT_given" ; then
4451    INSTALL_SCRIPT='${INSTALL}'
4452  fi
4453])dnl
4454
4455AC_DEFUN(KDE_LANG_CPLUSPLUS,
4456[AC_LANG_CPLUSPLUS
4457ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
4458pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
4459])
4460
4461pushdef([AC_LANG_CPLUSPLUS],
4462[popdef([AC_LANG_CPLUSPLUS])
4463KDE_LANG_CPLUSPLUS
4464])
4465
4466AC_DEFUN(KDE_CHECK_LONG_LONG,
4467[
4468AC_MSG_CHECKING(for long long)
4469AC_CACHE_VAL(kde_cv_c_long_long,
4470[
4471  AC_LANG_SAVE
4472  AC_LANG_CPLUSPLUS
4473  AC_TRY_LINK([], [
4474  long long foo = 0;
4475  foo = foo+1;
4476  ],
4477  kde_cv_c_long_long=yes, kde_cv_c_long_long=no)
4478  AC_LANG_RESTORE
4479])
4480AC_MSG_RESULT($kde_cv_c_long_long)
4481if test "$kde_cv_c_long_long" = yes; then
4482   AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype])
4483fi
4484])
4485
4486AC_DEFUN(KDE_CHECK_LIB,
4487[
4488     kde_save_LDFLAGS="$LDFLAGS"
4489     dnl AC_CHECK_LIB modifies LIBS, so save it here
4490     kde_save_LIBS="$LIBS"
4491     LDFLAGS="$LDFLAGS $all_libraries"
4492     case $host_os in
4493      aix*) LDFLAGS="-brtl $LDFLAGS"
4494	test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS"
4495	;;
4496     esac
4497     AC_CHECK_LIB($1, $2, $3, $4, $5)
4498     LDFLAGS="$kde_save_LDFLAGS"
4499     LIBS="$kde_save_LIBS"
4500])
4501
4502
4503
4504
4505AC_DEFUN(KDE_CHECK_INITGROUPS,
4506[
4507  AC_REQUIRE([AC_CANONICAL_HOST])
4508  AC_CHECK_FUNCS(initgroups)
4509  if test "x$ac_cv_func_initgroups" = "xyes"; then
4510    case $host_os in
4511      aix*) AC_LANG_SAVE
4512            AC_LANG_CPLUSPLUS
4513            AC_MSG_CHECKING([for initgroups prototype])
4514            AC_CACHE_VAL(kde_cv_check_initgroups_proto,
4515            [ AC_TRY_COMPILE(
4516              [ #include <grp.h>
4517              ],
4518              [ char buffer[10];
4519                gid_t id;
4520                int x = initgroups(buffer,id);
4521              ],
4522              kde_cv_check_initgroups_proto=yes,
4523              kde_cv_check_initgroups_proto=no)
4524            ])
4525            AC_MSG_RESULT($kde_cv_check_initgroups_proto)
4526            AC_LANG_RESTORE
4527            ;;
4528      *)
4529            kde_cv_check_initgroups_proto=yes
4530            ;;
4531    esac
4532  else
4533    kde_cv_check_initgroups_proto=no
4534  fi
4535  if test "x$kde_cv_check_initgroups_proto" = "xyes"; then
4536    kde_check_initgroups_proto=1
4537  else
4538    kde_check_initgroups_proto=0
4539  fi
4540  AC_DEFINE_UNQUOTED(HAVE_INITGROUPS_PROTO,$kde_check_initgroups_proto,
4541           [initgroups may exist but not its prototype (e.g. AIX<4.3.3:8)])
4542])
4543
4544
4545AC_DEFUN(KDE_CHECK_JAVA_DIR,
4546[
4547AC_MSG_CHECKING([for Java directory])
4548
4549AC_ARG_WITH(java,
4550[  --with-java=javadir     use java installed in javadir, --without-java disables ],
4551[  ac_java_dir=$withval
4552], ac_java_dir=""
4553)
4554
4555dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH
4556if test "x$ac_java_dir" = "xno"; then
4557   kde_cv_java_bindir=no
4558   kde_cv_java_includedir=no
4559   kde_java_libjvmdir=no
4560   kde_java_libhpidir=no
4561else
4562  if test "x$ac_java_dir" = "x"; then
4563    dnl No option set -> look in $PATH
4564    AC_CACHE_VAL(kde_cv_java_bindir,
4565    [
4566      dnl First look for javac in $PATH. If not found we'll look at the option.
4567      KDE_FIND_PATH(javac, JAVAC, [], [])
4568      if test -n "$JAVAC"; then
4569          kde_cv_java_bindir=`echo $JAVAC | sed -e 's,/javac$,/,'`
4570          dnl this substitution might not work - well, we test for jni.h below
4571          kde_cv_java_includedir=`echo $kde_cv_java_bindir | sed -e 's,bin/$,include/,'`
4572      else
4573          kde_cv_java_bindir=no
4574      fi
4575    ])
4576  else
4577    dnl config option set
4578    kde_cv_java_bindir=$ac_java_dir/bin
4579    kde_cv_java_includedir=$ac_java_dir/include
4580  fi
4581fi
4582
4583dnl At this point kde_cv_java_bindir and kde_cv_java_includedir are either set or "no"
4584if test "x$kde_cv_java_bindir" != "xno"; then
4585
4586  dnl Look for libjvm.so
4587  kde_java_libjvmdir=`find $kde_cv_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
4588  dnl Look for libhpi.so and avoid green threads
4589  kde_java_libhpidir=`find $kde_cv_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,'`
4590
4591  dnl Now check everything's fine under there
4592
4593  if test ! -x "$kde_cv_java_bindir/javac"; then
4594    AC_MSG_ERROR([javac not found under $kde_cv_java_bindir - it seems you passed a wrong --with-java.])
4595  fi
4596  if test ! -x "$kde_cv_java_bindir/javah"; then
4597    AC_MSG_ERROR([javah not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.])
4598  fi
4599  if test ! -x "$kde_cv_java_bindir/jar"; then
4600    AC_MSG_ERROR([jar not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.])
4601  fi
4602  if test ! -r "$kde_cv_java_includedir/jni.h"; then
4603    AC_MSG_ERROR([jni.h not found under $kde_cv_java_includedir. Use --with-java or --without-java.])
4604  fi
4605  if test ! -r "$kde_java_libjvmdir/libjvm.so"; then
4606    AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.])
4607  fi
4608  if test ! -r "$kde_java_libhpidir/libhpi.so"; then
4609    AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.])
4610  fi
4611
4612  jni_includes="-I$kde_cv_java_includedir"
4613  dnl Strange thing, jni.h requires jni_md.h which is under genunix here..
4614  dnl and under linux here..
4615  test -d "$kde_cv_java_includedir/linux" && jni_includes="$jni_includes -I$kde_cv_java_includedir/linux"
4616  test -d "$kde_cv_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_cv_java_includedir/genunix"
4617
4618  dnl Check for JNI version
4619  AC_LANG_SAVE
4620  AC_LANG_CPLUSPLUS
4621  ac_cxxflags_safe="$CXXFLAGS"
4622  CXXFLAGS="$CXXFLAGS $all_includes $jni_includes"
4623
4624  AC_TRY_COMPILE([
4625#include <jni.h>
4626	    ],
4627	    [
4628#ifndef JNI_VERSION_1_2
4629Syntax Error
4630#endif
4631	    ],[ kde_jni_works=yes ],
4632            [ kde_jni_works=no ])
4633
4634  if test $kde_jni_works = no; then
4635    AC_MSG_ERROR([Incorrect version of $kde_cv_java_includedir/jni.h.
4636	          You need to have Java Development Kit (JDK) version 1.2.
4637
4638	          Use --with-java to specify another location.
4639	          Use --without-java to configure without java support.
4640        	  Or download a newer JDK and try again.
4641	          See e.g. http://java.sun.com/products/jdk/1.2 ])
4642  fi
4643
4644  CXXFLAGS="$ac_cxxflags_safe"
4645  AC_LANG_RESTORE
4646
4647  dnl All tests ok, inform and subst the variables
4648  AC_MSG_RESULT([javac/javah/jar in $kde_cv_java_bindir, jni.h in $kde_cv_java_includedir])
4649
4650  JAVAC=$kde_cv_java_bindir/javac
4651  AC_SUBST(JAVAC)
4652  JAVAH=$kde_cv_java_bindir/javah
4653  AC_SUBST(JAVAH)
4654  JAR=$kde_cv_java_bindir/jar
4655  AC_SUBST(JAR)
4656  AC_SUBST(jni_includes)
4657  JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi"
4658  AC_SUBST(JVMLIBS)
4659fi
4660])
4661
4662dnl this is a redefinition of autoconf 2.5x's AC_FOREACH.
4663dnl When the argument list becomes big, as in KDE for AC_OUTPUT in
4664dnl big packages, m4_foreach is dog-slow.  So use our own version of
4665dnl it.  (matz@kde.org)
4666m4_define([mm_foreach],
4667[m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])])
4668m4_define([mm_car], [[$1]])
4669m4_define([mm_car2], [[$@]])
4670m4_define([_mm_foreach],
4671[m4_if(m4_quote($2), [], [],
4672       [m4_define([$1], [mm_car($2)])$3[]_mm_foreach([$1],
4673                                                     mm_car2(m4_shift($2)),
4674                                                     [$3])])])
4675m4_define([AC_FOREACH],
4676[mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])])
4677
4678AC_DEFUN(KDE_NEED_FLEX,
4679[
4680kde_libs_safe=$LIBS
4681LIBS="$LIBS $USER_LDFLAGS"
4682AM_PROG_LEX
4683LIBS=$kde_libs_safe
4684if test -z "$LEXLIB"; then
4685    AC_MSG_ERROR([You need to have flex installed.])
4686fi
4687AC_SUBST(LEXLIB)
4688])
4689
4690AC_DEFUN(AC_PATH_QTOPIA,
4691[
4692  dnl TODO: use AC_CACHE_VAL
4693
4694  if test -z "$1"; then
4695    qtopia_minver_maj=1
4696    qtopia_minver_min=5
4697    qtopia_minver_pat=0
4698  else
4699    qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"`
4700    qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"`
4701    qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"`
4702  fi
4703
4704  qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat"
4705  qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat"
4706
4707  AC_REQUIRE([AC_PATH_QT])
4708
4709  AC_MSG_CHECKING([for Qtopia])
4710
4711  LIB_QTOPIA="-lqpe"
4712  AC_SUBST(LIB_QTOPIA)
4713
4714  kde_qtopia_dirs="$QPEDIR /opt/Qtopia"
4715
4716  ac_qtopia_incdir=NO
4717
4718  AC_ARG_WITH(qtopia-dir,
4719              [  --with-qtopia-dir=DIR   where the root of Qtopia is installed ],
4720              [  ac_qtopia_incdir="$withval"/include] )
4721
4722  qtopia_incdirs=""
4723  for dir in $kde_qtopia_dirs; do
4724    qtopia_incdirs="$qtopia_incdirs $dir/include"
4725  done
4726
4727  if test ! "$ac_qtopia_incdir" = "NO"; then
4728    qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs"
4729  fi
4730
4731  qtopia_incdir=""
4732  AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir)
4733  ac_qtopia_incdir="$qtopia_incdir"
4734
4735  if test -z "$qtopia_incdir"; then
4736    AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.])
4737  fi
4738
4739  qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`;
4740  qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`;
4741  qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`;
4742
4743  qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat"
4744  qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat"
4745  if test "$qtopia_ver" -lt "$qtopia_minver"; then
4746    AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr
4747is required.])
4748  fi
4749
4750  AC_LANG_SAVE
4751  AC_LANG_CPLUSPLUS
4752
4753  ac_cxxflags_safe="$CXXFLAGS"
4754  ac_ldflags_safe="$LDFLAGS"
4755  ac_libs_safe="$LIBS"
4756
4757  CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes"
4758  LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
4759  LIBS="$LIBS $LIB_QTOPIA $LIBQT"
4760
4761  cat > conftest.$ac_ext <<EOF
4762#include "confdefs.h"
4763#include <qpe/qpeapplication.h>
4764#include <qpe/version.h>
4765
4766int main( int argc, char **argv )
4767{
4768    QPEApplication app( argc, argv );
4769    return 0;
4770}
4771EOF
4772
4773  if AC_TRY_EVAL(ac_link) && test -s conftest; then
4774    rm -f conftest*
4775  else
4776    rm -f conftest*
4777    AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at
4778the end of config.log])
4779  fi
4780
4781  CXXFLAGS="$ac_cxxflags_safe"
4782  LDFLAGS="$ac_ldflags_safe"
4783  LIBS="$ac_libs_safe"
4784
4785  AC_LANG_RESTORE
4786
4787  QTOPIA_INCLUDES="-I$qtopia_incdir"
4788  AC_SUBST(QTOPIA_INCLUDES)
4789
4790  AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir])
4791])
4792
4793AC_DEFUN(AC_CHECK_C_COMPILER,
4794[
4795  AC_ARG_ENABLE(debug,[  --enable-debug          enables debug symbols [default=no]],
4796  [
4797   if test $enableval = "no"; dnl
4798     then
4799       kde_use_debug_code="no"
4800       kde_use_debug_define=yes
4801     else
4802       kde_use_debug_code="yes"
4803       kde_use_debug_define=no
4804   fi
4805  ],
4806    [kde_use_debug_code="no"
4807      kde_use_debug_define=no
4808  ])
4809
4810  dnl Just for configure --help
4811  AC_ARG_ENABLE(dummyoption,[  --disable-debug         disables debug output and debug symbols [default=no]],[],[])
4812
4813  AC_ARG_ENABLE(strict,[  --enable-strict         compiles with strict compiler options (may not work!)],
4814   [
4815    if test $enableval = "no"; then
4816         kde_use_strict_options="no"
4817       else
4818         kde_use_strict_options="yes"
4819    fi
4820   ], [kde_use_strict_options="no"])
4821
4822  AC_ARG_ENABLE(profile,[  --enable-profile        creates profiling infos [default=no]],
4823    [kde_use_profiling=$enableval],
4824    [kde_use_profiling="no"]
4825  )
4826
4827  dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
4828  CFLAGS=" $CFLAGS"
4829
4830  AC_PROG_CC
4831
4832  if test "$GCC" = "yes"; then
4833    if test "$kde_use_debug_code" = "yes"; then
4834      CFLAGS="-g -O2 $CFLAGS"
4835      case $host in
4836        *-*-linux-gnu)
4837          CFLAGS="-ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS"
4838        ;;
4839      esac
4840    else
4841      CFLAGS="-O2 $CFLAGS"
4842    fi
4843  fi
4844
4845  if test "$kde_use_debug_define" = "yes"; then
4846    CFLAGS="-DNDEBUG $CFLAGS"
4847  fi
4848
4849  case "$host" in
4850  *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";;
4851  *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";;
4852  esac
4853
4854  if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
4855     LDFLAGS=""
4856  fi
4857
4858  if test "$kde_use_profiling" = "yes"; then
4859    KDE_CHECK_COMPILER_FLAG(pg,
4860    [
4861      CFLAGS="-pg $CFLAGS"
4862    ])
4863  fi
4864
4865  USE_EXCEPTIONS=
4866  AC_SUBST(USE_EXCEPTIONS)
4867  dnl obsolete macro - provided to keep things going
4868  USE_RTTI=
4869  AC_SUBST(USE_RTTI)
4870
4871  AC_PROG_CPP
4872
4873  # the following is to allow programs, that are known to
4874  # have problems when compiled with -O2
4875  if test -n "$CFLAGS"; then
4876      kde_safe_IFS=$IFS
4877      IFS=" "
4878      NOOPT_CFLAGS=""
4879      for i in $CFLAGS; do
4880        case $i in
4881          -O*)
4882                ;;
4883          *)
4884                NOOPT_CFLAGS="$NOOPT_CFLAGS $i"
4885                ;;
4886        esac
4887      done
4888      IFS=$kde_safe_IFS
4889  fi
4890
4891  AC_SUBST(NOOPT_CFLAGS)
4892
4893  KDE_CHECK_FINAL
4894
4895  ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDEV_ADD_DEPENDENCIES]), [])
4896
4897  KDE_CXXFLAGS=
4898  AC_SUBST(KDE_CXXFLAGS)
4899])
4900
4901AC_DEFUN(KDEV_ADD_DEPENDENCIES,
4902[
4903   [A]M_DEPENDENCIES(CC)
4904])
4905
4906
4907dnl just a wrapper to clean up configure.in only for c projects
4908AC_DEFUN(KDEV_PROG_LIBTOOL,
4909[
4910AC_REQUIRE([AC_CHECK_C_COMPILER])
4911AC_REQUIRE([AC_ENABLE_SHARED])
4912AC_REQUIRE([AC_ENABLE_STATIC])
4913
4914AC_REQUIRE([AC_LIBTOOL_DLOPEN])
4915
4916AC_LANG_SAVE
4917AC_LANG_C
4918AC_OBJEXT
4919AC_EXEEXT
4920AC_LANG_RESTORE
4921
4922AM_PROG_LIBTOOL
4923AC_LIBTOOL_SETUP
4924
4925LIBTOOL_SHELL="/bin/sh ./libtool"
4926#  LIBTOOL="$LIBTOOL --silent"
4927])
4928
4929
4930# serial 46 AC_PROG_LIBTOOL
4931AC_DEFUN([AC_PROG_LIBTOOL],
4932[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
4933dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
4934dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
4935  AC_PROVIDE_IFELSE([AC_PROG_CXX],
4936    [AC_LIBTOOL_CXX],
4937    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
4938])])
4939
4940dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
4941dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
4942dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
4943  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
4944    [AC_LIBTOOL_GCJ],
4945    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
4946        [AC_LIBTOOL_GCJ],
4947	[AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
4948	  [AC_LIBTOOL_GCJ],
4949	[ifdef([AC_PROG_GCJ],
4950	       [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ
4951])])
4952	 ifdef([A][M_PROG_GCJ],
4953	       [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ
4954])])
4955	 ifdef([LT_AC_PROG_GCJ],
4956	       [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ
4957])])])])])])
4958
4959AC_DEFUN([_AC_PROG_LIBTOOL],
4960[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
4961AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
4962AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
4963
4964# Save cache, so that ltconfig can load it
4965AC_CACHE_SAVE
4966
4967# Actually configure libtool.  ac_aux_dir is where install-sh is found.
4968AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
4969MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
4970LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
4971AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
4972objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
4973deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
4974${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
4975$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
4976|| AC_MSG_ERROR([libtool configure failed])
4977
4978# Reload cache, that may have been modified by ltconfig
4979AC_CACHE_LOAD
4980
4981# This can be used to rebuild libtool when needed
4982LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh"
4983
4984# Always use our own libtool.
4985LIBTOOL='$(SHELL) $(top_builddir)/libtool'
4986AC_SUBST(LIBTOOL)dnl
4987
4988# Redirect the config.log output again, so that the ltconfig log is not
4989# clobbered by the next message.
4990exec 5>>./config.log
4991])
4992
4993AC_DEFUN([AC_LIBTOOL_SETUP],
4994[AC_PREREQ(2.13)dnl
4995AC_REQUIRE([AC_ENABLE_SHARED])dnl
4996AC_REQUIRE([AC_ENABLE_STATIC])dnl
4997AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
4998AC_REQUIRE([AC_CANONICAL_HOST])dnl
4999AC_REQUIRE([AC_CANONICAL_BUILD])dnl
5000AC_REQUIRE([AC_PROG_CC])dnl
5001AC_REQUIRE([AC_PROG_LD])dnl
5002AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
5003AC_REQUIRE([AC_PROG_NM])dnl
5004AC_REQUIRE([AC_PROG_LN_S])dnl
5005AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
5006# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
5007AC_REQUIRE([AC_OBJEXT])dnl
5008AC_REQUIRE([AC_EXEEXT])dnl
5009dnl
5010
5011# Only perform the check for file, if the check method requires it
5012case $deplibs_check_method in
5013file_magic*)
5014  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
5015    AC_PATH_MAGIC
5016  fi
5017  ;;
5018esac
5019
5020AC_CHECK_TOOL(RANLIB, ranlib, :)
5021AC_CHECK_TOOL(STRIP, strip, :)
5022
5023# Check for any special flags to pass to ltconfig.
5024libtool_flags="--cache-file=$cache_file"
5025test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
5026test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
5027test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
5028test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
5029test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
5030ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
5031[libtool_flags="$libtool_flags --enable-dlopen"])
5032ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
5033[libtool_flags="$libtool_flags --enable-win32-dll"])
5034AC_ARG_ENABLE(libtool-lock,
5035  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
5036test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
5037test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
5038
5039AC_ARG_WITH(pic,
5040  [  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
5041     pic_mode="$withval", pic_mode=default)
5042test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
5043test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
5044
5045# Some flags need to be propagated to the compiler or linker for good
5046# libtool support.
5047case $host in
5048*-*-irix6*)
5049  # Find out which ABI we are using.
5050  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
5051  if AC_TRY_EVAL(ac_compile); then
5052    case `/usr/bin/file conftest.$ac_objext` in
5053    *32-bit*)
5054      LD="${LD-ld} -32"
5055      ;;
5056    *N32*)
5057      LD="${LD-ld} -n32"
5058      ;;
5059    *64-bit*)
5060      LD="${LD-ld} -64"
5061      ;;
5062    esac
5063  fi
5064  rm -rf conftest*
5065  ;;
5066
5067*-*-sco3.2v5*)
5068  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
5069  SAVE_CFLAGS="$CFLAGS"
5070  CFLAGS="$CFLAGS -belf"
5071  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
5072    [AC_LANG_SAVE
5073     AC_LANG_C
5074     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
5075     AC_LANG_RESTORE])
5076  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
5077    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
5078    CFLAGS="$SAVE_CFLAGS"
5079  fi
5080  ;;
5081
5082ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
5083[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
5084  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
5085  AC_CHECK_TOOL(AS, as, false)
5086  AC_CHECK_TOOL(OBJDUMP, objdump, false)
5087
5088  # recent cygwin and mingw systems supply a stub DllMain which the user
5089  # can override, but on older systems we have to supply one
5090  AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
5091    [AC_TRY_LINK([],
5092      [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
5093      DllMain (0, 0, 0);],
5094      [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
5095
5096  case $host/$CC in
5097  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
5098    # old mingw systems require "-dll" to link a DLL, while more recent ones
5099    # require "-mdll"
5100    SAVE_CFLAGS="$CFLAGS"
5101    CFLAGS="$CFLAGS -mdll"
5102    AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
5103      [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
5104    CFLAGS="$SAVE_CFLAGS" ;;
5105  *-*-cygwin* | *-*-pw32*)
5106    # cygwin systems need to pass --dll to the linker, and not link
5107    # crt.o which will require a WinMain@16 definition.
5108    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
5109  esac
5110  ;;
5111  ])
5112esac
5113])
5114
5115# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
5116AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
5117
5118# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
5119AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
5120
5121# AC_ENABLE_SHARED - implement the --enable-shared flag
5122# Usage: AC_ENABLE_SHARED[(DEFAULT)]
5123#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
5124#   `yes'.
5125AC_DEFUN([AC_ENABLE_SHARED],
5126[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
5127AC_ARG_ENABLE(shared,
5128changequote(<<, >>)dnl
5129<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
5130changequote([, ])dnl
5131[p=${PACKAGE-default}
5132case $enableval in
5133yes) enable_shared=yes ;;
5134no) enable_shared=no ;;
5135*)
5136  enable_shared=no
5137  # Look at the argument we got.  We use all the common list separators.
5138  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
5139  for pkg in $enableval; do
5140    if test "X$pkg" = "X$p"; then
5141      enable_shared=yes
5142    fi
5143  done
5144  IFS="$ac_save_ifs"
5145  ;;
5146esac],
5147enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
5148])
5149
5150# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
5151AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
5152AC_ENABLE_SHARED(no)])
5153
5154# AC_ENABLE_STATIC - implement the --enable-static flag
5155# Usage: AC_ENABLE_STATIC[(DEFAULT)]
5156#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
5157#   `yes'.
5158AC_DEFUN([AC_ENABLE_STATIC],
5159[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
5160AC_ARG_ENABLE(static,
5161changequote(<<, >>)dnl
5162<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
5163changequote([, ])dnl
5164[p=${PACKAGE-default}
5165case $enableval in
5166yes) enable_static=yes ;;
5167no) enable_static=no ;;
5168*)
5169  enable_static=no
5170  # Look at the argument we got.  We use all the common list separators.
5171  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
5172  for pkg in $enableval; do
5173    if test "X$pkg" = "X$p"; then
5174      enable_static=yes
5175    fi
5176  done
5177  IFS="$ac_save_ifs"
5178  ;;
5179esac],
5180enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
5181])
5182
5183# AC_DISABLE_STATIC - set the default static flag to --disable-static
5184AC_DEFUN([AC_DISABLE_STATIC],
5185[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
5186AC_ENABLE_STATIC(no)])
5187
5188
5189# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
5190# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
5191#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
5192#   `yes'.
5193AC_DEFUN([AC_ENABLE_FAST_INSTALL],
5194[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
5195AC_ARG_ENABLE(fast-install,
5196changequote(<<, >>)dnl
5197<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
5198changequote([, ])dnl
5199[p=${PACKAGE-default}
5200case $enableval in
5201yes) enable_fast_install=yes ;;
5202no) enable_fast_install=no ;;
5203*)
5204  enable_fast_install=no
5205  # Look at the argument we got.  We use all the common list separators.
5206  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
5207  for pkg in $enableval; do
5208    if test "X$pkg" = "X$p"; then
5209      enable_fast_install=yes
5210    fi
5211  done
5212  IFS="$ac_save_ifs"
5213  ;;
5214esac],
5215enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
5216])
5217
5218# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
5219AC_DEFUN([AC_DISABLE_FAST_INSTALL],
5220[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
5221AC_ENABLE_FAST_INSTALL(no)])
5222
5223# AC_LIBTOOL_PICMODE - implement the --with-pic flag
5224# Usage: AC_LIBTOOL_PICMODE[(MODE)]
5225#   Where MODE is either `yes' or `no'.  If omitted, it defaults to
5226#   `both'.
5227AC_DEFUN([AC_LIBTOOL_PICMODE],
5228[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
5229pic_mode=ifelse($#,1,$1,default)])
5230
5231
5232# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
5233AC_DEFUN([AC_PATH_TOOL_PREFIX],
5234[AC_MSG_CHECKING([for $1])
5235AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
5236[case $MAGIC_CMD in
5237  /*)
5238  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
5239  ;;
5240  ?:/*)
5241  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
5242  ;;
5243  *)
5244  ac_save_MAGIC_CMD="$MAGIC_CMD"
5245  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
5246dnl $ac_dummy forces splitting on constant user-supplied paths.
5247dnl POSIX.2 word splitting is done only on the output of word expansions,
5248dnl not every word.  This closes a longstanding sh security hole.
5249  ac_dummy="ifelse([$2], , $PATH, [$2])"
5250  for ac_dir in $ac_dummy; do
5251    test -z "$ac_dir" && ac_dir=.
5252    if test -f $ac_dir/$1; then
5253      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
5254      if test -n "$file_magic_test_file"; then
5255	case $deplibs_check_method in
5256	"file_magic "*)
5257	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
5258	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
5259	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
5260	    egrep "$file_magic_regex" > /dev/null; then
5261	    :
5262	  else
5263	    cat <<EOF 1>&2
5264
5265*** Warning: the command libtool uses to detect shared libraries,
5266*** $file_magic_cmd, produces output that libtool cannot recognize.
5267*** The result is that libtool may fail to recognize shared libraries
5268*** as such.  This will affect the creation of libtool libraries that
5269*** depend on shared libraries, but programs linked with such libtool
5270*** libraries will work regardless of this problem.  Nevertheless, you
5271*** may want to report the problem to your system manager and/or to
5272*** bug-libtool@gnu.org
5273
5274EOF
5275	  fi ;;
5276	esac
5277      fi
5278      break
5279    fi
5280  done
5281  IFS="$ac_save_ifs"
5282  MAGIC_CMD="$ac_save_MAGIC_CMD"
5283  ;;
5284esac])
5285MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
5286if test -n "$MAGIC_CMD"; then
5287  AC_MSG_RESULT($MAGIC_CMD)
5288else
5289  AC_MSG_RESULT(no)
5290fi
5291])
5292
5293
5294# AC_PATH_MAGIC - find a file program which can recognise a shared library
5295AC_DEFUN([AC_PATH_MAGIC],
5296[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
5297AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
5298if test -z "$lt_cv_path_MAGIC_CMD"; then
5299  if test -n "$ac_tool_prefix"; then
5300    AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
5301  else
5302    MAGIC_CMD=:
5303  fi
5304fi
5305])
5306
5307
5308# AC_PROG_LD - find the path to the GNU or non-GNU linker
5309AC_DEFUN([AC_PROG_LD],
5310[AC_ARG_WITH(gnu-ld,
5311[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
5312test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
5313AC_REQUIRE([AC_PROG_CC])dnl
5314AC_REQUIRE([AC_CANONICAL_HOST])dnl
5315AC_REQUIRE([AC_CANONICAL_BUILD])dnl
5316ac_prog=ld
5317if test "$GCC" = yes; then
5318  # Check if gcc -print-prog-name=ld gives a path.
5319  AC_MSG_CHECKING([for ld used by GCC])
5320  case $host in
5321  *-*-mingw*)
5322    # gcc leaves a trailing carriage return which upsets mingw
5323    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
5324  *)
5325    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
5326  esac
5327  case $ac_prog in
5328    # Accept absolute paths.
5329    [[\\/]* | [A-Za-z]:[\\/]*)]
5330      re_direlt=['/[^/][^/]*/\.\./']
5331      # Canonicalize the path of ld
5332      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
5333      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
5334	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
5335      done
5336      test -z "$LD" && LD="$ac_prog"
5337      ;;
5338  "")
5339    # If it fails, then pretend we aren't using GCC.
5340    ac_prog=ld
5341    ;;
5342  *)
5343    # If it is relative, then search for the first ld in PATH.
5344    with_gnu_ld=unknown
5345    ;;
5346  esac
5347elif test "$with_gnu_ld" = yes; then
5348  AC_MSG_CHECKING([for GNU ld])
5349else
5350  AC_MSG_CHECKING([for non-GNU ld])
5351fi
5352AC_CACHE_VAL(lt_cv_path_LD,
5353[if test -z "$LD"; then
5354  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
5355  for ac_dir in $PATH; do
5356    test -z "$ac_dir" && ac_dir=.
5357    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
5358      lt_cv_path_LD="$ac_dir/$ac_prog"
5359      # Check to see if the program is GNU ld.  I'd rather use --version,
5360      # but apparently some GNU ld's only accept -v.
5361      # Break only if it was the GNU/non-GNU ld that we prefer.
5362      if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
5363	test "$with_gnu_ld" != no && break
5364      else
5365	test "$with_gnu_ld" != yes && break
5366      fi
5367    fi
5368  done
5369  IFS="$ac_save_ifs"
5370else
5371  lt_cv_path_LD="$LD" # Let the user override the test with a path.
5372fi])
5373LD="$lt_cv_path_LD"
5374if test -n "$LD"; then
5375  AC_MSG_RESULT($LD)
5376else
5377  AC_MSG_RESULT(no)
5378fi
5379test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
5380AC_PROG_LD_GNU
5381])
5382
5383AC_DEFUN([AC_PROG_LD_GNU],
5384[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
5385[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
5386if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
5387  lt_cv_prog_gnu_ld=yes
5388else
5389  lt_cv_prog_gnu_ld=no
5390fi])
5391with_gnu_ld=$lt_cv_prog_gnu_ld
5392])
5393
5394# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
5395#   -- PORTME Some linkers may need a different reload flag.
5396AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
5397[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
5398[lt_cv_ld_reload_flag='-r'])
5399reload_flag=$lt_cv_ld_reload_flag
5400test -n "$reload_flag" && reload_flag=" $reload_flag"
5401])
5402
5403# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
5404#  -- PORTME fill in with the dynamic library characteristics
5405AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
5406[AC_CACHE_CHECK([how to recognise dependant libraries],
5407lt_cv_deplibs_check_method,
5408[lt_cv_file_magic_cmd='$MAGIC_CMD'
5409lt_cv_file_magic_test_file=
5410lt_cv_deplibs_check_method='unknown'
5411# Need to set the preceding variable on all platforms that support
5412# interlibrary dependencies.
5413# 'none' -- dependencies not supported.
5414# `unknown' -- same as none, but documents that we really don't know.
5415# 'pass_all' -- all dependencies passed with no checks.
5416# 'test_compile' -- check by making test program.
5417# 'file_magic [regex]' -- check by looking for files in library path
5418# which responds to the $file_magic_cmd with a given egrep regex.
5419# If you have `file' or equivalent on your system and you're not sure
5420# whether `pass_all' will *always* work, you probably want this one.
5421
5422case $host_os in
5423aix*)
5424  lt_cv_deplibs_check_method=pass_all
5425  ;;
5426
5427beos*)
5428  lt_cv_deplibs_check_method=pass_all
5429  ;;
5430
5431bsdi4*)
5432  lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)']
5433  lt_cv_file_magic_cmd='/usr/bin/file -L'
5434  lt_cv_file_magic_test_file=/shlib/libc.so
5435  ;;
5436
5437cygwin* | mingw* |pw32*)
5438  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
5439  lt_cv_file_magic_cmd='$OBJDUMP -f'
5440  ;;
5441
5442darwin* | rhapsody*)
5443  lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
5444  lt_cv_file_magic_cmd='/usr/bin/file -L'
5445  case "$host_os" in
5446  rhapsody* | darwin1.[012])
5447    lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
5448    ;;
5449  *) # Darwin 1.3 on
5450    lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
5451    ;;
5452  esac
5453  ;;
5454
5455freebsd* )
5456  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
5457    case $host_cpu in
5458    i*86 )
5459      # Not sure whether the presence of OpenBSD here was a mistake.
5460      # Let's accept both of them until this is cleared up.
5461      lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library']
5462      lt_cv_file_magic_cmd=/usr/bin/file
5463      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
5464      ;;
5465    esac
5466  else
5467    lt_cv_deplibs_check_method=pass_all
5468  fi
5469  ;;
5470
5471gnu*)
5472  lt_cv_deplibs_check_method=pass_all
5473  ;;
5474
5475hpux10.20*|hpux11*)
5476  lt_cv_deplibs_check_method=['file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library']
5477  lt_cv_file_magic_cmd=/usr/bin/file
5478  lt_cv_file_magic_test_file=/usr/lib/libc.sl
5479  ;;
5480
5481irix5* | irix6*)
5482  case $host_os in
5483  irix5*)
5484    # this will be overridden with pass_all, but let us keep it just in case
5485    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
5486    ;;
5487  *)
5488    case $LD in
5489    *-32|*"-32 ") libmagic=32-bit;;
5490    *-n32|*"-n32 ") libmagic=N32;;
5491    *-64|*"-64 ") libmagic=64-bit;;
5492    *) libmagic=never-match;;
5493    esac
5494    # this will be overridden with pass_all, but let us keep it just in case
5495    lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"]
5496    ;;
5497  esac
5498  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
5499  lt_cv_deplibs_check_method=pass_all
5500  ;;
5501
5502# This must be Linux ELF.
5503linux*)
5504  case $host_cpu in
5505  alpha* | i*86 | powerpc* | sparc* | ia64* | s390* | m68k* | arm* | mips* | hppa* | sh* )
5506    lt_cv_deplibs_check_method=pass_all ;;
5507  *)
5508    # glibc up to 2.1.1 does not perform some relocations on ARM
5509    lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;;
5510  esac
5511  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
5512  ;;
5513
5514netbsd*)
5515  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
5516    [lt_cv_deplibs_check_method='file_magic NetBSD/[a-z0-9]* demand paged shared library']
5517  else
5518    [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object']
5519  fi
5520  lt_cv_file_magic_cmd='/usr/bin/file -L'
5521  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
5522  ;;
5523
5524openbsd* )
5525  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
5526    case "$host_cpu" in
5527    i*86 )
5528      changequote(,)dnl
5529      lt_cv_deplibs_check_method='file_magic OpenBSD/i[3-9]86 demand paged shared library'
5530      changequote([, ])dnl
5531      lt_cv_file_magic_cmd=/usr/bin/file
5532      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
5533      ;;
5534    esac
5535  else
5536    lt_cv_deplibs_check_method=pass_all
5537  fi
5538  ;;
5539
5540newsos6)
5541  [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)']
5542  lt_cv_file_magic_cmd=/usr/bin/file
5543  lt_cv_file_magic_test_file=/usr/lib/libnls.so
5544  ;;
5545
5546osf3* | osf4* | osf5*)
5547  # this will be overridden with pass_all, but let us keep it just in case
5548  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
5549  lt_cv_file_magic_test_file=/shlib/libc.so
5550  lt_cv_deplibs_check_method=pass_all
5551  ;;
5552
5553sco3.2v5*)
5554  lt_cv_deplibs_check_method=pass_all
5555  ;;
5556
5557solaris*)
5558  lt_cv_deplibs_check_method=pass_all
5559  lt_cv_file_magic_test_file=/lib/libc.so
5560  ;;
5561
5562sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
5563  case $host_vendor in
5564  ncr)
5565    lt_cv_deplibs_check_method=pass_all
5566    ;;
5567  motorola)
5568    lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]']
5569    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
5570    ;;
5571  esac
5572  ;;
5573esac
5574])
5575file_magic_cmd=$lt_cv_file_magic_cmd
5576deplibs_check_method=$lt_cv_deplibs_check_method
5577])
5578
5579
5580# AC_PROG_NM - find the path to a BSD-compatible name lister
5581AC_DEFUN([AC_PROG_NM],
5582[AC_MSG_CHECKING([for BSD-compatible nm])
5583AC_CACHE_VAL(lt_cv_path_NM,
5584[if test -n "$NM"; then
5585  # Let the user override the test.
5586  lt_cv_path_NM="$NM"
5587else
5588  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
5589  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
5590    test -z "$ac_dir" && ac_dir=.
5591    tmp_nm=$ac_dir/${ac_tool_prefix}nm
5592    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
5593      # Check to see if the nm accepts a BSD-compat flag.
5594      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
5595      #   nm: unknown option "B" ignored
5596      # Tru64's nm complains that /dev/null is an invalid object file
5597      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
5598	lt_cv_path_NM="$tmp_nm -B"
5599	break
5600      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
5601	lt_cv_path_NM="$tmp_nm -p"
5602	break
5603      else
5604	lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
5605	continue # so that we can try to find one that supports BSD flags
5606      fi
5607    fi
5608  done
5609  IFS="$ac_save_ifs"
5610  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
5611fi])
5612NM="$lt_cv_path_NM"
5613AC_MSG_RESULT([$NM])
5614])
5615
5616# AC_CHECK_LIBM - check for math library
5617AC_DEFUN([AC_CHECK_LIBM],
5618[AC_REQUIRE([AC_CANONICAL_HOST])dnl
5619LIBM=
5620case $host in
5621*-*-beos* | *-*-cygwin* | *-*-pw32*)
5622  # These system don't have libm
5623  ;;
5624*-ncr-sysv4.3*)
5625  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
5626  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
5627  ;;
5628*)
5629  AC_CHECK_LIB(m, main, LIBM="-lm")
5630  ;;
5631esac
5632])
5633
5634# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
5635# the libltdl convenience library and INCLTDL to the include flags for
5636# the libltdl header and adds --enable-ltdl-convenience to the
5637# configure arguments.  Note that LIBLTDL and INCLTDL are not
5638# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
5639# provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
5640# with '${top_builddir}/' and INCLTDL will be prefixed with
5641# '${top_srcdir}/' (note the single quotes!).  If your package is not
5642# flat and you're not using automake, define top_builddir and
5643# top_srcdir appropriately in the Makefiles.
5644AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
5645[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
5646  case $enable_ltdl_convenience in
5647  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
5648  "") enable_ltdl_convenience=yes
5649      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
5650  esac
5651  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
5652  INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
5653])
5654
5655# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
5656# the libltdl installable library and INCLTDL to the include flags for
5657# the libltdl header and adds --enable-ltdl-install to the configure
5658# arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
5659# AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
5660# libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
5661# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
5662# with '${top_srcdir}/' (note the single quotes!).  If your package is
5663# not flat and you're not using automake, define top_builddir and
5664# top_srcdir appropriately in the Makefiles.
5665# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
5666AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
5667[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
5668  AC_CHECK_LIB(ltdl, main,
5669  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
5670  [if test x"$enable_ltdl_install" = xno; then
5671     AC_MSG_WARN([libltdl not installed, but installation disabled])
5672   else
5673     enable_ltdl_install=yes
5674   fi
5675  ])
5676  if test x"$enable_ltdl_install" = x"yes"; then
5677    ac_configure_args="$ac_configure_args --enable-ltdl-install"
5678    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
5679    INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
5680  else
5681    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
5682    LIBLTDL="-lltdl"
5683    INCLTDL=
5684  fi
5685])
5686
5687# If this macro is not defined by Autoconf, define it here.
5688ifdef([AC_PROVIDE_IFELSE],
5689      [],
5690      [define([AC_PROVIDE_IFELSE],
5691              [ifdef([AC_PROVIDE_$1],
5692                     [$2], [$3])])])
5693
5694# AC_LIBTOOL_CXX - enable support for C++ libraries
5695AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])])
5696
5697AC_DEFUN([_AC_LIBTOOL_CXX],
5698[AC_REQUIRE([AC_PROG_CXX])
5699AC_REQUIRE([AC_PROG_CXXCPP])
5700LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh"
5701lt_save_CC="$CC"
5702lt_save_CFLAGS="$CFLAGS"
5703dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
5704dnl is set to the C++ compiler.
5705AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
5706MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
5707LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
5708AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
5709objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
5710deplibs_check_method="$deplibs_check_method" \
5711file_magic_cmd="$file_magic_cmd" \
5712${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
5713--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \
5714|| AC_MSG_ERROR([libtool tag configuration failed])
5715CC="$lt_save_CC"
5716CFLAGS="$lt_save_CFLAGS"
5717
5718# Redirect the config.log output again, so that the ltconfig log is not
5719# clobbered by the next message.
5720exec 5>>./config.log
5721])
5722
5723# AC_LIBTOOL_GCJ - enable support for GCJ libraries
5724AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])])
5725
5726AC_DEFUN([_AC_LIBTOOL_GCJ],
5727[AC_REQUIRE([AC_PROG_LIBTOOL])
5728AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
5729  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
5730    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
5731      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
5732         [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
5733           [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
5734LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
5735lt_save_CC="$CC"
5736lt_save_CFLAGS="$CFLAGS"
5737dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
5738dnl is set to the C++ compiler.
5739AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \
5740MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
5741LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
5742AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
5743objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
5744deplibs_check_method="$deplibs_check_method" \
5745file_magic_cmd="$file_magic_cmd" \
5746${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
5747--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
5748|| AC_MSG_ERROR([libtool tag configuration failed])
5749CC="$lt_save_CC"
5750CFLAGS="$lt_save_CFLAGS"
5751
5752# Redirect the config.log output again, so that the ltconfig log is not
5753# clobbered by the next message.
5754exec 5>>./config.log
5755])
5756
5757dnl old names
5758AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
5759AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
5760AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
5761AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
5762AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
5763AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
5764AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
5765
5766dnl This is just to silence aclocal about the macro not being used
5767ifelse([AC_DISABLE_FAST_INSTALL])dnl
5768
5769AC_DEFUN([LT_AC_PROG_GCJ],
5770[AC_CHECK_TOOL(GCJ, gcj, no)
5771  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
5772  AC_SUBST(GCJFLAGS)
5773])
5774
5775# Do all the work for Automake.  This macro actually does too much --
5776# some checks are only needed if your package does certain things.
5777# But this isn't really a big deal.
5778
5779# serial 1
5780
5781dnl Usage:
5782dnl AM_INIT_AUTOMAKE(package,version, [no-define])
5783
5784AC_DEFUN([AM_INIT_AUTOMAKE],
5785[AC_REQUIRE([AC_PROG_INSTALL])
5786PACKAGE=[$1]
5787AC_SUBST(PACKAGE)
5788VERSION=[$2]
5789AC_SUBST(VERSION)
5790dnl test to see if srcdir already configured
5791if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
5792  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
5793fi
5794ifelse([$3],,
5795AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
5796AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
5797AC_REQUIRE([AM_SANITY_CHECK])
5798AC_REQUIRE([AC_ARG_PROGRAM])
5799dnl FIXME This is truly gross.
5800missing_dir=`cd $ac_aux_dir && pwd`
5801AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
5802AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
5803AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
5804AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
5805AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
5806AC_REQUIRE([AC_PROG_MAKE_SET])])
5807
5808#
5809# Check to make sure that the build environment is sane.
5810#
5811
5812AC_DEFUN([AM_SANITY_CHECK],
5813[AC_MSG_CHECKING([whether build environment is sane])
5814# Just in case
5815sleep 1
5816echo timestamp > conftestfile
5817# Do `set' in a subshell so we don't clobber the current shell's
5818# arguments.  Must try -L first in case configure is actually a
5819# symlink; some systems play weird games with the mod time of symlinks
5820# (eg FreeBSD returns the mod time of the symlink's containing
5821# directory).
5822if (
5823   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
5824   if test "[$]*" = "X"; then
5825      # -L didn't work.
5826      set X `ls -t $srcdir/configure conftestfile`
5827   fi
5828   if test "[$]*" != "X $srcdir/configure conftestfile" \
5829      && test "[$]*" != "X conftestfile $srcdir/configure"; then
5830
5831      # If neither matched, then we have a broken ls.  This can happen
5832      # if, for instance, CONFIG_SHELL is bash and it inherits a
5833      # broken ls alias from the environment.  This has actually
5834      # happened.  Such a system could not be considered "sane".
5835      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
5836alias in your environment])
5837   fi
5838
5839   test "[$]2" = conftestfile
5840   )
5841then
5842   # Ok.
5843   :
5844else
5845   AC_MSG_ERROR([newly created file is older than distributed files!
5846Check your system clock])
5847fi
5848rm -f conftest*
5849AC_MSG_RESULT(yes)])
5850
5851dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
5852dnl The program must properly implement --version.
5853AC_DEFUN([AM_MISSING_PROG],
5854[AC_MSG_CHECKING(for working $2)
5855# Run test in a subshell; some versions of sh will print an error if
5856# an executable is not found, even if stderr is redirected.
5857# Redirect stdin to placate older versions of autoconf.  Sigh.
5858if ($2 --version) < /dev/null > /dev/null 2>&1; then
5859   $1=$2
5860   AC_MSG_RESULT(found)
5861else
5862   $1="$3/missing $2"
5863   AC_MSG_RESULT(missing)
5864fi
5865AC_SUBST($1)])
5866
5867
5868dnl AM_PROG_LEX
5869dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
5870AC_DEFUN([AM_PROG_LEX],
5871[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
5872AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
5873AC_PROG_LEX
5874AC_DECL_YYTEXT])
5875
5876# Like AC_CONFIG_HEADER, but automatically create stamp file.
5877
5878AC_DEFUN([AM_CONFIG_HEADER],
5879[AC_PREREQ([2.12])
5880AC_CONFIG_HEADER([$1])
5881dnl When config.status generates a header, we must update the stamp-h file.
5882dnl This file resides in the same directory as the config header
5883dnl that is generated.  We must strip everything past the first ":",
5884dnl and everything past the last "/".
5885AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
5886ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
5887<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
5888<<am_indx=1
5889for am_file in <<$1>>; do
5890  case " <<$>>CONFIG_HEADERS " in
5891  *" <<$>>am_file "*<<)>>
5892    echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
5893    ;;
5894  esac
5895  am_indx=`expr "<<$>>am_indx" + 1`
5896done<<>>dnl>>)
5897changequote([,]))])
5898
5899