mirror of
https://github.com/linux-usb-gadgets/libusbgx.git
synced 2025-07-16 21:05:38 +03:00
The libusbgx API has changed over time (for example struct usbg_gadget_strs as changed from fixed-size fields to pointers to char) which requires that client programs also change. Sometimes it is not possible to keep applications and libusbgx versions in lock step and it is desirable to support multiple libusbgx API versions from a single client code base. Add a version number which can be used for conditional code in client applications by doing: #if USBG_VERSION < USBG_MAKE_VERSION(0, 2, 0) Signed-off-by: John Keeping <john@metanate.com> [Add macro for generating API version] Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
60 lines
2.3 KiB
Text
60 lines
2.3 KiB
Text
AC_INIT([libusbgx], [0.1.0], [k.opasiak@samsung.com])
|
|
AM_INIT_AUTOMAKE([1.12 -Wall -Werror foreign serial-tests])
|
|
AC_PROG_CC
|
|
AM_PROG_AR
|
|
AM_PROG_CC_C_O
|
|
AC_CONFIG_MACRO_DIR([m4])
|
|
AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions])
|
|
|
|
USBG_VERSION_HEX=`printf '0x%02x%02x%04x' $(printf '%s' "$PACKAGE_VERSION" | sed -e 's/\./ /g')`
|
|
AC_SUBST([USBG_VERSION_HEX])
|
|
|
|
AC_ARG_WITH([libconfig],
|
|
AS_HELP_STRING([--without-libconfig], [build without using libconfig]),
|
|
[with_libconfig=$withval], [with_libconfig=yes])
|
|
|
|
AC_ARG_ENABLE([examples],
|
|
AS_HELP_STRING([--disable-examples], [build without examples]),
|
|
[enable_examples=$enableval], [enable_examples=yes])
|
|
|
|
AC_ARG_ENABLE([gadget-schemes],
|
|
AS_HELP_STRING([--disable-gadget-schemes], [build without gadget-schemes support]),
|
|
[enable_gadget_schemes=$enableval], [enable_gadget_schemes=yes])
|
|
|
|
AC_ARG_ENABLE([tests],
|
|
AS_HELP_STRING([--enable-tests], [build with tests]),
|
|
[enable_tests=$enableval], [enable_tests=no])
|
|
|
|
# if both tests and schemes are disabled, we do not need libconfig
|
|
AS_IF([test "x$enable_gadget_schemes" = xno && test "x$enable_tests" = xno], [with_libconfig=no])
|
|
|
|
AS_IF([test "x$with_libconfig" = xyes], [
|
|
PKG_CHECK_MODULES([LIBCONFIG], [libconfig >= 1.4],
|
|
[ AC_DEFINE(HAS_LIBCONFIG, 1, [detected libconfig])
|
|
PKG_CHECK_MODULES([NEW_LIBCONFIG], [libconfig >= 1.5],
|
|
AC_DEFINE(HAVE_LIBCONFIG_15, 1, [detected libconfig equal to or greater than 1.5]),
|
|
AC_DEFINE(HAVE_LIBCONFIG_15, 0, []))
|
|
])
|
|
CFLAGS="$CFLAGS $LIBCONFIG_CFLAGS"
|
|
LIBS="$LIBS $LIBCONFIG_LIBS"
|
|
], [
|
|
enable_gadget_schemes=no
|
|
])
|
|
|
|
AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = xyes])
|
|
|
|
AS_IF([test "x$enable_tests" = xyes], [
|
|
PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.0.0],
|
|
AC_DEFINE(HAS_CMOCKA, 1, [detected cmocka]))
|
|
AC_CONFIG_FILES([tests/Makefile])
|
|
])
|
|
AM_CONDITIONAL(BUILD_TESTS, [test "x$enable_tests" = xyes])
|
|
|
|
AS_IF([test "x$enable_gadget_schemes" = xyes],
|
|
[AC_DEFINE(HAS_GADGET_SCHEMES, 1, [gadget schemes are enables])])
|
|
AM_CONDITIONAL(TEST_GADGET_SCHEMES, [test "x$enable_gadget_schemes" != xno])
|
|
|
|
LT_INIT
|
|
AC_CONFIG_FILES([Makefile src/Makefile examples/Makefile include/usbg/usbg_version.h libusbgx.pc doxygen.cfg])
|
|
DX_INIT_DOXYGEN([$PACKAGE_NAME],[doxygen.cfg])
|
|
AC_OUTPUT
|