aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/FindLibIntl.cmake5
-rw-r--r--config/CMakeLists.txt65
-rw-r--r--config/config.h.in114
3 files changed, 116 insertions, 68 deletions
diff --git a/cmake/FindLibIntl.cmake b/cmake/FindLibIntl.cmake
index ef7e3c10fd..893e4db8d5 100644
--- a/cmake/FindLibIntl.cmake
+++ b/cmake/FindLibIntl.cmake
@@ -6,6 +6,7 @@
# LibIntl_LIBRARIES - link these to use libintl
include(CheckCSourceCompiles)
+include(CheckVariableExists)
include(LibFindMacros)
# Append custom gettext path to CMAKE_PREFIX_PATH
@@ -49,6 +50,10 @@ int main(int argc, char** argv) {
textdomain(\"foo\");
}" HAVE_WORKING_LIBINTL)
+if (HAVE_WORKING_LIBINTL)
+ check_variable_exists(_nl_msg_cat_cntr HAVE_NL_MSG_CAT_CNTR)
+endif()
+
set(LibIntl_PROCESS_INCLUDES LibIntl_INCLUDE_DIR)
set(LibIntl_PROCESS_LIBS LibIntl_LIBRARY)
libfind_process(LibIntl)
diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt
index 747ed175ac..808105ec52 100644
--- a/config/CMakeLists.txt
+++ b/config/CMakeLists.txt
@@ -1,5 +1,7 @@
include(CheckTypeSize)
include(CheckSymbolExists)
+include(CheckFunctionExists)
+include(CheckIncludeFiles)
check_type_size("int" SIZEOF_INT)
check_type_size("long" SIZEOF_LONG)
@@ -9,11 +11,74 @@ check_type_size("void *" SIZEOF_VOID_PTR)
check_symbol_exists(_NSGetEnviron crt_externs.h HAVE__NSGETENVIRON)
+# Headers
+check_include_files(dirent.h HAVE_DIRENT_H)
+check_include_files(fcntl.h HAVE_FCNTL_H)
+check_include_files(iconv.h HAVE_ICONV_H)
+check_include_files(langinfo.h HAVE_LANGINFO_H)
+check_include_files(libgen.h HAVE_LIBGEN_H)
+check_include_files(locale.h HAVE_LOCALE_H)
+check_include_files(pwd.h HAVE_PWD_H)
+check_include_files(strings.h HAVE_STRINGS_H)
+check_include_files(stropts.h HAVE_STROPTS_H)
+check_include_files(sys/ioctl.h HAVE_SYS_IOCTL_H)
+check_include_files(sys/param.h HAVE_SYS_PARAM_H)
+check_include_files(sys/time.h HAVE_SYS_TIME_H)
+check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
+if(NOT HAVE_SYS_WAIT_H AND UNIX)
+ # See if_cscope.c
+ message(SEND_ERROR "header sys/wait.h is required for UNIX")
+endif()
+check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
+check_include_files(utime.h HAVE_UTIME_H)
+check_include_files(termcap.h HAVE_TERMCAP_H)
+check_include_files(termios.h HAVE_TERMIOS_H)
+check_include_files(termio.h HAVE_TERMIO_H)
+check_include_files(unistd.h HAVE_UNISTD_H)
+check_include_files(utime.h HAVE_UTIME_H)
+
+# Functions
+check_function_exists(fchown HAVE_FCHOWN)
+check_function_exists(fseeko HAVE_FSEEKO)
+check_function_exists(fsync HAVE_FSYNC)
+check_function_exists(getpwent HAVE_GETPWENT)
+check_function_exists(getpwnam HAVE_GETPWNAM)
+check_function_exists(getpwuid HAVE_GETPWUID)
+check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
+check_function_exists(iconv HAVE_ICONV)
+check_function_exists(lstat HAVE_LSTAT)
+if(NOT HAVE_LSTAT)
+ # os_unix.c uses lstat.c
+ message(SEND_ERROR "lstat() function not found on your system.")
+endif()
+check_function_exists(putenv HAVE_PUTENV)
+check_function_exists(opendir HAVE_OPENDIR)
+check_function_exists(readlink HAVE_READLINK)
+check_function_exists(setenv HAVE_SETENV)
+if(NOT HAVE_SETENV)
+ message(SEND_ERROR "setenv() function not found on your system.")
+endif()
+check_function_exists(setpgid HAVE_SETPGID)
+check_function_exists(setsid HAVE_SETSID)
+check_function_exists(sigaction HAVE_SIGACTION)
+check_function_exists(sigvec HAVE_SIGVEC)
+check_function_exists(strcasecmp HAVE_STRCASECMP)
+check_function_exists(strncasecmp HAVE_STRNCASECMP)
+check_function_exists(utime HAVE_UTIME)
+check_function_exists(utimes HAVE_UTIMES)
+
+# Symbols
+check_symbol_exists(FD_CLOEXEC "fcntl.h" HAVE_FD_CLOEXEC)
+if(HAVE_LANGINFO_H)
+ check_symbol_exists(CODESET "langinfo.h" HAVE_NL_LANGINFO_CODESET)
+endif()
+
# generate configuration header and update include directories
configure_file (
"${PROJECT_SOURCE_DIR}/config/config.h.in"
"${PROJECT_BINARY_DIR}/config/auto/config.h"
)
+
# generate pathdef.c
find_program(WHOAMI_PROG whoami)
find_program(HOSTNAME_PROG hostname)
diff --git a/config/config.h.in b/config/config.h.in
index 628d128512..32d6760312 100644
--- a/config/config.h.in
+++ b/config/config.h.in
@@ -2,9 +2,7 @@
#define NEOVIM_VERSION_MINOR @NEOVIM_VERSION_MINOR@
#define NEOVIM_VERSION_PATCH @NEOVIM_VERSION_PATCH@
-#if @DEBUG@
-#define DEBUG
-#endif
+#cmakedefine DEBUG
#define SIZEOF_INT @SIZEOF_INT@
#define SIZEOF_LONG @SIZEOF_LONG@
@@ -17,85 +15,65 @@
#define ARCH_32
#endif
-#define _FILE_OFFSET_BITS 64
#cmakedefine HAVE__NSGETENVIRON
#cmakedefine HAVE_CRT_EXTERNS_H
-#define HAVE_DIRENT_H 1
-#define HAVE_DLFCN_H 1
-#define HAVE_FCHOWN 1
-#define HAVE_FCNTL_H 1
-#define HAVE_FD_CLOEXEC 1
-#define HAVE_FSEEKO 1
-#define HAVE_FSYNC 1
-#define HAVE_GETCWD 1
-#define HAVE_GETPWENT 1
-#define HAVE_GETPWNAM 1
-#define HAVE_GETPWUID 1
-#define HAVE_GETRLIMIT 1
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_GETWD 1
-#define HAVE_ICONV 1
-#define HAVE_ICONV_H 1
-#define HAVE_LANGINFO_H 1
-#define HAVE_LIBGEN_H 1
-#define HAVE_LIBINTL_H 1
-#define HAVE_LOCALE_H 1
-#define HAVE_LSTAT 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_NL_LANGINFO_CODESET 1
-#define HAVE_NL_MSG_CAT_CNTR 1
-#define HAVE_OPENDIR 1
+#cmakedefine HAVE_DIRENT_H
+#cmakedefine HAVE_FCHOWN
+#cmakedefine HAVE_FCNTL_H
+#cmakedefine HAVE_FD_CLOEXEC
+#cmakedefine HAVE_FSEEKO
+#cmakedefine HAVE_FSYNC
+#cmakedefine HAVE_GETPWENT
+#cmakedefine HAVE_GETPWNAM
+#cmakedefine HAVE_GETPWUID
+#cmakedefine HAVE_GETTIMEOFDAY
+#cmakedefine HAVE_ICONV
+#cmakedefine USE_ICONV
+#cmakedefine HAVE_ICONV_H
+#cmakedefine HAVE_LANGINFO_H
+#cmakedefine HAVE_LIBGEN_H
+#cmakedefine HAVE_LOCALE_H
+#cmakedefine HAVE_LSTAT
+#cmakedefine HAVE_NL_LANGINFO_CODESET
+#cmakedefine HAVE_NL_MSG_CAT_CNTR
+#cmakedefine HAVE_OPENDIR
#define HAVE_OSPEED 1
-#define HAVE_POLL_H 1
-#define HAVE_PUTENV 1
-#define HAVE_PWD_H 1
-#define HAVE_READLINK 1
-#define HAVE_SELECT 1
+#cmakedefine HAVE_PUTENV
+#cmakedefine HAVE_PWD_H
+#cmakedefine HAVE_READLINK
// TODO: add proper cmake check
// #define HAVE_SELINUX 1
-#define HAVE_SETENV 1
-#define HAVE_SETPGID 1
-#define HAVE_SETSID 1
-#define HAVE_SGTTY_H 1
-#define HAVE_SIGACTION 1
-#define HAVE_SIGALTSTACK 1
-#define HAVE_SIGSTACK 1
-#define HAVE_SIGVEC 1
-#define HAVE_ST_BLKSIZE 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRINGS_H 1
-#define HAVE_STRNCASECMP 1
-// TODO: add proper cmake check
-// #define HAVE_STROPTS_H 1
-// TODO: add proper cmake check
-// #define HAVE_SYSCONF 1
-#define HAVE_SYS_IOCTL_H 1
-#define HAVE_SYS_PARAM_H 1
-#define HAVE_SYS_STATFS_H 1
-// TODO: add proper cmake check
-// #define HAVE_SYS_SYSINFO_H 1
-#define HAVE_SYS_TIME_H 1
-#define HAVE_SYS_UTSNAME_H 1
-#define HAVE_SYS_WAIT_H 1
-#define HAVE_TERMCAP_H 1
-#define HAVE_TERMIO_H 1
-#define HAVE_TERMIOS_H 1
+#cmakedefine HAVE_SETENV
+#cmakedefine HAVE_SETPGID
+#cmakedefine HAVE_SETSID
+#cmakedefine HAVE_SIGACTION
+#cmakedefine HAVE_SIGVEC
+#cmakedefine HAVE_STRCASECMP
+#cmakedefine HAVE_STRINGS_H
+#cmakedefine HAVE_STRNCASECMP
+#cmakedefine HAVE_STROPTS_H
+#cmakedefine HAVE_SYS_IOCTL_H
+#cmakedefine HAVE_SYS_PARAM_H
+#cmakedefine HAVE_SYS_TIME_H
+#cmakedefine HAVE_SYS_UTSNAME_H
+#cmakedefine HAVE_SYS_WAIT_H
+#cmakedefine HAVE_TERMCAP_H
+#cmakedefine HAVE_TERMIOS_H
+#cmakedefine HAVE_TERMIO_H
#define HAVE_TGETENT 1
-#define HAVE_UNISTD_H 1
+#cmakedefine HAVE_UNISTD_H
#define HAVE_UP_BC_PC 1
-#define HAVE_UTIME 1
-#define HAVE_UTIME_H 1
-#define HAVE_UTIMES 1
+#cmakedefine HAVE_UTIME
+#cmakedefine HAVE_UTIME_H
+#cmakedefine HAVE_UTIMES
#cmakedefine HAVE_WORKING_LIBINTL
#define RETSIGTYPE void
#define SIGRETURN return
-#define SYS_SELECT_WITH_SYS_TIME 1
#define TERMINFO 1
#define TGETENT_ZERO_ERR 0
#define TIME_WITH_SYS_TIME 1
-#define UNIX 1
+#cmakedefine UNIX
#define USEMAN_S 1
-#define USEMEMMOVE 1
#define FEAT_BROWSE
#define FEAT_CSCOPE