Subversion Repositories public

Rev

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