#MIN_CONFIG
KDE_ENABLE_HIDDEN_VISIBILITY
KDE_INIT_DOXYGEN([KDE Network API Reference], [Version $VERSION])


dnl Checks for header files.
AC_CHECK_HEADERS(linux/tcp.h linux/if_ppp.h,,,
     [[#if HAVE_LINUX_TCP_H
     # include <linux/tcp.h>
     #endif
     ]])
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 byteswap.h)
AC_CHECK_HEADER([resolv.h],,,[#include <netinet/in.h>])


AC_SYS_LARGEFILE
if test "$ac_cv_sys_file_offset_bits" != no; then
  CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
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
dnl define the configure option that disables slp
AC_ARG_ENABLE(slp, [  --disable-slp     don't require libslp (Browsing in krfb and krdc not possible) ],  with_slp=$enableval, with_slp=yes)
if test "$with_slp" = "yes"; then
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=""
])
CPPFLAGS=$save_slptest_CPPFLAGS
LDFLAGS=$save_slptest_LDFLAGS
LIBS=$save_slptest_LIBS
fi
AC_SUBST(LIB_SLP)

KDE_CHECK_THREADING

dnl For apps that NEED threads
if test -z "$LIBPTHREAD" && test -z "$USE_THREADS"; then
  DO_NOT_COMPILE="$DO_NOT_COMPILE kdict krfb krdc"
fi
CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"

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
])
