Subversion Repositories Scribus

Rev

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