Subversion Repositories Scribus

Rev

Rev 3 | Rev 96 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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