2017-08-31 20:24:20 +00:00
|
|
|
# Detect curses.
|
|
|
|
INCLUDE(FindCurses)
|
|
|
|
|
|
|
|
# Get threads.
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
2017-11-07 01:34:20 +00:00
|
|
|
# FindThreads < 3.4.0 doesn't work for C++-only projects
|
|
|
|
IF(CMAKE_VERSION VERSION_LESS 3.4.0)
|
|
|
|
ENABLE_LANGUAGE(C)
|
|
|
|
ENDIF()
|
2017-08-31 20:24:20 +00:00
|
|
|
FIND_PACKAGE(Threads REQUIRED)
|
|
|
|
|
|
|
|
IF(APPLE)
|
|
|
|
# 10.7+ only.
|
|
|
|
SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Werror=unguarded-availability")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
# Set up the config.h file.
|
|
|
|
SET(PACKAGE_NAME "fish")
|
|
|
|
SET(PACKAGE_TARNAME "fish")
|
|
|
|
INCLUDE(CheckFunctionExists)
|
2017-11-07 01:34:20 +00:00
|
|
|
INCLUDE(CheckCXXSymbolExists)
|
|
|
|
INCLUDE(CheckIncludeFileCXX)
|
2017-08-31 20:24:20 +00:00
|
|
|
INCLUDE(CheckStructHasMember)
|
|
|
|
INCLUDE(CheckCXXSourceCompiles)
|
|
|
|
INCLUDE(CheckTypeSize)
|
|
|
|
CHECK_FUNCTION_EXISTS(backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
|
|
|
|
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
|
|
|
|
CHECK_FUNCTION_EXISTS(ctermid_r HAVE_CTERMID_R)
|
2017-11-07 01:34:20 +00:00
|
|
|
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_type dirent.h HAVE_STRUCT_DIRENT_D_TYPE LANGUAGE CXX)
|
2017-08-31 20:24:20 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(dirfd HAVE_DIRFD)
|
2017-11-07 01:34:20 +00:00
|
|
|
CHECK_INCLUDE_FILE_CXX(execinfo.h HAVE_EXECINFO_H)
|
2017-08-31 20:24:20 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(flock HAVE_FLOCK)
|
|
|
|
# futimens is new in OS X 10.13 but is a weak symbol.
|
|
|
|
# Don't assume it exists just because we can link - it may be null.
|
2017-11-07 01:34:20 +00:00
|
|
|
CHECK_CXX_SYMBOL_EXISTS(futimens sys/stat.h HAVE_FUTIMENS)
|
2017-08-31 20:24:20 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(futimes HAVE_FUTIMES)
|
|
|
|
CHECK_FUNCTION_EXISTS(getifaddrs HAVE_GETIFADDRS)
|
|
|
|
CHECK_FUNCTION_EXISTS(getpwent HAVE_GETPWENT)
|
|
|
|
CHECK_FUNCTION_EXISTS(gettext HAVE_GETTEXT)
|
|
|
|
CHECK_FUNCTION_EXISTS(killpg HAVE_KILLPG)
|
2017-11-07 14:08:07 +00:00
|
|
|
CHECK_INCLUDE_FILE_CXX(libintl.h HAVE_LIBINTL_H) # Needed for _nl_msg_cat_cntr
|
2017-08-31 20:24:20 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(lrand48_r HAVE_LRAND48_R)
|
|
|
|
CHECK_FUNCTION_EXISTS(mkostemp HAVE_MKOSTEMP)
|
|
|
|
SET(HAVE_NCURSES_CURSES_H ${CURSES_HAVE_NCURSES_CURSES_H})
|
|
|
|
SET(HAVE_NCURSES_H ${CURSES_HAVE_NCURSES_H})
|
2017-11-07 01:34:20 +00:00
|
|
|
CHECK_INCLUDE_FILE_CXX("ncurses/term.h" HAVE_NCURSES_TERM_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(siginfo.h HAVE_SIGINFO_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(spawn.h HAVE_SPAWN_H)
|
2017-08-31 20:24:20 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(std::wcscasecmp HAVE_STD__WCSCASECMP)
|
|
|
|
CHECK_FUNCTION_EXISTS(std::wcsdup HAVE_STD__WCSDUP)
|
|
|
|
CHECK_FUNCTION_EXISTS(std::wcsncasecmp HAVE_STD__WCSNCASECMP)
|
2017-11-07 02:13:49 +00:00
|
|
|
CHECK_STRUCT_HAS_MEMBER("struct stat" st_ctime_nsec "sys/stat.h" HAVE_STRUCT_STAT_ST_CTIME_NSEC
|
|
|
|
LANGUAGE CXX)
|
|
|
|
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec "sys/stat.h"
|
|
|
|
HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC LANGUAGE CXX)
|
|
|
|
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec "sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
|
|
|
|
LANGUAGE CXX)
|
2017-11-07 01:34:20 +00:00
|
|
|
CHECK_CXX_SYMBOL_EXISTS(sys_errlist stdio.h HAVE_SYS_ERRLIST)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(sys/ioctl.h HAVE_SYS_IOCTL_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(sys/select.h HAVE_SYS_SELECT_H)
|
|
|
|
CHECK_INCLUDE_FILE_CXX(sys/sysctl.h HAVE_SYS_SYSCTL_H)
|
2017-11-07 14:08:07 +00:00
|
|
|
CHECK_INCLUDE_FILE_CXX(termios.h HAVE_TERMIOS_H) # Needed for TIOCGWINSZ
|
2017-11-07 01:34:20 +00:00
|
|
|
CHECK_INCLUDE_FILE_CXX(term.h HAVE_TERM_H)
|
2017-08-31 20:24:20 +00:00
|
|
|
CHECK_FUNCTION_EXISTS(wcscasecmp HAVE_WCSCASECMP)
|
|
|
|
CHECK_FUNCTION_EXISTS(wcsdup HAVE_WCSDUP)
|
|
|
|
CHECK_FUNCTION_EXISTS(wcslcpy HAVE_WCSLCPY)
|
|
|
|
CHECK_FUNCTION_EXISTS(wcsncasecmp HAVE_WCSNCASECMP)
|
|
|
|
CHECK_FUNCTION_EXISTS(wcsndup HAVE_WCSNDUP)
|
2017-11-07 01:34:20 +00:00
|
|
|
CHECK_CXX_SYMBOL_EXISTS(_nl_msg_cat_cntr stdlib.h HAVE__NL_MSG_CAT_CNTR)
|
|
|
|
CHECK_CXX_SYMBOL_EXISTS(_sys_errs stdlib.h HAVE__SYS__ERRS)
|
2017-08-31 20:24:20 +00:00
|
|
|
|
|
|
|
SET(CMAKE_EXTRA_INCLUDE_FILES termios.h sys/ioctl.h)
|
2017-11-07 01:34:20 +00:00
|
|
|
CHECK_TYPE_SIZE("struct winsize" STRUCT_WINSIZE LANGUAGE CXX)
|
2017-11-07 03:30:29 +00:00
|
|
|
CHECK_CXX_SYMBOL_EXISTS("TIOCGWINSZ" "termios.h;sys/ioctl.h" HAVE_TIOCGWINSZ)
|
|
|
|
IF(STRUCT_WINSIZE GREATER -1 AND HAVE_TIOCGWINSZ EQUAL 1)
|
2017-08-31 20:24:20 +00:00
|
|
|
SET(HAVE_WINSIZE 1)
|
|
|
|
ENDIF()
|
|
|
|
SET(CMAKE_EXTRA_INCLUDE_FILES)
|
|
|
|
|
|
|
|
SET(HAVE__PROC_SELF_STAT (EXISTS "/proc/self/stat"))
|
2017-11-07 01:34:20 +00:00
|
|
|
CHECK_TYPE_SIZE("wchar_t[8]" WCHAR_T_BITS LANGUAGE CXX)
|
2017-11-07 14:08:07 +00:00
|
|
|
|
|
|
|
# Not checked yet: non-varargs tparm ("Solaris tparm kludge")
|
|
|
|
# Not checked yet: gettext
|