Subversion Repositories public

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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