blob: ee62a9ac8bfe83ddd72eca62b38f32fbbfb50707 [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
9AC_PROG_INSTALL #Checks/sets the install variable to be used
10AC_PROG_MAKE_SET
11
12# Checks for typedefs, structures, and compiler characteristics.
Vernon Maueryb3d71312018-10-04 10:09:58 -070013AX_CXX_COMPILE_STDCXX_17([noext])
Matt Spinlerf716f322017-02-28 09:37:38 -060014AX_APPEND_COMPILE_FLAGS([-Wall -Werror], [CXXFLAGS])
15
16# Checks for library functions
17LT_INIT
18
Matt Spinler597e05c2017-02-28 09:59:53 -060019# Check/set gtest specific functions.
20AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
21AC_SUBST(GTEST_CPPFLAGS)
22AC_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)
25AC_ARG_VAR(OECORE_TARGET_SYSROOT,
26 [Path to the OE SDK SYSROOT])
27AS_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
Matt Spinleree401e92017-09-18 14:15:31 -050040#CHIPS can be passed in a from a recipe, or it will default to P9 and openfsi
Matt Spinler12bdf052017-03-09 16:01:39 -060041AC_ARG_VAR(CHIPS, [The list of chips to build the procedures for])
Ramesh Iyyar6230b0d2019-12-05 10:06:44 -060042
43AC_ARG_ENABLE([p9], AS_HELP_STRING([--enable-p9], [Use internal host initialisation procedures for POWER9 processors]))
Jayanth Othayothf7d1c1d2020-02-12 02:25:37 -060044AS_IF([test "$enable_p9" == "yes"], [CHIPS+=" p9 common"])
Ramesh Iyyar6230b0d2019-12-05 10:06:44 -060045
46AC_ARG_ENABLE([openfsi], AS_HELP_STRING([--enable-openfsi], [Support Openfsi]))
47AS_IF([test "$enable_openfsi" == "yes"], [CHIPS+=" openfsi"])
48
Ramesh Iyyarb181d3b2019-10-17 13:39:10 -050049AC_ARG_ENABLE([phal], AS_HELP_STRING([--enable-phal], [Use host processor initialisation procedures from PHAL])])
50
51AS_IF([ test "$enable_phal" == "yes" && test "$enable_p9" == "yes"],
52 [ AC_MSG_ERROR([Internal POWER9 and PHAL-provided procedures conflict, please configure only one])]
53 )
54
55AS_IF([test "$enable_phal" == "yes"],
56 [
57 AX_ABSOLUTE_HEADER([libipl.h])
58 if test x"$gl_cv_absolute_libipl_h" == "x" ; then
59 AC_MSG_ERROR([Cannot find libipl.h path])
60 fi
61
62 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
Jayanth Othayothf7d1c1d2020-02-12 02:25:37 -060067 CHIPS+=" phal common"
Eddie Jamesce042fe2020-01-28 10:25:13 -060068 AC_CONFIG_FILES([set-spi-mux.service])
Ramesh Iyyarb181d3b2019-10-17 13:39:10 -050069 ]
70 )
Eddie Jamesce042fe2020-01-28 10:25:13 -060071AM_CONDITIONAL([ENABLE_PHAL], [test "$enable_phal" == "yes"])
Ramesh Iyyarb181d3b2019-10-17 13:39:10 -050072
Jayanth Othayothf7d1c1d2020-02-12 02:25:37 -060073AS_IF([test "x$CHIPS" == "x"], [CHIPS="p9 openfsi common"])
Matt Spinler12bdf052017-03-09 16:01:39 -060074
75AC_CONFIG_FILES([Makefile.generated],
Matt Spinlercc2403c2017-03-17 11:07:06 -050076 [${srcdir}/gen_makefile.sh ${srcdir} "$myChips" > Makefile.generated],
Matt Spinler12bdf052017-03-09 16:01:39 -060077 [myChips="$CHIPS"])
78
Andrew Jeffery424475d2019-08-02 18:45:26 +093079AC_CHECK_LIB([pdbg], [thread_sreset_all])
80
Patrick Venture3348e622019-02-13 15:12:10 -080081PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
82PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
83PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces])
Matt Spinleree401e92017-09-18 14:15:31 -050084
Anthony Wilson171fbdf2018-11-01 13:38:50 -050085PKG_PROG_PKG_CONFIG
86AC_ARG_WITH([systemdsystemunitdir],
87 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
88 [with_systemdsystemunitdir=auto])
89AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
90 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
91
92 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
93 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
94 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
95 with_systemdsystemunitdir=no],
96 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
97AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
98 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
99
Matt Spinler597e05c2017-02-28 09:59:53 -0600100AC_CONFIG_FILES([Makefile test/Makefile])
Anthony Wilson171fbdf2018-11-01 13:38:50 -0500101AC_CONFIG_FILES([pcie-poweroff@.service])
Lakshminarayana R. Kammath16ab00c2019-06-03 04:33:33 -0500102AC_CONFIG_FILES([xyz.openbmc_project.Control.Host.NMI.service])
Matt Spinlerf716f322017-02-28 09:37:38 -0600103AC_OUTPUT