Commit Graph

58 Commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
050fd342da Support both GCC's Wno-redundant-move and LLVM's Wredundant-move 2021-02-22 15:44:17 -06:00
Fabian Homborg
9b763581cf cmake: Only check mbrtowc on Apple
The only thing we know ever triggered this is old macOS versions,
there's no need to use it for everyone else.

Since this uses try_run it breaks when cross-compiling, which
shouldn't be a common thing on macOS.

Fixes #7737
2021-02-22 20:17:17 +01:00
ridiculousfish
8066428feb Add fd_event_signaller_t
fd_event_signaller_t exists to expose eventfd under Linux. This is a
more lightweight way of signalling events than using a pipe.
2021-02-07 10:59:10 -08:00
ridiculousfish
b79ec0122a Use pipe2 when creating pipes if avaialble
This allows us to avoid marking the pipe as CLOEXEC in some cases,
saving a system call.
2021-02-05 17:58:08 -08:00
Fabian Homborg
d8af0d2eec Stop creating a "build," directory
This was a typo. CMake doesn't take comma-separated arguments, but if
you do add the comma it tends to work, because it just takes that
comma as part of the string. So if it takes a directory to work in,
that it will then create, and you pass

${CMAKE_CURRENT_BINARY_DIR},

well, that might just create a "build," directory.
2020-10-06 17:55:44 +02:00
Mahmoud Al-Qudsi
1365379518 Optimize away a str2wcs_internal check
str2wcs_internal is one of worst hot paths in the codebase, and this
particular check can be optimized away for non-macOS hosts at compile
time.
2020-09-07 18:05:18 -05:00
Soumya
56c64281bd Update -latomic check to match the one in LLVM.
It's not entirely clear why the existing check does not work, but it seems to pass on clang++ even without -latomic, but causes the fish build to fail later.

Confirmed that with this change, g++ does not use -latomic, while clang++ does, and fish builds fine with both.
2020-08-05 12:23:49 -07:00
Ryan Burns
ca4f2369d1 Fix build when ncurses is in nonstandard prefix 2020-07-25 11:21:36 -07:00
ridiculousfish
7ea396ab3f Remove lrand48 checks and support
lrand48 is no longer used.
2020-07-08 11:00:12 -07:00
Mahmoud Al-Qudsi
4a5f0f3a3d Fix missing references when manually linking against curses
When CMake's own curses logic fails to find curses/ncurses, we fall back to
pkg-config and manually link the required libraries. Some platforms (RHEL 6,
see #6587) require CURSES_EXTRA_LIBRARY=tinfo, so we link against libtinfo
if it's found but are happy to continue without it if it doesn't exist.

Closes #6587
2020-07-08 10:58:41 -05:00
Mahmoud Al-Qudsi
fb4967945a fixup! Put -Wno-redundant-move behind a compiler check
Use -Werror in the CMake test because the compiler check passes even
if warnings are emitted.
2020-07-05 13:31:28 -05:00
Mahmoud Al-Qudsi
fe2da0a94f Put -Wno-redundant-move behind a compiler check
This fixes a warning under Ubuntu 18.04's default gcc
(cc++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0)
2020-07-04 21:14:43 -05:00
ridiculousfish
a9bfe7f164 Remove find_program(sed) from CMake
We no longer use sed.
2020-05-22 13:44:55 -07:00
ridiculousfish
84e0c8d32e Guard thread_local
Mac OS X 10.9 supports __thread but not C++11 thread_local.
Teach CMake to detect support for thread_local and use the proper
define guard.

Fixes #7023
2020-05-22 13:41:05 -07:00
ridiculousfish
f117addf7c Use lowercase CMake function names
This is a best practice to distinguish them from variables.
2020-03-14 16:11:35 -07:00
Maya Rashish
934f708ef6 cmake: adjust logic for TPARM_VARARGS
- Define it before the headers so they can pick the variadic tparm
prototype.
- We need a TPARM_VARARGS define, add it to config_cmake.h.
- Move & adjust comment - put it near the code, and mentiont that
NetBSD curses doesn't need the kludge.

Now variadic tparm is used on NetBSD instead of the Solaris kludge.
2020-02-20 18:14:54 +01:00
David Adam
5df84c1998 cmake: use correct variable for C++ compiler flags
Broken in 8ca936aea6
2020-01-02 22:08:59 +08:00
David Adam
8ca936aea6 cmake: use C++ extension options when checking features
This matches the CMake default of extensions turned on.
2019-12-23 22:26:57 +08:00
David Adam
4d325dcd7a cmake: tidy up adding C++11 compile flags
Two blocks of code were trying to do the same thing in different ways;
standardise on one, and only add the compile flags if CMake won't do it
itself (policy CMP0067).
2019-12-23 22:26:57 +08:00
ridiculousfish
82baf74785 Attempt to fix the build
Move the CMake changes down in the file after the FIND_PACKAGE calls.
2019-12-22 12:31:14 -08:00
ridiculousfish
87854c81f5 Allow C++ standard to be passed to CHECK_CXX_SOURCE_COMPILES
Work around the issue in CMake where C++ standard doesn't get propagated
to CHECK_CXX_SOURCE_COMPILES. Also correctly check for std::make_unique;
the define was missing from the config.h header.
2019-12-22 12:07:46 -08:00
David Adam
45633f4a54 cmake: force C++11 in CHECK_CXX_SOURCE_COMPILES for atomic
GCC 4.8 requires the use of `-std=gnu++11` or similar to enable atomic
features. However, older versions of CMake don't pick up the
project-wide target for C++11 when building the configure check targets.
Although CMake policy 0067 could be set to NEW to enable this, it only
exists on CMake 3.8 and newer, while many of our supported platforms are
on an older version.
2019-12-21 22:00:22 +08:00
David Adam
8f2f3b648f cmake: check for 64-bit atomic operations directly
780bac671f did not actually successfully
compile on any platforms, leading to -latomic always being added
(including on platforms it does not exist on).

Work on #5865.
2019-12-20 23:47:46 +08:00
David Adam
780bac671f cmake: add -latomic on platforms that need it for 64-bit atomic operations
Closes #5865.
2019-12-20 23:00:06 +08:00
David Adam
665ae3787a Switch to runtime check for /proc/self/stat
Removes a compile-time check that may have affected cross-compilation.

Work on #1067.
2019-04-30 16:23:28 +08:00
ridiculousfish
b6555a0dc4 Add print-rusage-self to fish
This adds an option --print-rusage-self to the fish executable. When set,
this option prints some getrusage stats to the console in a human-readable
way. This will be used by upcoming benchmarking support.
2019-04-10 14:33:45 -07:00
David Adam
7200f7ff4a Revert "Drop hard requirement on explicit -lpthread support"
This reverts commit b402b635a9f7466616cef6e2b9cfd55a6e7068c5; as discussed in #5512 it is not
required.
2019-02-12 22:30:53 +08:00
Mahmoud Al-Qudsi
462cb6044c Use standard __CYGWIN__ define for Cygwin detection 2019-01-21 20:06:16 -06:00
Mahmoud Al-Qudsi
16a94db702 Check for -Werror=unguarded_availability support before forcing it
The compiler flag `-Werror=unguarded_availability` was hard-coded for
macOS, but is not supported by GCC on macOS 10.10 (Yosemite). Test for
support with CHECK_CXX_COMPILER_FLAG before forcing it.
2019-01-10 20:03:38 -06:00
Mahmoud Al-Qudsi
b402b635a9 Drop hard requirement on explicit -lpthread support
Closes #5512
2019-01-10 20:03:38 -06:00
Mahmoud Al-Qudsi
4f196eef64 Bypass mutually exclusive CMake checks
There are some redundant CMake checks, in the sense that they are either
not needed or cannot possibly match if a previous check already passed.
2019-01-04 14:46:36 -06:00
Mahmoud Al-Qudsi
5196a42165 Prevent CMake configure checks for affecting future checks
Using CMAKE_PUSH_CHECK_STATE/CMAKE_POP_CHECK_STATE to prevent CMake
checks from permanently altering the environment used by future checks.
2019-01-04 14:30:14 -06:00
Mahmoud Al-Qudsi
490432c177 Globally set the _GNU_SOURCE define for CMake configuration checks 2019-01-04 14:18:02 -06:00
Mahmoud Al-Qudsi
380bae80bf Fix wcstod_l detection under Linux
This was broken in a8eb02f9f5 when the
detection was corrected for FreeBSD. This patch makes the detection work
for both Linux and FreeBSD instead of one or the other (tested).
2019-01-02 19:07:53 -06:00
Mahmoud Al-Qudsi
7af0cad23d Fall back to CMake's pkg-config-based search for curses
CMake seems to have trouble finding libraries from multiarch packages
that do not have the compatibility symlink installed to the
arch-independent library directory. Users must either manually supply
the path to the library in question via command-line parameters or we
can fall back to CMake's alternate method of finding packages based off
of pkg-config rather than using the hard-coded `FindCurses` CMake module
specific to the CMake version/distribution installed.
2019-01-02 18:38:55 -06:00
Mahmoud Al-Qudsi
74422e476b Define _GNU_SOURCE for wcstod_l check 2019-01-02 14:05:49 -06:00
Mahmoud Al-Qudsi
d1913f0df0 Add workaround for Cygwin process management and job control bugs
We cannot wait by pgroup under Cygwin for unknown reasons. Always
wait on jobs by individual processes. See code for more information.
2019-01-02 00:14:07 -06:00
Fabian Homborg
a608e5d581 cmake: Check for TPARM_VARARGS 2018-12-31 14:24:22 +01:00
Mahmoud Al-Qudsi
a8eb02f9f5 Fix wcstod_l detection under FreeBSD 2018-12-31 02:31:48 -06:00
Fabian Homborg
ffab420e43 Add fallback wcstod_l for musl
Just sets locale to "C" (because that's the only one we need), does
wcstod and resets the locale.

No idea why uselocale(loc) failed for me, but it did.

Fixes #5407.
2018-12-12 15:12:12 +01:00
Mahmoud Al-Qudsi
000892e315 Use constexpr for is_windows_subsystem_for_linux()
To guarantee that at runtime there will be no branching, using a CMAKE
test/define combined with a constexpr wrapper for code-friendliness.
2018-03-04 21:13:31 -06:00
Mahmoud Al-Qudsi
fea1597a27 [cmake] Correct test for term.h (include curses.h first)
The non-ncurses version of term.h requires that curses.h be first
included. Only very recent versions of CMake include a LANGUAGE
option to CHECK_INCLUDE_FILES, so we aren't using it and specifying
CXX here..
2018-02-04 03:11:22 -06:00
David Adam
fb53a96a1c Add configure-time check for std::make_unique
Fixes the build on Clang 6 and closes #4685.
2018-01-31 13:43:05 +08:00
David Adam
f135c53196 [cmake] move all CheckFunctionExists to CheckCXXSymbolExists
CheckFunctionExists checks for C linkage only, and recommends the use of
CheckSymbolExists in the documentation. This improves the detection of
C++ features, as opposed to C features.
2018-01-30 22:28:04 +08:00
David Adam
7faa6e773f cmake: add SED to build_lexicon_filter 2017-11-28 21:37:42 +08:00
David Adam
ce46c80492 cmake: restore check for fixed-args tparm ("Solaris tparm kludge") 2017-11-22 18:58:27 +08:00
David Adam
64194d02fc cmake: correct configure check for _nl_msg_cat_cntr 2017-11-17 16:21:56 +08:00
David Adam
32714021f5 cmake: add gettext support 2017-11-17 16:21:56 +08:00
David Adam
7e24c14f8c cmake: print feature summary 2017-11-17 16:21:56 +08:00
David Adam
8543a4061e cmake: fix check for /proc/self/stat
Using the result of the exists test directly always passes.
2017-11-17 16:21:56 +08:00