Subversion Repositories Scribus

Rev

Rev 2962 | Details | Compare with Previous | Last modification | View Log | RSS feed

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