Limit the number of Active pnor versions

- We need to limit the number of pnor versions because
  pnor chip has limited space. If we run out of space
  and the user tries another pnor code update then the
  update will fail.
- Currently we can only hold two images on pnor at this
  point. As we continue to decrease the size of pnor image
  we will increment the number of active pnor chips we can
  hold.
- This check will need to be removed once we have complete
  issue #1402 which will automatically monitor the flash
  usage and delete any image accordingly.

Resolves openbmc/openbmc#2155

Change-Id: Id62ba8554fba1ddb78286f70b0c3482a7beb8a6b
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
diff --git a/configure.ac b/configure.ac
index 48d359a..8abd1b5 100755
--- a/configure.ac
+++ b/configure.ac
@@ -99,5 +99,9 @@
 AC_DEFINE(PNOR_PRSV_ACTIVE_PATH, "/var/lib/phosphor-software-manager/pnor/prsv",
     [Path to the active preserved pnor partitions])
 
+AC_ARG_VAR(ACTIVE_PNOR_MAX_ALLOWED, [The maximum allowed active pnor versions])
+AS_IF([test "x$ACTIVE_PNOR_MAX_ALLOWED" == "x"], [ACTIVE_PNOR_MAX_ALLOWED=2])
+AC_DEFINE_UNQUOTED([ACTIVE_PNOR_MAX_ALLOWED], [$ACTIVE_PNOR_MAX_ALLOWED], [The maximum allowed active pnor versions])
+
 AC_CONFIG_FILES([Makefile test/Makefile])
 AC_OUTPUT