xref: /OK3568_Linux_fs/buildroot/support/dependencies/check-host-asciidoc.sh (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2
3candidate="$1" #ignored
4
5asciidoc=`which asciidoc`
6if [ ! -x "$asciidoc" ]; then
7	# echo nothing: no suitable asciidoc found
8	exit 1
9fi
10
11# Output of 'asciidoc --version' examples:
12# asciidoc 8.6.7
13version=`$asciidoc --version | cut -d\  -f2`
14major=`echo "$version" | cut -d. -f1`
15minor=`echo "$version" | cut -d. -f2`
16bugfix=`echo "$version" | cut -d. -f3`
17
18# To generate the manual, we need asciidoc >= 8.6.3
19major_min=8
20minor_min=6
21bugfix_min=3
22if [ $major -gt $major_min ]; then
23	echo $asciidoc
24else
25	if [ $major -eq $major_min -a $minor -ge $minor_min ]; then
26		echo $asciidoc
27	else
28		if [ $major -eq $major_min -a $minor -eq $minor_min \
29			-a $bugfix -ge $bugfix_min ]; then
30			echo $asciidoc
31		else
32			# echo nothing: no suitable asciidoc found
33			exit 1
34		fi
35	fi
36fi
37