AC_INIT(README)
AC_PREREQ(2.13)
AM_INIT_AUTOMAKE(chasen, 2.2.9)
AM_MAINTAINER_MODE

AC_PROG_CC
AM_PROG_LIBTOOL
# Before making a release, the LTVERSION string should be modified.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility has
#   been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed interfaces)
#   change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A
LTVERSION="0:1:0"
AC_SUBST(LTVERSION)

dnl Checks for programs.
AC_ISC_POSIX
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/stat.h unistd.h)
AC_CHECK_HEADERS(sys/param.h sys/types.h netinet/in.h)
AC_CHECK_HEADERS(io.h windows.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
AC_TYPE_SIZE_T

dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(htonl)
AC_CHECK_LIB(nsl, gethostname)
AC_CHECK_LIB(socket, socket)

case "$host_os" in
    mingw* | os2*)
    RCPATH='c:\\\\Program Files\\\\chasen\\\\etc\\\\chasenrc'
    ;;
    *)
    # UNIX like-system
    AC_C_BIGENDIAN
    RCPATH="$sysconfdir/chasenrc"
    ;;
esac
AC_SUBST(RCPATH)

if test -n "$GCC"; then
 	CFLAGS="$CFLAGS -Wall"
fi

AM_CONFIG_HEADER(config.h)
AC_OUTPUT([ 
	    Makefile 
	    chasen-config
	    chasen/Makefile
	    mkchadic/Makefile
	    doc/Makefile 
	    lib/Makefile
	    prolog/Makefile
	    chasen.spec
	  ],
	  [chmod +x chasen-config])


# removed the following entry from AC_OUTPUT
#	    lib/Makefile.mingw32

# Local Variables:
# mode:shell-script
# sh-indentation:4
# End:
