ttail/configure.ac
Yann Weber 4d2fed6c92 Check unit test framework can be disabled
using --disable-check configure option
2017-05-15 16:11:40 +02:00

107 lines
2.8 KiB
Text

# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([ttail], [0.0.1], [yann.weber@member.fsf.org])
AM_INIT_AUTOMAKE
#configure options
AC_ARG_ENABLE([huge-file],[ --enable-huge-file to enable huge file support],
[case "${enableval}" in
yes) huge_file=true ;;
no) huge_file=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-huge-file]) ;;
esac],[huge_file=false])
AM_CONDITIONAL([HUGEFILE], [test x$huge_file = xtrue])
AC_ARG_ENABLE([debug],[ --enable-debug turn on debugging],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],[debug=false])
AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
AC_ARG_ENABLE([check],[ --disable-check disable unit test support],
[case "${enableval}" in
yes) check=true ;;
no) check=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-check]) ;;
esac],[check=true])
AM_CONDITIONAL([CHECK], [test x$check = xtrue])
AC_CONFIG_HEADERS([src/include/config.h])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_MACRO_DIR([m4])
# Checks for programs.
AC_GNU_SOURCE
AC_C_INLINE
AC_C_CONST
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test -z "$DOXYGEN";
then
AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
fi
AC_CHECK_PROGS([GIT], [git])
if test -z "$GIT";
then
AC_MSG_WARN([git not found - continuing without Doxygen support])
AC_SUBST([DOXYFILE_FILE_VERSION_FILTER], [])
else
AC_SUBST([DOXYFILE_FILE_VERSION_FILTER], ["\"/bin/sh -c 'git log --pretty=\\\"format:%ci, author:%aN <%aE>, commit:%h\\\" -1 --'\""])
fi
# Checks for libraries.
if test x$check = xtrue
then
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [],
AC_MSG_FAILURE([Unable to locate (check unit test c framework).
You can run ./configure --disable-check if you do not need unit tests.
]))
AS_IF([test x$debug = xtrue], [CK_FORK=no],[])
fi
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AS_IF([test x$debug = xtrue], [
AX_CHECK_CFLAGS([-Wall])
AX_CHECK_CFLAGS([-g])
AX_CHECK_CFLAGS([-ggdb])
AX_CHECK_CFLAGS([-O0])
],
[
AX_CHECK_CFLAGS([-O2])
AX_CHECK_CFLAGS([-std=c99 -pedantic])
AX_CHECK_CFLAGS([-Wall -Werror])
AX_CHECK_CFLAGS([-fgnu89-inline])
])
AX_CHECK_CFLAGS([-D_XOPEN_SOURCE -D_GNU_SOURCE])
#Condition done in Makefile.am
#AS_IF([test x$huge_file = xtrue], [
#AX_CHECK_CFLAGS([-DTTAIL_HUGE_FILE])
#],[])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CONFIG_FILES([Makefile
src/Makefile
tests/Makefile])
AM_CONDITIONAL([HAVE_DOXYGEN],
[test -n "$DOXYGEN"])AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([docs/Doxyfile
docs/Makefile])])
AC_OUTPUT