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

AC_PREREQ([2.69])
AC_INIT([SeFHT], [0.9], [jonathan@xn--schbel-yxa.info])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-macro])

AM_INIT_AUTOMAKE([foreign -Wall -Werror subdir-objects])

AC_ARG_PROGRAM

# Checks for programs.
AC_PROG_CC
AM_PROG_AR
AC_PROG_LIBTOOL

PKG_PROG_PKG_CONFIG()

# Optional test suite
AC_ARG_ENABLE([tests],
[AS_HELP_STRING([--enable-tests@<:@=auto|yes|no@:>@],
                [support building tests @<:@default=auto@:>@
                This needs check to be installed.],26,65)],
[],
[enable_tests=auto])

case ${enable_tests} in
  yes)
    PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
    ;;
  no)
    ;;
  auto)
    PKG_CHECK_MODULES([CHECK], [check >= 0.9.4],
    [enable_tests=yes],
    [
      enable_tests=no
      AC_MSG_WARN([tests are disabled, due to missing check])
    ])
    ;;
  *)
    AC_MSG_ERROR([invalid --enable-tests argument])
    ;;
esac

AM_CONDITIONAL([MISSING_CHECK], [test x${enable_tests} = xno])


# Checks for libraries.
LT_INIT()

# Checks for header files.
AC_CHECK_HEADER([errno.h])
AC_CHECK_HEADER([limits.h])
AC_CHECK_HEADER([math.h])
AC_CHECK_HEADER([stdbool.h])
AC_CHECK_HEADER([stdint.h])
AC_CHECK_HEADER([stdio.h])
AC_CHECK_HEADER([stdlib.h])
AC_CHECK_HEADER([string.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

# Makefiles
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/lib/Makefile])
AC_CONFIG_FILES([tests/Makefile])
AC_CONFIG_FILES([tests/no_test.sh], [chmod +x tests/no_test.sh])

AC_OUTPUT