Commit graph

273 commits

Author SHA1 Message Date
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
Aaron Gyes
f2a829aa23 Direct people to github to report bugs. 2018-12-11 02:47:34 -08:00
Fabian Homborg
ad5bbeb3c2
Make wcwidth configurable (#4816)
* 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.
2018-03-25 10:19:57 +02:00
Fabian Homborg
b75c3b968c Replace muparser with tinyexpr 2018-03-01 13:09:35 +01: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
ridiculousfish
d09210c08b [cmake] Untangle the CMake versioning
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..
2018-01-08 22:28:10 -08:00
ridiculousfish
452211ebf5 Disable exception handling in autotools build
Now that muparser no longer relies on exceptions, we can disable them
again.
2017-12-18 23:01:17 -08:00
David Adam
86b1c5a5a4 Update MuParser source
Drop build system artefacts and move to versioned directory.

Tarball from
https://github.com/beltoforion/muparser/archive/v2.2.5.tar.gz with
samples/example2 directory removed.
2017-08-25 07:54:40 +08:00
Kurtis Rader
d247c121a2 Check-in MuParser source
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.
2017-08-23 14:43:45 -07:00
David Adam
88134a2465 Revert "configure: check that errno is threadsafe"
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.
2017-08-14 18:18:10 -07:00
Kurtis Rader
edf745232f lint: replace ctermid() with ctermid_r() 2017-05-09 21:39:25 -07:00
Fabian Homborg
757a95123d configure.ac: Replace which with command -v
This allows us to drop `which` as a makedependency.
2017-04-08 13:21:04 +02:00
David Adam
3444fe87fb configure: check for definition of setupterm, not just linkability
Some platforms ship the headers and libraries for ncurses in different
packages, which can produce false positives when checking for their
presence.

Closes #3866.
2017-03-05 15:06:20 +08:00
ridiculousfish
07c9f0de9d Set -Wno-missing-field-initializers
Suppresses a hugely annoying warning in g++ build for
code initialized via the ={} idiom (which is safe).
2017-01-26 16:34:55 -08:00
mathbunnyru
9768653df7 New pcre2 2017-01-18 16:44:48 -08:00
David Adam
4bc220f349 Drop requirement for socket library
The socket(2) library function is only required on Linux, and does not
require special linker arguments to work.

Closes #2360.
2017-01-11 19:34:32 +08:00
Zoltán Mizsei
aedee4e1a4 Haiku have no lsocket, but lnetwork 2016-12-26 08:00:53 +08:00
Kurtis Rader
0019c12af3 changes to allow building on Solaris 10
Fixes #3456
2016-12-08 19:15:11 -08:00
David Adam
2b0bad889a configure: force use of -pthread on Solaris
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.
2016-12-03 16:36:06 +08:00
David Adam
ee15f1b987 configure: check that errno is threadsafe
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.
2016-12-03 16:36:06 +08:00
David Adam
2b7dddf342 add flock fallback
Import the flock compatibility wrapper from NetBSD.

Work on #3340.
2016-12-03 16:36:06 +08:00
David Adam
1293cd8b6a Check for functions in std namespace
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.
2016-12-03 16:36:06 +08:00
ridiculousfish
87b0d1b828 Merge pull request #3585 from fornwall/build-without-shmem
Fix build on systems without shm_open()
2016-11-26 14:38:07 -08:00
ridiculousfish
df55991806 Teach ./configure to rerun autoreconf --no-recursive
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)
2016-11-26 13:17:23 -08:00
Fredrik Fornwall
df12ac24b2 Fix build on systems without shm_open()
Notably, this fixes building on Android.
2016-11-26 16:14:15 -05:00
ridiculousfish
f0ba37b73a Enable C++11 in autotools build 2016-11-26 12:59:00 -08:00
Fredrik Fornwall
fe8727fb71 Fix building on Android by avoiding getpwent() (#3441)
* 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.
2016-10-15 17:20:53 -07:00
Fredrik Fornwall
36f320598e Check for struct stat.st_ctime_nsec before using
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.
2016-10-10 19:33:25 -07:00
Aaron Gyes
8d40bf325d Fix configure.ac comments 2016-10-08 16:09:25 -07:00
Aaron Gyes
488a09fffb Don't prefer clang++
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
2016-10-07 23:56:48 -07:00
Kurtis Rader
7fd3079bb6 remove one of the wrealpath() definitions
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.
2016-10-04 20:20:11 -07:00
David Adam
53f1ebaf6b don't check for CPP in the configure script
The preprocessor never gets called directly.
2016-10-02 18:52:21 +08:00
Aaron Gyes
30b71fbb78 $(v)echo foo -> $v echo foo for verbosity modifier
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.
2016-09-17 16:29:43 -07:00
Aaron Gyes
06c658dd5e Autotools build: teach it clang, utility macros
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
2016-09-15 23:24:41 -07:00
Kurtis Rader
9f21e3792a remove dependency on dcgettext()
While fixing issue #3110 I noticed there is exactly one place we use
dcgettext() and that use is completely unnecessary. So remove it.
2016-06-05 18:52:19 -07:00
Kurtis Rader
db1ec847f9 fix lint error in wgettext()
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.
2016-06-01 22:19:03 -07:00
Kurtis Rader
5bf1b0e5f5 fix random lint issues
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.
2016-05-29 22:24:29 -07:00
David Adam
91962d8aa2 configure: move an errant space
Introduced in 6b92fdd18d.
2016-05-25 21:39:57 +00:00
David Adam
6b92fdd18d configure: fix CXXFLAGS with system pcre2
cleanups in configure meant that a number of arguably spurious spaces
were dropped from the CXXFLAGS, which produced an error without the
below.
2016-05-24 12:24:56 +00:00
Kurtis Rader
7c24369454 fix building on Cygwin
Cygwin still doesn't support any of the backtrace functions. Also, remove a
spurious newline from a debug message.

Fixes #2993
2016-05-19 19:27:22 -07:00
David Adam
9192bf1db5 configure: fix _nl_msg_cat_cntr check 2016-05-18 22:39:20 +00:00
David Adam
db18449f4c fallback: drop fallbacks for C99/C++0x wide character functions
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.
2016-05-18 22:39:20 +00:00
David Adam
44757c81af fallback: remove fwprintf and friends fallbacks
All modern operating systems implement fwprintf, including NetBSD (which
introduced them in 2005).

Work on #2999.
2016-05-18 22:39:20 +00:00
David Adam
d0aa461587 fallback: remove sysconf fallback
sysconf was introduced in IEEE Std 1003.1-1988 (POSIX.1) and exists
on every system I can find.

Work on #2999.
2016-05-18 22:39:20 +00:00
David Adam
504b32f61b configure: drop fwprintf test
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.
2016-05-18 22:39:20 +00:00
David Adam
6a5d89669e configure: drop tests for ancient platforms
Work on #2999.
2016-05-18 22:39:20 +00:00
David Adam
e39628bbe9 configure: drop unnecessary feature flag checks
Work on #2999.
2016-05-18 22:39:20 +00:00
David Adam
f5dcb6a0cb configure: Use standard macro to enable Large File Support
Work on #2999.
2016-05-18 22:39:20 +00:00
David Adam
14187f9e3f configure: drop manual checks for __EXTENSIONS__
375bef4443 includes the appropriate
autoconf method of checking for this feature flag.

Work on #2999.
2016-05-18 22:39:20 +00:00
Kurtis Rader
73f2992a2e make debug() output more useful
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.
2016-05-17 14:52:55 -07:00