1 # - Find X11 installation
2 # Try to find X11 on UNIX systems. The following values are defined
3 # X11_FOUND - True if X11 is available
4 # X11_INCLUDE_DIR - include directories to use X11
5 # X11_LIBRARIES - link against these to use X11
7 # and also the following more fine grained variables:
8 # Include paths: X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND
9 # X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND
10 # X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND
11 # X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND
12 # X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND
13 # X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND
14 # X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND
15 # X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND
16 # X11_Xext_LIB, X11_Xext_FOUND
17 # X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND
18 # X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND
19 # X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND
20 # X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND
21 # X11_xf86vmode_INCLUDE_PATH, X11_xf86vmode_FOUND
22 # X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND
23 # X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND
24 # X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND
25 # X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND
26 # X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND
27 # X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND
28 # X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND
29 # X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND
30 # X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND
31 # X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND
32 # X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND
33 # X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND
34 # X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND
35 # X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND
37 # Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
38 # See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
42 # X11 is never a framework and some header files may be
43 # found in tcl on the mac
44 SET(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK})
45 SET(CMAKE_FIND_FRAMEWORK NEVER)
46 SET(X11_INC_SEARCH_PATH
52 /usr/openwin/share/include
53 /opt/graphics/OpenGL/include
56 SET(X11_LIB_SEARCH_PATH
63 FIND_PATH(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH})
64 FIND_PATH(X11_Xlib_INCLUDE_PATH X11/Xlib.h ${X11_INC_SEARCH_PATH})
66 # Look for includes; keep the list sorted by name of the cmake *_INCLUDE_PATH
67 # variable (which doesn't need to match the include file name).
69 # Solaris lacks XKBrules.h, so we should skip kxkbd there.
70 FIND_PATH(X11_ICE_INCLUDE_PATH X11/ICE/ICE.h ${X11_INC_SEARCH_PATH})
71 FIND_PATH(X11_Xaccessrules_INCLUDE_PATH X11/extensions/XKBrules.h ${X11_INC_SEARCH_PATH})
72 FIND_PATH(X11_Xaccessstr_INCLUDE_PATH X11/extensions/XKBstr.h ${X11_INC_SEARCH_PATH})
73 FIND_PATH(X11_Xau_INCLUDE_PATH X11/Xauth.h ${X11_INC_SEARCH_PATH})
74 FIND_PATH(X11_Xcomposite_INCLUDE_PATH X11/extensions/Xcomposite.h ${X11_INC_SEARCH_PATH})
75 FIND_PATH(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH})
76 FIND_PATH(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH})
77 FIND_PATH(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH})
78 FIND_PATH(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH})
79 FIND_PATH(X11_xf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH})
80 FIND_PATH(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH})
81 FIND_PATH(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH})
82 FIND_PATH(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH})
83 FIND_PATH(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH})
84 FIND_PATH(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH})
85 FIND_PATH(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH})
86 FIND_PATH(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH})
87 FIND_PATH(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH})
88 FIND_PATH(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH})
89 FIND_PATH(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH})
90 FIND_PATH(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH})
91 FIND_PATH(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH})
92 FIND_PATH(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH})
93 FIND_PATH(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH})
94 FIND_PATH(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH})
95 FIND_PATH(X11_Xt_INCLUDE_PATH X11/Intrinsic.h ${X11_INC_SEARCH_PATH})
96 FIND_PATH(X11_Xv_INCLUDE_PATH X11/extensions/Xvlib.h ${X11_INC_SEARCH_PATH})
99 FIND_LIBRARY(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH})
101 # Find additional X libraries. Keep list sorted by library name.
102 FIND_LIBRARY(X11_ICE_LIB ICE ${X11_LIB_SEARCH_PATH})
103 FIND_LIBRARY(X11_SM_LIB SM ${X11_LIB_SEARCH_PATH})
104 FIND_LIBRARY(X11_Xau_LIB Xau ${X11_LIB_SEARCH_PATH})
105 FIND_LIBRARY(X11_Xcomposite_LIB Xcomposite ${X11_LIB_SEARCH_PATH})
106 FIND_LIBRARY(X11_Xcursor_LIB Xcursor ${X11_LIB_SEARCH_PATH})
107 FIND_LIBRARY(X11_Xdamage_LIB Xdamage ${X11_LIB_SEARCH_PATH})
108 FIND_LIBRARY(X11_Xdmcp_LIB Xdmcp ${X11_LIB_SEARCH_PATH})
109 FIND_LIBRARY(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH})
110 FIND_LIBRARY(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH})
111 FIND_LIBRARY(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH})
112 FIND_LIBRARY(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH})
113 FIND_LIBRARY(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH})
114 FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH})
115 FIND_LIBRARY(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH})
116 FIND_LIBRARY(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
117 FIND_LIBRARY(X11_Xscreensaver_LIB Xss ${X11_LIB_SEARCH_PATH})
118 FIND_LIBRARY(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH})
119 FIND_LIBRARY(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH})
120 FIND_LIBRARY(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH})
121 FIND_LIBRARY(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH})
123 SET(X11_LIBRARY_DIR "")
125 GET_FILENAME_COMPONENT(X11_LIBRARY_DIR ${X11_X11_LIB} PATH)
128 SET(X11_INCLUDE_DIR) # start with empty list
129 IF(X11_X11_INCLUDE_PATH)
130 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH})
131 ENDIF(X11_X11_INCLUDE_PATH)
133 IF(X11_Xlib_INCLUDE_PATH)
134 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH})
135 ENDIF(X11_Xlib_INCLUDE_PATH)
137 IF(X11_Xutil_INCLUDE_PATH)
138 SET(X11_Xutil_FOUND TRUE)
139 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH})
140 ENDIF(X11_Xutil_INCLUDE_PATH)
142 IF(X11_Xshape_INCLUDE_PATH)
143 SET(X11_Xshape_FOUND TRUE)
144 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH})
145 ENDIF(X11_Xshape_INCLUDE_PATH)
147 SET(X11_LIBRARIES) # start with empty list
149 SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB})
153 SET(X11_Xext_FOUND TRUE)
154 SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB})
157 IF(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH)
158 SET(X11_Xt_FOUND TRUE)
159 ENDIF(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH)
161 IF(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH)
162 SET(X11_Xft_FOUND TRUE)
163 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xft_INCLUDE_PATH})
164 ENDIF(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH)
166 IF(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH)
167 SET(X11_Xv_FOUND TRUE)
168 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xv_INCLUDE_PATH})
169 ENDIF(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH)
171 IF (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH)
172 SET(X11_Xau_FOUND TRUE)
173 ENDIF (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH)
175 IF (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB)
176 SET(X11_Xdmcp_FOUND TRUE)
177 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdmcp_INCLUDE_PATH})
178 ENDIF (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB)
180 IF (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH)
181 SET(X11_Xaccess_FOUND TRUE)
182 SET(X11_Xaccess_INCLUDE_PATH ${X11_Xaccessstr_INCLUDE_PATH})
183 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xaccess_INCLUDE_PATH})
184 ENDIF (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH)
186 IF (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB)
187 SET(X11_Xpm_FOUND TRUE)
188 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xpm_INCLUDE_PATH})
189 ENDIF (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB)
191 IF (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB)
192 SET(X11_Xcomposite_FOUND TRUE)
193 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcomposite_INCLUDE_PATH})
194 ENDIF (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB)
196 IF (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB)
197 SET(X11_Xdamage_FOUND TRUE)
198 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdamage_INCLUDE_PATH})
199 ENDIF (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB)
201 IF (X11_XShm_INCLUDE_PATH)
202 SET(X11_XShm_FOUND TRUE)
203 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XShm_INCLUDE_PATH})
204 ENDIF (X11_XShm_INCLUDE_PATH)
206 IF (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB)
207 SET(X11_XTest_FOUND TRUE)
208 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH})
209 ENDIF (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB)
211 IF (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB)
212 SET(X11_Xinerama_FOUND TRUE)
213 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH})
214 ENDIF (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB)
216 IF (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB)
217 SET(X11_Xfixes_FOUND TRUE)
218 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xfixes_INCLUDE_PATH})
219 ENDIF (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB)
221 IF (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB)
222 SET(X11_Xrender_FOUND TRUE)
223 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH})
224 ENDIF (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB)
226 IF (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB)
227 SET(X11_Xrandr_FOUND TRUE)
228 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH})
229 ENDIF (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB)
231 IF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB)
232 SET(X11_xf86misc_FOUND TRUE)
233 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH})
234 ENDIF (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB)
236 IF (X11_xf86vmode_INCLUDE_PATH)
237 SET(X11_xf86vmode_FOUND TRUE)
238 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH})
239 ENDIF (X11_xf86vmode_INCLUDE_PATH)
241 IF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB)
242 SET(X11_Xcursor_FOUND TRUE)
243 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcursor_INCLUDE_PATH})
244 ENDIF (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB)
246 IF (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB)
247 SET(X11_Xscreensaver_FOUND TRUE)
248 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xscreensaver_INCLUDE_PATH})
249 ENDIF (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB)
251 IF (X11_dpms_INCLUDE_PATH)
252 SET(X11_dpms_FOUND TRUE)
253 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_dpms_INCLUDE_PATH})
254 ENDIF (X11_dpms_INCLUDE_PATH)
256 IF (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH)
257 SET(X11_Xkb_FOUND TRUE)
258 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkb_INCLUDE_PATH} )
259 ENDIF (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH)
261 IF (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB)
262 SET(X11_Xinput_FOUND TRUE)
263 SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH})
264 ENDIF (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB)
266 IF(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH)
267 SET(X11_ICE_FOUND TRUE)
268 ENDIF(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH)
270 # Deprecated variable for backwards compatibility with CMake 1.4
271 IF (X11_X11_INCLUDE_PATH AND X11_LIBRARIES)
273 ENDIF (X11_X11_INCLUDE_PATH AND X11_LIBRARIES)
276 INCLUDE(CheckFunctionExists)
277 INCLUDE(CheckLibraryExists)
279 # Translated from an autoconf-generated configure script.
280 # See libs.m4 in autoconf's m4 directory.
281 IF($ENV{ISC} MATCHES "^yes$")
282 SET(X11_X_EXTRA_LIBS -lnsl_s -linet)
283 ELSE($ENV{ISC} MATCHES "^yes$")
284 SET(X11_X_EXTRA_LIBS "")
286 # See if XOpenDisplay in X11 works by itself.
287 CHECK_LIBRARY_EXISTS("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO)
288 IF(NOT X11_LIB_X11_SOLO)
289 # Find library needed for dnet_ntoa.
290 CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA)
291 IF (X11_LIB_DNET_HAS_DNET_NTOA)
292 SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet)
293 ELSE (X11_LIB_DNET_HAS_DNET_NTOA)
294 CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA)
295 IF (X11_LIB_DNET_STUB_HAS_DNET_NTOA)
296 SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub)
297 ENDIF (X11_LIB_DNET_STUB_HAS_DNET_NTOA)
298 ENDIF (X11_LIB_DNET_HAS_DNET_NTOA)
299 ENDIF(NOT X11_LIB_X11_SOLO)
301 # Find library needed for gethostbyname.
302 CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME)
303 IF(NOT CMAKE_HAVE_GETHOSTBYNAME)
304 CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
305 IF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
306 SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lnsl)
307 ELSE (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
308 CHECK_LIBRARY_EXISTS("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
309 IF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
310 SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd)
311 ENDIF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
312 ENDIF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
313 ENDIF(NOT CMAKE_HAVE_GETHOSTBYNAME)
315 # Find library needed for connect.
316 CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT)
317 IF(NOT CMAKE_HAVE_CONNECT)
318 CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT)
319 IF (CMAKE_LIB_SOCKET_HAS_CONNECT)
320 SET (X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS})
321 ENDIF (CMAKE_LIB_SOCKET_HAS_CONNECT)
322 ENDIF(NOT CMAKE_HAVE_CONNECT)
324 # Find library needed for remove.
325 CHECK_FUNCTION_EXISTS("remove" CMAKE_HAVE_REMOVE)
326 IF(NOT CMAKE_HAVE_REMOVE)
327 CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE)
328 IF (CMAKE_LIB_POSIX_HAS_REMOVE)
329 SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix)
330 ENDIF (CMAKE_LIB_POSIX_HAS_REMOVE)
331 ENDIF(NOT CMAKE_HAVE_REMOVE)
333 # Find library needed for shmat.
334 CHECK_FUNCTION_EXISTS("shmat" CMAKE_HAVE_SHMAT)
335 IF(NOT CMAKE_HAVE_SHMAT)
336 CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT)
337 IF (CMAKE_LIB_IPS_HAS_SHMAT)
338 SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc)
339 ENDIF (CMAKE_LIB_IPS_HAS_SHMAT)
340 ENDIF(NOT CMAKE_HAVE_SHMAT)
341 ENDIF($ENV{ISC} MATCHES "^yes$")
344 CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}"
345 CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
346 IF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
347 SET (X11_X_PRE_LIBS ${X11_ICE_LIB})
349 SET (X11_X_PRE_LIBS ${X11_SM_LIB} ${X11_X_PRE_LIBS})
351 ENDIF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
352 ENDIF (X11_ICE_FOUND)
354 # Build the final list of libraries.
355 SET(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS})
357 INCLUDE(FindPackageMessage)
358 FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
359 "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
361 IF (X11_FIND_REQUIRED)
362 MESSAGE(FATAL_ERROR "Could not find X11")
363 ENDIF (X11_FIND_REQUIRED)
372 X11_Xlib_INCLUDE_PATH
373 X11_Xutil_INCLUDE_PATH
374 X11_Xcomposite_INCLUDE_PATH
376 X11_Xaccess_INCLUDE_PATH
378 X11_Xfixes_INCLUDE_PATH
380 X11_Xrandr_INCLUDE_PATH
382 X11_Xdamage_INCLUDE_PATH
384 X11_Xrender_INCLUDE_PATH
386 X11_xf86misc_INCLUDE_PATH
387 X11_xf86vmode_INCLUDE_PATH
389 X11_Xinerama_INCLUDE_PATH
391 X11_XTest_INCLUDE_PATH
393 X11_Xcursor_INCLUDE_PATH
394 X11_dpms_INCLUDE_PATH
399 X11_Xaccessrules_INCLUDE_PATH
400 X11_Xaccessstr_INCLUDE_PATH
401 X11_Xdmcp_INCLUDE_PATH
403 X11_Xkblib_INCLUDE_PATH
404 X11_Xscreensaver_INCLUDE_PATH
409 X11_Xinput_INCLUDE_PATH
412 X11_Xshape_INCLUDE_PATH
415 X11_XShm_INCLUDE_PATH
420 SET(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE})
423 # X11_FIND_REQUIRED_<component> could be checked too