Files
salmanoff/m4/commonlibs-opts.m4
T
hayodea e201b5e695 Build: Support common+sense+wilzor API libs; Move xcbXorg into commonLibs
xcbXorg is a connection manager lib that'll be used in common by all of
the xcb API frontends: xcbMouse, xcbWindow and xcbKeyboard. We moved
it into commonLibs to make it make more sense.

We also cleaned up the M4 scripting around AC_ARG_VAR-ing new common
libs as well as sense/wilzor libs.
2025-07-22 02:03:45 -04:00

70 lines
2.9 KiB
Plaintext

dnl _HK_LIB_ENABLE_IMPL(name, description, config_define, enable_var,
dnl enabled_list, [commands], [unimplemented])
dnl name - Name of the library (e.g., xcbXorg)
dnl description - Human readable description
dnl config_define - Configuration define name (e.g., CONFIG_XCBXORG_ENABLED)
dnl enable_var - Shell variable to track enabled status
dnl enabled_list - List variable to append name to (e.g., SENSEAPIS_ENABLED)
dnl commands - Optional: Shell commands to execute when enabling
dnl unimplemented - Optional: If "unimplemented", error out
AC_DEFUN([_HK_LIB_ENABLE_IMPL], [
AS_IF([test "x[]m4_normalize($7)" = "xunimplemented"], [
AC_MSG_ERROR([$1 is not yet implemented])
])
AS_IF([test "x${$4_done}" != "xyes"], [
$4_done=yes
AC_DEFINE([$3], [1], [Enable $2])
$5="${$5} $1"
$6
])
])
dnl _HK_LIB_ARG_ENABLE(dev_api_type, name, description, config_define,
dnl enabled_list, [commands], [unimplemented])
dnl lib/api_type - Type of API ("senseapi", "wilzorapi", or "lib")
dnl name - Name of the library (e.g., xcbXorg)
dnl description - Human readable description
dnl config_define - Configuration define name (e.g., CONFIG_XCBXORG_ENABLED)
dnl enabled_list - List variable to append name to
dnl commands - Optional: Shell commands to execute when enabling
dnl unimplemented - Optional: If "unimplemented", error out
AC_DEFUN([_HK_LIB_ARG_ENABLE], [
AC_ARG_ENABLE([$1-$2],
[AS_HELP_STRING([--enable-$1-$2], [Enable $3])],
[AS_IF([test "x$enable_$1_$2" != "xno"], [
_HK_LIB_ENABLE_IMPL([$2], [$3], [$4], [enable_$1_$2], [$5], [$6], [$7])
])],
[enable_$1_$2=no]
)
])
# Macro for enabling the XCB/Xorg Connection Mgr lib. Invoked by several other
# libs.
AC_DEFUN([_HK_LIB_XCBXORG_ENABLE], [
_HK_LIB_ENABLE_IMPL([xcbXorg], [XCB/Xorg Connection Manager backend],
[CONFIG_LIB_XCBXORG_ENABLED], [enable_lib_xcbXorg], [COMMONLIBS_ENABLED], [
PKG_CHECK_MODULES([XCB], [xcb], [], [
AC_MSG_ERROR(m4_normalize([XCB library not found. Sense API
XCB/Xorg requires the XCB dev headers and shlib.]))
])
AC_SUBST([XCB_CFLAGS])
AC_SUBST([XCB_LIBS])
]
)
])
AC_DEFUN([_HK_LIB_ALSA_ENABLE], [
_HK_LIB_ENABLE_IMPL([alsa], [ALSA Connection Manager backend],
[CONFIG_LIB_ALSA_ENABLED], [enable_lib_alsa], [COMMONLIBS_ENABLED], [
PKG_CHECK_MODULES([ALSA], [alsa], [], [
AC_MSG_ERROR(m4_normalize([ALSA library not found. Sense API
ALSA requires the ALSA dev headers and shlib.]))
])
AC_SUBST([ALSA_CFLAGS])
AC_SUBST([ALSA_LIBS])
]
)
])
# Temporary until we implement the xcbWindow SenseAPI.
_HK_LIB_XCBXORG_ENABLE