configure.ac revision 1009a292
1
2# Initialize Autoconf
3AC_PREREQ([2.60])
4AC_INIT([libICE], [1.1.1],
5        [https://gitlab.freedesktop.org/xorg/lib/libice/-/issues], [libICE])
6AC_CONFIG_SRCDIR([Makefile.am])
7AC_CONFIG_HEADERS([config.h])
8
9# Set common system defines for POSIX extensions, such as _GNU_SOURCE
10# Must be called before any macros that run the compiler (like
11# AC_PROG_LIBTOOL or XORG_DEFAULT_OPTIONS) to avoid autoconf errors.
12AC_USE_SYSTEM_EXTENSIONS
13
14# Initialize Automake
15AM_INIT_AUTOMAKE([foreign dist-xz])
16
17# Initialize libtool
18AC_PROG_LIBTOOL
19
20# Require xorg-macros minimum of 1.12 for DocBook external references
21m4_ifndef([XORG_MACROS_VERSION],
22          [m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
23XORG_MACROS_VERSION(1.12)
24XORG_DEFAULT_OPTIONS
25XORG_ENABLE_DOCS
26XORG_ENABLE_SPECS
27XORG_WITH_XMLTO(0.0.22)
28XORG_WITH_FOP
29XORG_WITH_XSLTPROC
30XORG_CHECK_SGML_DOCTOOLS(1.8)
31
32# Obtain compiler/linker options for dependencies
33PKG_CHECK_MODULES(ICE, [xproto >= 7.0.25 xtrans])
34
35# Checks for typedefs, structures, and compiler characteristics.
36AC_SYS_LARGEFILE
37
38# Checks for non-standard functions and fallback to libbsd if we can
39# We only check for arc4random_buf, because if we have that, we don't
40# need/use getentropy.
41AC_LINK_IFELSE([AC_LANG_CALL([], [arc4random_buf])],
42               [TRY_LIBBSD="no"], [TRY_LIBBSD="yes"])
43AS_IF([test "x$TRY_LIBBSD" = "xyes"],
44      [PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay], [
45	CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
46	LIBS="$LIBS $LIBBSD_LIBS"
47], [:])])
48
49# Checks for library functions.
50AC_CHECK_FUNCS([asprintf arc4random_buf getentropy])
51
52# Transport selection macro from xtrans.m4
53XTRANS_CONNECTION_FLAGS
54AC_DEFINE(ICE_t, 1, [Xtrans transport type])
55AC_DEFINE(TRANS_CLIENT, 1, [Xtrans transport client code])
56AC_DEFINE(TRANS_SERVER, 1, [Xtrans transport server code])
57
58# Allow checking code with lint, sparse, etc.
59XORG_WITH_LINT
60XORG_LINT_LIBRARY([ICE])
61LINT_FLAGS="${LINT_FLAGS} ${ICE_CFLAGS} ${XTRANS_CFLAGS}"
62
63AC_CONFIG_FILES([Makefile
64		doc/Makefile
65		specs/Makefile
66		src/Makefile
67		ice.pc])
68AC_OUTPUT
69