* Make wcwidth configurable
This adds the cmake option "INTERNAL_WCWIDTH" (to be set to "ON" or
"OFF") and the configure option --[en,dis]able-internal-wcwidth.
Both default to enabling our fallback, but can be set to use the system's wcwidth again.
Sequel to #4554.
See #4571, #4539, #4609.
On my system, this would fix#4306.
This untangles the CMake versioning issues (I hope) as discussed in #4626.
Note most of the advice found on the Internet about how to inject git
versions into CMake is just wrong.
The behavior we want is to unconditionally run the script
build_tools/git_version_gen.sh at build time (i.e. when you invoke ninja or
make, and not when you invoke cmake, which is build system generation time).
This script is careful to only update the FISH-BUILD-VERSION-FILE if the
contents have changed, to avoid spurious rebuilding dependencies of
FISH-BUILD-VERSION-FILE. Assuming the git version hasn't changed, the script
will run, but not update FISH-BUILD-VERSION-FILE, and therefore
fish_version.o will not have to be rebuilt.
This might normally rebuild more than is necessary even if the timestamp is
not updated, because ninja computes the dependency chain ahead of time. But
Ninja also supports the 'restat' option for just this case, and CMake is rad
and exposes this via BYPRODUCTS. So mark FISH-BUILD-VERSION-FILE as a
byproduct and make the script always update a dummy file
(fish-build-version-witness.txt). Note this is the use case for which
BYPRODUCTS is designed.
We also have fish_version.cpp #include "FISH-BUILD-VERSION-FILE", and do a
semi-silly thing and make FISH-BUILD-VERSION-FILE valid C++ (so there's just
one version file). This means we have to filter out the quotes in other
cases..
First step in fixing issue #3157 is to check-in the source code and hook
it into our build system.
The inclusion of the MuParser source adds the MIT License to those that
apply to fish. Update our documentation to reflect that fact.
The MuParser documentation is at
http://beltoforion.de/article.php?a=muparser. The source was downloaded
from https://github.com/beltoforion/muparser/releases. It is also hosted
on Github, https://github.com/beltoforion/muparser/. I did not download
it from Github because that source contained just a couple of cleanup
changes which don't affect its behavior.
This reverts commit ee15f1b987.
The test relies on undefined behaviour (checking for errno in the
absence of an error condition) and was broken on OpenBSD.
Closes#4184.
Some platforms ship the headers and libraries for ncurses in different
packages, which can produce false positives when checking for their
presence.
Closes#3866.
This fixes a problem with non-threadsafe errno.
Ideally, this would be the use of the AX_PTHREAD macro, but it is GPL 3+
only, which is incompatible with the GPL 2 license of fish. It also
would need extending to cover C++.
For now, fish doesn't build on anything except GCC under Solaris anyway,
so `-pthread` is the right thing to use.
Work on #3340.
Without `-pthread` specified to the compiler, errno is not threadsafe on
Solaris (as _REENTRANT is undefined, and _POSIX_C_SOURCE may not be set
until after the inclusion of <errno.h>).
Work on #3340.
On Solaris, some standard wide character functions are only contained in
the std:: namespace. The configure script now checks for these, enabling
the appropriate `uses` statements in src/common.h.
The checks are handwritten, because Autoconf's AC_CHECK_FUNC macro
always uses C linkage, but the problem only appears under C++ linkage.
Work on #3340.
Currently, the ./configure script generated by autotools will
test if the configure.ac script is newer than its output configure
script, and if so, run autoconf to rebuild it. However autoconf
is no longer sufficient because we have some m4 macros. So now
run autoreconf --no-recursive (per #3572)
* Fix building on Android by avoiding getpwent() if missing with autoconf check
The getpwent() function does not link when building for Android,
and user names on that platform are not interesting anyway.
Using a configure check for stat.st_ctime_nsec fixes building on
Android which has that field but does not define STAT_HAVE_NSEC.
Before this change the Android build failed on the st_ctim.tv_nsec
fallback #else clause.
This change causes our configure script to just use the default behavior
of autoconf: in practice it will try g++ instead of clang++ first.
There are good reasons to use the behavior this reverts, namely g++
might be a symlink to clang++ and clang++ is never a symlink to g++ -
when `configure` says using "g++" that doens't tell us much.
On more systems than not, as far as I can tell, clang++ will often be a
newer compiler than g++ from what I can see as well.
However, it appears we have some bad things happening with Cygwin on
clang.
Fixes#3435
It is believed there are no longer any platforms we support that do not
support passing NULL as the second argument to realpath(). So rather
than duplicating the logic to get reasonable behavior from our
wrealpath() wrapper simply remove the redundant implementation.
Not sure why I crammed $(v) up like that with the parens. This is
a little sed job after regretting the Makefile seeming harder to read.
Certainly better.
We want clang or gcc picked for both C++/C
Few final cleanups - time to feed it to Travis.
Teach autotools about clang++.
- Use AC macros for these utilities in Makefile:
LN_S, MKDIR_P, AWK, GREP, FGREP.
This has the effect on OS X with prefixed coreutils installed
from macports: > make show-LN_S show-MKDIR_P show-AWK show-GREP
LN_S = 'ln -s'
MKDIR_P = '/opt/local/bin/gmkdir -p'
AWK = 'awk'
GREP = '/opt/local/bin/grep'
FGREP = '/opt/local/bin/grep -F'
- Use GNU Make findstrings, wildcard,notdir,
- SHELL = @SHELL@ per reccomended practice and in line with
actual behavior.
- Add output for string wrangling steps
Cppcheck was complaining about the `return val.c_str()` at the end of the
`wgettext()` function. That would normally a bug since the lifetime of
`val` ends when the function returns. In this particular case that's not
true because the string is interned in a cache. Nonetheless, rather than
suppress the lint warning I decided to modify the API to be more idiomatic.
In the process of fixing the aforementioned lint warning I fixed several other
lint errors in that module.
This required making our copy of `wgetopt()` compatible with the rest of
the fish code. Specifically, by removing its local definitions of the
"_" macro so it uses the same macro used everywhere else in the fish
code. The sooner we kill the use of wide chars the better.
This only eliminates errors reported by `make lint`. It shouldn't cause any
functional changes.
This change does remove several functions that are unused. It also removes the
`desc_arr` variable which is both unused and out of date with reality.
Drops configure check for wcsdup, wcslen, wcscasecmp, wcsncasecmp,
wcwidth, wcswidth, wcstok, fputwc, fgetwc, and wcstol. Drop the fallback
implementations of these on non-Snow Leopard platforms.
Work on #2999.
fwprintf would segfault on DragonFly BSD 1.4.0, released in January
2006. This was fixed by DragonFly BSD 1.4.4, released in April 2006. It
seems unlikely that anyone is still running a ten-year-old, unsupported
version, and hoping that fish will continue to build.
I've checked this in virtual machines.
Work on #2999.
This change does several things. First, and most important, it allows
dumping the "n" most recent stack frames on each debug() call. Second,
it demangles the C++ symbols. Third, it prepends each debug() message
with the debug level.
Unrelated to the above I've replaced all `assert(!is_forked_child());`
statements with `ASSERT_IS_NOT_FORKED_CHILD()` for consistency.