blob: ecefc9ce112660c61a4aa347d4f16caa562f93cf [file] [log] [blame]
AC_INIT([tpm2.0-tss],
[m4_esyscmd_s([git describe --tags --always --dirty])])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
AC_PROG_CXX
LT_INIT()
AM_INIT_AUTOMAKE([foreign
subdir-objects])
AC_CONFIG_FILES([Makefile])
AC_ARG_ENABLE([unit],
[AS_HELP_STRING([--enable-unit],
[build cmocka unit tests (default is no)])],
[enable_unit=$enableval],
[enable_unit=no])
AS_IF([test "x$enable_unit" != xno],
[PKG_CHECK_MODULES([CMOCKA],
[cmocka],
[AC_DEFINE([HAVE_CMOCKA],
[1])])])
AM_CONDITIONAL([UNIT], [test "x$enable_unit" != xno])
dnl add_cflag:
dnl A macro to add a CFLAG to the EXTRA_CFLAGS variable. This macro will
dnl check to be sure the compiler supprts the flag. Flags can be made
dnl mandatory (configure will fail).
dnl $1: C compiler flag to add to EXTRA_CFLAGS.
dnl $2: Set to "required" to cause configure failure if flag not supported..
AC_DEFUN([add_cflag],[
AX_CHECK_COMPILE_FLAG([$1],[
EXTRA_CFLAGS="$EXTRA_CFLAGS $1"],[
AS_IF([test x$2 != xrequired],[
AC_MSG_WARN([Optional CFLAG "$1" not supported by your compiler, continuing.])],[
AC_MSG_ERROR([Required CFLAG "$1" not supported by your compiler, aborting.])]
)]
)]
)
add_cflag([-Wall])
add_cflag([-Werror])
AC_SUBST([EXTRA_CFLAGS])
AC_SUBST([EXTRA_LDFLAGS])
AC_OUTPUT