Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 1 | AC_PREREQ([2.69]) |
| 2 | AC_INIT([openpower-occ-control], [1.0], [https://github.com/openbmc/openpower-occ-control/issues]) |
| 3 | |
| 4 | AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz]) |
| 5 | AM_SILENT_RULES([yes]) |
| 6 | |
| 7 | # Checks for programs |
| 8 | AC_PROG_CXX |
| 9 | AM_PROG_AR |
| 10 | AC_PROG_INSTALL |
| 11 | AC_PROG_MAKE_SET |
| 12 | |
| 13 | # Surpress the --with-libtool-sysroot error |
| 14 | LT_INIT |
| 15 | |
Andrew Geissler | 4cea4d2 | 2017-07-10 15:13:33 -0500 | [diff] [blame] | 16 | # gtest |
| 17 | # Check/set gtest specific functions. |
| 18 | AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) |
| 19 | AC_SUBST(GTEST_CPPFLAGS) |
| 20 | |
| 21 | # Test cases require SDK so only build if we're told to (and SDK is available) |
| 22 | AC_ARG_ENABLE([oe-sdk], |
| 23 | AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.]) |
| 24 | ) |
| 25 | AC_ARG_VAR(OECORE_TARGET_SYSROOT, |
| 26 | [Path to the OE SDK SYSROOT]) |
| 27 | AS_IF([test "x$enable_oe_sdk" == "xyes"], |
| 28 | AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"], |
| 29 | AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk]) |
| 30 | ) |
| 31 | AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT]) |
| 32 | [ |
| 33 | testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib" |
| 34 | testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib" |
| 35 | testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`" |
| 36 | ] |
| 37 | AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags]) |
| 38 | ) |
| 39 | |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 40 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,\ |
| 41 | AC_MSG_ERROR(["Requires sdbusplus package."])) |
| 42 | PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],,\ |
| 43 | AC_MSG_ERROR(["Requires phosphor-logging package."])) |
| 44 | PKG_CHECK_MODULES([OPENPOWER_DBUS_INTERFACES], [openpower-dbus-interfaces],,\ |
| 45 | AC_MSG_ERROR(["Requires openpower-dbus-interfaces package."])) |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 46 | PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],,\ |
| 47 | AC_MSG_ERROR(["Requires phosphor-dbus-interfaces package."])) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 48 | |
Vishwanatha Subbanna | 9bb065b | 2017-04-18 14:25:26 +0530 | [diff] [blame] | 49 | # Check for sdbusplus |
| 50 | PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],, [AC_MSG_ERROR(["sdbusplus packaged required and not found"])]) |
| 51 | |
| 52 | # Check for sdbus++ tool |
| 53 | AC_PATH_PROG([SDBUSPLUSPLUS], [sdbus++]) |
| 54 | AS_IF([test "x$SDBUSPLUSPLUS" == "x"], AC_MSG_ERROR([Cannot find sdbus++])) |
| 55 | |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 56 | # Checks for typedefs, structures, and compiler characteristics. |
| 57 | AX_CXX_COMPILE_STDCXX_14([noext]) |
| 58 | AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS]) |
| 59 | |
Lei YU | 0ab90ca | 2017-07-13 17:02:23 +0800 | [diff] [blame] | 60 | AC_ARG_ENABLE([i2c-occ], |
| 61 | AS_HELP_STRING([--enable-i2c-occ], [Enable I2C OCC support]) |
| 62 | ) |
| 63 | AS_IF([test "x$enable_i2c_occ" == "xyes"], |
| 64 | AC_MSG_NOTICE([Enabling I2C OCC]) |
| 65 | [ |
| 66 | cpp_flags="-DI2C_OCC" |
| 67 | ] |
| 68 | AC_SUBST([CPPFLAGS], [$cpp_flags]) |
| 69 | ) |
| 70 | |
Vishwanatha Subbanna | 2180b2d | 2017-06-28 14:05:57 +0530 | [diff] [blame] | 71 | AC_ARG_VAR(OCC_CONTROL_BUSNAME, [The Dbus busname to own]) |
| 72 | AS_IF([test "x$OCC_CONTROL_BUSNAME" == "x"], [OCC_CONTROL_BUSNAME="org.open_power.OCC.Control"]) |
| 73 | AC_DEFINE_UNQUOTED([OCC_CONTROL_BUSNAME], ["$OCC_CONTROL_BUSNAME"], [The DBus busname to own]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 74 | |
Vishwanatha Subbanna | 2180b2d | 2017-06-28 14:05:57 +0530 | [diff] [blame] | 75 | AC_ARG_VAR(OCC_CONTROL_ROOT, [The Dbus root]) |
| 76 | AS_IF([test "x$OCC_CONTROL_ROOT" == "x"], [OCC_CONTROL_ROOT="/org/open_power/control"]) |
| 77 | AC_DEFINE_UNQUOTED([OCC_CONTROL_ROOT], ["$OCC_CONTROL_ROOT"], [The Dbus root]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 78 | |
Deepak Kodihalli | fd358d1 | 2017-05-08 07:11:22 -0500 | [diff] [blame] | 79 | AC_ARG_VAR(CPU_PATH, [CPU inventory path]) |
| 80 | AS_IF([test "x$CPU_PATH" == "x"], [CPU_PATH="/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu"]) |
| 81 | AC_DEFINE_UNQUOTED([CPU_PATH], ["$CPU_PATH"], [CPU inventory path]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 82 | |
Deepak Kodihalli | fd358d1 | 2017-05-08 07:11:22 -0500 | [diff] [blame] | 83 | AC_ARG_VAR(MAX_CPUS, [The max number of CPUs]) |
| 84 | AS_IF([test "x$MAX_CPUS" == "x"], [MAX_CPUS=2]) |
| 85 | AC_DEFINE_UNQUOTED([MAX_CPUS], [$MAX_CPUS], [The max number of CPUs]) |
| 86 | |
| 87 | AC_ARG_VAR(CPU_NAME, [The CPU object name]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 88 | AS_IF([test "x$CPU_NAME" == "x"], [CPU_NAME="cpu"]) |
Deepak Kodihalli | fd358d1 | 2017-05-08 07:11:22 -0500 | [diff] [blame] | 89 | AC_DEFINE_UNQUOTED([CPU_NAME], ["$CPU_NAME"], [The CPU object name]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 90 | |
Deepak Kodihalli | fd358d1 | 2017-05-08 07:11:22 -0500 | [diff] [blame] | 91 | AC_ARG_VAR(OCC_NAME, [The OCC object name]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 92 | AS_IF([test "x$OCC_NAME" == "x"], [OCC_NAME="occ"]) |
Deepak Kodihalli | fd358d1 | 2017-05-08 07:11:22 -0500 | [diff] [blame] | 93 | AC_DEFINE_UNQUOTED([OCC_NAME], ["$OCC_NAME"], [The OCC object name]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 94 | |
Andrew Geissler | 6ac874e | 2017-07-10 15:54:58 -0500 | [diff] [blame] | 95 | AC_ARG_VAR(OCC_MASTER_NAME, [The OCC master object name]) |
Andrew Geissler | 554d600 | 2017-07-21 13:28:56 -0500 | [diff] [blame] | 96 | AS_IF([test "x$OCC_MASTER_NAME" == "x"], [OCC_MASTER_NAME="occ1-dev0"]) |
Andrew Geissler | 6ac874e | 2017-07-10 15:54:58 -0500 | [diff] [blame] | 97 | AC_DEFINE_UNQUOTED([OCC_MASTER_NAME], ["$OCC_MASTER_NAME"], [The OCC master object name]) |
| 98 | |
Vishwanatha Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 99 | AC_ARG_VAR(OCC_HWMON_PATH, [The OCC hwmon path]) |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 100 | AC_ARG_VAR(DEV_PATH, [The device path]) |
Lei YU | 0ab90ca | 2017-07-13 17:02:23 +0800 | [diff] [blame] | 101 | AC_ARG_VAR(I2C_OCC_DEVICE_NAME, [The device name of i2c occ hwmon]) |
| 102 | AS_IF([test "x$enable_i2c_occ" == "xyes"], |
| 103 | # If enable_2c_occ is defined, define occ hwmon path for I2C and its driver's name |
| 104 | AS_IF([test "x$OCC_HWMON_PATH" == "x"], [OCC_HWMON_PATH="/sys/bus/i2c/drivers/occ-hwmon/"]) |
| 105 | AS_IF([test "x$DEV_PATH" == "x"], [DEV_PATH="/sys/bus/i2c/devices"]) |
| 106 | AS_IF([test "x$I2C_OCC_DEVICE_NAME" == "x"], [I2C_OCC_DEVICE_NAME="p8-occ-hwmon"]), |
| 107 | |
| 108 | # Else, define occ hwmon path for FSI |
| 109 | AS_IF([test "x$OCC_HWMON_PATH" == "x"], [OCC_HWMON_PATH="/sys/bus/platform/drivers/occ-hwmon/"]) |
| 110 | AS_IF([test "x$DEV_PATH" == "x"], [DEV_PATH="/sys/bus/platform/devices/"]), |
| 111 | ) |
| 112 | AC_DEFINE_UNQUOTED([OCC_HWMON_PATH], ["$OCC_HWMON_PATH"], [The OCC hwmon path]) |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 113 | AC_DEFINE_UNQUOTED([DEV_PATH], ["$DEV_PATH"], [The device path]) |
Lei YU | 0ab90ca | 2017-07-13 17:02:23 +0800 | [diff] [blame] | 114 | AC_DEFINE_UNQUOTED([I2C_OCC_DEVICE_NAME], ["$I2C_OCC_DEVICE_NAME"], [The device name of i2c occ hwmon]) |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 115 | |
Vishwanatha Subbanna | d298105 | 2017-08-09 21:42:10 +0530 | [diff] [blame] | 116 | AC_ARG_VAR(FSI_SCAN_FILE, [The File to write for initiating FSI rescan]) |
| 117 | AS_IF([test "x$FSI_SCAN_FILE" == "x"], [FSI_SCAN_FILE="/sys/devices/platform/gpio-fsi/fsi0/slave@00:00/00:00:00:0a/fsi1/rescan"]) |
| 118 | AC_DEFINE_UNQUOTED([FSI_SCAN_FILE], ["$FSI_SCAN_FILE"], [The File to write for initiating FSI rescan]) |
| 119 | |
Vishwanatha Subbanna | 3e5422e | 2017-08-10 18:25:26 +0530 | [diff] [blame] | 120 | AC_ARG_VAR(OCC_DEV_PATH, [The OCC device path in /dev]) |
| 121 | AS_IF([test "x$OCC_DEV_PATH" == "x"], [OCC_DEV_PATH="/dev/occ"]) |
| 122 | AC_DEFINE_UNQUOTED([OCC_DEV_PATH], ["$OCC_DEV_PATH"], [The OCC device path in /dev]) |
| 123 | |
Andrew Geissler | 4cea4d2 | 2017-07-10 15:13:33 -0500 | [diff] [blame] | 124 | AC_ARG_VAR(PS_DERATING_FACTOR, [The power supply derating factor]) |
| 125 | AS_IF([test "x$PS_DERATING_FACTOR" == "x"], [PS_DERATING_FACTOR=90]) |
| 126 | AC_DEFINE_UNQUOTED([PS_DERATING_FACTOR], [$PS_DERATING_FACTOR], [The power supply derating factor]) |
| 127 | |
Deepak Kodihalli | 5f031f3 | 2017-07-26 08:25:59 -0500 | [diff] [blame] | 128 | AC_ARG_VAR(CPU_SUBPATH, [The subpath containing CPU objects]) |
| 129 | AS_IF([test "x$CPU_SUBPATH" == "x"], [CPU_SUBPATH="/xyz/openbmc_project/inventory/system/chassis/motherboard"]) |
| 130 | AC_DEFINE_UNQUOTED([CPU_SUBPATH], ["$CPU_SUBPATH"], [The subpath containing CPU objects]) |
| 131 | |
Vishwanatha Subbanna | 6add0b8 | 2017-07-21 19:02:37 +0530 | [diff] [blame] | 132 | # Handling configuration files |
| 133 | AC_ARG_VAR(YAML_PATH, [The path to the yaml config files.]) |
| 134 | AS_IF([test "x$YAML_PATH" == "x"], [YAML_PATH="$srcdir/example"]) |
| 135 | AC_DEFINE_UNQUOTED([YAML_PATH], ["$YAML_PATH"], [The path to the yaml config files]) |
| 136 | |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 137 | AC_CONFIG_HEADERS([config.h]) |
Andrew Geissler | 4cea4d2 | 2017-07-10 15:13:33 -0500 | [diff] [blame] | 138 | AC_CONFIG_FILES([Makefile test/Makefile]) |
Deepak Kodihalli | 92a6341 | 2017-03-17 05:01:00 -0500 | [diff] [blame] | 139 | AC_OUTPUT |