xref: /openbmc/btbridge/configure.ac (revision fc0fa20df27a48437575f0486b67883513b5cc1e)
168bcce03SMatthew Barth# Initialization
268bcce03SMatthew BarthAC_PREREQ([2.69])
368bcce03SMatthew BarthAC_INIT([btbridge], [1.0], [https://github.com/openbmc/btbridge/issues])
468bcce03SMatthew BarthAC_CONFIG_HEADERS([config.h])
568bcce03SMatthew BarthAM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
668bcce03SMatthew BarthAM_SILENT_RULES([yes])
768bcce03SMatthew Barth
868bcce03SMatthew Barth# Checks for programs.
968bcce03SMatthew BarthAC_PROG_CC
1068bcce03SMatthew BarthAM_PROG_AR
1168bcce03SMatthew BarthAC_PROG_INSTALL
1268bcce03SMatthew BarthAC_PROG_MAKE_SET
1368bcce03SMatthew Barth
1468bcce03SMatthew Barth# Checks for libraries.
1568bcce03SMatthew BarthPKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
1668bcce03SMatthew Barth
1768bcce03SMatthew Barth# Checks for header files.
18*fc0fa20dSManojkiran EdaAC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd development package required])])
1968bcce03SMatthew BarthAC_CHECK_HEADER(linux/bt-bmc.h,[HAVE_LINUX_BT_BMC_H=""],[HAVE_LINUX_BT_BMC_H="-I linux/bt-bmc.h"])
2068bcce03SMatthew BarthAS_IF([test "$HAVE_LINUX_BT_BMC_H" != ""],
2168bcce03SMatthew Barth    AC_MSG_WARN([Could not find linux/bt-bmc.h: Attempting to download locally for building from https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/bt-bmc.h])
2268bcce03SMatthew Barth    AC_SUBST([BT_BMC_DL],[`mkdir -p linux;wget https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/bt-bmc.h -O linux/bt-bmc.h`])
2368bcce03SMatthew Barth)
2468bcce03SMatthew Barth
2568bcce03SMatthew Barth# Checks for typedefs, structures, and compiler characteristics.
2668bcce03SMatthew BarthAX_APPEND_COMPILE_FLAGS([-fpic -Wall -Werror], [CFLAGS])
2768bcce03SMatthew Barth
2868bcce03SMatthew Barth# Checks for library functions.
2968bcce03SMatthew BarthLT_INIT # Removes 'unrecognized options: --with-libtool-sysroot'
3068bcce03SMatthew Barth
3168bcce03SMatthew Barth# Check/set gtest specific functions.
3268bcce03SMatthew BarthAX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
3368bcce03SMatthew BarthAC_SUBST(GTEST_CPPFLAGS)
3468bcce03SMatthew Barth
3568bcce03SMatthew BarthAC_ARG_ENABLE([oe-sdk],
3668bcce03SMatthew Barth    AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
3768bcce03SMatthew Barth)
3868bcce03SMatthew BarthAC_ARG_VAR(OECORE_TARGET_SYSROOT,
3968bcce03SMatthew Barth    [Path to the OE SDK SYSROOT])
4068bcce03SMatthew BarthAS_IF([test "x$enable_oe_sdk" == "xyes"],
4168bcce03SMatthew Barth    AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
4268bcce03SMatthew Barth          AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
4368bcce03SMatthew Barth    )
4468bcce03SMatthew Barth    AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
4568bcce03SMatthew Barth    [
4668bcce03SMatthew Barth        testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
4768bcce03SMatthew Barth        testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
4868bcce03SMatthew Barth        testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
4968bcce03SMatthew Barth    ]
5068bcce03SMatthew Barth    AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
5168bcce03SMatthew Barth)
5268bcce03SMatthew Barth
5368bcce03SMatthew Barth# Create configured output
5468bcce03SMatthew BarthAC_CONFIG_FILES([Makefile])
5568bcce03SMatthew BarthAC_OUTPUT
56