Commit 5e4c6de7 authored by Tim van der Molen's avatar Tim van der Molen
Browse files

Enable --version-sort on systems without strverscmp()

The --version-sort option requires strverscmp(), but this is a glibc
extension that does not exist on OpenBSD and other systems. To enable
--version-sort on those systems, provide an internal implementation of
strverscmp(). The implementation is from the musl C library and is
MIT-licensed.

The build process remains the same: the verscmp flag should be set to 1
only if strverscmp() is available in libc. If verscmp is 0, then the
internal implementation is used.
parent a624883d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ indicates that the corresponding feature is enabled by default.
| help | 0 | include help text (refers to the manpage otherwise) |
| inotify | 0 | enable inotify, needed for `--auto-reload` |
| stat64 | 0 | Support CIFS shares from 64bit hosts on 32bit machines |
| verscmp | 1 | Support naturing sorting (`--version-sort`). Requires a GNU-compatible libc exposing `strverscmp` |
| verscmp | 1 | Whether your libc provides `strvercmp()`. If set to 0, feh will use an internal implementation. |
| xinerama | 1 | Support Xinerama/XRandR multiscreen setups |

For example, `make xinerama=0 debug=1` will disable Xinerama support and
+1 −4
Original line number Diff line number Diff line
@@ -64,10 +64,7 @@ ifeq (${stat64},1)
endif

ifeq (${verscmp},1)
	CFLAGS += -DHAVE_VERSCMP
	MAN_VERSCMP = available
else
	MAN_VERSCMP = not available
	CFLAGS += -DHAVE_STRVERSCMP
endif

ifeq (${xinerama},1)
+0 −1
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@ all: ${TARGETS}
	-e 's/\$$MAN_DEBUG\$$/${MAN_DEBUG}/' \
	-e 's/\$$MAN_EXIF\$$/${MAN_EXIF}/' \
	-e 's/\$$MAN_INOTIFY\$$/${MAN_INOTIFY}/' \
	-e 's/\$$MAN_VERSCMP\$$/${MAN_VERSCMP}/' \
	-e 's/\$$MAN_XINERAMA\$$/${MAN_XINERAMA}/' \
	< ${@:.1=.pre} > $@

+0 −4
Original line number Diff line number Diff line
@@ -32,9 +32,6 @@ Compile-time switches in this build:
remote file support: libcurl $MAN_CURL$
.
.It
natural sorting option $MAN_VERSCMP$
.
.It
Xinerama multi-monitor support $MAN_XINERAMA$
.
.It
@@ -887,7 +884,6 @@ output version information and exit.
.
.It Cm --version-sort
.
.Pq optional feature, $MAN_VERSCMP$ in this build
When combined with
.Cm --sort name , --sort filename ,
or
+4 −0
Original line number Diff line number Diff line
@@ -34,6 +34,10 @@ ifeq (${exif},1)
		exif_nikon.c
endif

ifneq (${verscmp},1)
	TARGETS += strverscmp.c
endif

OBJECTS = ${TARGETS:.c=.o}

I_SRCS = ${shell echo *.raw}
Loading