summaryrefslogtreecommitdiffstats
path: root/configure.in.in
blob: c2badfa92ece3938c0611ffcbecf280485ba911d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas

dnl Process this file with autoconf to produce a configure script.
AC_INIT(acinclude.m4) dnl a source file from your sub dir

dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)

dnl Setting the prefix for kdelibs uses a special version of KDE_SET_PREFIX
dnl (since that one normally looks for existing kde installations)
KDE_SET_PREFIX_CORE


AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM

dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(@MODULENAME@, @VERSION@) dnl searches for some needed programs

AM_MAINTAINER_MODE

AC_PROG_INSTALL

dnl generate the config header
AM_CONFIG_HEADER(config.h) dnl at the distribution this done

dnl Checks for programs.
AC_CHECK_COMPILERS
AC_LIBLTDL_CONVENIENCE

AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL

AC_LANG_SAVE
AC_LANG_C
KDE_LIB_LTDL
AC_LANG_RESTORE

dnl for NLS support. Call them in this order!
dnl WITH_NLS is for the po files, GNU_GETTEXT for the sources
AM_KDE_WITH_NLS
AM_KDE_GNU_GETTEXT

dnl Checks for header files.
KDE_CHECK_STL
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/param.h sys/mman.h sys/time.h sysent.h strings.h sys/stat.h sys/select.h paths.h malloc.h limits.h sys/soundcard.h dlfcn.h termios.h sys/prctl.h)

AC_ARG_WITH(acl,
  [AC_HELP_STRING(--with-acl,
    [enable support for POSIX ACLs @<:@default=check@:>@])],
  [], with_acl=check)

ACL_LIBS=""
if test "x$with_acl" != xno; then
  USE_POSIX_ACL=yes
  HAVE_NON_POSIX_ACL_EXTENSIONS=no
  KDE_CHECK_HEADER(sys/acl.h, ,[USE_POSIX_ACL="no"])
  HAVE_SYS_XATTR_H=no
  KDE_CHECK_HEADER(sys/xattr.h,[HAVE_SYS_XATTR_H="yes"],)
  if test "$HAVE_SYS_XATTR_H" = "yes" ; then
    AC_DEFINE([HAVE_SYS_XATTR_H], 1, [Define if system has the sys/xattr.h header.])
  fi

  case $host in
      *-*-freebsd*)
              KDE_CHECK_LIB(c,acl_init,[ACL_LIBS="-lc"],[USE_POSIX_ACL="no"])
              ;;
      *)
              KDE_CHECK_HEADER(attr/libattr.h, ,[USE_POSIX_ACL="no"])
              KDE_CHECK_LIB(acl,acl_init,[ACL_LIBS="-lacl -lattr"],[USE_POSIX_ACL="no"])
              KDE_CHECK_HEADER(acl/libacl.h,[HAVE_NON_POSIX_ACL_EXTENSIONS="yes"],)
              if test "$HAVE_SYS_XATTR_H" = "no" ; then
                USE_POSIX_ACL="no"
              fi
              ;;
  esac

  if test "$USE_POSIX_ACL" = "yes" ; then
    AC_DEFINE([USE_POSIX_ACL], 1, [Define if system has POSIX ACL support.])
    if test "$HAVE_NON_POSIX_ACL_EXTENSIONS" = "yes" ; then
      AC_DEFINE([HAVE_NON_POSIX_ACL_EXTENSIONS], 1, [Define if system has non-POSIX extensions to the ACL support.])
    fi
  fi

  if test "x$with_acl" != xcheck && test "$USE_POSIX_ACL" != "yes"; then
    AC_MSG_ERROR([--with-acl was given, but test for POSIX ACLs failed])
  fi
fi
AC_SUBST(ACL_LIBS)

DCOPIDL2CPP="compiled"
DCOPIDL="compiled"
DCOPIDLNG="compiled"
MEINPROC="compiled"
KDECONFIG="compiled"
KCONFIG_COMPILER="compiled"
MAKEKDEWIDGETS="compiled"

dnl Checks for libraries etc
AC_BASE_PATH_KDE([don't test]) dnl kdelibs is a special case
KDE_ENABLE_HIDDEN_VISIBILITY

AC_CREATE_KFSSTND(default)
AC_SUBST_KFSSTND

KDE_CREATE_LIBS_ALIASES

AC_DEFUN([KDE_DO_UIC_AGAIN],
[
AC_REQUIRE([AC_PATH_QT_MOC_UIC])
UIC=$UIC_PATH
if test x$ac_uic_supports_nounload = xyes; then
    UIC="$UIC -nounload"
fi
AC_SUBST(UIC)
])
KDE_DO_UIC_AGAIN

# configure would do this very late. Too late for us!
test "x$prefix" = xNONE && prefix=$ac_default_prefix

AC_DEFINE_UNQUOTED(KDEDIR, "$prefix", [The prefix to use as fallback])
KDE_EXPAND_MAKEVAR(ac_kde_sysconfdir, sysconfdir)
AC_DEFINE_UNQUOTED(KDESYSCONFDIR, "$ac_kde_sysconfdir", [The compiled in system configuration prefix])

ac_cpp_safe=$ac_cpp
ac_CPPFLAGS_safe=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_INCLUDES"
ac_cpp='$CXXCPP $CPPFLAGS'
KDE_CHECK_HEADERS(X11/extensions/shape.h,,,
[
#include <X11/Xlib.h>
#include <X11/Xutil.h>
])
KDE_CHECK_HEADERS(X11/extensions/XShm.h, 
  [have_mitshm=yes], [have_mitshm=no], [#include <X11/Xlib.h>])
KDE_CHECK_HEADERS(X11/ICE/ICElib.h)
KDE_CHECK_HEADER(sys/sendfile.h, [have_sendfile=yes], )
ac_cpp=$ac_cpp_safe
CPPFLAGS=$ac_CPPFLAGS_safe

dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME

AC_LANG_SAVE
AC_LANG_C
dnl AC_C_BIGENDIAN has a bug (one of its tests uses "main()" instead of
dnl "int main()") so C++ compilers would break. Thats why we switch languages
AC_C_BIGENDIAN
AC_LANG_RESTORE

dnl check if the compiler has bool
AC_CHECK_BOOL

dnl Checks for library functions.
AC_CHECK_SETENV
AC_CHECK_UNSETENV
AC_CHECK_RANDOM
AC_CHECK_MKSTEMPS
AC_CHECK_MKSTEMP
AC_CHECK_MKDTEMP
AC_CHECK_FUNCS(strtoll socket seteuid setegid strfmon stpcpy gettimeofday readdir_r setpriority tcgetattr tcsetattr)

AH_BOTTOM([
/* provide a definition for a 32 bit entity, usable as a typedef, possibly
   extended by "unsigned" */
#undef INT32_BASETYPE
#ifdef SIZEOF_INT
#if SIZEOF_INT == 4
#define INT32_BASETYPE int
#endif
#endif
#if !defined(INT32_BASETYPE) && defined(SIZEOF_LONG)
#if SIZEOF_LONG == 4
#define INT32_BASETYPE long
#endif
#endif
#ifndef INT32_BASETYPE
#define INT32_BASETYPE int
#endif

#ifndef HAVE_SETEUID
#define HAVE_SETEUID
#define HAVE_SETEUID_FAKE
#ifdef __cplusplus
extern "C"
#endif
int seteuid(INT32_BASETYPE euid); /* defined in fakes.c */
#endif
])

AC_CHECK_USLEEP
AC_CHECK_GETHOSTNAME
AC_CHECK_RANDOM
AC_CHECK_S_ISSOCK
AC_CHECK_INITGROUPS

AC_MSG_CHECKING([for mount tab file])
AC_CACHE_VAL(kde_cv_mtab_file,
[
    kde_cv_mtab_file=no

    for ac_file in    \
                      \
        /etc/mtab \
        /etc/mnttab \
     ; \
    do
    if test -r "$ac_file"; then
       kde_cv_mtab_file=$ac_file
       break
    fi
    done
])

AC_MSG_RESULT($kde_cv_mtab_file)
if test "$kde_cv_mtab_file" != "no"; then
    AC_DEFINE_UNQUOTED(MTAB_FILE, "$kde_cv_mtab_file", [Define the file for mount entries])
fi

if test -n "$qt_includes"; then
  QNAMESPACE_H="$qt_includes/qnamespace.h"
fi
AC_SUBST(QNAMESPACE_H)

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_MSG_CHECKING([if getmntinfo() uses struct statvfs])
AC_TRY_LINK([#include <sys/types.h>
#include <sys/statvfs.h>
],[int flags = 0; struct statvfs *mntbufp; return getmntinfo(&mntbufp, flags);],
[AC_MSG_RESULT(yes)
AC_DEFINE(GETMNTINFO_USES_STATVFS,,[getmntinfo() uses struct statvfs])],
AC_MSG_RESULT(no))
AC_LANG_RESTORE

dnl output files
AC_SUBST(x_includes)
AC_SUBST(x_libraries)
AC_SUBST(LIBSOCKET)
AC_SUBST(LIBCOMPAT)
AC_SUBST(LIBUTIL)
AC_SUBST(LIBRESOLV)
AC_SUBST(LIBICE)

AC_SUBST(LIB_KAB, '$(top_builddir)/kab/libkab.la')
AC_SUBST(LIB_KABC, '$(top_builddir)/kabc/libkabc.la')
AC_SUBST(LIB_TDECORE, '$(top_builddir)/tdecore/libtdecore.la')
AC_SUBST(LIB_TDEUI, '$(top_builddir)/tdeui/libtdeui.la')
AC_SUBST(LIB_KIO, '$(top_builddir)/kio/libkio.la')
AC_SUBST(LIB_KFILE, '$(top_builddir)/kio/libkio.la')
AC_SUBST(LIB_KSYCOCA, '$(top_builddir)/kio/libkio.la')
AC_SUBST(LIB_KHTML, '$(top_builddir)/khtml/libkhtml.la')
AC_SUBST(LIB_TDEPRINT, '$(top_builddir)/tdeprint/libtdeprint.la')
AC_SUBST(LIB_KPARTS, '$(top_builddir)/kparts/libkparts.la')
AC_SUBST(LIB_KIMGIO, '$(top_builddir)/kimgio/libkimgio.la')
AC_SUBST(LIB_KNEWSTUFF, '$(top_builddir)/knewstuff/libknewstuff.la')
AC_SUBST(LIB_KUNITTEST, '$(top_builddir)/kunittest/libkunittest.la')
case $host in 
	*cygwin*) lib_kded='$(top_builddir)/kded/libtdeinit_kded.la' ;;
	*) lib_kded='' ;;
esac
AC_SUBST(LIB_KDED, $lib_kded)

AC_SUBST(EXTRA_SUBDIRS)

AC_MSG_CHECKING(if sendfile() is wanted)
AC_ARG_ENABLE(sendfile,
AC_HELP_STRING([--enable-sendfile],[enable the use of sendfile() (Linux only)]),
[if test "$enableval" = yes; then
  AC_MSG_RESULT(yes)
  want_sendfile="yes"
else
  AC_MSG_RESULT(no)
fi], [AC_MSG_RESULT(no)])

if test "$want_sendfile" = "yes" -a "$have_sendfile" = "yes"; then
  AC_SUBST(HAVE_SENDFILE)
  AC_DEFINE(HAVE_SENDFILE,1,[Define if you want sendfile() support])
fi

AC_MSG_CHECKING(if MIT-SHM support is wanted)
AC_ARG_ENABLE(mitshm,
AC_HELP_STRING([--enable-mitshm],[use MIT-SHM for pixmap loading/saving]),
[if test "$enableval" = yes; then
  AC_MSG_RESULT(yes)
  want_mitshm="yes"
else
  AC_MSG_RESULT(no)
fi], [AC_MSG_RESULT(yes); want_mitshm="yes"])

if test "$want_mitshm" = "yes" -a "$have_mitshm" = "yes"; then
  AC_SUBST(HAVE_MITSHM)
  AC_DEFINE(HAVE_MITSHM,1,[Define if you want MIT-SHM support])
fi

AC_CHECK_FUNC(posix_fadvise,[AC_DEFINE(HAVE_FADVISE,1,[Define is posix_fadvise is supported] )])

AC_SUBST(ICE_SUBDIR, 'ICE')
AC_SUBST(ICE_RLIB, 'ICE/libkICE.la')

AC_SUBST(DCOPIDL, '$(top_builddir)/dcop/dcopidl/dcopidl')
AC_SUBST(DCOPIDLNG, '$(top_srcdir)/dcop/dcopidlng/dcopidlng')
AC_SUBST(DCOPIDL2CPP, '$(top_builddir)/dcop/dcopidl2cpp/dcopidl2cpp')
AC_SUBST(MAKEKDEWIDGETS, '$(top_builddir)/kdewidgets/makekdewidgets')
AC_SUBST(KCONFIG_COMPILER, '$(top_builddir)/tdecore/kconfig_compiler/kconfig_compiler')

ac_save_LIBS="$LIBS"
LIBS="$LIBS $X_LDFLAGS -lICE"
AC_CHECK_FUNCS(_IceTransNoListen)
LIBS="$ac_save_LIBS"

if test "x$kde_use_qt_emb" != "xyes"; then
   CXXFLAGS="$CXXFLAGS $USE_RTTI"
fi

AC_ARG_WITH([rgbfile],
  AC_HELP_STRING([--with-rgbfile=path], [Define custom path for rgb.txt. (default: \$(x11libdir)/X11/rgb.txt)]),
  [rgb_file=$withval], [rgb_file="$x_libraries/X11/rgb.txt"])

AC_DEFINE_UNQUOTED(X11_RGBFILE, "$rgb_file", [where rgb.txt is in])

AC_MSG_CHECKING([for Compiler version])
case "$CXX" in
xlC*)
  # The __IBMCPP__ macro contains the C++ compiler version in decimal notation.
  echo "__IBMCPP__" > conftest.C

  # Preprocess and at least make sure it's returned a number.
  changequote(, )dnl
  $CXX -E conftest.C 2>&1 | grep "^[0-9][0-9][0-9]" > conftest.i
  changequote([, ])dnl

  # "502" would signify version 5.0.2.
  clean_compiler_version="$CXX version "`cut -b1 conftest.i`"."`cut -b2 conftest.i`"."`cut -b3 conftest.i`
  rm -f conftest.C conftest.i
 ;;
KCC*)
  # KCC doesn't give it's version, if nothing is compiled (the frontend
  # isn't called in that case)
  rm -f conftest.C conftest.o
  echo "void f(void) {}" > conftest.C
  clean_compiler_version=`$CXX -V -c conftest.C -o conftest.o 2>&1 | sed 's/--.*//'`
  rm -f conftest.C conftest.o
 ;;
*)
  for flag in '-v' '-V' '--version' '-version'; do
    compiler_version=`$CXX $flag 2>&1 | egrep -v "Reading specs|Using built-?in specs|Configured with|Thread model" | head -n 1`
    clean_compiler_version=`echo $compiler_version | egrep -vi 'Usage|ERROR|unknown option|WARNING|missing|###'`
    test -n "$clean_compiler_version" && break
  done
 ;;
esac

# Quote backslashesm, as we are going to make this a string.
clean_compiler_version=`echo $clean_compiler_version | sed 's/\([\\\\]\)/\\\\\\1/g'`
if test -z "$clean_compiler_version"; then
  clean_compiler_version="unknown"
fi
AC_DEFINE_UNQUOTED(KDE_COMPILER_VERSION, "$clean_compiler_version", [what C++ compiler was used for compilation])
AC_MSG_RESULT($clean_compiler_version)

AC_MSG_CHECKING([for uname])
case `uname -s` in
AIX)
  IBM_ARCH=PowerPC #good default
  if [ -x /usr/sbin/lsdev -a -x /usr/sbin/lsattr ]; then
    IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -n 1 | awk '{ print $1 }'`
    if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
      IBM_ARCH=POWER
    fi
  fi
  uname_string=`uname -svr | awk '{ print $1" "$3"."$2 }'`" ${IBM_ARCH}"
 ;;
*)
  uname_string=`uname -smr`
 ;;
esac
AC_DEFINE_UNQUOTED(KDE_COMPILING_OS, "$uname_string", [what OS used for compilation])
AC_MSG_RESULT($uname_string)

AC_MSG_CHECKING([for distribution channel])
AC_ARG_WITH(distribution,
AC_HELP_STRING([--with-distribution],[indicate the distribution in bug reports]),
[kde_distribution_text="$withval"
], [kde_distribution_text='compiled sources'])
AC_DEFINE_UNQUOTED(KDE_DISTRIBUTION_TEXT, "$kde_distribution_text", [Distribution Text to append to OS])
AC_MSG_RESULT($kde_distribution_text)

AC_ARG_WITH(utempter,
[AC_HELP_STRING([--with-utempter], [use utempter for utmp management @<:@default=check@:>@])],
[], with_utempter=check)
if test "x$with_utempter" != xno; then
  kde_have_utempter=yes
  AC_CHECK_LIB(utempter, addToUtmp, [LIBUTEMPTER=-lutempter], kde_have_utempter=no)
  AC_SUBST(LIBUTEMPTER)
  if test "$kde_have_utempter" = "yes"; then
    AC_DEFINE_UNQUOTED(HAVE_UTEMPTER, 1, [Define if you have the utempter helper for utmp managment])
  fi
  if test "x$with_utempter" != xcheck && test "x$kde_have_utempter" != xyes; then
    AC_MSG_ERROR([--with-utempter was given, but test for utempter failed])
  fi
fi

KDE_INIT_DOXYGEN([The KDE API Reference], [Version $VERSION])
KDE_CHECK_BINUTILS