8e913180c54f868a22ae63c3e1d29691c5e005f0
[openssl.git] / util / pod2mantest
1 #!/bin/sh
2
3 # This script is used by test/Makefile.ssl to check whether a sane 'pod2man'
4 # is installed.
5 # ('make install' should not try to run 'pod2man' if it does not exist or if
6 # it is a broken 'pod2man' version that is known to cause trouble. if we find
7 # the system 'pod2man' to be broken, we use our own copy instead)
8 #
9 # In any case, output an appropriate command line for running (or not
10 # running) pod2man.
11
12
13 IFS=:
14 if test "$OSTYPE" = "msdosdjgpp"; then IFS=";"; fi
15 try_without_dir=false
16 # First we try "pod2man", then "$dir/pod2man" for each item in $PATH.
17 for dir in dummy:$PATH; do
18     if [ "$try_without_dir" = true ]; then
19       # first iteration
20       pod2man=pod2man
21       try_without_dir=false
22     else
23       # second and later iterations
24       pod2man="$dir/pod2man"
25       if [ ! -f "$pod2man" ]; then  # '-x' is not available on Ultrix
26         pod2man=''
27       fi
28     fi
29
30     if [ ! "$pod2man" = '' ]; then
31         failure=none
32
33
34         if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null 2>&1; then
35             failure=MultilineTest
36         fi
37
38
39         if [ "$failure" = none ]; then
40             echo "$pod2man"
41             exit 0
42         fi
43
44         echo "$pod2man does not work properly ('$failure' failed).  Looking for another pod2man ..." >&2
45     fi
46 done
47
48 echo "No working pod2man found.  Consider installing a new version." >&2
49 if [ "$1" = ignore ]; then
50   echo "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2
51   echo "../../util/pod2man.pl"
52   exit 0
53 fi
54 exit 1