~ubuntu-branches/ubuntu/karmic/ksocrat/karmic

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