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