dnl Process this file with autoconf to produce a configure script.
AC_INIT(jitterbug.c)
AC_CONFIG_HEADER(config.h)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_AWK
AC_SUBST(SHELL)

AC_HEADER_DIRENT
AC_HEADER_TIME
AC_CHECK_HEADERS(sys/fcntl.h fcntl.h sys/time.h sys/unistd.h unistd.h)
AC_CHECK_HEADERS(compat.h sys/param.h ctype.h)
AC_CHECK_HEADERS(string.h strings.h stdlib.h sys/socket.h regex.h)

AC_FUNC_MEMCMP
AC_CHECK_FUNCS(strtok getcwd mkdir strdup strerror)
AC_CHECK_FUNCS(fstat strchr bcopy bzero)
AC_CHECK_FUNCS(memmove setbuf socket)

AC_SUBST(CCOPTFLAGS)
AC_SUBST(LIBS)

echo $ac_n "checking for broken readdir ... $ac_c"
AC_TRY_RUN([#include <sys/types.h>
#include <dirent.h>
main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
di->d_name[0] == 0) return 0; return 1;} ],
echo yes;AC_DEFINE(HAVE_BROKEN_READDIR), 
echo no)


AC_CANONICAL_SYSTEM
case "$host_os" in
	*linux*)   CCOPTFLAGS="-Wall";;
        *solaris*) LIBS="-lsocket -lnsl";;
esac

AC_OUTPUT(Makefile)
