blob: ebe40bc9485286154fbdcc19a9f254c93d76d8b9 [file] [log] [blame]
Matt Spinlerf716f322017-02-28 09:37:38 -06001AC_PREREQ([2.69])
2AC_INIT([openpower-proc-control], [1.0], [https://github.com/openbmc/openpower-proc-control/issues])
3AC_LANG([C++])
4AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
5AM_SILENT_RULES([yes])
6
7# Checks for programs
8AC_PROG_CXX
Marri Devender Rao78479602020-01-06 03:45:11 -06009AM_PROG_AR
Matt Spinlerf716f322017-02-28 09:37:38 -060010AC_PROG_INSTALL #Checks/sets the install variable to be used
11AC_PROG_MAKE_SET
12
13# Checks for typedefs, structures, and compiler characteristics.
Vernon Maueryb3d71312018-10-04 10:09:58 -070014AX_CXX_COMPILE_STDCXX_17([noext])
Ramesh Iyyaref767ee2020-09-22 02:46:51 -050015AX_APPEND_COMPILE_FLAGS([-Wall -Werror -Wno-psabi], [CXXFLAGS])
Matt Spinlerf716f322017-02-28 09:37:38 -060016
17# Checks for library functions
18LT_INIT
19
Matt Spinler597e05c2017-02-28 09:59:53 -060020# Check/set gtest specific functions.
21AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
22AC_SUBST(GTEST_CPPFLAGS)
23AC_ARG_ENABLE([oe-sdk],
24 AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
25)
26AC_ARG_VAR(OECORE_TARGET_SYSROOT,
27 [Path to the OE SDK SYSROOT])
28AS_IF([test "x$enable_oe_sdk" == "xyes"],
29 AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
30 AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
31 )
32 AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
33 [
34 testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
35 testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
36 testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
37 ]
38 AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
39)
40
Matt Spinleree401e92017-09-18 14:15:31 -050041#CHIPS can be passed in a from a recipe, or it will default to P9 and openfsi
Matt Spinler12bdf052017-03-09 16:01:39 -060042AC_ARG_VAR(CHIPS, [The list of chips to build the procedures for])
Ramesh Iyyar6230b0d2019-12-05 10:06:44 -060043
44AC_ARG_ENABLE([p9], AS_HELP_STRING([--enable-p9], [Use internal host initialisation procedures for POWER9 processors]))
Jayanth Othayothf7d1c1d2020-02-12 02:25:37 -060045AS_IF([test "$enable_p9" == "yes"], [CHIPS+=" p9 common"])
Ramesh Iyyar6230b0d2019-12-05 10:06:44 -060046
47AC_ARG_ENABLE([openfsi], AS_HELP_STRING([--enable-openfsi], [Support Openfsi]))
48AS_IF([test "$enable_openfsi" == "yes"], [CHIPS+=" openfsi"])
49
Ramesh Iyyarb181d3b2019-10-17 13:39:10 -050050AC_ARG_ENABLE([phal], AS_HELP_STRING([--enable-phal], [Use host processor initialisation procedures from PHAL])])
51
52AS_IF([ test "$enable_phal" == "yes" && test "$enable_p9" == "yes"],
53 [ AC_MSG_ERROR([Internal POWER9 and PHAL-provided procedures conflict, please configure only one])]
54 )
55
56AS_IF([test "$enable_phal" == "yes"],
57 [
Marri Devender Rao78479602020-01-06 03:45:11 -060058 AX_ABSOLUTE_HEADER([libipl.H])
59 if test x"$gl_cv_absolute_libipl_H" == "x" ; then
60 AC_MSG_ERROR([Cannot find libipl.H path])
Ramesh Iyyarb181d3b2019-10-17 13:39:10 -050061 fi
Ramesh Iyyarb181d3b2019-10-17 13:39:10 -050062 AC_CHECK_LIB([ipl], [ipl_init])
63 if test x"$ac_cv_lib_ipl_ipl_init" != "xyes" ; then
64 AC_MSG_ERROR([IPL library not found])
65 fi
66
Marri Devender Rao78479602020-01-06 03:45:11 -060067 AX_ABSOLUTE_HEADER([libekb.H])
68 if test x"$gl_cv_absolute_libekb_H" == "x" ; then
69 AC_MSG_ERROR([Cannot find libekb.H path])
70 fi
71 AC_CHECK_LIB([ekb], [libekb_init])
72 if test x"$ac_cv_lib_ekb_libekb_init" != "xyes" ; then
73 AC_MSG_ERROR([EKB library not found])
74 fi
75
Lakshminarayana R. Kammath75912e82020-04-28 07:37:17 -050076 PKG_CHECK_MODULES([LIBDT_API], [libdt-api])
77 LIBS="$LIBS $LIBDT_API_LIBS"
78 CFLAGS="$CFLAGS $LIBDT_API_CFLAGS"
79
Ramesh Iyyaref767ee2020-09-22 02:46:51 -050080 PKG_CHECK_MODULES([FMT], [fmt])
81 LIBS="$LIBS $FMT_LIBS"
82
Jayanth Othayothf7d1c1d2020-02-12 02:25:37 -060083 CHIPS+=" phal common"
Eddie Jamesce042fe2020-01-28 10:25:13 -060084 AC_CONFIG_FILES([set-spi-mux.service])
Ramesh Iyyarb20593f2020-09-16 10:43:37 -050085 AC_CONFIG_FILES([phal-reinit-devtree.service])
Ramesh Iyyarb181d3b2019-10-17 13:39:10 -050086 ]
87 )
88
Marri Devender Rao78479602020-01-06 03:45:11 -060089AM_CONDITIONAL([ENABLE_PHAL], [test "$enable_phal" == "yes"])
Jayanth Othayothf7d1c1d2020-02-12 02:25:37 -060090AS_IF([test "x$CHIPS" == "x"], [CHIPS="p9 openfsi common"])
Matt Spinler12bdf052017-03-09 16:01:39 -060091
92AC_CONFIG_FILES([Makefile.generated],
Matt Spinlercc2403c2017-03-17 11:07:06 -050093 [${srcdir}/gen_makefile.sh ${srcdir} "$myChips" > Makefile.generated],
Matt Spinler12bdf052017-03-09 16:01:39 -060094 [myChips="$CHIPS"])
95
Andrew Jeffery424475d2019-08-02 18:45:26 +093096AC_CHECK_LIB([pdbg], [thread_sreset_all])
97
Patrick Venture3348e622019-02-13 15:12:10 -080098PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
99PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
100PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
Matt Spinleree401e92017-09-18 14:15:31 -0500101
Anthony Wilson171fbdf2018-11-01 13:38:50 -0500102PKG_PROG_PKG_CONFIG
103AC_ARG_WITH([systemdsystemunitdir],
104 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
105 [with_systemdsystemunitdir=auto])
106AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
107 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
108
109 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
110 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
111 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
112 with_systemdsystemunitdir=no],
113 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
114AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
115 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
116
Matt Spinler597e05c2017-02-28 09:59:53 -0600117AC_CONFIG_FILES([Makefile test/Makefile])
Anthony Wilson171fbdf2018-11-01 13:38:50 -0500118AC_CONFIG_FILES([pcie-poweroff@.service])
Lakshminarayana R. Kammath16ab00c2019-06-03 04:33:33 -0500119AC_CONFIG_FILES([xyz.openbmc_project.Control.Host.NMI.service])
Andrew Geissler6a133ab2020-01-31 14:13:06 -0600120AC_CONFIG_FILES([op-stop-instructions@.service])
Andrew Geisslera0076682020-02-05 13:14:53 -0600121AC_CONFIG_FILES([op-cfam-reset.service])
Dhruvaraj Subhashchandran3506c182020-02-18 05:28:39 -0600122AC_CONFIG_FILES([op-continue-mpreboot@.service])
123AC_CONFIG_FILES([op-enter-mpreboot@.service])
Matt Spinlerf716f322017-02-28 09:37:38 -0600124AC_OUTPUT