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