~ubuntu-branches/debian/sid/kxstitch/sid

« back to all changes in this revision

Viewing changes to admin/acinclude.m4.in

  • Committer: Bazaar Package Importer
  • Author(s): eric pareja
  • Date: 2005-02-19 12:37:22 UTC
  • Revision ID: james.westby@ubuntu.com-20050219123722-kt3ru1nqvllietee
Tags: upstream-0.6
ImportĀ upstreamĀ versionĀ 0.6

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