Hans-Joerg Schurr
8f6d3f6897
This adds a autoconfig base build system and some test files. To build: 1) autoreconf 2) ./configure 3) make
80 lines
2.1 KiB
Plaintext
80 lines
2.1 KiB
Plaintext
# -*- Autoconf -*-
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
AC_PREREQ([2.69])
|
|
AC_INIT([hvif-light], [0.0.1], [commits@schurr.at])
|
|
AC_CONFIG_MACRO_DIR(m4)
|
|
AM_INIT_AUTOMAKE([subdir-objects foreign 1.13])
|
|
AM_SILENT_RULES([yes])
|
|
AC_CONFIG_SRCDIR([src/hvif-light.h])
|
|
AC_CONFIG_HEADERS([src/config.h])
|
|
|
|
# Checks C compiler (with empty default flags).
|
|
: ${CFLAGS=""}
|
|
AC_PROG_CC
|
|
|
|
AX_CHECK_COMPILE_FLAG([-std=c11],
|
|
[ CFLAGS+=" -std=c11" ],
|
|
[ AC_MSG_ERROR([C compiler doesn't support C11 mode])] )
|
|
|
|
# TODO: Update checks once we have code
|
|
|
|
# Checks for header files.
|
|
AC_CHECK_HEADERS([limits.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
AC_CHECK_HEADER_STDBOOL
|
|
AC_C_INLINE
|
|
AC_TYPE_INT32_T
|
|
AC_TYPE_SIZE_T
|
|
AC_TYPE_UINT32_T
|
|
|
|
# Checks for library functions.
|
|
AC_FUNC_MALLOC
|
|
AC_FUNC_REALLOC
|
|
AC_CHECK_FUNCS([memmove memset mkdir pow strchr strdup strstr strtol])
|
|
|
|
# User defined options: debug, lto
|
|
AC_ARG_ENABLE([debug],
|
|
[AS_HELP_STRING([--enable-debug],[compile with debug options])],
|
|
[debug=${enableval}], [debug=no])
|
|
AC_ARG_ENABLE([lto],
|
|
[AS_HELP_STRING([--disable-lto], [disable link time optimization])],
|
|
[lto=${enableval}], [lto=yes])
|
|
|
|
AC_MSG_NOTICE([Setting up compiler flags])
|
|
CFLAGS+=" -Wall -Wpedantic -Wextra"
|
|
|
|
if test x$debug = xyes; then
|
|
CFLAGS+=" -O0"
|
|
CFLAGS+=" -g -g3 -gdwarf-2"
|
|
CFLAGS+=" -ftrapv"
|
|
CPPFLAGS+="-DDEBUG"
|
|
YFLAGS+=" --debug -v"
|
|
lto=no
|
|
else
|
|
CFLAGS+=" -O3"
|
|
CPPFLAGS+=" -DNDEBUG"
|
|
CFLAGS+=" -fomit-frame-pointer"
|
|
AX_CHECK_COMPILE_FLAG([-finline-limit=1000000 ],
|
|
[ CFLAGS+=" -finline-limit=1000000" ])
|
|
fi
|
|
|
|
if test x$lto = xyes; then
|
|
AX_CHECK_COMPILE_FLAG([-flto],
|
|
[ CFLAGS+=" -flto" ],
|
|
[ AC_MSG_WARN([C compiler doesn't support link time optimization])] )
|
|
fi
|
|
|
|
AC_CONFIG_FILES([Makefile src/Makefile])
|
|
AC_OUTPUT
|
|
|
|
AS_ECHO("")
|
|
AS_ECHO("")
|
|
AS_ECHO("Configuration summary")
|
|
AS_ECHO("CC = $CC")
|
|
AS_ECHO("CFLAGS = $CFLAGS")
|
|
AS_ECHO("CPPLAGS = $CPPFLAGS")
|
|
AS_ECHO("YFLAGS = $YFLAGS")
|
|
AS_ECHO("LFLAGS = $LFLAGS")
|