AC_PREREQ(2.59)
AC_INIT(mynx, 1.0, [])
platform=`uname -s|sed -e 's/^\([[a-zA-Z0-9]]*\)[[^a-zA-Z0-9]].*/\1/'`
echo "platform is... $platform"
my_configure_command="$[]0 $[]@"
AC_CHECK_TOOL(autoconf_tool, autoconf)
if test ${autoconf_tool:-no} != 'no' -a \( aclocal.m4 -nt configure -o configure.in -nt configure \); then
	echo 'Rebuilding the configure script first...'
	autoconf -f
	echo 'Restarting configure script...'
	echo $my_configure_command
	exec $my_configure_command
fi
AC_SUBST(platform, $platform)
AC_CONFIG_SRCDIR($PACKAGE_NAME.c)
AC_CONFIG_FILES(makefile)
AC_ARG_ENABLE(w32, 
	[AC_HELP_STRING([--disable-w32],[generate Cygwin binary in Cygwin environment])]
)
if test $platform = 'CYGWIN' -a ${enable_w32:-yes} != 'no' ; then
	CFLAGS="-mno-cygwin ${CFLAGS}"
	LIBS="-lws2_32 ${LIBS}"
fi
AC_PROG_CC
AC_HEADER_STDC
AC_SEARCH_LIBS(socket, [socket nsl],[AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_SOCKET])])])
AC_CHECK_HEADERS(
	[arpa/inet.h netdb.h netinet/in.h sys/socket.h sys/ioctl.h],
	[], [AC_MSG_FAILURE([Missing required I/O header.], 1)]
)
AC_CHECK_HEADERS([windows.h winsock2.h])
AC_OUTPUT()
echo
echo $PACKAGE_STRING
echo
AC_MSG_RESULT([  platform...: $platform])
AC_MSG_RESULT([  prefix.....: $prefix])
AC_MSG_RESULT([  CFLAGS.....: $CFLAGS])
AC_MSG_RESULT([  LDFLAGS....: $LDFLAGS])
AC_MSG_RESULT([  LIBS.......: $LIBS])
echo
