build: enable ac config headers feature
This has number of benefits as described in the GNU autoconf manual.
See the manual for details.
Fixes: #1232
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
diff --git a/.gitignore b/.gitignore
index 6f6a07d..22597c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,3 +80,4 @@
Doxyfile
doc/rtf
m4/
+config.h*
diff --git a/configure.ac b/configure.ac
index facb4db..8d97349 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,8 @@
subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) #Backward compatible setting of "silent-rules"
+AC_CONFIG_HEADERS([config.h])
+
AC_CONFIG_FILES([Makefile Doxyfile])
# propagate configure arguments to distcheck
@@ -49,7 +51,7 @@
[PKG_CHECK_MODULES([CMOCKA],
[cmocka >= cmocka_min_version],
[AC_DEFINE([HAVE_CMOCKA],
- [1])],
+ [1], [CMOCKA UNIT TEST LIBRARY])],
[AC_MSG_ERROR([cmocka_err])])])
AM_CONDITIONAL([UNIT], [test "x$enable_unit" != xno])
@@ -68,7 +70,7 @@
[enable_tcti_device_async=$enableval],
[enable_tcti_device_async=no])
AS_IF([test "x$enable_tcti_device_async" = "xyes"],
- AC_DEFINE([TCTI_ASYNC],[1]))
+ AC_DEFINE([TCTI_ASYNC],[1], [TCTI ASYNC MODE]))
AC_ARG_ENABLE([tcti-partial-reads],
AS_HELP_STRING([--enable-tcti-partial-reads],
@@ -77,7 +79,7 @@
[enable_tcti_partial_reads=$enableval],
[enable_tcti_partial_reads=no])
AS_IF([test "x$enable_tcti_partial_reads" = "xyes"],
- AC_DEFINE([TCTI_PARTIAL_READ],[1]))
+ AC_DEFINE([TCTI_PARTIAL_READ],[1], [TCTI PARTIAL READ MODE]))
AC_ARG_WITH([crypto],
[AS_HELP_STRING([--with-crypto={gcrypt,ossl}],
diff --git a/src/tss2-esys/esys_iutil.h b/src/tss2-esys/esys_iutil.h
index 9403401..84887af 100644
--- a/src/tss2-esys/esys_iutil.h
+++ b/src/tss2-esys/esys_iutil.h
@@ -9,6 +9,7 @@
#include <stdbool.h>
#include <inttypes.h>
#include <string.h>
+#include <config.h>
#include "tss2_esys.h"
diff --git a/src/tss2-mu/base-types.c b/src/tss2-mu/base-types.c
index 269a4e2..669cbb9 100644
--- a/src/tss2-mu/base-types.c
+++ b/src/tss2-mu/base-types.c
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include <string.h>
+#include <config.h>
#include "tss2_mu.h"
diff --git a/src/tss2-mu/tpm2b-types.c b/src/tss2-mu/tpm2b-types.c
index f9bc0ac..9c1003a 100644
--- a/src/tss2-mu/tpm2b-types.c
+++ b/src/tss2-mu/tpm2b-types.c
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include <string.h>
+#include <config.h>
#include "tss2_mu.h"
diff --git a/src/tss2-mu/tpma-types.c b/src/tss2-mu/tpma-types.c
index 762e955..24a9b9e 100644
--- a/src/tss2-mu/tpma-types.c
+++ b/src/tss2-mu/tpma-types.c
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include <string.h>
+#include <config.h>
#include "tss2_mu.h"
diff --git a/src/tss2-mu/tpml-types.c b/src/tss2-mu/tpml-types.c
index 6f1726d..d618caf 100644
--- a/src/tss2-mu/tpml-types.c
+++ b/src/tss2-mu/tpml-types.c
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include <string.h>
+#include <config.h>
#include "tss2_mu.h"
diff --git a/src/tss2-mu/tpms-types.c b/src/tss2-mu/tpms-types.c
index 344fbce..efaa467 100644
--- a/src/tss2-mu/tpms-types.c
+++ b/src/tss2-mu/tpms-types.c
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include <string.h>
+#include <config.h>
#include "tss2_mu.h"
diff --git a/src/tss2-mu/tpmt-types.c b/src/tss2-mu/tpmt-types.c
index 523c328..3138bce 100644
--- a/src/tss2-mu/tpmt-types.c
+++ b/src/tss2-mu/tpmt-types.c
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include <string.h>
+#include <config.h>
#include "tss2_mu.h"
diff --git a/src/tss2-mu/tpmu-types.c b/src/tss2-mu/tpmu-types.c
index d3d1fe5..ed0d8b1 100644
--- a/src/tss2-mu/tpmu-types.c
+++ b/src/tss2-mu/tpmu-types.c
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include <string.h>
+#include <config.h>
#include "tss2_mu.h"
diff --git a/src/tss2-sys/sysapi_util.h b/src/tss2-sys/sysapi_util.h
index c7fa8f5..5c98844 100644
--- a/src/tss2-sys/sysapi_util.h
+++ b/src/tss2-sys/sysapi_util.h
@@ -7,6 +7,8 @@
#ifndef TSS2_SYSAPI_UTIL_H
#define TSS2_SYSAPI_UTIL_H
+#include <config.h>
+
#include "tss2_tpm2_types.h"
#include "tss2_tcti.h"
#include "tss2_sys.h"
diff --git a/src/tss2-tcti/tcti-common.h b/src/tss2-tcti/tcti-common.h
index a6beaea..036be52 100644
--- a/src/tss2-tcti/tcti-common.h
+++ b/src/tss2-tcti/tcti-common.h
@@ -8,6 +8,7 @@
#include <errno.h>
#include <stdbool.h>
+#include <config.h>
#include "tss2_tcti.h"
diff --git a/src/util/log.h b/src/util/log.h
index 704e1fe..0a6155e 100644
--- a/src/util/log.h
+++ b/src/util/log.h
@@ -3,6 +3,7 @@
#include <stdint.h>
#include <stddef.h>
+#include <config.h>
#ifndef LOGMODULE
#error "LOGMODULE must be set before including log/log.h"