AC_INIT()
AM_INIT_AUTOMAKE(libmp4v2,0.9.2.8,dummy)

AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL

AM_PROG_LIBTOOL

AM_CONFIG_HEADER(config.h)

AC_CHECK_HEADERS(stdint.h)
AC_CHECK_HEADERS(inttypes.h)
AC_CHECK_HEADERS(sys/time.h)
AC_HEADER_TIME

AC_CHECK_FUNCS(strsep)
AC_DEFUN(MY_CHECK_TYPEDEF_FROM_INCLUDE,
[
   AC_MSG_CHECKING([for $1])
   AC_TRY_COMPILE([$2],
                  [$1;],
                  mp4v2_ok=yes, mp4v2_ok=no)
   if test $mp4v2_ok = yes; then
      AC_DEFINE($3)
      AC_MSG_RESULT([yes])
   else
      AC_MSG_RESULT([no])
   fi
])

MY_CHECK_TYPEDEF_FROM_INCLUDE([in_port_t temp], 
        [#include <sys/types.h>
         #include <netinet/in.h>], [HAVE_IN_PORT_T])
MY_CHECK_TYPEDEF_FROM_INCLUDE([socklen_t temp], 
        [#include <sys/types.h>
         #include <sys/socket.h>], HAVE_SOCKLEN_T)
MY_CHECK_TYPEDEF_FROM_INCLUDE([fpos_t foo; foo.__pos = 0;],
        [#include <stdio.h>],
        [HAVE_FPOS_T_POS])
    
AC_CHECK_TYPES(uint64_t)
AC_CHECK_TYPES(uint32_t)
AC_CHECK_TYPES(uint16_t)
AC_CHECK_TYPES(uint8_t)
AC_CHECK_TYPES(u_int64_t)
AC_CHECK_TYPES(u_int32_t)
AC_CHECK_TYPES(u_int16_t)
AC_CHECK_TYPES(u_int8_t)
AC_CHECK_TYPES(int64_t)
AC_CHECK_TYPES(int32_t)
AC_CHECK_TYPES(int16_t)
AC_CHECK_TYPES(int8_t)


AC_OUTPUT(Makefile)
