~ubuntu-branches/debian/squeeze/kdelibs/squeeze

« back to all changes in this revision

Viewing changes to .pc/common/06_disable_no_undefined.diff/admin/acinclude.m4.in

  • Committer: Bazaar Package Importer
  • Author(s): Modestas Vainius
  • Date: 2010-08-07 23:20:21 UTC
  • Revision ID: james.westby@ubuntu.com-20100807232021-owvkgp5wpc076s33
Tags: 4:3.5.10.dfsg.1-5
* Change by email address to @debian.org.
* Drop common HTML docs from kdelibs-data package. Instead suggest
  kdelibs5-data which ships them (Closes: #591609). What's more, whoever
  wants to view docs, will have to install khelpcenter4 which pulls in
  kdelibs5-data anyway.
* Switch to dpkg-source format 3.0 (quilt):
  - drop simple-patchsys.mk from debian/rules;
  - add debian/patches/series file.
* Fix corruption of zip files caused by wrong encoding of umlauts in kzip
  (patch 67_kio_zip_file_encoding.diff). (Closes: #563942) Thanks to Bjoern
  Ricks for the patch.
* Support opening of KDE 4 khelpcenter in Help -> Handbook. (Closes: #525621)
  Thanks to Ben Burton for the patch.
* Do not recurse into .pc subdirectory with doxygen 
  (patch debian/patches/02_exclude_pc_from_dox.diff).
* Urgency=medium due to multiple RC bug fixes.

Show diffs side-by-side

added added

removed removed

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