build: add requirement for libpam to configure_ac

Add requirement for libpam in the configure_ac script, such that the
build will when not present.

Tested: Verified LIBS variable holds -lpam.
Change-Id: Idad73d89bd97c38fe739e16e5e23193e47945e50
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/Makefile.am b/Makefile.am
index 25a8c9c..88dda05 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,12 +11,12 @@
 	-module \
 	-avoid-version \
 	-shared \
-	$(LIBPAM)
+	$(LIBS)
 
 pam_ipmisave_la_SOURCES = src/pam_ipmisave/pam_ipmisave.c
 pam_ipmisave_la_LDFLAGS = \
 	-module \
 	-avoid-version \
 	-shared \
-	$(OPENSSL_LIBS) \
-	$(LIBPAM)
+	$(LIBS) \
+	$(OPENSSL_LIBS)
diff --git a/configure.ac b/configure.ac
index 47058ec..24bb490 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,7 @@
 AC_PROG_MAKE_SET
 
 AX_CHECK_OPENSSL([], [AC_MSG_ERROR(["openssl required and not found"])])
+AC_CHECK_LIB([pam], [pam_start], [], [AC_MSG_ERROR([libpam not found])])
 
 # Checks for library functions.
 LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot