#MIN_CONFIG
dnl Image readers/writers
KDE_CHECK_KIMGIO

dnl Checks for header files.
AC_CHECK_HEADERS(linux/tcp.h linux/if_ppp.h)
AC_CHECK_HEADERS(net/errno.h net/if_ppp.h)
AC_CHECK_HEADERS(asm/param.h)
AC_CHECK_HEADERS(sys/file.h sys/stat.h sys/time.h sys/cdefs.h sys/sockio.h)
AC_CHECK_HEADERS(fcntl.h unistd.h fnmatch.h sysent.h strings.h paths.h)
AC_CHECK_HEADERS(utmp.h re_comp.h getopt.h resolv.h byteswap.h)

AC_SYS_LARGEFILE
if test "x$ac_cv_sys_file_offset_bits" != "xno"; then
  CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
fi

if test "x$ac_cv_sys_large_files" != "xno"; then
  CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=1"
fi

AC_CHECK_FUNCS(flock)
AC_CHECK_USLEEP

dnl Checks for library functions.
AC_CHECK_FUNCS(socket fabsl strdup vsnprintf tzset)
AC_CHECK_SETENV
AC_CHECK_UNSETENV
AC_CHECK_GETDOMAINNAME
AC_CHECK_GETHOSTNAME
AC_C_BIGENDIAN

AC_CHECK_FUNC(res_init)
if test "$ac_cv_func_res_init" = no; then
  AC_CHECK_LIB(resolv, res_init, LIBRESOLV="-lresolv $LIBSOCKET", , $LIBSOCKET)
fi
AC_SUBST(LIBRESOLV)

AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
	AC_TRY_COMPILE([
		#include <time.h>
	], [
		timezone = 1;
	], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
if test $ac_cv_var_timezone = yes; then
	AC_DEFINE(HAVE_TIMEZONE, 1, [define if you have a timezone variable])
fi
AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,	
	AC_TRY_COMPILE([
		#include <time.h>
	], [
		struct tm tm;
		tm.tm_gmtoff = 1;
	], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
if test $ac_cv_struct_tm_gmtoff = yes; then
	AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if you have a tm_gmtoff member in struct tm])
fi

#check for SLP
AC_MSG_CHECKING(for SLP support)
save_slptest_LIBS="$LIBS"
save_slptest_LDFLAGS="$LDFLAGS"
save_slptest_CPPFLAGS="$CPPFLAGS"
LDFLAGS="$all_libraries $LDFLAGS"
CPPFLAGS="$CPPFLAGS $all_includes"
LIBS="-lslp"
AC_TRY_LINK(	[
			#include <slp.h>
		],[
			SLPOpen(0, SLP_FALSE, (SLPHandle*) 0);
		],[
			AC_DEFINE(HAVE_SLP,1,[Define if SLP is available])
                        LIB_SLP="-lslp"
			AC_MSG_RESULT(yes)
		],[
			AC_MSG_RESULT(no)
                        LIB_SLP=""
			AC_MSG_WARN([Browsing in krfb and krdc not possible. Install OpenSLP (www.openslp.org).])
])
CPPFLAGS=$save_slptest_CPPFLAGS
LDFLAGS=$save_slptest_LDFLAGS
LIBS=$save_slptest_LIBS
AC_SUBST(LIB_SLP)

KDE_CHECK_STRLCPY
KDE_CHECK_THREADING

dnl For apps that NEED threads
if test -z "$LIBPTHREAD" && test -z "$USE_THREADS"; then
  DO_NOT_COMPILE="$DO_NOT_COMPILE knode kdict"
fi
CXXFLAGS="$CXXFLAGS -DQT_NO_COMPAT -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DKDE_NO_COMPAT -DKDE_NO_COMPAT_H"

AH_VERBATIM(_osf_config_h,
[
#ifdef __osf__
/* From Tom Leitner */
#if __STDC__
#include <stdarg.h>
#include <stdlib.h>
#else
#include <varargs.h>
#endif
#ifndef __OSF_INCLUDED__
#define __OSF_INCLUDED__
#define MSG_NOSIGNAL 0
#ifndef AF_LOCAL
#define AF_LOCAL 1          /* is the same as AF_UNIX */
#endif
#ifndef herror
#define herror(a)   printf(a)
#endif

#include <sys/types.h>
#ifdef __cplusplus
extern "C" int sethostname (char *name, int name_len );
extern "C" int flock(int filedes, int operation );
#else
int sethostname (char *name, int name_len );
int flock(int filedes, int operation );
#endif
#endif
#endif
])
