1dnl
2dnl  Copyright © 2017 Keith Packard
3dnl
4dnl  Permission to use, copy, modify, distribute, and sell this software and its
5dnl  documentation for any purpose is hereby granted without fee, provided that
6dnl  the above copyright notice appear in all copies and that both that
7dnl  copyright notice and this permission notice appear in supporting
8dnl  documentation, and that the name of Keith Packard not be used in
9dnl  advertising or publicity pertaining to distribution of the software without
10dnl  specific, written prior permission.  Keith Packard makes no
11dnl  representations about the suitability of this software for any purpose.  It
12dnl  is provided "as is" without express or implied warranty.
13dnl
14dnl  KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16dnl  EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20dnl  PERFORMANCE OF THIS SOFTWARE.
21dnl
22dnl Process this file with autoconf to create configure.
23
24AC_PREREQ([2.60])
25# keep version in sync with meson.build
26AC_INIT([xorgproto], [2024.1],
27        [https://gitlab.freedesktop.org/xorg/proto/xorgproto/issues])
28AM_INIT_AUTOMAKE([foreign dist-xz])
29
30# Require xorg-macros: XORG_DEFAULT_OPTIONS
31m4_ifndef([XORG_MACROS_VERSION],
32          [m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
33XORG_MACROS_VERSION(1.12)
34XORG_DEFAULT_OPTIONS
35XORG_ENABLE_SPECS
36XORG_WITH_XMLTO(0.0.22)
37XORG_WITH_FOP
38XORG_WITH_XSLTPROC
39XORG_CHECK_SGML_DOCTOOLS(1.8)
40
41AM_PATH_PYTHON([3.6], , [:])
42AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
43
44AC_CANONICAL_HOST
45
46AC_ARG_ENABLE(legacy,
47	      AS_HELP_STRING([--enable-legacy],
48			     [Install legacy protocol headers (default: false)]),
49			     [LEGACY=$enableval], [LEGACY=no])
50AM_CONDITIONAL(LEGACY, [test "x$LEGACY" = "xyes"])
51
52AC_CHECK_HEADERS([sys/select.h sys/param.h sys/types.h sys/time.h])
53
54# Handle Xpoll.h.in
55# Avoid determining fds_bits on WIN32 hosts (not including cygwin)
56case $host_os in
57	mingw*)		fds_bits_found=true;;
58	*)		fds_bits_found=false;;
59esac
60
61if test "x$fds_bits_found" = xfalse ; then
62   AC_CHECK_MEMBER(fd_set.fds_bits,
63			   [
64			       fds_bits_found=plain
65			       USE_FDS_BITS="fds_bits"
66			   ],,
67			   [
68                               #ifdef HAVE_SYS_PARAM_H
69                               #include <sys/param.h>
70                               #endif
71                               #ifdef HAVE_SYS_TYPES_H
72                               #include <sys/types.h>
73                               #endif
74                               #ifdef HAVE_SYS_TIME_H
75                               #include <sys/time.h>
76                               #endif
77                               #ifdef HAVE_SYS_SELECT_H
78			       #include <sys/select.h>
79                               #endif
80			   ])
81fi
82
83if test "x$fds_bits_found" = xfalse ; then
84   AC_CHECK_MEMBER(fd_set.__fds_bits,
85			[
86			    fds_bits_found=underscores
87			    USE_FDS_BITS="__fds_bits"
88			],,
89			[
90                               #ifdef HAVE_SYS_PARAM_H
91                               #include <sys/param.h>
92                               #endif
93                               #ifdef HAVE_SYS_TYPES_H
94                               #include <sys/types.h>
95                               #endif
96                               #ifdef HAVE_SYS_TIME_H
97                               #include <sys/time.h>
98                               #endif
99                               #ifdef HAVE_SYS_SELECT_H
100			       #include <sys/select.h>
101                               #endif
102			])
103fi
104
105if test "x$fds_bits_found" = xfalse ; then
106    AC_MSG_ERROR([Could not determine how to access the fds_bits or equivalent
107                  structure in fd_set on your platform.])
108fi
109
110AC_SUBST([USE_FDS_BITS])
111
112AC_CONFIG_FILES([applewmproto.pc
113		 bigreqsproto.pc
114		 compositeproto.pc
115		 damageproto.pc
116		 dmxproto.pc
117		 dpmsproto.pc
118		 dri2proto.pc
119		 dri3proto.pc
120		 evieproto.pc
121		 fixesproto.pc
122		 fontcacheproto.pc
123		 fontsproto.pc
124		 glproto.pc
125		 include/X11/Xpoll.h
126		 inputproto.pc
127		 kbproto.pc
128		 lg3dproto.pc
129		 Makefile
130		 presentproto.pc
131		 printproto.pc
132		 randrproto.pc
133		 recordproto.pc
134		 renderproto.pc
135		 resourceproto.pc
136		 scrnsaverproto.pc
137		 specs/Makefile
138		 specs/bigreqsproto/Makefile
139		 specs/fontsproto/Makefile
140		 specs/kbproto/Makefile
141		 specs/recordproto/Makefile
142		 specs/scrnsaverproto/Makefile
143		 specs/xcmiscproto/Makefile
144		 specs/xextproto/Makefile
145		 specs/xproto/Makefile
146		 trapproto.pc
147		 videoproto.pc
148		 windowswmproto.pc
149		 xcalibrateproto.pc
150		 xcmiscproto.pc
151		 xextproto.pc
152		 xf86bigfontproto.pc
153		 xf86dgaproto.pc
154		 xf86driproto.pc
155		 xf86miscproto.pc
156		 xf86rushproto.pc
157		 xf86vidmodeproto.pc
158		 xineramaproto.pc
159		 xproto.pc
160		 xproxymngproto.pc
161		 xwaylandproto.pc])
162
163AC_OUTPUT
164