2018-07-27 07:53:26 -06:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
|
2007-08-19 05:51:53 -06:00
|
|
|
|
2007-08-20 11:03:20 -06:00
|
|
|
# include used modules
|
2007-08-21 10:39:11 -06:00
|
|
|
include(DefineInstallationPaths)
|
2007-08-19 05:51:53 -06:00
|
|
|
include(CheckIncludeFileCXX)
|
|
|
|
include(CheckFunctionExists)
|
2015-08-01 03:41:45 -06:00
|
|
|
include(CheckSymbolExists)
|
2007-08-19 05:51:53 -06:00
|
|
|
include(CheckLibraryExists)
|
|
|
|
include(CheckCXXCompilerFlag)
|
2007-08-20 07:50:06 -06:00
|
|
|
include(CheckMkdirArgs)
|
2015-11-16 03:59:23 -07:00
|
|
|
include(CheckIncludeFiles)
|
2007-08-19 05:51:53 -06:00
|
|
|
|
2007-08-21 13:43:03 -06:00
|
|
|
# setup short variable path names
|
|
|
|
set(BINDIR ${BIN_INSTALL_DIR})
|
|
|
|
set(SBINDIR ${SBIN_INSTALL_DIR})
|
|
|
|
set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
|
|
|
|
set(LOCALSTATEDIR ${LOCALSTATE_INSTALL_DIR})
|
|
|
|
set(MANDIR ${MAN_INSTALL_DIR})
|
|
|
|
|
2007-08-23 15:01:05 -06:00
|
|
|
# set default hardcoded config paths
|
2014-07-03 14:58:20 -06:00
|
|
|
if(WIN32)
|
|
|
|
set(BNETD_DEFAULT_CONF_FILE "conf/bnetd.conf")
|
|
|
|
set(D2CS_DEFAULT_CONF_FILE "conf/d2cs.conf")
|
|
|
|
set(D2DBS_DEFAULT_CONF_FILE "conf/d2dbs.conf")
|
|
|
|
else(WIN32)
|
|
|
|
set(BNETD_DEFAULT_CONF_FILE "${SYSCONFDIR}/bnetd.conf")
|
|
|
|
set(D2CS_DEFAULT_CONF_FILE "${SYSCONFDIR}/d2cs.conf")
|
|
|
|
set(D2DBS_DEFAULT_CONF_FILE "${SYSCONFDIR}/d2dbs.conf")
|
|
|
|
endif(WIN32)
|
2007-08-23 15:01:05 -06:00
|
|
|
|
2007-08-20 11:03:20 -06:00
|
|
|
# library checks
|
2018-07-27 07:53:26 -06:00
|
|
|
if(WITH_BNETD)
|
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
endif(WITH_BNETD)
|
2007-08-20 11:03:20 -06:00
|
|
|
|
2014-05-23 12:19:43 -06:00
|
|
|
if(WITH_LUA)
|
|
|
|
find_package(Lua REQUIRED)
|
|
|
|
endif(WITH_LUA)
|
|
|
|
|
2007-08-20 11:03:20 -06:00
|
|
|
# storage module checks
|
2012-04-29 02:13:10 -06:00
|
|
|
if(WITH_ODBC)
|
|
|
|
find_package(ODBC REQUIRED)
|
|
|
|
endif(WITH_ODBC)
|
2007-08-20 11:03:20 -06:00
|
|
|
if(WITH_MYSQL)
|
|
|
|
find_package(MySQL REQUIRED)
|
|
|
|
endif(WITH_MYSQL)
|
|
|
|
if(WITH_SQLITE3)
|
|
|
|
find_package(SQLite3 REQUIRED)
|
|
|
|
endif(WITH_SQLITE3)
|
2007-08-27 14:02:18 -06:00
|
|
|
if(WITH_PGSQL)
|
|
|
|
find_package(PostgreSQL REQUIRED)
|
|
|
|
endif(WITH_PGSQL)
|
2007-08-20 11:03:20 -06:00
|
|
|
|
2018-07-27 07:53:26 -06:00
|
|
|
|
|
|
|
check_library_exists(nsl gethostbyname "" HAVE_LIBNSL)
|
|
|
|
check_library_exists(socket socket "" HAVE_LIBSOCKET)
|
|
|
|
check_library_exists(resolv inet_aton "" HAVE_LIBRESOLV)
|
|
|
|
check_library_exists(bind __inet_aton "" HAVE_LIBBIND)
|
|
|
|
|
2007-08-20 11:03:20 -06:00
|
|
|
if(HAVE_LIBNSL)
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} nsl)
|
|
|
|
SET(NETWORK_LIBRARIES ${NETWORK_LIBRARIES} nsl)
|
|
|
|
endif(HAVE_LIBNSL)
|
|
|
|
if(HAVE_LIBSOCKET)
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} socket)
|
|
|
|
SET(NETWORK_LIBRARIES ${NETWORK_LIBRARIES} socket)
|
|
|
|
endif(HAVE_LIBSOCKET)
|
|
|
|
if(HAVE_LIBRESOLV)
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} resolv)
|
|
|
|
SET(NETWORK_LIBRARIES ${NETWORK_LIBRARIES} resolv)
|
|
|
|
endif(HAVE_LIBRESOLV)
|
|
|
|
if(HAVE_LIBBIND)
|
|
|
|
# this is used for BeOS BONE, when someone will want
|
|
|
|
# to test pvpgn with cmake on BeOS please contact us
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} bind)
|
|
|
|
SET(NETWORK_LIBRARIES ${NETWORK_LIBRARIES} bind)
|
|
|
|
endif(HAVE_LIBBIND)
|
2007-08-22 08:41:01 -06:00
|
|
|
# for win32 unconditionally add network library linking to "ws2_32"
|
2007-08-20 11:03:20 -06:00
|
|
|
if(WIN32)
|
2007-08-22 08:41:01 -06:00
|
|
|
SET(NETWORK_LIBRARIES ${NETWORK_LIBRARIES} ws2_32)
|
2007-08-20 11:03:20 -06:00
|
|
|
endif(WIN32)
|
|
|
|
|
2007-08-19 05:51:53 -06:00
|
|
|
|
2015-08-24 00:02:11 -06:00
|
|
|
message(STATUS "Checking POSIX headers")
|
|
|
|
check_include_file_cxx(arpa/inet.h HAVE_ARPA_INET_H)
|
|
|
|
check_include_file_cxx(dirent.h HAVE_DIRENT_H)
|
|
|
|
check_include_file_cxx(grp.h HAVE_GRP_H)
|
2007-08-19 05:51:53 -06:00
|
|
|
check_include_file_cxx(fcntl.h HAVE_FCNTL_H)
|
2015-08-24 00:02:11 -06:00
|
|
|
check_include_file_cxx(netdb.h HAVE_NETDB_H)
|
|
|
|
check_include_file_cxx(netinet/in.h HAVE_NETINET_IN_H)
|
|
|
|
check_include_file_cxx(poll.h HAVE_POLL_H)
|
|
|
|
check_include_file_cxx(pwd.h HAVE_PWD_H)
|
|
|
|
check_include_file_cxx(sys/mman.h HAVE_SYS_MMAN_H)
|
|
|
|
check_include_file_cxx(sys/resource.h HAVE_SYS_RESOURCE_H)
|
2007-08-19 05:51:53 -06:00
|
|
|
check_include_file_cxx(sys/select.h HAVE_SYS_SELECT_H)
|
|
|
|
check_include_file_cxx(sys/socket.h HAVE_SYS_SOCKET_H)
|
2015-08-24 00:02:11 -06:00
|
|
|
check_include_file_cxx(sys/stat.h HAVE_SYS_STAT_H)
|
|
|
|
check_include_file_cxx(sys/time.h HAVE_SYS_TIME_H)
|
2007-08-19 05:51:53 -06:00
|
|
|
check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H)
|
2015-08-24 00:02:11 -06:00
|
|
|
check_include_file_cxx(sys/utsname.h HAVE_SYS_UTSNAME_H)
|
2007-08-19 05:51:53 -06:00
|
|
|
check_include_file_cxx(sys/wait.h HAVE_SYS_WAIT_H)
|
2015-08-24 00:02:11 -06:00
|
|
|
check_include_file_cxx(termios.h HAVE_TERMIOS_H)
|
|
|
|
check_include_file_cxx(unistd.h HAVE_UNISTD_H)
|
|
|
|
|
|
|
|
message(STATUS "Checking optional POSIX/required SUS headers")
|
|
|
|
check_include_file_cxx(sys/timeb.h HAVE_SYS_TIMEB_H)
|
|
|
|
|
|
|
|
message(STATUS "Checking FreeBSD-based headers")
|
2015-11-16 03:59:23 -07:00
|
|
|
check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
|
2015-08-24 00:02:11 -06:00
|
|
|
check_include_file_cxx(sys/param.h HAVE_SYS_PARAM_H)
|
|
|
|
|
|
|
|
message(STATUS "Checking BSD headers")
|
2007-08-19 05:51:53 -06:00
|
|
|
check_include_file_cxx(sys/file.h HAVE_SYS_FILE_H)
|
2015-08-24 00:02:11 -06:00
|
|
|
|
|
|
|
message(STATUS "Checking Linux headers")
|
2007-08-19 05:51:53 -06:00
|
|
|
check_include_file_cxx(sys/epoll.h HAVE_SYS_EPOLL_H)
|
2015-08-24 00:02:11 -06:00
|
|
|
|
|
|
|
message(STATUS "Checking Win32 headers")
|
2007-08-19 16:50:02 -06:00
|
|
|
check_include_file_cxx(windows.h HAVE_WINDOWS_H)
|
|
|
|
check_include_file_cxx(winsock2.h HAVE_WINSOCK2_H)
|
2015-09-06 11:49:42 -06:00
|
|
|
check_include_file_cxx(ws2tcpip.h HAVE_WS2TCPIP_H)
|
2007-08-23 11:59:48 -06:00
|
|
|
check_include_file_cxx(process.h HAVE_PROCESS_H)
|
2007-08-19 05:51:53 -06:00
|
|
|
|
2015-08-24 00:02:11 -06:00
|
|
|
message(STATUS "Checking other headers")
|
|
|
|
check_include_file_cxx(dir.h HAVE_DIR_H)
|
|
|
|
check_include_file_cxx(direct.h HAVE_DIRECT_H)
|
|
|
|
check_include_file_cxx(ndir.h HAVE_NDIR_H)
|
|
|
|
check_include_file_cxx(sys/dir.h HAVE_SYS_DIR_H)
|
|
|
|
check_include_file_cxx(sys/ndir.h HAVE_SYS_NDIR_H)
|
|
|
|
check_include_file_cxx(sys/poll.h HAVE_SYS_POLL_H)
|
2007-08-19 05:51:53 -06:00
|
|
|
|
2015-10-17 14:11:46 -06:00
|
|
|
check_function_exists(chdir HAVE_CHDIR)
|
|
|
|
check_function_exists(epoll_create HAVE_EPOLL_CREATE)
|
2007-08-19 05:51:53 -06:00
|
|
|
check_function_exists(fork HAVE_FORK)
|
2015-10-17 14:11:46 -06:00
|
|
|
check_function_exists(ftime HAVE_FTIME)
|
|
|
|
check_function_exists(getgid HAVE_GETGID)
|
|
|
|
check_function_exists(getgrnam HAVE_GETGRNAM)
|
|
|
|
check_function_exists(getlogin HAVE_GETLOGIN)
|
|
|
|
check_function_exists(getopt HAVE_GETOPT)
|
2007-08-19 05:51:53 -06:00
|
|
|
check_function_exists(getpid HAVE_GETPID)
|
2015-10-17 14:11:46 -06:00
|
|
|
check_function_exists(getpwnam HAVE_GETPWNAME)
|
|
|
|
check_function_exists(getrlimit HAVE_GETRLIMIT)
|
|
|
|
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
|
|
|
|
check_function_exists(getuid HAVE_GETUID)
|
|
|
|
check_function_exists(ioctl HAVE_IOCTL)
|
|
|
|
check_function_exists(kqueue HAVE_KQUEUE)
|
|
|
|
check_function_exists(_mkdir HAVE__MKDIR)
|
2015-10-17 14:16:06 -06:00
|
|
|
check_function_exists(mkdir HAVE_MKDIR)
|
2015-10-17 14:11:46 -06:00
|
|
|
check_function_exists(mmap HAVE_MMAP)
|
|
|
|
check_function_exists(pipe HAVE_PIPE)
|
|
|
|
check_function_exists(poll HAVE_POLL)
|
|
|
|
check_function_exists(setitimer HAVE_SETITIMER)
|
|
|
|
check_function_exists(setpgid HAVE_SETPGID)
|
|
|
|
check_function_exists(setpgrp HAVE_SETPGRP)
|
|
|
|
check_function_exists(setsid HAVE_SETSID)
|
|
|
|
check_function_exists(setuid HAVE_SETUID)
|
2007-08-19 05:51:53 -06:00
|
|
|
check_function_exists(sigaction HAVE_SIGACTION)
|
|
|
|
check_function_exists(sigaddset HAVE_SIGADDSET)
|
2015-10-17 14:11:46 -06:00
|
|
|
check_function_exists(sigprocmask HAVE_SIGPROCMASK)
|
2007-08-19 05:51:53 -06:00
|
|
|
check_function_exists(strcasecmp HAVE_STRCASECMP)
|
2015-10-17 14:11:46 -06:00
|
|
|
check_function_exists(strdup HAVE_STRDUP)
|
2007-08-19 05:51:53 -06:00
|
|
|
check_function_exists(stricmp HAVE_STRICMP)
|
2015-10-17 14:11:46 -06:00
|
|
|
check_function_exists(strncasecmp HAVE_STRNCASECMP)
|
2007-08-19 05:51:53 -06:00
|
|
|
check_function_exists(strnicmp HAVE_STRNICMP)
|
|
|
|
check_function_exists(strsep HAVE_STRSEP)
|
2015-10-17 14:11:46 -06:00
|
|
|
check_function_exists(uname HAVE_UNAME)
|
|
|
|
check_function_exists(wait HAVE_WAIT)
|
|
|
|
check_function_exists(waitpid HAVE_WAITPID)
|
2007-08-20 07:50:06 -06:00
|
|
|
|
2015-09-20 21:10:28 -06:00
|
|
|
|
2007-08-20 07:50:06 -06:00
|
|
|
if(HAVE_WINSOCK2_H)
|
|
|
|
set(HAVE_GETHOSTNAME ON)
|
|
|
|
set(HAVE_SELECT ON)
|
|
|
|
set(HAVE_SOCKET ON)
|
|
|
|
set(HAVE_RECV ON)
|
|
|
|
set(HAVE_SEND ON)
|
|
|
|
set(HAVE_RECVFROM ON)
|
|
|
|
set(HAVE_SENDTO ON)
|
|
|
|
set(HAVE_GETHOSTBYNAME ON)
|
|
|
|
set(HAVE_GETSERVBYNAME ON)
|
|
|
|
else(HAVE_WINSOCK2_H)
|
|
|
|
check_function_exists(gethostname HAVE_GETHOSTNAME)
|
|
|
|
check_function_exists(select HAVE_SELECT)
|
|
|
|
check_function_exists(socket HAVE_SOCKET)
|
|
|
|
check_function_exists(recv HAVE_RECV)
|
|
|
|
check_function_exists(send HAVE_SEND)
|
|
|
|
check_function_exists(recvfrom HAVE_RECVFROM)
|
|
|
|
check_function_exists(sendto HAVE_SENDTO)
|
|
|
|
check_function_exists(gethostbyname HAVE_GETHOSTBYNAME)
|
|
|
|
check_function_exists(getservbyname HAVE_GETSERVBYNAME)
|
|
|
|
endif(HAVE_WINSOCK2_H)
|
2007-08-19 05:51:53 -06:00
|
|
|
|
2007-08-20 07:50:06 -06:00
|
|
|
check_mkdir_args(MKDIR_TAKES_ONE_ARG)
|
2007-08-19 16:50:02 -06:00
|
|
|
|
2018-07-27 07:53:26 -06:00
|
|
|
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|