• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1AC_PREREQ([2.64])
2
3m4_define([wayland_major_version],  [1])
4m4_define([wayland_minor_version], [19])
5m4_define([wayland_micro_version], [0])
6m4_define([wayland_version],
7          [wayland_major_version.wayland_minor_version.wayland_micro_version])
8
9AC_INIT([wayland],
10        [wayland_version],
11	[https://gitlab.freedesktop.org/wayland/wayland/issues/],
12        [wayland],
13        [https://wayland.freedesktop.org/])
14
15AC_SUBST([WAYLAND_VERSION_MAJOR], [wayland_major_version])
16AC_SUBST([WAYLAND_VERSION_MINOR], [wayland_minor_version])
17AC_SUBST([WAYLAND_VERSION_MICRO], [wayland_micro_version])
18AC_SUBST([WAYLAND_VERSION], [wayland_version])
19
20AC_CONFIG_HEADERS([config.h])
21AC_CONFIG_MACRO_DIR([m4])
22
23AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz subdir-objects])
24
25AM_SILENT_RULES([yes])
26
27# Check for programs
28AC_PROG_CC
29AC_PROG_CXX
30AC_PROG_GREP
31AM_PROG_AS
32AC_PROG_NM
33
34# check if we have C++ compiler. This is hacky workaround,
35# for a reason why it is this way see
36# http://lists.gnu.org/archive/html/bug-autoconf/2010-05/msg00001.html
37have_cpp_compiler=yes
38
39if ! which "$CXX" &>/dev/null; then
40	have_cpp_compiler=no
41fi
42
43AM_CONDITIONAL(ENABLE_CPP_TEST, test "x$have_cpp_compiler" = "xyes")
44
45# Initialize libtool
46LT_PREREQ([2.2])
47LT_INIT([disable-static])
48
49PKG_PROG_PKG_CONFIG()
50
51AC_ARG_ENABLE([fatal-warnings],
52	      AC_HELP_STRING([--enable-fatal-warnings],
53			     [Build with -Werror]),
54	      [enable_fatal_warnings=$enableval],
55	      [enable_fatal_warnings=no])
56AS_IF([test x"$enable_fatal_warnings" != "xno"], [
57      WERROR_CFLAGS="-Werror"
58])
59
60if test "x$GCC" = "xyes"; then
61	GCC_CFLAGS="$WERROR_CFLAGS -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden"
62fi
63AC_SUBST(GCC_CFLAGS)
64
65AC_CHECK_HEADERS([sys/prctl.h])
66AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate prctl memfd_create strndup])
67
68# *BSD don't have libdl, but they have its functions in libc
69WESTON_SEARCH_LIBS([DL], [dl], [dlsym])
70
71# OpenBSD doesn't have librt, but it has its functions in libc
72WESTON_SEARCH_LIBS([RT], [rt], [clock_gettime])
73
74AC_ARG_ENABLE([libraries],
75	      [AC_HELP_STRING([--disable-libraries],
76			      [Disable compilation of wayland libraries])],
77	      [],
78	      [enable_libraries=yes])
79
80AC_ARG_WITH([host-scanner],
81              [AC_HELP_STRING([--with-host-scanner],
82                              [Use installed wayland-scanner from host PATH during build])],
83              [],
84              [with_host_scanner=no])
85
86AC_ARG_ENABLE([documentation],
87	      [AC_HELP_STRING([--disable-documentation],
88		              [Disable building the documentation])],
89	      [],
90	      [enable_documentation=yes])
91
92AC_ARG_ENABLE([dtd-validation],
93	      [AC_HELP_STRING([--disable-dtd-validation],
94			      [Disable DTD validation of the protocol])],
95	      [],
96	      [enable_dtd_validation=yes])
97
98AM_CONDITIONAL(USE_HOST_SCANNER, test "x$with_host_scanner" = xyes)
99
100AM_CONDITIONAL(ENABLE_LIBRARIES, test "x$enable_libraries" = xyes)
101
102AC_ARG_WITH(icondir, [  --with-icondir=<dir>    Look for cursor icons here],
103		     [  ICONDIR=$withval],
104		     [  ICONDIR=${datadir}/icons])
105AC_SUBST([ICONDIR])
106
107if test "x$enable_libraries" = "xyes"; then
108	PKG_CHECK_MODULES(FFI, [libffi])
109	AC_CHECK_DECL(SFD_CLOEXEC,[],
110		      [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile wayland libraries")],
111		      [[#include <sys/signalfd.h>]])
112	AC_CHECK_DECL(TFD_CLOEXEC,[],
113		      [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile wayland libraries")],
114		      [[#include <sys/timerfd.h>]])
115	AC_CHECK_DECL(CLOCK_MONOTONIC,[],
116		      [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile wayland libraries")],
117		      [[#include <time.h>]])
118fi
119
120PKG_CHECK_MODULES(EXPAT, [expat])
121
122AM_CONDITIONAL([DTD_VALIDATION], [test "x$enable_dtd_validation" = "xyes"])
123if test "x$enable_dtd_validation" = "xyes"; then
124	PKG_CHECK_MODULES(LIBXML, [libxml-2.0])
125	AC_DEFINE(HAVE_LIBXML, 1, [libxml-2.0 is available])
126	AC_CONFIG_LINKS([src/wayland.dtd.embed:protocol/wayland.dtd])
127fi
128
129AC_PATH_PROG(XSLTPROC, xsltproc)
130AM_CONDITIONAL([HAVE_XSLTPROC], [test "x$XSLTPROC" != "x"])
131
132
133AM_CONDITIONAL(BUILD_DOCS, [test x$enable_documentation = xyes])
134if test "x$enable_documentation" = "xyes"; then
135	AC_PATH_PROG(DOXYGEN, doxygen)
136
137	if test "x$DOXYGEN" = "x"; then
138		AC_MSG_ERROR([Documentation build requested but doxygen not found. Install doxygen or disable the documentation using --disable-documentation])
139	fi
140
141	AC_MSG_CHECKING([for compatible doxygen version])
142	doxygen_version=`$DOXYGEN --version`
143	AS_VERSION_COMPARE([$doxygen_version], [1.6.0],
144	                   [AC_MSG_RESULT([no])
145	                    AC_MSG_ERROR([Doxygen $doxygen_version too old. Doxygen 1.6+ required for documentation build. Install required doxygen version or disable the documentation using --disable-documentation])],
146	                   [AC_MSG_RESULT([yes])],
147	                   [AC_MSG_RESULT([yes])])
148
149	AC_PATH_PROG(XMLTO, xmlto)
150
151	if test "x$XMLTO" = "x"; then
152		AC_MSG_ERROR([Documentation build requested but xmlto not found. Install xmlto or disable the documentation using --disable-documentation])
153	fi
154
155	AC_PATH_PROG(DOT, dot)
156	if test "x$DOT" = "x"; then
157		AC_MSG_ERROR([Documentation build requested but graphviz's dot not found. Install graphviz or disable the documentation using --disable-documentation])
158	fi
159	AC_MSG_CHECKING([for compatible dot version])
160	dot_version=`$DOT -V 2>&1|$GREP -o ['[0-9]*\.[0-9]*\.[0-9]*']`
161	AS_VERSION_COMPARE([$dot_version], [2.26.0],
162	                   [AC_MSG_RESULT([no])
163	                    AC_MSG_ERROR([Graphviz dot $dot_version too old. Graphviz 2.26+ required for documentation build. Install required graphviz version or disable the documentation using --disable-documentation])],
164	                   [AC_MSG_RESULT([yes])],
165	                   [AC_MSG_RESULT([yes])])
166
167	AC_MSG_CHECKING([for docbook stylesheets])
168	DOCS_STYLESHEET=http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
169	AC_PATH_PROGS_FEATURE_CHECK([XSLTPROC_TMP], [xsltproc],
170				    AS_IF([`"$ac_path_XSLTPROC_TMP" --nonet "$DOCS_STYLESHEET" > /dev/null 2>&1`],
171					  [HAVE_DOCS_STYLESHEET=yes]))
172	if test "x$HAVE_DOCS_STYLESHEET" != "xyes"; then
173		AC_MSG_RESULT([no])
174		AC_MSG_ERROR([Documentation build requested but docbook-xsl stylesheets are not found. Install the docbook-xsl package or disable the documentation using --disable-documentation])
175	fi
176
177	AC_MSG_RESULT([yes])
178	AC_SUBST(DOCS_STYLESHEET)
179
180	AC_CONFIG_FILES([
181	doc/doxygen/wayland.doxygen
182	])
183
184fi
185AM_CONDITIONAL([HAVE_XMLTO], [test "x$XMLTO" != "x"])
186
187AC_CONFIG_FILES([Makefile
188		 cursor/wayland-cursor.pc
189		 cursor/wayland-cursor-uninstalled.pc
190		 doc/Makefile
191		 doc/publican/Makefile
192		 doc/doxygen/Makefile
193		 egl/wayland-egl.pc
194		 egl/wayland-egl-backend.pc
195		 src/wayland-server-uninstalled.pc
196		 src/wayland-client-uninstalled.pc
197		 src/wayland-scanner-uninstalled.pc
198		 src/wayland-server.pc
199		 src/wayland-client.pc
200		 src/wayland-scanner.pc
201		 src/wayland-version.h])
202AC_OUTPUT
203