2001-11-11 07:01:06 +03:00
|
|
|
#
|
2002-09-02 23:46:04 +04:00
|
|
|
# try to find X11 on UNIX systems.
|
2001-11-11 07:01:06 +03:00
|
|
|
#
|
2002-09-02 23:46:04 +04:00
|
|
|
# The following values are defined
|
2003-01-08 19:45:48 +03:00
|
|
|
# X11_FOUND - True if X11 is available
|
|
|
|
# X11_INCLUDE_DIR - include directories to use X11
|
|
|
|
# X11_LIBRARIES - link against these to use X11
|
2002-09-03 14:10:06 +04:00
|
|
|
|
2002-09-02 23:46:04 +04:00
|
|
|
IF (UNIX)
|
2003-01-08 19:45:48 +03:00
|
|
|
SET(X11_FOUND 0)
|
2002-12-17 19:55:54 +03:00
|
|
|
|
2003-01-08 19:45:48 +03:00
|
|
|
SET(X11_INC_SEARCH_PATH
|
2002-09-02 23:46:04 +04:00
|
|
|
/usr/X11R6/include
|
2002-11-05 15:15:42 +03:00
|
|
|
/usr/local/include
|
|
|
|
/usr/include/X11
|
|
|
|
/usr/openwin/include
|
|
|
|
/usr/openwin/share/include
|
|
|
|
/opt/graphics/OpenGL/include
|
2003-01-02 17:57:42 +03:00
|
|
|
/usr/include
|
2002-11-05 15:15:42 +03:00
|
|
|
)
|
|
|
|
|
2003-01-08 19:45:48 +03:00
|
|
|
SET(X11_LIB_SEARCH_PATH
|
2002-09-02 23:46:04 +04:00
|
|
|
/usr/X11R6/lib
|
|
|
|
/usr/local/lib
|
|
|
|
/usr/openwin/lib
|
2003-01-02 17:57:42 +03:00
|
|
|
/usr/lib
|
2001-11-11 07:01:06 +03:00
|
|
|
)
|
|
|
|
|
2003-01-08 19:45:48 +03:00
|
|
|
FIND_PATH(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH})
|
|
|
|
FIND_PATH(X11_Xlib_INCLUDE_PATH X11/Xlib.h ${X11_INC_SEARCH_PATH})
|
|
|
|
FIND_PATH(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH})
|
|
|
|
FIND_LIBRARY(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH})
|
|
|
|
FIND_LIBRARY(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH})
|
2003-01-02 17:57:42 +03:00
|
|
|
|
2003-01-08 19:45:48 +03:00
|
|
|
IF(X11_X11_INCLUDE_PATH)
|
|
|
|
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH})
|
|
|
|
ENDIF(X11_X11_INCLUDE_PATH)
|
2002-09-02 23:46:04 +04:00
|
|
|
|
2003-01-08 19:45:48 +03:00
|
|
|
IF(X11_Xlib_INCLUDE_PATH)
|
|
|
|
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH})
|
|
|
|
ENDIF(X11_Xlib_INCLUDE_PATH)
|
2002-06-15 00:49:00 +04:00
|
|
|
|
2003-01-08 19:45:48 +03:00
|
|
|
IF(X11_Xutil_INCLUDE_PATH)
|
|
|
|
SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH})
|
|
|
|
ENDIF(X11_Xutil_INCLUDE_PATH)
|
2002-09-05 20:00:45 +04:00
|
|
|
|
2003-01-08 19:45:48 +03:00
|
|
|
IF(X11_X11_LIB)
|
|
|
|
SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB})
|
|
|
|
ENDIF(X11_X11_LIB)
|
2002-12-17 19:55:54 +03:00
|
|
|
|
2003-01-08 19:45:48 +03:00
|
|
|
IF(X11_Xext_LIB)
|
|
|
|
SET(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB})
|
|
|
|
ENDIF(X11_Xext_LIB)
|
2002-09-05 20:00:45 +04:00
|
|
|
|
2002-12-17 19:55:54 +03:00
|
|
|
# Deprecated variable for backwards compatibility with CMake 1.4
|
2003-01-08 19:45:48 +03:00
|
|
|
IF(X11_X11_INCLUDE_PATH)
|
|
|
|
IF(X11_LIBRARIES)
|
|
|
|
SET(X11_FOUND 1)
|
|
|
|
ENDIF(X11_LIBRARIES)
|
|
|
|
ENDIF(X11_X11_INCLUDE_PATH)
|
2002-12-17 19:55:54 +03:00
|
|
|
|
2003-01-29 17:06:46 +03:00
|
|
|
SET(X11_LIBRARY_DIR "")
|
|
|
|
IF(X11_X11_LIB)
|
|
|
|
GET_FILENAME_COMPONENT(X11_LIBRARY_DIR ${X11_X11_LIB} PATH)
|
|
|
|
ENDIF(X11_X11_LIB)
|
|
|
|
|
2003-01-08 19:45:48 +03:00
|
|
|
IF(X11_FOUND)
|
2004-08-27 06:52:53 +04:00
|
|
|
INCLUDE(CheckFunctionExists)
|
|
|
|
INCLUDE(CheckLibraryExists)
|
2002-12-17 19:55:54 +03:00
|
|
|
|
|
|
|
# Translated from an autoconf-generated configure script.
|
|
|
|
# See libs.m4 in autoconf's m4 directory.
|
|
|
|
IF($ENV{ISC} MATCHES "^yes$")
|
2003-01-08 19:45:48 +03:00
|
|
|
SET(X11_X_EXTRA_LIBS -lnsl_s -linet)
|
2002-12-17 19:55:54 +03:00
|
|
|
ELSE($ENV{ISC} MATCHES "^yes$")
|
2003-01-08 19:45:48 +03:00
|
|
|
SET(X11_X_EXTRA_LIBS "")
|
2002-12-17 19:55:54 +03:00
|
|
|
|
|
|
|
# See if XOpenDisplay in X11 works by itself.
|
2003-01-29 17:06:46 +03:00
|
|
|
CHECK_LIBRARY_EXISTS("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO)
|
2003-01-08 19:45:48 +03:00
|
|
|
IF(NOT X11_LIB_X11_SOLO)
|
2002-12-17 19:55:54 +03:00
|
|
|
# Find library needed for dnet_ntoa.
|
2003-01-08 19:45:48 +03:00
|
|
|
CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA)
|
|
|
|
IF (X11_LIB_DNET_HAS_DNET_NTOA)
|
|
|
|
SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet)
|
|
|
|
ELSE (X11_LIB_DNET_HAS_DNET_NTOA)
|
|
|
|
CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA)
|
|
|
|
IF (X11_LIB_DNET_STUB_HAS_DNET_NTOA)
|
|
|
|
SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub)
|
|
|
|
ENDIF (X11_LIB_DNET_STUB_HAS_DNET_NTOA)
|
|
|
|
ENDIF (X11_LIB_DNET_HAS_DNET_NTOA)
|
|
|
|
ENDIF(NOT X11_LIB_X11_SOLO)
|
2002-12-17 19:55:54 +03:00
|
|
|
|
|
|
|
# Find library needed for gethostbyname.
|
|
|
|
CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME)
|
|
|
|
IF(NOT CMAKE_HAVE_GETHOSTBYNAME)
|
|
|
|
CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
|
|
|
IF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
2003-01-20 22:39:03 +03:00
|
|
|
SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lnsl)
|
2002-12-17 19:55:54 +03:00
|
|
|
ELSE (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
|
|
|
CHECK_LIBRARY_EXISTS("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
|
|
|
|
IF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
|
2003-01-08 19:45:48 +03:00
|
|
|
SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd)
|
2002-12-17 19:55:54 +03:00
|
|
|
ENDIF (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME)
|
|
|
|
ENDIF (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME)
|
|
|
|
ENDIF(NOT CMAKE_HAVE_GETHOSTBYNAME)
|
|
|
|
|
|
|
|
# Find library needed for connect.
|
|
|
|
CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT)
|
|
|
|
IF(NOT CMAKE_HAVE_CONNECT)
|
|
|
|
CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT)
|
|
|
|
IF (CMAKE_LIB_SOCKET_HAS_CONNECT)
|
2003-01-08 19:45:48 +03:00
|
|
|
SET (X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS})
|
2002-12-17 19:55:54 +03:00
|
|
|
ENDIF (CMAKE_LIB_SOCKET_HAS_CONNECT)
|
|
|
|
ENDIF(NOT CMAKE_HAVE_CONNECT)
|
|
|
|
|
|
|
|
# Find library needed for remove.
|
|
|
|
CHECK_FUNCTION_EXISTS("remove" CMAKE_HAVE_REMOVE)
|
|
|
|
IF(NOT CMAKE_HAVE_REMOVE)
|
|
|
|
CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE)
|
|
|
|
IF (CMAKE_LIB_POSIX_HAS_REMOVE)
|
2003-01-08 19:45:48 +03:00
|
|
|
SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix)
|
2002-12-17 19:55:54 +03:00
|
|
|
ENDIF (CMAKE_LIB_POSIX_HAS_REMOVE)
|
|
|
|
ENDIF(NOT CMAKE_HAVE_REMOVE)
|
|
|
|
|
|
|
|
# Find library needed for shmat.
|
|
|
|
CHECK_FUNCTION_EXISTS("shmat" CMAKE_HAVE_SHMAT)
|
|
|
|
IF(NOT CMAKE_HAVE_SHMAT)
|
|
|
|
CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT)
|
|
|
|
IF (CMAKE_LIB_IPS_HAS_SHMAT)
|
2003-01-08 19:45:48 +03:00
|
|
|
SET (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc)
|
2002-12-17 19:55:54 +03:00
|
|
|
ENDIF (CMAKE_LIB_IPS_HAS_SHMAT)
|
|
|
|
ENDIF(NOT CMAKE_HAVE_SHMAT)
|
|
|
|
ENDIF($ENV{ISC} MATCHES "^yes$")
|
|
|
|
|
2003-01-29 17:06:46 +03:00
|
|
|
CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}"
|
2002-12-17 19:55:54 +03:00
|
|
|
CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
|
|
|
IF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
2003-01-08 19:45:48 +03:00
|
|
|
SET (X11_X_PRE_LIBS -lSM -lICE)
|
2002-12-17 19:55:54 +03:00
|
|
|
ENDIF(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER)
|
|
|
|
# Build the final list of libraries.
|
2003-01-08 19:45:48 +03:00
|
|
|
SET (X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS})
|
|
|
|
ENDIF(X11_FOUND)
|
2002-12-17 19:55:54 +03:00
|
|
|
|
2002-11-06 01:20:45 +03:00
|
|
|
MARK_AS_ADVANCED(
|
2003-01-08 19:45:48 +03:00
|
|
|
X11_X11_INCLUDE_PATH
|
|
|
|
X11_X11_LIB
|
|
|
|
X11_Xext_LIB
|
|
|
|
X11_Xlib_INCLUDE_PATH
|
|
|
|
X11_Xutil_INCLUDE_PATH
|
|
|
|
X11_LIBRARIES
|
2002-11-06 01:20:45 +03:00
|
|
|
)
|
2002-11-13 00:27:24 +03:00
|
|
|
|
2002-09-02 23:46:04 +04:00
|
|
|
ENDIF (UNIX)
|