1295003Sjkim#!/bin/sh 2295003Sjkim 3295003Sjkim# This script is used by test/Makefile to check whether a sane 'pod2man' 4295003Sjkim# is installed. 5295003Sjkim# ('make install' should not try to run 'pod2man' if it does not exist or if 6295003Sjkim# it is a broken 'pod2man' version that is known to cause trouble. if we find 7295003Sjkim# the system 'pod2man' to be broken, we use our own copy instead) 8295003Sjkim# 9295003Sjkim# In any case, output an appropriate command line for running (or not 10295003Sjkim# running) pod2man. 11295003Sjkim 12295003Sjkim 13295003SjkimIFS=: 14295003Sjkimif test "$OSTYPE" = "msdosdjgpp"; then IFS=";"; fi 15295003Sjkim 16295003Sjkimtry_without_dir=true 17295003Sjkim# First we try "pod2man", then "$dir/pod2man" for each item in $PATH. 18295003Sjkimfor dir in dummy${IFS}$PATH; do 19295003Sjkim if [ "$try_without_dir" = true ]; then 20295003Sjkim # first iteration 21295003Sjkim pod2man=pod2man 22295003Sjkim try_without_dir=false 23295003Sjkim else 24295003Sjkim # second and later iterations 25295003Sjkim pod2man="$dir/pod2man" 26295003Sjkim if [ ! -f "$pod2man" ]; then # '-x' is not available on Ultrix 27295003Sjkim pod2man='' 28295003Sjkim fi 29295003Sjkim fi 30295003Sjkim 31295003Sjkim if [ ! "$pod2man" = '' ]; then 32295003Sjkim failure=none 33295003Sjkim 34295003Sjkim if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | fgrep OpenSSL >/dev/null; then 35295003Sjkim : 36295003Sjkim else 37295003Sjkim failure=BasicTest 38295003Sjkim fi 39295003Sjkim 40295003Sjkim if [ "$failure" = none ]; then 41295003Sjkim if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null; then 42295003Sjkim failure=MultilineTest 43295003Sjkim fi 44295003Sjkim fi 45295003Sjkim 46295003Sjkim 47295003Sjkim if [ "$failure" = none ]; then 48295003Sjkim echo "$pod2man" 49295003Sjkim exit 0 50295003Sjkim fi 51295003Sjkim 52295003Sjkim echo "$pod2man does not work properly ('$failure' failed). Looking for another pod2man ..." >&2 53295003Sjkim fi 54295003Sjkimdone 55295003Sjkim 56295003Sjkimecho "No working pod2man found. Consider installing a new version." >&2 57295003Sjkimecho "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2 58295003Sjkimecho "$1 ../../util/pod2man.pl" 59