449ef14f1b438426ccf82f3a2d46f0243c08689d
[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 try_without_dir=false
15 # First we try "pod2man", then "$dir/pod2man" for each item in $PATH.
16 for dir in dummy:$PATH; do
17     if [ "$try_without_dir" = true ]; then
18       # first iteration
19       pod2man=pod2man
20       try_without_dir=false
21     else
22       # second and later iterations
23       pod2man="$dir/pod2man"
24       if [ ! -f "$pod2man" ]; then  # '-x' is not available on Ultrix
25         pod2man=''
26       fi
27     fi
28
29     if [ ! "$pod2man" = '' ]; then
30         failure=none
31
32
33         if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null 2>&1; then
34             failure=MultilineTest
35         fi
36
37
38         if [ "$failure" = none ]; then
39             echo "$pod2man"
40             exit 0
41         fi
42
43         echo "$pod2man does not work properly ('$failure' failed).  Looking for another pod2man ..." >&2
44     fi
45 done
46
47 echo "No working pod2man found.  Consider installing a new version." >&2
48 if [ "$1" = ignore ]; then
49   echo "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2
50   echo "../../util/pod2man.pl"
51   exit 0
52 fi
53 exit 1