blob: cd2a88fc5fc45b9262afceb8e54ffea7f5451fe1 [file] [log] [blame]
Gunnar Mills9df13162017-03-08 15:00:08 -06001AC_PREREQ([2.69])
2AC_INIT([openpower-pnor-code-mgmt], [1.0], [https://github.com/openbmc/openpower-pnor-code-mgmt/issues])
3AC_LANG([C++])
4AC_CONFIG_HEADERS([config.h])
5AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
6AM_SILENT_RULES([yes])
7
Andrew Jeffery234ba8a2017-04-18 16:55:25 +09308AC_CONFIG_MACRO_DIRS([m4])
9
Gunnar Mills9df13162017-03-08 15:00:08 -060010# Checks for programs
11AC_PROG_CXX
12AC_PROG_INSTALL #Checks/sets the install variable to be used
13AC_PROG_MAKE_SET
14
15# Check for libraries
Patrick Venture0d2f9322019-02-13 15:15:28 -080016PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
17PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus])
Brad Bishop0283f7c2020-11-09 10:09:26 -050018PKG_CHECK_MODULES([SDEVENTPLUS], [sdeventplus])
Patrick Venture0d2f9322019-02-13 15:15:28 -080019PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
Gunnar Mills9df13162017-03-08 15:00:08 -060020
21# Checks for library functions
22LT_INIT # Required for systemd linking
23
Lei YU7d832d72019-03-14 13:58:07 +080024PKG_PROG_PKG_CONFIG
25AC_ARG_WITH([systemdsystemunitdir],
26 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
27 [with_systemdsystemunitdir=auto])
28AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
29 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
30
31 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
32 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
33 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
34 with_systemdsystemunitdir=no],
35 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
36AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
37 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
38AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
39
Gunnar Mills1ea62e12017-03-27 21:49:16 -050040# Check/set gtest specific functions.
41AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
42AC_SUBST(GTEST_CPPFLAGS)
43AC_ARG_ENABLE([oe-sdk],
44 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
45)
46AC_ARG_VAR(OECORE_TARGET_SYSROOT,
47 [Path to the OE SDK SYSROOT])
48AS_IF([test "x$enable_oe_sdk" == "xyes"],
49 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
50 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
51 )
52 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
53 [
54 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
55 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
56 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
57 ]
58 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
59)
60
Gunnar Mills9df13162017-03-08 15:00:08 -060061# Checks for typedefs, structures, and compiler characteristics.
Adriana Kobylak139604e2018-09-24 13:21:12 -050062AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
Gunnar Mills9df13162017-03-08 15:00:08 -060063AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
64
Gunnar Mills9df13162017-03-08 15:00:08 -060065AC_ARG_VAR(SOFTWARE_OBJPATH, [The software manager Dbus root])
66AS_IF([test "x$SOFTWARE_OBJPATH" == "x"], [SOFTWARE_OBJPATH="/xyz/openbmc_project/software"])
67AC_DEFINE_UNQUOTED([SOFTWARE_OBJPATH], ["$SOFTWARE_OBJPATH"], [The software manager Dbus root])
68
Gunnar Millsfe075362017-08-30 13:06:30 -050069AC_DEFINE(ACTIVATION_FWD_ASSOCIATION, "inventory", [The name of the activation's forward association.])
70AC_DEFINE(ACTIVATION_REV_ASSOCIATION, "activation", [The name of the activation's reverse association.])
Gunnar Mills3edb84b2017-08-18 15:13:15 -050071AC_DEFINE(HOST_INVENTORY_PATH, "/xyz/openbmc_project/inventory/system/chassis", [The host inventory path.])
72
Gunnar Mills9741cd12017-08-28 15:09:00 -050073AC_DEFINE(ACTIVE_FWD_ASSOCIATION, "active", [The name of the active's forward association.])
74AC_DEFINE(ACTIVE_REV_ASSOCIATION, "software_version", [The name of the active's reverse association.])
75
Adriana Kobylak3c810372020-07-15 16:47:03 -050076AC_DEFINE(UPDATEABLE_FWD_ASSOCIATION, "updateable", [The name of the updateable forward association.])
77AC_DEFINE(UPDATEABLE_REV_ASSOCIATION, "software_version", [The updateable reverse association.])
78
Gunnar Mills833e4f32017-09-14 12:30:27 -050079AC_DEFINE(FUNCTIONAL_FWD_ASSOCIATION, "functional", [The name of the functional forward association.])
Adriana Kobylakcb273172018-05-02 11:13:25 -050080AC_DEFINE(FUNCTIONAL_REV_ASSOCIATION, "software_version", [The functional reverse association.])
Gunnar Mills833e4f32017-09-14 12:30:27 -050081
Adriana Kobylakb66ac3a2017-03-28 13:33:20 -050082AC_DEFINE(VERSION_IFACE, "xyz.openbmc_project.Software.Version",
83 [The software version manager interface])
Adriana Kobylak5ba6b102017-05-19 09:41:27 -050084AC_DEFINE(FILEPATH_IFACE, "xyz.openbmc_project.Common.FilePath",
85 [The common file path interface])
Adriana Kobylakb66ac3a2017-03-28 13:33:20 -050086
Adriana Kobylak2d8fa222017-03-15 12:34:32 -050087AC_DEFINE(BUSNAME_UPDATER, "org.open_power.Software.Host.Updater",
88 [The item updater DBus busname to own.])
89
Jayanth Othayoth4016e522018-03-20 09:39:06 -050090AC_ARG_VAR(IMG_DIR, [Directory where downloaded or uploaded software images are placed and extracted])
91AS_IF([test "x$IMG_DIR" == "x"], [IMG_DIR="/tmp/images"])
92AC_DEFINE_UNQUOTED([IMG_DIR], ["$IMG_DIR"], [Directory where downloaded or uploaded software images are placed and extracted])
93
Saqib Khan77420d22017-04-04 11:07:07 -050094AC_ARG_VAR(MANIFEST_FILE, [The path to the MANIFEST file])
Adriana Kobylak5ba6b102017-05-19 09:41:27 -050095AS_IF([test "x$MANIFEST_FILE" == "x"], [MANIFEST_FILE="MANIFEST"])
Saqib Khan77420d22017-04-04 11:07:07 -050096AC_DEFINE_UNQUOTED([MANIFEST_FILE], ["$MANIFEST_FILE"], [The path to the MANIFEST file])
Gunnar Mills44c77292017-03-20 15:02:27 -050097
Jayanth Othayoth70804dc2018-03-20 06:31:59 -050098AC_ARG_VAR(PUBLICKEY_FILE_NAME, [The name of the public key file])
99AS_IF([test "x$PUBLICKEY_FILE_NAME" == "x"], [PUBLICKEY_FILE_NAME="publickey"])
100AC_DEFINE_UNQUOTED([PUBLICKEY_FILE_NAME], ["$PUBLICKEY_FILE_NAME"], [The name of the public key file])
101
102AC_ARG_VAR(HASH_FILE_NAME, [Hash file name])
103AS_IF([test "x$HASH_FILE_NAME" == "x"], [HASH_FILE_NAME="hashfunc"])
104AC_DEFINE_UNQUOTED([HASH_FILE_NAME], ["$HASH_FILE_NAME"], [The name of the hash file])
105
106AC_ARG_VAR(PNOR_SIGNED_IMAGE_CONF_PATH, [Path of PNOR image public key and hash function files])
107AS_IF([test "x$PNOR_SIGNED_IMAGE_CONF_PATH" == "x"], [PNOR_SIGNED_IMAGE_CONF_PATH="/etc/activationdata/"])
108AC_DEFINE_UNQUOTED([PNOR_SIGNED_IMAGE_CONF_PATH], ["$PNOR_SIGNED_IMAGE_CONF_PATH"], [Path of PNOR image public key and hash function files])
109
110AC_ARG_VAR(SIGNATURE_FILE_EXT, [The extension of the Signature file])
111AS_IF([test "x$SIGNATURE_FILE_EXT" == "x"], [SIGNATURE_FILE_EXT=".sig"])
112AC_DEFINE_UNQUOTED([SIGNATURE_FILE_EXT], ["$SIGNATURE_FILE_EXT"], [The extension of the Signature file])
113
114# setup signature verification
Adriana Kobylak207469f2018-04-17 10:35:26 -0500115AC_ARG_ENABLE([verify_pnor_signature],
116 AS_HELP_STRING([--enable-verify_pnor_signature], [Enable image signature validation.]))
117AS_IF([test "x$enable_verify_pnor_signature" == "xyes"], \
Jayanth Othayoth70804dc2018-03-20 06:31:59 -0500118 [AC_DEFINE([WANT_SIGNATURE_VERIFY],[],[Enable image signature validation.])])
Adriana Kobylak207469f2018-04-17 10:35:26 -0500119AM_CONDITIONAL([WANT_SIGNATURE_VERIFY_BUILD], [test "x$enable_verify_pnor_signature" == "xyes"])
Jayanth Othayoth70804dc2018-03-20 06:31:59 -0500120
Adriana Kobylakf3dfe652019-10-08 11:35:55 -0500121# setup virtual pnor support
122AC_ARG_ENABLE([virtual-pnor],
123 AS_HELP_STRING([--enable-virtual-pnor], [Enable support for virtual pnor])
124)
125AM_CONDITIONAL([VIRTUAL_PNOR_ENABLED], [test "x$enable_virtual_pnor" == "xyes"])
126
Michael Tritz5b756512017-10-06 16:52:01 -0500127AC_DEFINE(CHASSIS_STATE_PATH, "/xyz/openbmc_project/state/chassis0",
128 [The chassis state path.])
129AC_DEFINE(CHASSIS_STATE_OBJ, "xyz.openbmc_project.State.Chassis",
130 [The chassis state interface.])
131AC_DEFINE(CHASSIS_STATE_OFF, "xyz.openbmc_project.State.Chassis.PowerState.Off",
132 [The chassis state off property value.])
133
Adriana Kobylakb66ac3a2017-03-28 13:33:20 -0500134AC_DEFINE(MAPPER_BUSNAME, "xyz.openbmc_project.ObjectMapper",
135 [The object mapper busname.])
136AC_DEFINE(MAPPER_PATH, "/xyz/openbmc_project/object_mapper",
137 [The object mapper path.])
138AC_DEFINE(MAPPER_INTERFACE, "xyz.openbmc_project.ObjectMapper",
139 [The object mapper interface.])
140
Adriana Kobylak692b5552017-04-17 14:02:58 -0500141AC_DEFINE(SYSTEMD_BUSNAME, "org.freedesktop.systemd1",
142 [systemd busname.])
143AC_DEFINE(SYSTEMD_PATH, "/org/freedesktop/systemd1",
144 [systemd path.])
145AC_DEFINE(SYSTEMD_INTERFACE, "org.freedesktop.systemd1.Manager",
146 [systemd interface.])
Michael Tritz5b756512017-10-06 16:52:01 -0500147AC_DEFINE(SYSTEMD_PROPERTY_INTERFACE, "org.freedesktop.DBus.Properties",
148 [systemd properties interface.])
John Wangd05d4722019-09-11 15:18:15 +0800149AC_DEFINE(ASSOCIATIONS_INTERFACE, "xyz.openbmc_project.Association.Definitions",
Adriana Kobylakea4e6ae2018-10-30 12:17:31 -0500150 [The associations interface.])
Adriana Kobylak692b5552017-04-17 14:02:58 -0500151
Adriana Kobylak55f9e832017-05-14 16:13:00 -0500152AC_DEFINE(PNOR_TOC_FILE, "pnor.toc",
153 [The name of the PNOR table of contents file])
Saqib Khan4c5d7442017-07-18 00:43:52 -0500154AC_DEFINE(MEDIA_DIR, "/media/",
155 [The base dir where all PNOR RO AND RW partitions are mounted])
Michael Tritz60bc20f2017-07-29 23:32:21 -0500156AC_DEFINE(PERSIST_DIR, "/var/lib/obmc/openpower-pnor-code-mgmt/",
157 [The dir where activation data is stored in files])
Adriana Kobylak55f9e832017-05-14 16:13:00 -0500158AC_DEFINE(PNOR_RO_PREFIX, "/media/pnor-ro-",
159 [The prefix path for the versioned read-only pnor partitions])
160AC_DEFINE(PNOR_RW_PREFIX, "/media/pnor-rw-",
161 [The prefix path for the versioned read-write pnor partitions])
162AC_DEFINE(PNOR_PRSV, "/media/pnor-prsv",
163 [The path for the preserved pnor partitions])
164AC_DEFINE(PNOR_ACTIVE_PATH, "/var/lib/phosphor-software-manager/pnor/",
165 [Path to the active pnor partitions])
166AC_DEFINE(PNOR_RO_ACTIVE_PATH, "/var/lib/phosphor-software-manager/pnor/ro",
167 [Path to the active read-only pnor partitions])
168AC_DEFINE(PNOR_RW_ACTIVE_PATH, "/var/lib/phosphor-software-manager/pnor/rw",
169 [Path to the active read-write pnor partitions])
170AC_DEFINE(PNOR_PRSV_ACTIVE_PATH, "/var/lib/phosphor-software-manager/pnor/prsv",
171 [Path to the active preserved pnor partitions])
172
Lei YUf3ce4332019-02-21 14:09:49 +0800173# Setup ubifs layout support
Lei YUf3ce4332019-02-21 14:09:49 +0800174AC_ARG_ENABLE([ubifs_layout],
Adriana Kobylak8bc2ab42020-07-15 09:16:27 -0500175 AS_HELP_STRING([--enable-ubifs_layout], [Enable ubifs support.]))
176AS_IF([test "x$enable_ubifs_layout" == "xyes"], \
Lei YUf3ce4332019-02-21 14:09:49 +0800177 [AC_DEFINE([UBIFS_LAYOUT],[],[Enable ubifs support.])])
Adriana Kobylak8bc2ab42020-07-15 09:16:27 -0500178AM_CONDITIONAL([UBIFS_LAYOUT], [test "x$enable_ubifs_layout" == "xyes"])
179
180# Setup MMC layout support
181AC_ARG_ENABLE([mmc_layout],
182 AS_HELP_STRING([--enable-mmc_layout], [Enable MMC support.]))
183AS_IF([test "x$enable_mmc_layout" == "xyes"], \
184 [AC_DEFINE([MMC_LAYOUT],[],[Enable MMC support.])])
185AM_CONDITIONAL([MMC_LAYOUT], [test "x$enable_mmc_layout" == "xyes"])
186
187# Setup static layout support (default)
188AS_IF([test "x$enable_ubifs_layout" != "xyes" -a "x$enable_mmc_layout" != "xyes"], \
189 [AC_DEFINE([STATIC_LAYOUT],[],[Enable static layout support.])])
190AM_CONDITIONAL([STATIC_LAYOUT], [test "x$enable_ubifs_layout" != "xyes" -a "x$enable_mmc_layout" != "xyes"])
Lei YUf3ce4332019-02-21 14:09:49 +0800191
Saqib Khan2cbfa032017-08-17 14:52:37 -0500192AC_ARG_VAR(ACTIVE_PNOR_MAX_ALLOWED, [The maximum allowed active pnor versions])
193AS_IF([test "x$ACTIVE_PNOR_MAX_ALLOWED" == "x"], [ACTIVE_PNOR_MAX_ALLOWED=2])
194AC_DEFINE_UNQUOTED([ACTIVE_PNOR_MAX_ALLOWED], [$ACTIVE_PNOR_MAX_ALLOWED], [The maximum allowed active pnor versions])
195
Adriana Kobylak4772a942018-10-09 15:26:44 -0500196AC_ARG_VAR(PNOR_MSL, [The PNOR minimum ship level])
197AS_IF([test "x$PNOR_MSL" == "x"], [PNOR_MSL=""])
198AC_DEFINE_UNQUOTED([PNOR_MSL], ["$PNOR_MSL"], [The PNOR minimum ship level])
199
200AC_ARG_VAR(PNOR_VERSION_PARTITION, [The name of the PNOR version partition])
201AS_IF([test "x$PNOR_VERSION_PARTITION" == "x"], [PNOR_VERSION_PARTITION="VERSION"])
202AC_DEFINE_UNQUOTED([PNOR_VERSION_PARTITION], ["$PNOR_VERSION_PARTITION"],
203 [The name of the PNOR version partition])
204
Gunnar Mills1ea62e12017-03-27 21:49:16 -0500205AC_CONFIG_FILES([Makefile test/Makefile])
Gunnar Mills9df13162017-03-08 15:00:08 -0600206AC_OUTPUT