#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT(mod_smooth_streaming, m4_esyscmd([./version.sh | tr -d '\n']), support@unified-streaming.com)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([tar-pax])
AC_COPYRIGHT([Copyright (C) 2009-2026 CodeShop B.V.])
AC_CONFIG_SRCDIR([mod_smooth_streaming/mod_smooth_streaming.cpp])
AC_CONFIG_HEADER([config.h])

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PROG_INSTALL

AC_CONFIG_MACRO_DIR([m4])

AX_CXX_COMPILE_STDCXX(17, noext, mandatory)

AP_VERSION=2.0.39
CHECK_APACHE(,$AP_VERSION,
    :,:,
    AC_MSG_ERROR([*** Apache version $AP_VERSION not found!])
)

prefix=${AP_PREFIX}

AX_LIB_FMP4([$VERSION])
AM_CONDITIONAL(HAVE_FMP4, test "x$success" = "xyes")
if test "x$HAVE_FMP4_TRUE" = "x#"
then
 AC_MSG_ERROR([FATAL: fmp4 not found (headers not installed?)])
fi

AX_LIB_REMIX([$VERSION])
AM_CONDITIONAL(HAVE_REMIX, test "x$success" = "xyes")
if test "x$HAVE_REMIX_TRUE" = "x#"
then
 AC_MSG_ERROR([FATAL: remix not found (headers not installed?)])
fi

#LIBTOOL="`${APR_CONFIG} --apr-libtool`"
#AC_SUBST(LIBTOOL)

MODULE_CFLAGS="${APXS_CFLAGS} ${AP_INCLUDES} ${APR_INCLUDES} ${APU_INCLUDES}"
AC_SUBST(MODULE_CFLAGS)

MODULE_LDFLAGS=" `${APR_CONFIG} --link-libtool` `${APU_CONFIG} --link-libtool`"
AC_SUBST(MODULE_LDFLAGS)

BIN_LDFLAGS=" `${APR_CONFIG} --link-libtool` `${APU_CONFIG} --link-libtool` `${APU_CONFIG} --ldflags --libs` `${APR_CONFIG} --ldflags --libs`"
AC_SUBST(BIN_LDFLAGS)

# Checks for libraries.

# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([inttypes.h limits.h stdint.h stdlib.h string.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T

# Checks for library functions.
AC_FUNC_FSEEKO
AC_FUNC_MALLOC
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memset strdup strrchr])

AC_CONFIG_FILES([\
  Makefile\
  common/Makefile\
  mod_smooth_streaming/Makefile\
  mod_smooth_streaming/mod_smooth_streaming.conf\
  mod_smooth_streaming/mod_smooth_streaming.load\
  mod_unified_remix/Makefile\
  mod_unified_remix/mod_unified_remix.conf\
  mod_unified_remix/mod_unified_remix.load\
  mod_unified_s3_auth/Makefile\
  mod_unified_s3_auth/mod_unified_s3_auth.conf\
  mod_unified_s3_auth/mod_unified_s3_auth.load\
  mod_unified_transcode/Makefile\
  mod_unified_transcode/mod_unified_transcode.conf\
  mod_unified_transcode/mod_unified_transcode.load\
])
AC_OUTPUT
