build: Use AX_PTHREAD in configure.ac.
This gets us the right compiler and linker flags for pthreads
depending on the needs of the platform.
Resolves #6
Signed-off-by: Philip Tricca <philip.b.tricca@intel.com>
diff --git a/INSTALL b/INSTALL
index ec7e26c..2287046 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,6 @@
To build and install the tpm2.0-tss software the following software is required:
GNU Autoconf
+GNU Autoconf archive
GNU Automake
GNU Libtool
C compiler
diff --git a/Makefile.am b/Makefile.am
index 17533d3..49a479f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,10 +33,10 @@
bin_PROGRAMS = resourcemgr/resourcemgr test/tpmclient/tpmclient test/tpmtest/tpmtest
noinst_LIBRARIES = sysapi/libtpm.a
-resourcemgr_resourcemgr_CFLAGS = $(RESOURCEMGR_INC)
-resourcemgr_resourcemgr_CXXFLAGS = $(RESOURCEMGR_INC)
+resourcemgr_resourcemgr_CFLAGS = $(RESOURCEMGR_INC) $(PTHREAD_CFLAGS)
+resourcemgr_resourcemgr_CXXFLAGS = $(RESOURCEMGR_INC) $(PTHREAD_CFLAGS)
resourcemgr_resourcemgr_LDADD = $(noinst_LIBRARIES)
-resourcemgr_resourcemgr_LDFLAGS = -lpthread
+resourcemgr_resourcemgr_LDFLAGS = $(PTHREAD_LDFLAGS)
resourcemgr_resourcemgr_SOURCES = $(RESOURCEMGR_SRC) $(TPMSOCKETS_SRC) \
$(LOCALTPM_SRC) $(COMMON_SRC)
diff --git a/configure.ac b/configure.ac
index ca6adfb..2193c65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,7 @@
AC_PROG_CC
AC_PROG_CXX
LT_INIT([disable-shared])
+AX_PTHREAD([], [AC_MSG_ERROR([requires pthread])])
AM_INIT_AUTOMAKE([foreign
subdir-objects])
AC_CONFIG_FILES([Makefile])